Lines Matching defs:ckp
101 fmd_ckpt_create(fmd_ckpt_t *ckp, fmd_module_t *mp)
107 bzero(ckp, sizeof (fmd_ckpt_t));
108 ckp->ckp_mp = mp;
110 ckp->ckp_size = sizeof (fcf_hdr_t);
111 ckp->ckp_strn = 1; /* for \0 */
113 (void) snprintf(ckp->ckp_src, PATH_MAX, "%s/%s+", dir, name);
114 (void) snprintf(ckp->ckp_dst, PATH_MAX, "%s/%s", dir, name);
116 (void) unlink(ckp->ckp_src);
118 ckp->ckp_fd = open64(ckp->ckp_src, O_WRONLY | O_CREAT | O_EXCL, mode);
120 return (ckp->ckp_fd);
125 fmd_ckpt_inval(fmd_ckpt_t *ckp, const char *format, ...)
133 fmd_free(ckp->ckp_buf, ckp->ckp_size);
138 fmd_ckpt_open(fmd_ckpt_t *ckp, fmd_module_t *mp)
145 bzero(ckp, sizeof (fmd_ckpt_t));
146 ckp->ckp_mp = mp;
148 (void) snprintf(ckp->ckp_src, PATH_MAX, "%s/%s",
151 if ((ckp->ckp_fd = open(ckp->ckp_src, O_RDONLY)) == -1)
154 if (fstat64(ckp->ckp_fd, &st) == -1) {
156 (void) close(ckp->ckp_fd);
160 ckp->ckp_buf = fmd_alloc(st.st_size, FMD_SLEEP);
161 ckp->ckp_hdr = (void *)ckp->ckp_buf;
162 ckp->ckp_size = read(ckp->ckp_fd, ckp->ckp_buf, st.st_size);
164 if (ckp->ckp_size != st.st_size || ckp->ckp_size < sizeof (fcf_hdr_t) ||
165 ckp->ckp_size != ckp->ckp_hdr->fcfh_filesz) {
166 err = ckp->ckp_size == (size_t)-1L ? errno : EFMD_CKPT_SHORT;
167 fmd_free(ckp->ckp_buf, st.st_size);
168 (void) close(ckp->ckp_fd);
172 (void) close(ckp->ckp_fd);
173 ckp->ckp_fd = -1;
181 if (bcmp(&ckp->ckp_hdr->fcfh_ident[FCF_ID_MAG0],
183 return (fmd_ckpt_inval(ckp, "bad checkpoint magic string\n"));
185 if (ckp->ckp_hdr->fcfh_ident[FCF_ID_MODEL] != FCF_MODEL_NATIVE)
186 return (fmd_ckpt_inval(ckp, "bad checkpoint data model\n"));
188 if (ckp->ckp_hdr->fcfh_ident[FCF_ID_ENCODING] != FCF_ENCODE_NATIVE)
189 return (fmd_ckpt_inval(ckp, "bad checkpoint data encoding\n"));
191 if (ckp->ckp_hdr->fcfh_ident[FCF_ID_VERSION] != FCF_VERSION_1) {
192 return (fmd_ckpt_inval(ckp, "bad checkpoint version %u\n",
193 ckp->ckp_hdr->fcfh_ident[FCF_ID_VERSION]));
197 if (ckp->ckp_hdr->fcfh_ident[i] != 0) {
198 return (fmd_ckpt_inval(ckp,
203 if (ckp->ckp_hdr->fcfh_flags & ~FCF_FL_VALID)
204 return (fmd_ckpt_inval(ckp, "bad checkpoint flags\n"));
206 if (ckp->ckp_hdr->fcfh_pad != 0)
207 return (fmd_ckpt_inval(ckp, "reserved field in use\n"));
209 if (ckp->ckp_hdr->fcfh_hdrsize < sizeof (fcf_hdr_t) ||
210 ckp->ckp_hdr->fcfh_secsize < sizeof (fcf_sec_t)) {
211 return (fmd_ckpt_inval(ckp,
215 seclen = (uint64_t)ckp->ckp_hdr->fcfh_secnum *
216 (uint64_t)ckp->ckp_hdr->fcfh_secsize;
218 if (ckp->ckp_hdr->fcfh_secoff > ckp->ckp_size ||
219 seclen > ckp->ckp_size ||
220 ckp->ckp_hdr->fcfh_secoff + seclen > ckp->ckp_size ||
221 ckp->ckp_hdr->fcfh_secoff + seclen < ckp->ckp_hdr->fcfh_secoff)
222 return (fmd_ckpt_inval(ckp, "truncated section headers\n"));
224 if (!IS_P2ALIGNED(ckp->ckp_hdr->fcfh_secoff, sizeof (uint64_t)) ||
225 !IS_P2ALIGNED(ckp->ckp_hdr->fcfh_secsize, sizeof (uint64_t)))
226 return (fmd_ckpt_inval(ckp, "misaligned section headers\n"));
233 ckp->ckp_secp = (void *)(ckp->ckp_buf + ckp->ckp_hdr->fcfh_secoff);
234 ckp->ckp_secs = ckp->ckp_hdr->fcfh_secnum;
236 for (i = 0; i < ckp->ckp_secs; i++) {
237 fcf_sec_t *sp = (void *)(ckp->ckp_buf +
238 ckp->ckp_hdr->fcfh_secoff + ckp->ckp_hdr->fcfh_secsize * i);
243 return (fmd_ckpt_inval(ckp, "section %u has invalid "
248 return (fmd_ckpt_inval(ckp, "section %u has invalid "
253 return (fmd_ckpt_inval(ckp, "section %u is not properly"
259 return (fmd_ckpt_inval(ckp, "section %u has misaligned "
263 if (sp->fcfs_offset > ckp->ckp_size ||
264 sp->fcfs_size > ckp->ckp_size ||
265 sp->fcfs_offset + sp->fcfs_size > ckp->ckp_size ||
267 return (fmd_ckpt_inval(ckp, "section %u has corrupt "
273 return (fmd_ckpt_inval(ckp, "section %u has unknown "
278 return (fmd_ckpt_inval(ckp, "section %u has align %u "
284 return (fmd_ckpt_inval(ckp, "section %u has short "
290 if (ckp->ckp_strs != NULL) {
291 return (fmd_ckpt_inval(ckp, "multiple string "
295 ckp->ckp_strs = (char *)ckp->ckp_buf + sp->fcfs_offset;
296 ckp->ckp_strn = sp->fcfs_size;
298 if (ckp->ckp_strs[ckp->ckp_strn - 1] != '\0') {
299 return (fmd_ckpt_inval(ckp, "string table %u "
305 if (ckp->ckp_modp != NULL) {
306 return (fmd_ckpt_inval(ckp, "multiple module "
309 ckp->ckp_modp = sp;
318 if (ckp->ckp_secs == 0 || ckp->ckp_secp->fcfs_type != FCF_SECT_NONE ||
319 ckp->ckp_secp->fcfs_entsize != 0 || ckp->ckp_secp->fcfs_size != 0) {
320 return (fmd_ckpt_inval(ckp, "section 0 is not of the "
324 if (ckp->ckp_modp == NULL) {
325 return (fmd_ckpt_inval(ckp,
333 fmd_ckpt_destroy(fmd_ckpt_t *ckp)
335 if (ckp->ckp_buf != NULL)
336 fmd_free(ckp->ckp_buf, ckp->ckp_size);
337 if (ckp->ckp_fd >= 0)
338 (void) close(ckp->ckp_fd);
350 fmd_ckpt_error(fmd_ckpt_t *ckp, int err, const char *format, ...)
352 fmd_module_t *mp = ckp->ckp_mp;
362 fmd_ckpt_destroy(ckp);
367 fmd_ckpt_section(fmd_ckpt_t *ckp, const void *data, uint_t type, uint64_t size)
374 ckp->ckp_ptr = (uchar_t *)
375 P2ROUNDUP((uintptr_t)ckp->ckp_ptr, dp->secd_align);
377 ckp->ckp_secp->fcfs_type = type;
378 ckp->ckp_secp->fcfs_align = dp->secd_align;
379 ckp->ckp_secp->fcfs_flags = 0;
380 ckp->ckp_secp->fcfs_entsize = dp->secd_entsize;
381 ckp->ckp_secp->fcfs_offset = (size_t)(ckp->ckp_ptr - ckp->ckp_buf);
382 ckp->ckp_secp->fcfs_size = size;
386 * the caller is responsible for doing so and updating ckp->ckp_ptr.
389 bcopy(data, ckp->ckp_ptr, size);
390 ckp->ckp_ptr += size;
393 ckp->ckp_secp++;
394 return (ckp->ckp_secs++);
398 fmd_ckpt_string(fmd_ckpt_t *ckp, const char *s)
400 fcf_stridx_t idx = (fcf_stridx_t)(ckp->ckp_strp - ckp->ckp_strs);
402 (void) strcpy(ckp->ckp_strp, s);
403 ckp->ckp_strp += strlen(s) + 1;
409 fmd_ckpt_alloc(fmd_ckpt_t *ckp, uint64_t gen)
419 ckp->ckp_secs += 2; /* for FCF_SECT_NONE and FCF_SECT_STRTAB */
420 ckp->ckp_size += sizeof (fcf_sec_t) * ckp->ckp_secs;
421 ckp->ckp_size += ckp->ckp_strn;
423 TRACE((FMD_DBG_CKPT, "alloc fcf buf size %u", ckp->ckp_size));
424 ckp->ckp_buf = fmd_zalloc(ckp->ckp_size, FMD_NOSLEEP);
426 if (ckp->ckp_buf == NULL)
429 ckp->ckp_hdr = (void *)ckp->ckp_buf;
431 ckp->ckp_hdr->fcfh_ident[FCF_ID_MAG0] = FCF_MAG_MAG0;
432 ckp->ckp_hdr->fcfh_ident[FCF_ID_MAG1] = FCF_MAG_MAG1;
433 ckp->ckp_hdr->fcfh_ident[FCF_ID_MAG2] = FCF_MAG_MAG2;
434 ckp->ckp_hdr->fcfh_ident[FCF_ID_MAG3] = FCF_MAG_MAG3;
435 ckp->ckp_hdr->fcfh_ident[FCF_ID_MODEL] = FCF_MODEL_NATIVE;
436 ckp->ckp_hdr->fcfh_ident[FCF_ID_ENCODING] = FCF_ENCODE_NATIVE;
437 ckp->ckp_hdr->fcfh_ident[FCF_ID_VERSION] = FCF_VERSION;
439 ckp->ckp_hdr->fcfh_hdrsize = sizeof (fcf_hdr_t);
440 ckp->ckp_hdr->fcfh_secsize = sizeof (fcf_sec_t);
441 ckp->ckp_hdr->fcfh_secnum = ckp->ckp_secs;
442 ckp->ckp_hdr->fcfh_secoff = sizeof (fcf_hdr_t);
443 ckp->ckp_hdr->fcfh_filesz = ckp->ckp_size;
444 ckp->ckp_hdr->fcfh_cgen = gen;
446 ckp->ckp_secs = 0; /* reset section counter for second pass */
447 ckp->ckp_secp = (void *)(ckp->ckp_buf + sizeof (fcf_hdr_t));
448 ckp->ckp_strs = (char *)ckp->ckp_buf + ckp->ckp_size - ckp->ckp_strn;
449 ckp->ckp_strp = ckp->ckp_strs + 1; /* use first byte as \0 */
450 ckp->ckp_ptr = (uchar_t *)(ckp->ckp_secp + ckp->ckp_hdr->fcfh_secnum);
452 (void) fmd_ckpt_section(ckp, NULL, FCF_SECT_NONE, 0);
457 fmd_ckpt_commit(fmd_ckpt_t *ckp)
459 fcf_sec_t *secbase = (void *)(ckp->ckp_buf + sizeof (fcf_hdr_t));
460 size_t stroff = ckp->ckp_size - ckp->ckp_strn;
468 ASSERT((size_t)(ckp->ckp_ptr - ckp->ckp_buf) == stroff);
469 (void) fmd_ckpt_section(ckp, NULL, FCF_SECT_STRTAB, ckp->ckp_strn);
470 ckp->ckp_ptr += ckp->ckp_strn; /* string table is already filled in */
472 ASSERT(ckp->ckp_secs == ckp->ckp_hdr->fcfh_secnum);
473 ASSERT(ckp->ckp_secp == secbase + ckp->ckp_hdr->fcfh_secnum);
474 ASSERT(ckp->ckp_ptr == ckp->ckp_buf + ckp->ckp_hdr->fcfh_filesz);
476 if (write(ckp->ckp_fd, ckp->ckp_buf, ckp->ckp_size) != ckp->ckp_size ||
477 fsync(ckp->ckp_fd) != 0 || close(ckp->ckp_fd) != 0)
480 ckp->ckp_fd = -1; /* fd is now closed */
481 return (rename(ckp->ckp_src, ckp->ckp_dst) != 0);
485 fmd_ckpt_resv(fmd_ckpt_t *ckp, size_t size, size_t align)
488 ckp->ckp_size = P2ROUNDUP(ckp->ckp_size, align) + size;
489 ckp->ckp_secs++;
494 fmd_ckpt_resv_buf(fmd_buf_t *bp, fmd_ckpt_t *ckp)
496 ckp->ckp_size = P2ROUNDUP(ckp->ckp_size, _MAX_ALIGNMENT) + bp->buf_size;
497 ckp->ckp_strn += strlen(bp->buf_name) + 1;
498 ckp->ckp_secs++;
502 fmd_ckpt_save_buf(fmd_buf_t *bp, fmd_ckpt_t *ckp)
504 fcf_buf_t *fcfb = ckp->ckp_arg;
506 fcfb->fcfb_name = fmd_ckpt_string(ckp, bp->buf_name);
507 fcfb->fcfb_data = fmd_ckpt_section(ckp,
510 ckp->ckp_arg = fcfb + 1;
514 fmd_ckpt_save_event(fmd_ckpt_t *ckp, fmd_event_t *e)
516 fcf_event_t *fcfe = (void *)ckp->ckp_ptr;
527 ckp->ckp_ptr += sizeof (fcf_event_t);
531 fmd_ckpt_save_nvlist(fmd_ckpt_t *ckp, nvlist_t *nvl)
533 fcf_nvl_t *fcfn = (void *)ckp->ckp_ptr;
534 char *nvbuf = (char *)ckp->ckp_ptr + sizeof (fcf_nvl_t);
541 ckp->ckp_ptr += sizeof (fcf_nvl_t) + nvsize;
543 ckp->ckp_ptr = (uchar_t *)
544 P2ROUNDUP((uintptr_t)ckp->ckp_ptr, sizeof (uint64_t));
548 fmd_ckpt_resv_serd(fmd_serd_eng_t *sgp, fmd_ckpt_t *ckp)
550 fmd_ckpt_resv(ckp,
553 ckp->ckp_strn += strlen(sgp->sg_name) + 1;
557 fmd_ckpt_save_serd(fmd_serd_eng_t *sgp, fmd_ckpt_t *ckp)
559 fcf_serd_t *fcfd = ckp->ckp_arg;
564 evsec = fmd_ckpt_section(ckp, NULL, FCF_SECT_EVENTS,
569 fmd_ckpt_save_event(ckp, sep->se_event);
572 fcfd->fcfd_name = fmd_ckpt_string(ckp, sgp->sg_name);
578 ckp->ckp_arg = fcfd + 1;
582 fmd_ckpt_resv_case(fmd_ckpt_t *ckp, fmd_case_t *cp)
592 fmd_buf_hash_apply(&cip->ci_bufs, (fmd_buf_f *)fmd_ckpt_resv_buf, ckp);
593 fmd_ckpt_resv(ckp, sizeof (fcf_buf_t) * n, sizeof (uint32_t));
596 fmd_ckpt_resv(ckp, sizeof (fcf_event_t), sizeof (uint64_t));
598 fmd_ckpt_resv(ckp,
602 ckp->ckp_size = P2ROUNDUP(ckp->ckp_size, sizeof (uint64_t));
614 fmd_ckpt_resv(ckp, cip->ci_nvsz, sizeof (uint64_t));
615 fmd_ckpt_resv(ckp, sizeof (fcf_case_t), sizeof (uint32_t));
616 ckp->ckp_strn += strlen(cip->ci_uuid) + 1;
620 fmd_ckpt_save_case(fmd_ckpt_t *ckp, fmd_case_t *cp)
639 fcf_buf_t *bufs = ckp->ckp_arg = fmd_alloc(size, FMD_SLEEP);
642 (fmd_buf_f *)fmd_ckpt_save_buf, ckp);
644 bufsec = fmd_ckpt_section(ckp, bufs, FCF_SECT_BUFS, size);
649 prsec = fmd_ckpt_section(ckp, NULL, FCF_SECT_EVENTS,
652 fmd_ckpt_save_event(ckp, cip->ci_principal);
656 evsec = fmd_ckpt_section(ckp, NULL, FCF_SECT_EVENTS,
660 fmd_ckpt_save_event(ckp, cit->cit_event);
664 nvsec = fmd_ckpt_section(ckp, NULL,
668 fmd_ckpt_save_nvlist(ckp, cis->cis_nvl);
671 fcfc.fcfc_uuid = fmd_ckpt_string(ckp, cip->ci_uuid);
692 (void) fmd_ckpt_section(ckp, &fcfc, FCF_SECT_CASE, sizeof (fcf_case_t));
696 fmd_ckpt_resv_module(fmd_ckpt_t *ckp, fmd_module_t *mp)
702 fmd_ckpt_resv_case(ckp, cp);
706 (fmd_serd_eng_f *)fmd_ckpt_resv_serd, ckp);
707 fmd_ckpt_resv(ckp, sizeof (fcf_serd_t) * n, sizeof (uint64_t));
710 fmd_buf_hash_apply(&mp->mod_bufs, (fmd_buf_f *)fmd_ckpt_resv_buf, ckp);
711 fmd_ckpt_resv(ckp, sizeof (fcf_buf_t) * n, sizeof (uint32_t));
713 fmd_ckpt_resv(ckp, sizeof (fcf_module_t), sizeof (uint32_t));
714 ckp->ckp_strn += strlen(mp->mod_name) + 1;
715 ckp->ckp_strn += strlen(mp->mod_path) + 1;
716 ckp->ckp_strn += strlen(mp->mod_info->fmdi_desc) + 1;
717 ckp->ckp_strn += strlen(mp->mod_info->fmdi_vers) + 1;
721 fmd_ckpt_save_module(fmd_ckpt_t *ckp, fmd_module_t *mp)
729 fmd_ckpt_save_case(ckp, cp);
733 fcf_serd_t *serds = ckp->ckp_arg = fmd_alloc(size, FMD_SLEEP);
736 (fmd_serd_eng_f *)fmd_ckpt_save_serd, ckp);
738 (void) fmd_ckpt_section(ckp, serds, FCF_SECT_SERD, size);
744 fcf_buf_t *bufs = ckp->ckp_arg = fmd_alloc(size, FMD_SLEEP);
747 (fmd_buf_f *)fmd_ckpt_save_buf, ckp);
749 bufsec = fmd_ckpt_section(ckp, bufs, FCF_SECT_BUFS, size);
753 fcfm.fcfm_name = fmd_ckpt_string(ckp, mp->mod_name);
754 fcfm.fcfm_path = fmd_ckpt_string(ckp, mp->mod_path);
755 fcfm.fcfm_desc = fmd_ckpt_string(ckp, mp->mod_info->fmdi_desc);
756 fcfm.fcfm_vers = fmd_ckpt_string(ckp, mp->mod_info->fmdi_vers);
759 (void) fmd_ckpt_section(ckp, &fcfm,
771 fmd_ckpt_t ckp;
814 if (fmd_ckpt_create(&ckp, mp) == -1) {
815 fmd_error(EFMD_CKPT_CREATE, "failed to create %s", ckp.ckp_src);
819 fmd_ckpt_resv_module(&ckp, mp);
821 if (fmd_ckpt_alloc(&ckp, mp->mod_gen + 1) != 0) {
822 fmd_error(EFMD_CKPT_NOMEM, "failed to build %s", ckp.ckp_src);
823 fmd_ckpt_destroy(&ckp);
832 fmd_ckpt_save_module(&ckp, mp);
833 err = fmd_ckpt_commit(&ckp);
834 fmd_ckpt_destroy(&ckp);
837 fmd_error(EFMD_CKPT_COMMIT, "failed to commit %s", ckp.ckp_dst);
856 fmd_ckpt_secptr(fmd_ckpt_t *ckp, fcf_secidx_t sid, uint_t type)
858 const fcf_sec_t *sp = (void *)(ckp->ckp_buf +
859 ckp->ckp_hdr->fcfh_secoff + ckp->ckp_hdr->fcfh_secsize * sid);
861 return (sid < ckp->ckp_secs && (sp->fcfs_type == type ||
870 fmd_ckpt_dataptr(fmd_ckpt_t *ckp, const fcf_sec_t *sp)
872 return (ckp->ckp_buf + sp->fcfs_offset);
880 fmd_ckpt_datalim(fmd_ckpt_t *ckp, const fcf_sec_t *sp)
882 return (ckp->ckp_buf + sp->fcfs_offset + sp->fcfs_size);
890 fmd_ckpt_strptr(fmd_ckpt_t *ckp, fcf_stridx_t sid, const char *defstr)
892 return (sid < ckp->ckp_strn ? ckp->ckp_strs + sid : defstr);
896 fmd_ckpt_restore_events(fmd_ckpt_t *ckp, fcf_secidx_t sid,
907 if ((sp = fmd_ckpt_secptr(ckp, sid, FCF_SECT_EVENTS)) == NULL) {
908 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL,
915 fcfe = fmd_ckpt_dataptr(ckp, sp);
955 fmd_ckpt_restore_suspects(fmd_ckpt_t *ckp, fmd_case_t *cp, fcf_secidx_t sid)
962 if ((sp = fmd_ckpt_secptr(ckp, sid, FCF_SECT_NVLISTS)) == NULL) {
963 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL,
967 fcfn = fmd_ckpt_dataptr(ckp, sp);
968 endn = fmd_ckpt_datalim(ckp, sp);
975 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL, "nvlist %u [%d] "
980 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL, "failed to "
996 fmd_ckpt_restore_bufs(fmd_ckpt_t *ckp, fmd_module_t *mp,
1003 if ((sp = fmd_ckpt_secptr(ckp, sid, FCF_SECT_BUFS)) == NULL) {
1004 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL,
1011 fcfb = fmd_ckpt_dataptr(ckp, sp);
1015 dsp = fmd_ckpt_secptr(ckp, fcfb->fcfb_data, FCF_SECT_BUFFER);
1018 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL, "invalid %u "
1023 fmd_ckpt_strptr(ckp, fcfb->fcfb_name, "<CORRUPT>"),
1024 ckp->ckp_buf + dsp->fcfs_offset, dsp->fcfs_size);
1031 fmd_ckpt_restore_case(fmd_ckpt_t *ckp, fmd_module_t *mp, const fcf_sec_t *sp)
1033 const fcf_case_t *fcfc = fmd_ckpt_dataptr(ckp, sp);
1034 const char *uuid = fmd_ckpt_strptr(ckp, fcfc->fcfc_uuid, NULL);
1039 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL, "corrupt %u case uuid "
1040 "and/or state\n", (uint_t)(sp - ckp->ckp_secp));
1048 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL,
1052 fmd_ckpt_restore_events(ckp, fcfc->fcfc_principal,
1055 fmd_ckpt_restore_events(ckp, fcfc->fcfc_events,
1068 n = fmd_ckpt_restore_suspects(ckp, cp, fcfc->fcfc_suspects);
1080 fmd_ckpt_restore_bufs(ckp, mp, cp, fcfc->fcfc_bufs);
1084 fmd_ckpt_restore_serd(fmd_ckpt_t *ckp, fmd_module_t *mp, const fcf_sec_t *sp)
1086 const fcf_serd_t *fcfd = fmd_ckpt_dataptr(ckp, sp);
1092 esp = fmd_ckpt_secptr(ckp, fcfd->fcfd_events, FCF_SECT_EVENTS);
1095 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL,
1099 if ((s = fmd_ckpt_strptr(ckp, fcfd->fcfd_name, NULL)) == NULL) {
1100 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL,
1107 fmd_ckpt_restore_events(ckp, fcfd->fcfd_events,
1117 fmd_ckpt_restore_module(fmd_ckpt_t *ckp, fmd_module_t *mp)
1119 const fcf_module_t *fcfm = fmd_ckpt_dataptr(ckp, ckp->ckp_modp);
1123 if (strcmp(mp->mod_name, fmd_ckpt_strptr(ckp, fcfm->fcfm_name, "")) ||
1124 strcmp(mp->mod_path, fmd_ckpt_strptr(ckp, fcfm->fcfm_path, ""))) {
1125 fmd_ckpt_error(ckp, EFMD_CKPT_INVAL,
1129 for (i = 0; i < ckp->ckp_secs; i++) {
1130 sp = (void *)(ckp->ckp_buf +
1131 ckp->ckp_hdr->fcfh_secoff + ckp->ckp_hdr->fcfh_secsize * i);
1135 fmd_ckpt_restore_case(ckp, mp, sp);
1138 fmd_ckpt_restore_serd(ckp, mp, sp);
1143 fmd_ckpt_restore_bufs(ckp, mp, NULL, fcfm->fcfm_bufs);
1144 mp->mod_gen = ckp->ckp_hdr->fcfh_cgen;
1155 fmd_ckpt_t ckp;
1162 if (fmd_ckpt_open(&ckp, mp) == -1) {
1164 fmd_error(EFMD_CKPT_OPEN, "can't open %s", ckp.ckp_src);
1170 fmd_ckpt_restore_module(&ckp, mp);
1171 fmd_ckpt_destroy(&ckp);