/* * Construct the pathname of the state file and return a pointer to * caller. Read the config file to get the mount point of the * filesystem and the pathname within fs. */ char * cpr_build_statefile_path(void) { struct cprconfig *cf = &cprconfig; if (cpr_get_config()) return (NULL); switch (cf->cf_type) { case CFT_UFS: if (strlen(cf->cf_path) + strlen(cf->cf_fs) >= MAXNAMELEN - 1) { cpr_err(CE_CONT, "Statefile path is too long.\n"); return (NULL); } return (cpr_cprconfig_to_path()); case CFT_ZVOL: /*FALLTHROUGH*/ case CFT_SPEC: return (cf->cf_devfs); default: cpr_err(CE_PANIC, "invalid statefile type"); /*NOTREACHED*/ return (NULL); } }
int cpr_statefile_is_spec(void) { if (cpr_get_config()) return (0); return (cprconfig.cf_type == CFT_SPEC); }
/* * Make sure that the statefile can be used as a block special statefile * (meaning that is exists and has nothing mounted on it) * Returns errno if not a valid statefile. */ int cpr_check_spec_statefile(void) { int err; if (err = cpr_get_config()) return (err); ASSERT(cprconfig.cf_type == CFT_SPEC); if (cprconfig.cf_devfs == NULL) return (ENXIO); return (cpr_verify_statefile_path()); }