int create_lost_and_found(PVFS_fs_id cur_fs, PVFS_credentials *creds) { int ret; PVFS_object_ref root_ref; PVFS_sys_attr attr; PVFS_sysresp_lookup lookup_resp; PVFS_sysresp_mkdir mkdir_resp; /* if it's already there, don't bother */ ret = PVFS_sys_lookup(cur_fs, "/lost+found", creds, &lookup_resp, PVFS2_LOOKUP_LINK_NO_FOLLOW, NULL); if (ret == 0) { laf_ref = lookup_resp.ref; return 0; } attr.owner = creds->uid; attr.owner = creds->uid; attr.group = creds->gid; attr.perms = PVFS_util_translate_mode(0755, 0); attr.mask = PVFS_ATTR_SYS_ALL_SETABLE; ret = PVFS_sys_lookup(cur_fs, "/", creds, &lookup_resp, PVFS2_LOOKUP_LINK_NO_FOLLOW, NULL); assert(ret == 0); root_ref = lookup_resp.ref; printf("* %s creating lost+found to hold orphans.\n", fsck_opts->destructive ? "" : "not"); if (fsck_opts->destructive) { ret = PVFS_sys_mkdir("lost+found", root_ref, attr, creds, &mkdir_resp, NULL); if (ret == 0) { laf_ref = mkdir_resp.ref; } } else { ret = 0; } return ret; }
void make_attribs(PVFS_sys_attr *attr, PVFS_credentials *credentials, int nr_datafiles, int mode) { attr->owner = credentials->uid; attr->group = credentials->gid; attr->perms = PVFS_util_translate_mode(mode, 0); attr->mask = (PVFS_ATTR_SYS_ALL_SETABLE); attr->dfile_count = nr_datafiles; if (attr->dfile_count > 0) { attr->mask |= PVFS_ATTR_SYS_DFILE_COUNT; } }