Whamcloud - gitweb
b=22069 port "llapi_get_connect_flags()" API from b1_8 to master
authorFan Yong <Yong.Fan@sun.com>
Thu, 29 Apr 2010 05:37:03 +0000 (13:37 +0800)
committerRobert Read <robert.read@oracle.com>
Thu, 29 Apr 2010 18:12:49 +0000 (11:12 -0700)
Port "llapi_get_connect_flags()" API from b1_8 to master.

i=robert.read
i=landen

lustre/include/lustre/liblustreapi.h
lustre/include/lustre/lustre_user.h
lustre/llite/dir.c
lustre/lmv/lmv_obd.c
lustre/mdc/mdc_request.c
lustre/utils/liblustreapi.c

index c84e137..12bd8a1 100644 (file)
@@ -194,6 +194,7 @@ extern int llapi_quotacheck(char *mnt, int check_type);
 extern int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk);
 extern int llapi_quotactl(char *mnt, struct if_quotactl *qctl);
 extern int llapi_target_iterate(int type_num, char **obd_type, void *args, llapi_cb_t cb);
+extern int llapi_get_connect_flags(const char *mnt, __u64 *flags);
 extern int llapi_lsetfacl(int argc, char *argv[]);
 extern int llapi_lgetfacl(int argc, char *argv[]);
 extern int llapi_rsetfacl(int argc, char *argv[]);
index 543d305..0709027 100644 (file)
@@ -139,7 +139,8 @@ struct obd_statfs {
 #define LL_IOC_LLOOP_INFO               _IOWR('f', 171, long)
 #define LL_IOC_LLOOP_DETACH_BYDEV       _IOWR('f', 172, long)
 #define LL_IOC_PATH2FID                 _IOR ('f', 173, long)
-#define LL_IOC_GET_MDTIDX               _IOR ('f', 174, int)
+#define LL_IOC_GET_CONNECT_FLAGS        _IOWR('f', 174, __u64 *)
+#define LL_IOC_GET_MDTIDX               _IOR ('f', 175, int)
 
 #define LL_IOC_HSM_CT_START             _IOW ('f', 178, struct lustre_kernelcomm *)
 
index 266ae99..aedf472 100644 (file)
@@ -1288,6 +1288,9 @@ out_free:
                                      sizeof(struct lu_fid)))
                         RETURN(-EFAULT);
                 RETURN(0);
+        case LL_IOC_GET_CONNECT_FLAGS: {
+                RETURN(obd_iocontrol(cmd, sbi->ll_md_exp, 0, NULL, (void*)arg));
+        }
         case OBD_IOC_CHANGELOG_SEND:
         case OBD_IOC_CHANGELOG_CLEAR:
                 rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void *)arg,
index 335c45e..36594af 100644 (file)
@@ -821,6 +821,10 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
                                    sizeof(*icc), icc, NULL);
                 break;
         }
+        case LL_IOC_GET_CONNECT_FLAGS: {
+                rc = obd_iocontrol(cmd, lmv->tgts[0].ltd_exp, len, karg, uarg);
+                break;
+        }
 
         default : {
                 for (i = 0; i < count; i++) {
index 23f52e5..809a207 100644 (file)
@@ -1413,6 +1413,12 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
                 GOTO(out, rc = 0);
         }
+        case LL_IOC_GET_CONNECT_FLAGS: {
+                if (cfs_copy_to_user(uarg, &exp->exp_connect_flags, sizeof(__u64)))
+                        GOTO(out, rc = -EFAULT);
+                else
+                        GOTO(out, rc = 0);
+        }
         default:
                 CERROR("mdc_ioctl(): unrecognised ioctl %#x\n", cmd);
                 GOTO(out, rc = -ENOTTY);
index 7edef43..e28f533 100644 (file)
@@ -3244,5 +3244,21 @@ int llapi_copytool_free(struct hsm_action_list **hal)
         return 0;
 }
 
+int llapi_get_connect_flags(const char *mnt, __u64 *flags)
+{
+        DIR *root;
+        int rc;
 
+        root = opendir(mnt);
+        if (!root) {
+                llapi_err(LLAPI_MSG_ERROR, "open %s failed", mnt);
+                return -1;
+        }
 
+        rc = ioctl(dirfd(root), LL_IOC_GET_CONNECT_FLAGS, flags);
+        closedir(root);
+        if (rc < 0)
+                llapi_err(LLAPI_MSG_ERROR,
+                          "ioctl on %s for getting connect flags failed", mnt);
+        return rc;
+}