int sli_fcmh_getattr(struct fidc_membh *f) { struct stat stb; if (fstat(fcmh_2_fd(f), &stb) == -1) return (-errno); FCMH_LOCK(f); sl_externalize_stat(&stb, &f->fcmh_sstb); // XXX get ptruncgen and gen f->fcmh_flags |= FCMH_HAVE_ATTRS; FCMH_ULOCK(f); return (0); }
int sli_fcmh_ctor(struct fidc_membh *f, __unusedx int flags) { int rc; struct stat stb; struct fcmh_iod_info *fii; fii = fcmh_2_fii(f); INIT_PSC_LISTENTRY(&fii->fii_lentry); psc_assert(f->fcmh_flags & FCMH_INITING); if (f->fcmh_fg.fg_gen == FGEN_ANY) { DEBUG_FCMH(PLL_NOTICE, f, "refusing to open backing file " "with FGEN_ANY"); /* * This is not an error, we just don't have enough info * to create the backing file. */ return (0); } /* try to get a file descriptor for this backing obj */ rc = sli_open_backing_file(f); if (rc == 0) { if (fstat(fcmh_2_fd(f), &stb) == -1) { rc = -errno; DEBUG_FCMH(PLL_WARN, f, "error during " "getattr backing file rc=%d", rc); close(fcmh_2_fd(f)); } else { sl_externalize_stat(&stb, &f->fcmh_sstb); // XXX get ptruncgen and gen f->fcmh_flags |= FCMH_HAVE_ATTRS; } } if (!rc) f->fcmh_flags |= FCMH_IOD_BACKFILE; return (rc); }