Merge commit 'refs/top-bases/linux-have-sysevent' into linux-have-sysevent

This commit is contained in:
Brian Behlendorf 2008-12-18 13:43:59 -08:00
commit bc05eda218
1 changed files with 23 additions and 16 deletions

View File

@ -956,6 +956,28 @@ dmu_recv_abort_cleanup(dmu_recv_cookie_t *drc)
}
}
/*
* Compute checksum of drr_begin record
*/
static void
dmu_recv_stream_cksum(struct restorearg *ra)
{
dmu_replay_record_t *drr;
drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP);
drr->drr_type = DRR_BEGIN;
drr->drr_u.drr_begin = *drc->drc_drrb;
if (ra->byteswap) {
fletcher_4_incremental_byteswap(drr,
sizeof (dmu_replay_record_t), &(ra->cksum));
} else {
fletcher_4_incremental_native(drr,
sizeof (dmu_replay_record_t), &(ra->cksum));
}
kmem_free(drr, sizeof (dmu_replay_record_t));
}
/*
* NB: callers *must* call dmu_recv_end() if this succeeds.
*/
@ -970,22 +992,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp)
if (drc->drc_drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC))
ra.byteswap = TRUE;
{
/* compute checksum of drr_begin record */
dmu_replay_record_t *drr;
drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP);
drr->drr_type = DRR_BEGIN;
drr->drr_u.drr_begin = *drc->drc_drrb;
if (ra.byteswap) {
fletcher_4_incremental_byteswap(drr,
sizeof (dmu_replay_record_t), &ra.cksum);
} else {
fletcher_4_incremental_native(drr,
sizeof (dmu_replay_record_t), &ra.cksum);
}
kmem_free(drr, sizeof (dmu_replay_record_t));
}
dmu_recv_stream_cksum(&ra);
if (ra.byteswap) {
struct drr_begin *drrb = drc->drc_drrb;