Whamcloud - gitweb
Branch HEAD
authoradilger <adilger>
Sat, 17 Mar 2007 18:30:03 +0000 (18:30 +0000)
committeradilger <adilger>
Sat, 17 Mar 2007 18:30:03 +0000 (18:30 +0000)
Add llapi_is_lustre_mnt() to check for client filesystems, so that we
can keep the API of llapi_is_lustre_mnttype() the same.
b=10747
r=nathan

lustre/include/lustre/liblustreapi.h
lustre/utils/lfs.c
lustre/utils/liblustreapi.c

index 3a8b742..ea1c9d0 100644 (file)
@@ -17,7 +17,7 @@ extern int llapi_file_create(const char *name, unsigned long stripe_size,
 extern int llapi_file_get_stripe(const char *path, struct lov_user_md *lum);
 #define HAVE_LLAPI_FILE_LOOKUP
 extern int llapi_file_lookup(int dirfd, const char *name);
+
 struct find_param {
         unsigned int maxdepth;
         time_t  atime;
@@ -58,7 +58,10 @@ extern int llapi_ping(char *obd_type, char *obd_name);
 extern int llapi_target_check(int num_types, char **obd_types, char *dir);
 extern int llapi_catinfo(char *dir, char *keyword, char *node_name);
 extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
-extern int llapi_is_lustre_mnttype(struct mntent *mnt);
+extern int llapi_is_lustre_mnttype(const char *type);
+struct mntent;
+#define HAVE_LLAPI_IS_LUSTRE_MNT
+extern int llapi_is_lustre_mnt(struct mntent *mnt);
 extern int llapi_quotachown(char *path, int flag);
 extern int llapi_quotacheck(char *mnt, int check_type);
 extern int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk);
index 1e90437..abda085 100644 (file)
@@ -500,7 +500,7 @@ static int lfs_osts(int argc, char **argv)
                 memset(&param, 0, sizeof(param));
                 param.obduuid = obduuid;
                 while (feof(fp) == 0 && ferror(fp) ==0) {
-                        if (llapi_is_lustre_mnttype(mnt)) {
+                        if (llapi_is_lustre_mnt(mnt)) {
                                 rc = llapi_getstripe(mnt->mnt_dir, &param);
                                 if (rc)
                                         fprintf(stderr,
@@ -548,7 +548,7 @@ static int path2mnt(char *path, FILE *fp, char *mntdir, int dir_len)
         len = 0;
         mnt = getmntent(fp);
         while (feof(fp) == 0 && ferror(fp) == 0) {
-                if (llapi_is_lustre_mnttype(mnt)) {
+                if (llapi_is_lustre_mnt(mnt)) {
                         len = strlen(mnt->mnt_dir);
                         if (len > out_len &&
                             !strncmp(rpath, mnt->mnt_dir, len)) {
@@ -769,7 +769,7 @@ static int lfs_df(int argc, char **argv)
         } else {
                 mnt = getmntent(fp);
                 while (feof(fp) == 0 && ferror(fp) == 0) {
-                        if (llapi_is_lustre_mnttype(mnt)) {
+                        if (llapi_is_lustre_mnt(mnt)) {
                                 rc = mntdf(mnt->mnt_dir, ishow, cooked);
                                 if (rc)
                                         break;
@@ -820,7 +820,7 @@ static int lfs_check(int argc, char **argv)
         } else {
                 mnt = getmntent(fp);
                 while (feof(fp) == 0 && ferror(fp) ==0) {
-                        if (llapi_is_lustre_mnttype(mnt))
+                        if (llapi_is_lustre_mnt(mnt))
                                 break;
                         mnt = getmntent(fp);
                 }
@@ -861,7 +861,7 @@ static int lfs_catinfo(int argc, char **argv)
         } else {
                 mnt = getmntent(fp);
                 while (feof(fp) == 0 && ferror(fp) == 0) {
-                        if (llapi_is_lustre_mnttype(mnt))
+                        if (llapi_is_lustre_mnt(mnt))
                                 break;
                         mnt = getmntent(fp);
                 }
index 553ca34..ada17be 100644 (file)
@@ -99,25 +99,25 @@ int llapi_file_create(const char *name, unsigned long stripe_size,
                         "expected (%u).\n", page_size, LOV_MIN_STRIPE_SIZE);
         }
         if (stripe_size < 0 || (stripe_size & (LOV_MIN_STRIPE_SIZE - 1))) {
+                errno = rc = -EINVAL;
                 err_msg("error: bad stripe_size %lu, must be an even "
                         "multiple of %d bytes", stripe_size, page_size);
-                errno = rc = -EINVAL;
                 goto out;
         }
         if (stripe_offset < -1 || stripe_offset > MAX_OBD_DEVICES) {
-                err_msg("error: bad stripe offset %d", stripe_offset);
                 errno = rc = -EINVAL;
+                err_msg("error: bad stripe offset %d", stripe_offset);
                 goto out;
         }
         if (stripe_count < -1 || stripe_count > LOV_MAX_STRIPE_COUNT) {
-                err_msg("error: bad stripe count %d", stripe_count);
                 errno = rc = -EINVAL;
+                err_msg("error: bad stripe count %d", stripe_count);
                 goto out;
         }
         if (stripe_count > 0 && (__u64)stripe_size * stripe_count > 0xffffffff){
+                errno = rc = -EINVAL;
                 err_msg("error: stripe_size %lu * stripe_count %u "
                         "exceeds 4GB", stripe_size, stripe_count);
-                errno = rc = -EINVAL;
                 goto out;
         }
 
@@ -1131,12 +1131,17 @@ int llapi_catinfo(char *dir, char *keyword, char *node_name)
         return rc;
 }
 
+/* Is this a lustre fs? */
+int llapi_is_lustre_mnttype(const char *type)
+{
+        return (strcmp(type, "lustre") == 0 || strcmp(type,"lustre_lite") == 0);
+}
+
 /* Is this a lustre client fs? */
-int llapi_is_lustre_mnttype(struct mntent *mnt)
+int llapi_is_lustre_mnt(struct mntent *mnt)
 {
-        char *type = mnt->mnt_type;
-        return ((strcmp(type, "lustre") == 0 || strcmp(type,"lustre_lite") == 0)
-                && (strstr(mnt->mnt_fsname, ":/") != NULL));
+        return (llapi_is_lustre_mnttype(mnt->mnt_type) &&
+                strstr(mnt->mnt_fsname, ":/") != NULL);
 }
 
 int llapi_quotacheck(char *mnt, int check_type)