Whamcloud - gitweb
LU-4690 osp: some cleanup for patch 9511
[fs/lustre-release.git] / lustre / utils / liblustreapi.c
index 5e16e22..97d7fc7 100644 (file)
@@ -69,7 +69,7 @@
 #endif
 #include <poll.h>
 
-#include <liblustre.h>
+#include <libcfs/libcfs.h>
 #include <lnet/lnetctl.h>
 #include <lustre/lustreapi.h>
 #include <lustre_ioctl.h>
@@ -2387,7 +2387,7 @@ void lmv_dump_user_lmm(struct lmv_user_md *lum, char *pool_name,
        struct lmv_user_mds_data *objects = lum->lum_objects;
        char *prefix = lum->lum_magic == LMV_USER_MAGIC ? "(Default)" : "";
        int i, obdstripe = 0;
-       char *seperator = "";
+       char *separator = "";
 
        if (obdindex != OBD_NOT_FOUND) {
                for (i = 0; i < lum->lum_stripe_count; i++) {
@@ -2414,25 +2414,25 @@ void lmv_dump_user_lmm(struct lmv_user_md *lum, char *pool_name,
                llapi_printf(LLAPI_MSG_NORMAL, "%s%s\n", prefix, path);
 
        if (verbose & VERBOSE_COUNT) {
-               llapi_printf(LLAPI_MSG_NORMAL, "%s", seperator);
+               llapi_printf(LLAPI_MSG_NORMAL, "%s", separator);
                if (verbose & ~VERBOSE_COUNT)
                        llapi_printf(LLAPI_MSG_NORMAL, "lmv_stripe_count: ");
                llapi_printf(LLAPI_MSG_NORMAL, "%u",
                             (int)lum->lum_stripe_count);
-               seperator = "\n";
+               separator = "\n";
        }
 
        if (verbose & VERBOSE_OFFSET) {
-               llapi_printf(LLAPI_MSG_NORMAL, "%s", seperator);
+               llapi_printf(LLAPI_MSG_NORMAL, "%s", separator);
                if (verbose & ~VERBOSE_OFFSET)
                        llapi_printf(LLAPI_MSG_NORMAL, "lmv_stripe_offset: ");
                llapi_printf(LLAPI_MSG_NORMAL, "%d",
                             (int)lum->lum_stripe_offset);
-               seperator = "\n";
+               separator = "\n";
        }
 
        if (verbose & VERBOSE_OBJID && lum->lum_magic != LMV_USER_MAGIC) {
-               llapi_printf(LLAPI_MSG_NORMAL, "%s", seperator);
+               llapi_printf(LLAPI_MSG_NORMAL, "%s", separator);
                if (obdstripe == 1 && lum->lum_stripe_count > 0)
                        llapi_printf(LLAPI_MSG_NORMAL,
                                     "mdtidx\t\t FID[seq:oid:ver]\n");
@@ -2449,12 +2449,12 @@ void lmv_dump_user_lmm(struct lmv_user_md *lum, char *pool_name,
        }
 
        if ((verbose & VERBOSE_POOL) && (pool_name[0] != '\0')) {
-               llapi_printf(LLAPI_MSG_NORMAL, "%s", seperator);
+               llapi_printf(LLAPI_MSG_NORMAL, "%s", separator);
                if (verbose & ~VERBOSE_POOL)
                        llapi_printf(LLAPI_MSG_NORMAL, "%slmv_pool:           ",
                                     prefix);
                llapi_printf(LLAPI_MSG_NORMAL, "%s%c ", pool_name, ' ');
-               seperator = "\n";
+               separator = "\n";
        }
 
        if (!(verbose & VERBOSE_OBJID))
@@ -4283,9 +4283,13 @@ int llapi_fid2path(const char *device, const char *fidstr, char *buf,
                 if (rc != -ENOENT)
                         llapi_error(LLAPI_MSG_ERROR, rc, "ioctl err %d", rc);
         } else {
-                memcpy(buf, gf->gf_path, gf->gf_pathlen);
-                *recno = gf->gf_recno;
-                *linkno = gf->gf_linkno;
+               memcpy(buf, gf->gf_path, gf->gf_pathlen);
+               if (buf[0] == '\0') { /* ROOT path */
+                       buf[0] = '/';
+                       buf[1] = '\0';
+               }
+               *recno = gf->gf_recno;
+               *linkno = gf->gf_linkno;
         }
 
         free(gf);