]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Change update to enum in update_super and update_subarray
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index 09915a0009d96d77e91e0fb9e99992a4d1c96c37..5dc9439054f700852218a76212cc3c210f044442 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -33,8 +33,10 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 # endif
 #endif
 
+#include       <assert.h>
 #include       <sys/types.h>
 #include       <sys/stat.h>
+#include       <stdarg.h>
 #include       <stdint.h>
 #include       <stdlib.h>
 #include       <time.h>
@@ -394,7 +396,6 @@ struct createinfo {
        int     gid;
        int     autof;
        int     mode;
-       int     symlinks;
        int     names;
        int     bblist;
        struct supertype *supertype;
@@ -419,6 +420,7 @@ enum mode {
 };
 
 extern char short_options[];
+extern char short_monitor_options[];
 extern char short_bitmap_options[];
 extern char short_bitmap_auto_options[];
 extern struct option long_options[];
@@ -441,7 +443,6 @@ enum special_options {
        BackupFile,
        HomeHost,
        AutoHomeHost,
-       Symlinks,
        AutoDetect,
        Waitclean,
        DetailPlatform,
@@ -496,6 +497,51 @@ enum special_options {
        ConsistencyPolicy,
 };
 
+enum update_opt {
+       UOPT_NAME = 1,
+       UOPT_PPL,
+       UOPT_NO_PPL,
+       UOPT_BITMAP,
+       UOPT_NO_BITMAP,
+       UOPT_SUBARRAY_ONLY,
+       UOPT_SPARC22,
+       UOPT_SUPER_MINOR,
+       UOPT_SUMMARIES,
+       UOPT_RESYNC,
+       UOPT_UUID,
+       UOPT_HOMEHOST,
+       UOPT_HOME_CLUSTER,
+       UOPT_NODES,
+       UOPT_DEVICESIZE,
+       UOPT_BBL,
+       UOPT_NO_BBL,
+       UOPT_FORCE_NO_BBL,
+       UOPT_METADATA,
+       UOPT_REVERT_RESHAPE,
+       UOPT_LAYOUT_ORIGINAL,
+       UOPT_LAYOUT_ALTERNATE,
+       UOPT_LAYOUT_UNSPECIFIED,
+       UOPT_BYTEORDER,
+       UOPT_HELP,
+       UOPT_USER_ONLY,
+       /*
+        * Code specific options, cannot be set by the user
+        */
+       UOPT_SPEC_FORCE_ONE,
+       UOPT_SPEC_FORCE_ARRAY,
+       UOPT_SPEC_ASSEMBLE,
+       UOPT_SPEC_LINEAR_GROW_NEW,
+       UOPT_SPEC_LINEAR_GROW_UPDATE,
+       UOPT_SPEC__RESHAPE_PROGRESS,
+       UOPT_SPEC_WRITEMOSTLY,
+       UOPT_SPEC_READWRITE,
+       UOPT_SPEC_FAILFAST,
+       UOPT_SPEC_NOFAILFAST,
+       UOPT_SPEC_REVERT_RESHAPE_NOBACKUP,
+       UOPT_UNDEFINED
+};
+extern void fprint_update_options(FILE *outf, enum update_opt update_mode);
+
 enum prefix_standard {
        JEDEC,
        IEC
@@ -596,6 +642,7 @@ struct shape {
        int     assume_clean;
        int     write_behind;
        unsigned long long size;
+       unsigned long long data_offset;
        int     consistency_policy;
 };
 
@@ -775,7 +822,7 @@ extern char *map_num(mapping_t *map, int num);
 extern int map_name(mapping_t *map, char *name);
 extern mapping_t r0layout[], r5layout[], r6layout[],
        pers[], modes[], faultylayout[];
-extern mapping_t consistency_policies[], sysfs_array_states[];
+extern mapping_t consistency_policies[], sysfs_array_states[], update_options[];
 
 extern char *map_dev_preferred(int major, int minor, int create,
                               char *prefer);
@@ -796,6 +843,17 @@ static inline int is_fd_valid(int fd)
        return (fd > -1);
 }
 
+/**
+ * is_level456() - check whether given level is between inclusive 4 and 6.
+ * @level: level to check.
+ *
+ * Return: true if condition is met, false otherwise
+ */
+static inline bool is_level456(int level)
+{
+       return (level >= 4 && level <= 6);
+}
+
 /**
  * close_fd() - verify, close and unset file descriptor.
  * @fd: pointer to file descriptor.
@@ -953,7 +1011,7 @@ extern struct superswitch {
         *                    it will resume going in the opposite direction.
         */
        int (*update_super)(struct supertype *st, struct mdinfo *info,
-                           char *update,
+                           enum update_opt update,
                            char *devname, int verbose,
                            int uuid_set, char *homehost);
 
@@ -1079,9 +1137,15 @@ extern struct superswitch {
        /* Permit subarray's to be deleted from inactive containers */
        int (*kill_subarray)(struct supertype *st,
                             char *subarray_id); /* optional */
-       /* Permit subarray's to be modified */
+       /**
+        * update_subarray() - Permit subarray to be modified.
+        * @st: Supertype.
+        * @subarray: Subarray name.
+        * @update: Update option.
+        * @ident: Optional identifiers.
+        */
        int (*update_subarray)(struct supertype *st, char *subarray,
-                              char *update, struct mddev_ident *ident); /* optional */
+                              enum update_opt update, struct mddev_ident *ident);
        /* Check if reshape is supported for this external format.
         * st is obtained from super_by_fd() where st->subarray[0] is
         * initialized to indicate if reshape is being performed at the
@@ -1421,7 +1485,6 @@ extern int Grow_addbitmap(char *devname, int fd,
                          struct context *c, struct shape *s);
 extern int Grow_reshape(char *devname, int fd,
                        struct mddev_dev *devlist,
-                       unsigned long long data_offset,
                        struct context *c, struct shape *s);
 extern int Grow_restart(struct supertype *st, struct mdinfo *info,
                        int *fdlist, int cnt, char *backup_file, int verbose);
@@ -1452,8 +1515,7 @@ extern int Create(struct supertype *st, char *mddev,
                  char *name, int *uuid,
                  int subdevs, struct mddev_dev *devlist,
                  struct shape *s,
-                 struct context *c,
-                 unsigned long long data_offset);
+                 struct context *c);
 
 extern int Detail(char *dev, struct context *c);
 extern int Detail_Platform(struct superswitch *ss, int scan, int verbose, int export, char *controller_path);
@@ -1530,6 +1592,7 @@ extern int stat_is_blkdev(char *devname, dev_t *rdev);
 extern bool is_dev_alive(char *path);
 extern int get_mdp_major(void);
 extern int get_maj_min(char *dev, int *major, int *minor);
+extern bool is_bit_set(int *val, unsigned char index);
 extern int dev_open(char *dev, int flags);
 extern int open_dev(char *devnm);
 extern void reopen_mddev(int mdfd);
@@ -1542,6 +1605,8 @@ extern void enable_fds(int devices);
 extern void manage_fork_fds(int close_all);
 extern int continue_via_systemd(char *devnm, char *service_name);
 
+extern void ident_init(struct mddev_ident *ident);
+
 extern int parse_auto(char *str, char *msg, int config);
 extern struct mddev_ident *conf_get_ident(char *dev);
 extern struct mddev_dev *conf_get_devs(void);
@@ -1636,6 +1701,7 @@ extern int create_mddev(char *dev, char *name, int autof, int trustworthy,
 #define        FOREIGN 2
 #define        METADATA 3
 extern int open_mddev(char *dev, int report_errors);
+extern int is_mddev(char *dev);
 extern int open_container(int fd);
 extern int metadata_container_matches(char *metadata, char *devnm);
 extern int metadata_subdev_matches(char *metadata, char *devnm);
@@ -1662,6 +1728,7 @@ void *super1_make_v0(struct supertype *st, struct mdinfo *info, mdp_super_t *sb0
 extern char *stat2kname(struct stat *st);
 extern char *fd2kname(int fd);
 extern char *stat2devnm(struct stat *st);
+bool stat_is_md_dev(struct stat *st);
 extern char *fd2devnm(int fd);
 extern void udev_block(char *devnm);
 extern void udev_unblock(void);
@@ -1707,6 +1774,10 @@ extern int cluster_get_dlmlock(void);
 extern int cluster_release_dlmlock(void);
 extern void set_dlm_hooks(void);
 
+#define MSEC_TO_NSEC(msec) ((msec) * 1000000)
+#define USEC_TO_NSEC(usec) ((usec) * 1000)
+extern void sleep_for(unsigned int sec, long nsec, bool wake_after_interrupt);
+
 #define _ROUND_UP(val, base)   (((val) + (base) - 1) & ~(base - 1))
 #define ROUND_UP(val, base)    _ROUND_UP(val, (typeof(val))(base))
 #define ROUND_UP_PTR(ptr, base)        ((typeof(ptr)) \
@@ -1763,8 +1834,7 @@ static inline sighandler_t signal_s(int sig, sighandler_t handler)
 #define dprintf_cont(fmt, arg...) \
         ({ if (0) fprintf(stderr, fmt, ##arg); 0; })
 #endif
-#include <assert.h>
-#include <stdarg.h>
+
 static inline int xasprintf(char **strp, const char *fmt, ...) {
        va_list ap;
        int ret;
@@ -1908,3 +1978,17 @@ enum r0layout {
  * This is true for native and DDF, IMSM allows 16.
  */
 #define MD_NAME_MAX 32
+
+/**
+ * is_container() - check if @level is &LEVEL_CONTAINER
+ * @level: level value
+ *
+ * return:
+ * 1 if level is equal to &LEVEL_CONTAINER, 0 otherwise.
+ */
+static inline int is_container(const int level)
+{
+       if (level == LEVEL_CONTAINER)
+               return 1;
+       return 0;
+}