]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
imsm: add support for checkpointing via 'curr_migr_unit'
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index b0ff7dc6916cf28aae59aa737d1394d974b2bf7c..c1c36affd8a0adf8c8fcb67875aaeb78ee6af66b 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -1,7 +1,7 @@
 /*
  * mdadm - manage Linux "md" devices aka RAID arrays.
  *
- * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
+ * Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
  *
  *
  *    This program is free software; you can redistribute it and/or modify
  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  *    Author: Neil Brown
- *    Email: <neilb@cse.unsw.edu.au>
- *    Paper: Neil Brown
- *           School of Computer Science and Engineering
- *           The University of New South Wales
- *           Sydney, 2052
- *           Australia
+ *    Email: <neilb@suse.de>
  */
 
 #define        _GNU_SOURCE
@@ -134,6 +129,22 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 #endif /* __KLIBC__ */
 
 
+/*
+ * min()/max()/clamp() macros that also do
+ * strict type-checking.. See the
+ * "unnecessary" pointer comparison.
+ */
+#define min(x, y) ({                            \
+       typeof(x) _min1 = (x);                  \
+       typeof(y) _min2 = (y);                  \
+       (void) (&_min1 == &_min2);              \
+       _min1 < _min2 ? _min1 : _min2; })
+
+#define max(x, y) ({                            \
+       typeof(x) _max1 = (x);                  \
+       typeof(y) _max2 = (y);                  \
+       (void) (&_max1 == &_max2);              \
+       _max1 > _max2 ? _max1 : _max2; })
 
 /* general information that might be extracted from a superblock */
 struct mdinfo {
@@ -151,13 +162,22 @@ struct mdinfo {
                                                    */
        int                     reshape_active;
        unsigned long long      reshape_progress;
-       unsigned long long      resync_start;
+       union {
+               unsigned long long resync_start; /* per-array resync position */
+               unsigned long long recovery_start; /* per-device rebuild position */
+               #define MaxSector  (~0ULL) /* resync/recovery complete position */
+       };
        unsigned long           safe_mode_delay; /* ms delay to mark clean */
        int                     new_level, delta_disks, new_layout, new_chunk;
        int                     errors;
        int                     cache_size; /* size of raid456 stripe cache*/
        int                     mismatch_cnt;
        char                    text_version[50];
+       void                    *update_private; /* for passing metadata-format
+                                                 * specific update data
+                                                 * between successive calls to
+                                                 * update_super()
+                                                 */
 
        int container_member; /* for assembling external-metatdata arrays
                               * This is to be used internally by metadata
@@ -168,6 +188,7 @@ struct mdinfo {
        struct mdinfo *next;
 
        /* Device info for mdmon: */
+       int recovery_fd;
        int state_fd;
        #define DS_FAULTY       1
        #define DS_INSYNC       2
@@ -380,8 +401,7 @@ extern int sysfs_get_str(struct mdinfo *sra, struct mdinfo *dev,
                         char *name, char *val, int size);
 extern int sysfs_set_safemode(struct mdinfo *sra, unsigned long ms);
 extern int sysfs_set_array(struct mdinfo *info, int vers);
-extern int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd,
-                         int in_sync);
+extern int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int resume);
 extern int sysfs_disk_to_scsi_id(int fd, __u32 *id);
 extern int sysfs_unique_holder(int devnum, long rdev);
 extern int load_sys(char *path, char *buf);
@@ -446,6 +466,7 @@ extern struct superswitch {
         */
        void (*examine_super)(struct supertype *st, char *homehost);
        void (*brief_examine_super)(struct supertype *st, int verbose);
+       void (*brief_examine_subarrays)(struct supertype *st, int verbose);
        void (*export_examine_super)(struct supertype *st);
 
        /* Used to report details of an active array.
@@ -721,7 +742,7 @@ extern int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                        long long size,
                        int level, char *layout_str, int chunksize, int raid_disks);
 extern int Grow_restart(struct supertype *st, struct mdinfo *info,
-                       int *fdlist, int cnt, char *backup_file);
+                       int *fdlist, int cnt, char *backup_file, int verbose);
 extern int Grow_continue(int mdfd, struct supertype *st,
                         struct mdinfo *info, char *backup_file);
 
@@ -753,11 +774,11 @@ extern int Examine(mddev_dev_t devlist, int brief, int export, int scan,
 extern int Monitor(mddev_dev_t devlist,
                   char *mailaddr, char *alert_cmd,
                   int period, int daemonise, int scan, int oneshot,
-                  int dosyslog, int test, char *pidfile);
+                  int dosyslog, int test, char *pidfile, int increments);
 
-extern int Kill(char *dev, int force, int quiet, int noexcl);
+extern int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl);
 extern int Wait(char *dev);
-extern int WaitClean(char *dev, int verbose);
+extern int WaitClean(char *dev, int sock, int verbose);
 
 extern int Incremental(char *devname, int verbose, int runstop,
                       struct supertype *st, char *homehost, int require_homehost,
@@ -817,6 +838,7 @@ extern void uuid_from_super(int uuid[4], mdp_super_t *super);
 extern const int uuid_match_any[4];
 extern int same_uuid(int a[4], int b[4], int swapuuid);
 extern void copy_uuid(void *a, int b[4], int swapuuid);
+extern char *__fname_from_uuid(int id[4], int swap, char *buf, char sep);
 extern char *fname_from_uuid(struct supertype *st,
                             struct mdinfo *info, char *buf, char sep);
 extern unsigned long calc_csum(void *super, int bytes);
@@ -836,6 +858,7 @@ extern int assemble_container_content(struct supertype *st, int mdfd,
 extern int add_disk(int mdfd, struct supertype *st,
                    struct mdinfo *sra, struct mdinfo *info);
 extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
+unsigned long long min_recovery_start(struct mdinfo *array);
 
 extern char *human_size(long long bytes);
 extern char *human_size_brief(long long bytes);
@@ -861,6 +884,7 @@ extern int open_container(int fd);
 extern int mdmon_running(int devnum);
 extern int signal_mdmon(int devnum);
 extern int check_env(char *name);
+extern __u32 random32(void);
 extern int start_mdmon(int devnum);
 
 extern char *devnum2devname(int num);