Whamcloud - gitweb
LU-12511 utils: Move utilies specific values out of Lustre UAPI headers 90/38790/3
authorJames Simmons <jsimmons@infradead.org>
Fri, 5 Jun 2020 02:13:38 +0000 (22:13 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 16 Jun 2020 02:21:20 +0000 (02:21 +0000)
Use FS_IOC_FS[S|G]ETXATTR directly. Move several things in the
UAPI header lustre_user.h that is only needed by user land tools
to the proper places.

Change-Id: Ie7a33742c0aba478c365c5fa44315400b28d8193
Test-Parameters: trivial
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/38790
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
lustre/include/lustre/lustreapi.h
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/llite/dir.c
lustre/llite/file.c
lustre/tests/statx.c
lustre/utils/lfs_project.c
lustre/utils/liblustreapi.c
lustre/utils/liblustreapi_layout.c

index c9573db..b959bf1 100644 (file)
@@ -54,6 +54,16 @@ extern "C" {
 #define LL_MAXQUOTAS 3
 #endif
 
+#ifndef SEL_UNIT_SIZE
+#define SEL_UNIT_SIZE 1024llu
+#endif
+
+#ifndef LOV_PATTERN_DEFAULT
+#define LOV_PATTERN_DEFAULT    0xffffffff
+#endif
+
+typedef struct statx lstatx_t;
+
 #define lustre_fid struct lu_fid
 
 /* Currently external applications can access this but in the
@@ -553,6 +563,30 @@ int llapi_hsm_request(const char *path, const struct hsm_user_request *request);
 int llapi_hsm_current_action(const char *path, struct hsm_current_action *hca);
 
 /* JSON handling */
+enum llapi_json_types {
+       LLAPI_JSON_INTEGER = 1,
+       LLAPI_JSON_BIGNUM,
+       LLAPI_JSON_REAL,
+       LLAPI_JSON_STRING
+};
+
+struct llapi_json_item {
+       char                    *lji_key;
+       __u32                   lji_type;
+       union {
+               int             lji_integer;
+               __u64           lji_u64;
+               double          lji_real;
+               char            *lji_string;
+       };
+       struct llapi_json_item  *lji_next;
+};
+
+struct llapi_json_item_list {
+       int                     ljil_item_count;
+       struct llapi_json_item  *ljil_items;
+};
+
 int llapi_json_init_list(struct llapi_json_item_list **item_list);
 int llapi_json_destroy_list(struct llapi_json_item_list **item_list);
 int llapi_json_add_item(struct llapi_json_item_list **item_list, char *key,
index 25ff63c..15d62b6 100644 (file)
@@ -648,8 +648,6 @@ struct fsxattr {
 #define FS_IOC_FSGETXATTR              _IOR('X', 31, struct fsxattr)
 #define FS_IOC_FSSETXATTR              _IOW('X', 32, struct fsxattr)
 #endif
-#define LL_IOC_FSGETXATTR              FS_IOC_FSGETXATTR
-#define LL_IOC_FSSETXATTR              FS_IOC_FSSETXATTR
 #ifndef FS_XFLAG_PROJINHERIT
 #define FS_XFLAG_PROJINHERIT           0x00000200
 #endif
@@ -2435,31 +2433,6 @@ struct hsm_copy {
        struct hsm_action_item  hc_hai;
 };
 
-/* JSON objects */
-enum llapi_json_types {
-       LLAPI_JSON_INTEGER = 1,
-       LLAPI_JSON_BIGNUM,
-       LLAPI_JSON_REAL,
-       LLAPI_JSON_STRING
-};
-
-struct llapi_json_item {
-       char                    *lji_key;
-       __u32                   lji_type;
-       union {
-               int     lji_integer;
-               __u64   lji_u64;
-               double  lji_real;
-               char    *lji_string;
-       };
-       struct llapi_json_item  *lji_next;
-};
-
-struct llapi_json_item_list {
-       int                     ljil_item_count;
-       struct llapi_json_item  *ljil_items;
-};
-
 enum lu_ladvise_type {
        LU_LADVISE_INVALID      = 0,
        LU_LADVISE_WILLREAD     = 1,
index 9a83ba4..1501ce0 100644 (file)
@@ -2082,9 +2082,9 @@ migrate_free:
 
                RETURN(rc);
        }
-       case LL_IOC_FSGETXATTR:
+       case FS_IOC_FSGETXATTR:
                RETURN(ll_ioctl_fsgetxattr(inode, cmd, arg));
-       case LL_IOC_FSSETXATTR:
+       case FS_IOC_FSSETXATTR:
                RETURN(ll_ioctl_fssetxattr(inode, cmd, arg));
        case LL_IOC_PCC_DETACH_BY_FID: {
                struct lu_pcc_detach_fid *detach;
index 4085d54..aac8685 100644 (file)
@@ -3899,9 +3899,9 @@ out_ladvise:
                fd->fd_designated_mirror = (__u32)arg;
                RETURN(0);
        }
-       case LL_IOC_FSGETXATTR:
+       case FS_IOC_FSGETXATTR:
                RETURN(ll_ioctl_fsgetxattr(inode, cmd, arg));
-       case LL_IOC_FSSETXATTR:
+       case FS_IOC_FSSETXATTR:
                RETURN(ll_ioctl_fssetxattr(inode, cmd, arg));
        case BLKSSZGET:
                RETURN(put_user(PAGE_SIZE, (int __user *)arg));
index 80bc295..aa7429b 100644 (file)
@@ -73,6 +73,11 @@ static bool o_quiet;
 
 #ifdef __NR_statx
 #ifndef HAVE_STATX
+
+#define AT_STATX_SYNC_TYPE     0x6000
+#define AT_STATX_FORCE_SYNC    0x2000
+#define AT_STATX_DONT_SYNC     0x4000
+
 static __attribute__((unused))
 ssize_t statx(int dfd, const char *filename, int flags,
              unsigned int mask, struct statx *buffer)
index f16d825..9f82b74 100644 (file)
@@ -118,7 +118,7 @@ static int project_get_xattr(const char *pathname, struct fsxattr *fsx,
                return -errno;
        }
 
-       ret = ioctl(fd, LL_IOC_FSGETXATTR, fsx);
+       ret = ioctl(fd, FS_IOC_FSGETXATTR, fsx);
        if (ret) {
                fprintf(stderr, "%s: failed to get xattr for '%s': %s\n",
                        progname, pathname, strerror(errno));
@@ -207,7 +207,7 @@ project_set_one(const char *pathname, struct project_handle_control *phc)
        if (phc->set_projid)
                fsx.fsx_projid = phc->projid;
 
-       ret = ioctl(fd, LL_IOC_FSSETXATTR, &fsx);
+       ret = ioctl(fd, FS_IOC_FSSETXATTR, &fsx);
        if (ret)
                fprintf(stderr, "%s: failed to set xattr for '%s': %s\n",
                        progname, pathname, strerror(errno));
@@ -235,7 +235,7 @@ project_clear_one(const char *pathname, struct project_handle_control *phc)
        if (!phc->keep_projid)
                fsx.fsx_projid = 0;
 
-       ret = ioctl(fd, LL_IOC_FSSETXATTR, &fsx);
+       ret = ioctl(fd, FS_IOC_FSSETXATTR, &fsx);
        if (ret)
                fprintf(stderr, "%s: failed to set xattr for '%s': %s\n",
                        progname, pathname, strerror(errno));
index 705b544..f46f72b 100644 (file)
@@ -4597,7 +4597,7 @@ static int fget_projid(int fd, int *projid)
        struct fsxattr fsx;
        int rc;
 
-       rc = ioctl(fd, LL_IOC_FSGETXATTR, &fsx);
+       rc = ioctl(fd, FS_IOC_FSGETXATTR, &fsx);
        if (rc)
                return -errno;
 
index 5dfd6f4..87ed8c8 100644 (file)
@@ -3110,6 +3110,10 @@ struct llapi_layout_sanity_args {
        int lsa_rc;
 };
 
+/* The component flags can be set by users at creation/modification time. */
+#define LCME_USER_COMP_FLAGS   (LCME_FL_PREF_RW | LCME_FL_NOSYNC | \
+                                LCME_FL_EXTENSION)
+
 static int llapi_layout_sanity_cb(struct llapi_layout *layout,
                                  void *arg)
 {