/* * Write out the persistent representation of an active case. */ static void zfs_case_serialize(fmd_hdl_t *hdl, zfs_case_t *zcp) { /* * Always update cases to the latest version, even if they were the * previous version when unserialized. */ zcp->zc_data.zc_version = CASE_DATA_VERSION_SERD; fmd_buf_write(hdl, zcp->zc_case, CASE_DATA, &zcp->zc_data, sizeof (zcp->zc_data)); if (zcp->zc_fru != NULL) fmd_buf_write(hdl, zcp->zc_case, CASE_FRU, zcp->zc_fru, strlen(zcp->zc_fru)); }
static void fmd_ckpt_restore_bufs(fmd_ckpt_t *ckp, fmd_module_t *mp, fmd_case_t *cp, fcf_secidx_t sid) { const fcf_sec_t *sp, *dsp; const fcf_buf_t *fcfb; uint_t i, n; if ((sp = fmd_ckpt_secptr(ckp, sid, FCF_SECT_BUFS)) == NULL) { fmd_ckpt_error(ckp, EFMD_CKPT_INVAL, "invalid link to section %u: expected bufs\n", sid); } if (sp->fcfs_size == 0) return; /* empty events section or type none */ fcfb = fmd_ckpt_dataptr(ckp, sp); n = sp->fcfs_size / sp->fcfs_entsize; for (i = 0; i < n; i++) { dsp = fmd_ckpt_secptr(ckp, fcfb->fcfb_data, FCF_SECT_BUFFER); if (dsp == NULL) { fmd_ckpt_error(ckp, EFMD_CKPT_INVAL, "invalid %u " "buffer link %u\n", sid, fcfb->fcfb_data); } fmd_buf_write((fmd_hdl_t *)mp, cp, fmd_ckpt_strptr(ckp, fcfb->fcfb_name, "<CORRUPT>"), ckp->ckp_buf + dsp->fcfs_offset, dsp->fcfs_size); fcfb = (fcf_buf_t *)((uintptr_t)fcfb + sp->fcfs_entsize); } }
void cmd_branch_dirty(fmd_hdl_t *hdl, cmd_branch_t *branch) { if (fmd_buf_size(hdl, NULL, branch->branch_bufname) != sizeof (cmd_branch_pers_t)) fmd_buf_destroy(hdl, NULL, branch->branch_bufname); /* No need to rewrite the FMRIs in the branch - they don't change */ fmd_buf_write(hdl, NULL, branch->branch_bufname, &branch->branch_pers, sizeof (cmd_branch_pers_t)); }