From: Arshad Hussain Date: Wed, 10 May 2023 08:48:11 +0000 (+0530) Subject: LU-16814 utils: Change llapi_root_path_open() signature X-Git-Tag: 2.15.56~28 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F50909%2F3;p=fs%2Flustre-release.git LU-16814 utils: Change llapi_root_path_open() signature This patch changes llapi_root_path_open() first argument form char * to const char * as the argument passed is not modified. This patch also fixes llapi_rmfid and llapi_root_path_open man page. Fixes: 5d93025240 ("LU-16427 lfs: rmfid does not print anything on error") Reported-by: Thomas Bertschinger Test-Parameters: trivial testlist=sanity Signed-off-by: Arshad Hussain Change-Id: I81de8cb9280af91af8a2de8dbb51f8e82807220d Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50909 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Thomas Bertschinger Reviewed-by: Oleg Drokin --- diff --git a/lustre/doc/llapi_rmfid.3 b/lustre/doc/llapi_rmfid.3 index d7c8db0..a6cb6cc 100644 --- a/lustre/doc/llapi_rmfid.3 +++ b/lustre/doc/llapi_rmfid.3 @@ -57,6 +57,10 @@ Invalid FID is passed .TP .SM -ENOMEM Not enough memory to process the request +.TP +.SM -ENOTTY +.I file +may not point to a Lustre filesystem mountpoint .SH "SEE ALSO" .BR lustreapi (7) .BR llapi_rmfid_at (3) diff --git a/lustre/doc/llapi_root_path_open.3 b/lustre/doc/llapi_root_path_open.3 index 1ccc973..428c60c 100644 --- a/lustre/doc/llapi_root_path_open.3 +++ b/lustre/doc/llapi_root_path_open.3 @@ -6,7 +6,7 @@ llapi_root_path_open \- Return open fd for a given device/path provided .B #include .sp -.BI "int llapi_root_path_open(char *"device ", int *" fd " ); +.BI "int llapi_root_path_open(const char *"device ", int *" fd " ); .sp .fi @@ -15,7 +15,8 @@ llapi_root_path_open \- Return open fd for a given device/path provided .B llapi_root_path_open(\|) is called with .I device -which points to the FSNAME or complet path. On success +which points to the FSNAME or complete path specifying a mountpount of Lustre +filesystem. On success, .I fd is populated with valid descriptor. diff --git a/lustre/include/lustre/lustreapi.h b/lustre/include/lustre/lustreapi.h index 013ab04..b98882f 100644 --- a/lustre/include/lustre/lustreapi.h +++ b/lustre/include/lustre/lustreapi.h @@ -521,7 +521,7 @@ int llapi_fd2parent(int fd, unsigned int linkno, struct lu_fid *parent_fid, char *name, size_t name_size); int llapi_rmfid(const char *path, struct fid_array *fa); int llapi_rmfid_at(int fd, struct fid_array *fa); -int llapi_root_path_open(char *device, int *outfd); +int llapi_root_path_open(const char *device, int *outfd); int llapi_chomp_string(char *buf); struct file_handle; diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index a632bf8..b405982 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -9899,9 +9899,10 @@ static int lfs_rmfid_and_show_errors(int rootfd, struct fid_array *fa) static int lfs_rmfid(int argc, char **argv) { - char *fidstr, *device; int rc = 0, rc2, rc3 = 0, nr; struct fid_array *fa; + const char *device; + char *fidstr; int rootfd; /* Interactive mode: Adjust optind */ diff --git a/lustre/utils/liblustreapi_util.c b/lustre/utils/liblustreapi_util.c index 9818851..9cb9c45 100644 --- a/lustre/utils/liblustreapi_util.c +++ b/lustre/utils/liblustreapi_util.c @@ -297,7 +297,7 @@ int llapi_search_ost(const char *fsname, const char *poolname, * \retval 0 on success * \retval -ve on failure */ -int llapi_root_path_open(char *device, int *rootfd) +int llapi_root_path_open(const char *device, int *rootfd) { int tmp_fd, rc; @@ -333,7 +333,7 @@ int llapi_rmfid(const char *path, struct fid_array *fa) { int rootfd, rc; - rc = llapi_root_path_open((char *)path, &rootfd); + rc = llapi_root_path_open(path, &rootfd); if (rc < 0) { fprintf(stderr, "lfs rmfid: error opening device/fsname '%s': %s\n",