From 99d26afb907b34ecc6a54f75b7a374f7e34a206c Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Thu, 29 Apr 2010 13:37:03 +0800 Subject: [PATCH] b=22069 port "llapi_get_connect_flags()" API from b1_8 to master Port "llapi_get_connect_flags()" API from b1_8 to master. i=robert.read i=landen --- lustre/include/lustre/liblustreapi.h | 1 + lustre/include/lustre/lustre_user.h | 3 ++- lustre/llite/dir.c | 3 +++ lustre/lmv/lmv_obd.c | 4 ++++ lustre/mdc/mdc_request.c | 6 ++++++ lustre/utils/liblustreapi.c | 16 ++++++++++++++++ 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lustre/include/lustre/liblustreapi.h b/lustre/include/lustre/liblustreapi.h index c84e137..12bd8a1 100644 --- a/lustre/include/lustre/liblustreapi.h +++ b/lustre/include/lustre/liblustreapi.h @@ -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[]); diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 543d305..0709027 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -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 *) diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 266ae99..aedf472 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -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, diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 335c45e..36594af 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -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++) { diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 23f52e5..809a207 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -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); diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 7edef43..e28f533 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -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; +} -- 1.8.3.1