Whamcloud - gitweb
LU-15492 build: fallthrough macro for pre/post gcc-7
[fs/lustre-release.git] / lustre / include / lustre / lustreapi.h
index 4d7c299..caaa780 100644 (file)
@@ -61,6 +61,14 @@ extern "C" {
 #define LOV_PATTERN_DEFAULT    0xffffffff
 #endif
 
+#ifndef fallthrough
+# if defined(__GNUC__) && __GNUC__ >= 7
+#  define fallthrough  __attribute__((fallthrough)) /* fallthrough */
+# else
+#  define fallthrough do {} while (0)  /* fallthrough */
+# endif
+#endif
+
 typedef struct statx lstatx_t;
 
 #define lustre_fid struct lu_fid
@@ -148,10 +156,18 @@ struct llapi_stripe_param {
 
 #define lsp_tgts       lsp_osts
 
+enum {
+       LLAPI_MIGRATION_NONBLOCK        = 0x0001,
+       LLAPI_MIGRATION_MIRROR          = 0x0002,
+       LLAPI_MIGRATION_NONDIRECT       = 0x0004,
+       LLAPI_MIGRATION_VERBOSE         = 0x0008,
+};
+
 __u32 llapi_pattern_to_lov(uint64_t pattern);
 
 int llapi_file_open_param(const char *name, int flags, mode_t mode,
                          const struct llapi_stripe_param *param);
+int llapi_file_is_encrypted(int fd);
 int llapi_file_create_foreign(const char *name, mode_t mode, __u32 type,
                              __u32 flags, char *foreign_lov);
 int llapi_file_create(const char *name, unsigned long long stripe_size,
@@ -166,6 +182,8 @@ int llapi_file_open_pool(const char *name, int flags, int mode,
                         unsigned long long stripe_size, int stripe_offset,
                         int stripe_count, int stripe_pattern, char *pool_name);
 int llapi_poollist(const char *name);
+int llapi_get_poolbuf(const char *name, char **buf,
+                     char ***poolist, int *poolcount);
 int llapi_get_poollist(const char *name, char **poollist, int list_size,
                       char *buffer, int buffer_size);
 int llapi_get_poolmembers(const char *poolname, char **members, int list_size,
@@ -221,12 +239,20 @@ enum {
        NEWERXY_MAX,
 };
 
+enum lfs_find_perm {
+       LFS_FIND_PERM_EXACT = -2,
+       LFS_FIND_PERM_ANY   = -1,
+       LFS_FIND_PERM_OFF   =  0,
+       LFS_FIND_PERM_ALL   =  1,
+};
+
 struct find_param {
        unsigned int             fp_max_depth;
        dev_t                    fp_dev;
        mode_t                   fp_type; /* S_IFIFO,... */
        uid_t                    fp_uid;
        gid_t                    fp_gid;
+       mode_t                   fp_perm;
        time_t                   fp_atime;
        time_t                   fp_mtime;
        time_t                   fp_ctime;
@@ -248,7 +274,7 @@ struct find_param {
                                 fp_mdt_count_sign:2,
                                 fp_blocks_sign:2,
                                 fp_ext_size_sign:2,
-                                fp_unused1_sign:2, /* Fields available to use*/
+                                fp_perm_sign:2,
                                 fp_unused2_sign:2, /* Once used we must add  */
                                 fp_unused3_sign:2, /* a separate flag field  */
                                 fp_unused4_sign:2; /* at end of the struct.  */
@@ -314,12 +340,11 @@ struct find_param {
                                 fp_lazy:1,
                                 fp_newerxy:1,
                                 fp_exclude_btime:1,
-                                fp_unused_bit3:1, /* All of these unused bit */
-                                fp_unused_bit4:1, /* fields available to use.*/
-                                fp_unused_bit5:1, /* Once all unused fields  */
-                                fp_unused_bit6:1, /* are used we need to add */
-                                fp_unused_bit7:1; /* a separate flag field at*/
-                                                  /* the end of the struct.  */
+                                fp_exclude_perm:1,
+                                fp_unused_bit4:1, /* Once all unused fields  */
+                                fp_unused_bit5:1, /* are used we need to add */
+                                fp_unused_bit6:1, /* a separate flag field at*/
+                                fp_unused_bit7:1; /* the end of the struct.  */
 
        enum llapi_layout_verbose fp_verbose;
        int                      fp_quiet;
@@ -367,7 +392,7 @@ struct find_param {
        unsigned long long       fp_comp_end;
        unsigned long long       fp_comp_end_units;
        unsigned long long       fp_mdt_count;
-       unsigned                 fp_projid;
+       unsigned int             fp_projid;
        unsigned long long       fp_blocks;
        unsigned long long       fp_blocks_units;
 
@@ -390,6 +415,8 @@ struct find_param {
        int                      fp_bsign;
        unsigned int             fp_hash_inflags;
        unsigned int             fp_hash_exflags;
+       /* Print all information (lfs find only) */
+       char                     *fp_format_printf_str;
 };
 
 int llapi_ostlist(char *path, struct find_param *param);
@@ -529,7 +556,8 @@ int llapi_swap_layouts(const char *path1, const char *path2, __u64 dv1,
 
 /* Records received are in extended format now, though most of them are still
  * written in disk in changelog_rec format (to save space and time), it's
- * converted to extended format in the lustre api to ease changelog analysis. */
+ * converted to extended format in the lustre api to ease changelog analysis.
+ */
 #define HAVE_CHANGELOG_EXTEND_REC 1
 
 int llapi_changelog_start(void **priv, enum changelog_send_flag flags,
@@ -673,9 +701,8 @@ struct llapi_layout;
 int llapi_mirror_truncate(int fd, unsigned int id, off_t length);
 ssize_t llapi_mirror_write(int fd, unsigned int id, const void *buf,
                           size_t count, off_t pos);
-uint32_t llapi_mirror_find(struct llapi_layout *layout,
-                          uint64_t file_start, uint64_t file_end,
-                          uint64_t *endp);
+int llapi_mirror_find(struct llapi_layout *layout, uint64_t file_start,
+                     uint64_t file_end, uint64_t *endp);
 int llapi_layout_get_last_init_comp(struct llapi_layout *layout);
 int llapi_layout_mirror_inherit(struct llapi_layout *f_layout,
                                struct llapi_layout *m_layout);
@@ -806,8 +833,8 @@ int llapi_layout_merge(struct llapi_layout **dst_layout,
 #define LLAPI_LAYOUT_OVERSTRIPING      4ULL
 
 /**
-* The layout includes a specific set of OSTs on which to allocate.
-*/
+ * The layout includes a specific set of OSTs on which to allocate.
+ */
 #define LLAPI_LAYOUT_SPECIFIC  0x2000000000000000ULL
 
 /**
@@ -837,6 +864,10 @@ int llapi_layout_stripe_count_get(const struct llapi_layout *layout,
  */
 int llapi_layout_stripe_count_set(struct llapi_layout *layout, uint64_t count);
 
+/**
+ * Check if the stripe count \a stripe_count \a is valid.
+ */
+bool llapi_layout_stripe_count_is_valid(int64_t stripe_count);
 /******************** Stripe Size ********************/
 
 /**
@@ -968,7 +999,7 @@ int llapi_layout_pool_name_get(const struct llapi_layout *layout,
  * \retval -1  Invalid argument, errno set to EINVAL.
  */
 int llapi_layout_pool_name_set(struct llapi_layout *layout,
-                             const char *pool_name);
+                              const char *pool_name);
 
 /******************** File Creation ********************/
 
@@ -1030,7 +1061,7 @@ int llapi_layout_file_create(const char *path, int open_flags, int mode,
 int llapi_layout_flags_set(struct llapi_layout *layout, uint32_t flags);
 int llapi_layout_flags_get(struct llapi_layout *layout, uint32_t *flags);
 const char *llapi_layout_flags_string(uint32_t flags);
-const __u16 llapi_layout_string_flags(char *string);
+__u16 llapi_layout_string_flags(char *string);
 
 /**
  * llapi_layout_mirror_count_get() - Get mirror count from the header of
@@ -1079,6 +1110,7 @@ static const struct comp_flag_name {
        { LCME_FL_OFFLINE,      "offline" },
        { LCME_FL_NOSYNC,       "nosync" },
        { LCME_FL_EXTENSION,    "extension" },
+       { LCME_FL_PARITY,       "parity" },
 };
 
 /**