Whamcloud - gitweb
LU-16814 utils: Change llapi_root_path_open() signature 09/50909/3
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Wed, 10 May 2023 08:48:11 +0000 (14:18 +0530)
committerOleg Drokin <green@whamcloud.com>
Wed, 31 May 2023 19:14:00 +0000 (19:14 +0000)
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 <bertschinger@lanl.gov>
Test-Parameters: trivial testlist=sanity
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I81de8cb9280af91af8a2de8dbb51f8e82807220d
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50909
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Thomas Bertschinger <bertschinger@lanl.gov>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/doc/llapi_rmfid.3
lustre/doc/llapi_root_path_open.3
lustre/include/lustre/lustreapi.h
lustre/utils/lfs.c
lustre/utils/liblustreapi_util.c

index d7c8db0..a6cb6cc 100644 (file)
@@ -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)
index 1ccc973..428c60c 100644 (file)
@@ -6,7 +6,7 @@ llapi_root_path_open \- Return open fd for a given device/path provided
 .B #include <lustre/lustreapi.h>
 
 .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.
 
index 013ab04..b98882f 100644 (file)
@@ -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;
index a632bf8..b405982 100644 (file)
@@ -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 */
index 9818851..9cb9c45 100644 (file)
@@ -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",