Whamcloud - gitweb
LU-6245 libcfs: create userland and kernel string operations
[fs/lustre-release.git] / lustre / utils / liblustreapi.c
index 47ae129..4694491 100644 (file)
@@ -71,6 +71,7 @@
 #endif
 #include <poll.h>
 
+#include <libcfs/util/string.h>
 #include <libcfs/libcfs.h>
 #include <lnet/lnetctl.h>
 #include <lustre/lustreapi.h>
@@ -1880,7 +1881,7 @@ enum tgt_type {
 /*
  * If uuidp is NULL, return the number of available obd uuids.
  * If uuidp is non-NULL, then it will return the uuids of the obds. If
- * there are more OSTs then allocated to uuidp, then an error is returned with
+ * there are more OSTs than allocated to uuidp, then an error is returned with
  * the ost_count set to number of available obd uuids.
  */
 static int llapi_get_target_uuids(int fd, struct obd_uuid *uuidp,
@@ -3204,14 +3205,13 @@ obd_matches:
                if (param->fp_mdt_index != OBD_NOT_FOUND)
                         print_failed_tgt(param, path, LL_STATFS_LMV);
 
-               if (S_ISDIR(st->st_mode))
+               if (dir != NULL)
                        ret = fstat_f(dirfd(dir), st);
-               else if (dir != NULL)
-                       ret = ioctl(dirfd(dir), IOC_LOV_GETINFO,
-                                   (void *)param->fp_lmd);
+               else if (de != NULL)
+                       ret = fstatat_f(dirfd(parent), de->d_name, st,
+                                       AT_SYMLINK_NOFOLLOW);
                else
-                       ret = ioctl(dirfd(parent), IOC_LOV_GETINFO,
-                                   (void *)param->fp_lmd);
+                       ret = lstat_f(path, st);
 
                 if (ret) {
                         if (errno == ENOENT) {