goto out;
}
- if (path_or_device[0] == '/')
- rc = get_root_path(WANT_FD, NULL, &mnt_fd,
- (char *)path_or_device, -1, NULL, NULL);
- else
- rc = get_root_path(WANT_FD, (char *)path_or_device,
- &mnt_fd, NULL, -1, NULL, NULL);
-
+ rc = llapi_root_path_open(path_or_device, &mnt_fd);
if (rc < 0)
goto out;
/* mnt_fd is cached internally, no need to close it */
rc = llapi_fid2path_at(mnt_fd, &fid, path, pathlen, recno, linkno);
+ close(mnt_fd);
out:
return rc;
/* this will return a cached FD if available, so only one open needed.
* WANT_FD doesn't modify lustre_dir so casting away "const" is OK */
- rc = get_root_path(WANT_FD, NULL, &mnt_fd, (char *)lustre_dir, 0, NULL,
- NULL);
+
+ rc = llapi_root_path_open(lustre_dir, &mnt_fd);
if (rc)
goto out;
int rc;
int fd;
- rc = get_root_path(WANT_FD, NULL, &fd, (char *)path, -1, NULL, NULL);
+ rc = llapi_root_path_open(path, &fd);
if (rc)
return rc;
/* If error, save errno value */
rc = rc ? -errno : 0;
- /* fd is cached internally, no need to close it */
+ close(fd);
return rc;
}
int fd;
struct lu_pcc_detach_fid detach;
- rc = get_root_path(WANT_FD, NULL, &fd, (char *)mntpath, -1, NULL, NULL);
+ rc = llapi_root_path_open(mntpath, &fd);
if (rc) {
llapi_error(LLAPI_MSG_ERROR, rc, "cannot get root path: %s",
mntpath);
detach.pccd_fid = *fid;
detach.pccd_opt = option;
- /* fd is cached internally, no need to close */
rc = ioctl(fd, LL_IOC_PCC_DETACH_BY_FID, &detach);
rc = rc ? -errno : 0;
+ close(fd);
return rc;
}