Do the check inside the callback. save_post
will pass you both the post ID and the post object:
do_action('save_post', $post_ID, $post);
So…
function save_my_meta_box_to_postmeta($post_ID, $post) {
if ('yourtype' === $post->post_type) {
echo '<pre>';
var_dump($post_ID,$post);
echo '</pre>';
die;
}
}
add_action('save_post','save_my_meta_box_to_postmeta',1,2);
You may want other conditionals as well like !DOING_AJAX
, for example.