]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Improve type names for mddev_dev
authorNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:05 +0000 (20:58 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:05 +0000 (20:58 +1100)
Remove the _t pointer typedef and remove the _s suffix for the
structure,

These things do not help readability.

Signed-off-by: NeilBrown <neilb@suse.de>
Assemble.c
Build.c
Create.c
Examine.c
Incremental.c
Manage.c
Monitor.c
config.c
mdadm.c
mdadm.h

index e18f9d992d1277fe9e9c385fb3d45016123d1879..6ba78a8669c5919177514279397cdb29b4804dad 100644 (file)
@@ -118,7 +118,7 @@ static int ident_matches(struct mddev_ident *ident,
 
 int Assemble(struct supertype *st, char *mddev,
             struct mddev_ident *ident,
-            mddev_dev_t devlist, char *backup_file,
+            struct mddev_dev *devlist, char *backup_file,
             int readonly, int runstop,
             char *update, char *homehost, int require_homehost,
             int verbose, int force)
@@ -207,7 +207,7 @@ int Assemble(struct supertype *st, char *mddev,
        int start_partial_ok = (runstop >= 0) && 
                (force || devlist==NULL || auto_assem);
        unsigned int num_devs;
-       mddev_dev_t tmpdev;
+       struct mddev_dev *tmpdev;
        struct mdinfo info;
        struct mdinfo *content = NULL;
        char *avail;
@@ -492,7 +492,7 @@ int Assemble(struct supertype *st, char *mddev,
                                                                devname);
                                                goto loop;
                                        } else { /* reject all those sofar */
-                                               mddev_dev_t td;
+                                               struct mddev_dev *td;
                                                if (report_missmatch)
                                                        fprintf(stderr, Name ": %s overrides previous devices due to good homehost\n",
                                                                devname);
diff --git a/Build.c b/Build.c
index 7f3925864731bf63e0c1c1a10357a3476a95a2fe..cb9f01e33264376e63be43c2efd8da1672c96461 100644 (file)
--- a/Build.c
+++ b/Build.c
@@ -29,7 +29,7 @@
 #define STOP_MD                _IO (MD_MAJOR, 3)
 
 int Build(char *mddev, int chunk, int level, int layout,
-         int raiddisks, mddev_dev_t devlist, int assume_clean,
+         int raiddisks, struct mddev_dev *devlist, int assume_clean,
          char *bitmap_file, int bitmap_chunk, int write_behind,
          int delay, int verbose, int autof, unsigned long long size)
 {
@@ -50,7 +50,7 @@ int Build(char *mddev, int chunk, int level, int layout,
        int vers;
        struct stat stb;
        int subdevs = 0, missing_disks = 0;
-       mddev_dev_t dv;
+       struct mddev_dev *dv;
        int bitmap_fd;
        unsigned long long bitmapsize;
        int mdfd;
index 337040c22d9c48d184a5d06f37e5458ca0df5312..b9fe7998e73806410210bbd62511eea9a0e59377 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -68,7 +68,7 @@ static int default_layout(struct supertype *st, int level, int verbose)
 int Create(struct supertype *st, char *mddev,
           int chunk, int level, int layout, unsigned long long size, int raiddisks, int sparedisks,
           char *name, char *homehost, int *uuid,
-          int subdevs, mddev_dev_t devlist,
+          int subdevs, struct mddev_dev *devlist,
           int runstop, int verbose, int force, int assume_clean,
           char *bitmap_file, int bitmap_chunk, int write_behind, int delay, int autof)
 {
@@ -93,7 +93,7 @@ int Create(struct supertype *st, char *mddev,
        char *mindisc = NULL;
        char *maxdisc = NULL;
        int dnum;
-       mddev_dev_t dv;
+       struct mddev_dev *dv;
        int fail=0, warn=0;
        struct stat stb;
        int first_missing = subdevs * 2;
@@ -735,7 +735,7 @@ int Create(struct supertype *st, char *mddev,
        infos = malloc(sizeof(*infos) * total_slots);
 
        for (pass=1; pass <=2 ; pass++) {
-               mddev_dev_t moved_disk = NULL; /* the disk that was moved out of the insert point */
+               struct mddev_dev *moved_disk = NULL; /* the disk that was moved out of the insert point */
 
                for (dnum=0, dv = devlist ; dv ;
                     dv=(dv->next)?(dv->next):moved_disk, dnum++) {
index c8a44b014f4abc23f8cf0accaa43dea3c5219afe..3c1e73f9c1516349bdef1d0ed8f64ecf02a0dccf 100644 (file)
--- a/Examine.c
+++ b/Examine.c
@@ -30,7 +30,7 @@
 #endif
 #include       "md_u.h"
 #include       "md_p.h"
-int Examine(mddev_dev_t devlist, int brief, int export, int scan,
+int Examine(struct mddev_dev *devlist, int brief, int export, int scan,
            int SparcAdjust, struct supertype *forcest,
            char *homehost)
 {
index 0320ce788eed924449a4d0f2e16020507d56f567..0df69b7d95bd26aaf7fde5eb118744633fd7c7d8 100644 (file)
@@ -862,7 +862,7 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
                /* add current device to chosen array as a spare */
                int mdfd = open_dev(devname2devnum(chosen->sys_name));
                if (mdfd >= 0) {
-                       struct mddev_dev_s devlist;
+                       struct mddev_dev devlist;
                        char devname[20];
                        devlist.next = NULL;
                        devlist.used = 0;
@@ -1363,7 +1363,7 @@ int IncrementalRemove(char *devname, int verbose)
        int mdfd;
        int rv;
        struct mdstat_ent *ent;
-       struct mddev_dev_s devlist;
+       struct mddev_dev devlist;
 
        if (strchr(devname, '/')) {
                fprintf(stderr, Name ": incremental removal requires a "
index 2bd3965e9f6cd5119c93ad7f13bfa344deedfd56..f0b197c5dcadd842d639001c471c2f69752cb5cf 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -324,7 +324,7 @@ int Manage_resize(char *devname, int fd, long long size, int raid_disks)
 }
 
 int Manage_subdevs(char *devname, int fd,
-                  mddev_dev_t devlist, int verbose, int test)
+                  struct mddev_dev *devlist, int verbose, int test)
 {
        /* do something to each dev.
         * devmode can be
@@ -340,11 +340,11 @@ int Manage_subdevs(char *devname, int fd,
         * For 'f' and 'r', the device can also be a kernel-internal
         * name such as 'sdb'.
         */
-       mddev_dev_t add_devlist = NULL;
+       struct mddev_dev *add_devlist = NULL;
        mdu_array_info_t array;
        mdu_disk_info_t disc;
        unsigned long long array_size;
-       mddev_dev_t dv, next = NULL;
+       struct mddev_dev *dv, *next = NULL;
        struct stat stb;
        int j, jnext = 0;
        int tfd = -1;
index b23b488a3ec975038487b7f21fdd16771bdd04bd..fa2751267183a84be48ad5cc1c7808241dc95cad 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -38,7 +38,7 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail
  * At least it isn't MD_SB_DISKS.
  */
 #define MaxDisks 384
-int Monitor(mddev_dev_t devlist,
+int Monitor(struct mddev_dev *devlist,
            char *mailaddr, char *alert_cmd,
            int period, int daemonise, int scan, int oneshot,
            int dosyslog, int test, char* pidfile, int increments)
@@ -180,7 +180,7 @@ int Monitor(mddev_dev_t devlist,
                        statelist = st;
                }
        } else {
-               mddev_dev_t dv;
+               struct mddev_dev *dv;
                for (dv=devlist ; dv; dv=dv->next) {
                        struct mddev_ident *mdlist = conf_get_ident(dv->devname);
                        struct state *st = malloc(sizeof *st);
@@ -481,7 +481,7 @@ int Monitor(mddev_dev_t devlist,
                                                        }
                                                }
                                                if (dev > 0) {
-                                                       struct mddev_dev_s devlist;
+                                                       struct mddev_dev devlist;
                                                        char devname[20];
                                                        devlist.next = NULL;
                                                        devlist.used = 0;
index 0f38e205d4f825b10b857120e5295249ed161405..f4d46ff41d53068dca6323c709c98f4c56fcb350 100644 (file)
--- a/config.c
+++ b/config.c
@@ -231,11 +231,11 @@ struct conf_dev {
     char *name;
 } *cdevlist = NULL;
 
-mddev_dev_t load_partitions(void)
+struct mddev_dev *load_partitions(void)
 {
        FILE *f = fopen("/proc/partitions", "r");
        char buf[1024];
-       mddev_dev_t rv = NULL;
+       struct mddev_dev *rv = NULL;
        if (f == NULL) {
                fprintf(stderr, Name ": cannot open /proc/partitions\n");
                return NULL;
@@ -243,7 +243,7 @@ mddev_dev_t load_partitions(void)
        while (fgets(buf, 1024, f)) {
                int major, minor;
                char *name, *mp;
-               mddev_dev_t d;
+               struct mddev_dev *d;
 
                buf[1023] = '\0';
                if (buf[0] != ' ')
@@ -267,12 +267,12 @@ mddev_dev_t load_partitions(void)
        return rv;
 }
 
-mddev_dev_t load_containers(void)
+struct mddev_dev *load_containers(void)
 {
        struct mdstat_ent *mdstat = mdstat_read(1, 0);
        struct mdstat_ent *ent;
-       mddev_dev_t d;
-       mddev_dev_t rv = NULL;
+       struct mddev_dev *d;
+       struct mddev_dev *rv = NULL;
 
        if (!mdstat)
                return NULL;
@@ -918,23 +918,23 @@ struct mddev_ident *conf_get_ident(char *dev)
        return rv;
 }
 
-static void append_dlist(mddev_dev_t *dlp, mddev_dev_t list)
+static void append_dlist(struct mddev_dev **dlp, struct mddev_dev *list)
 {
        while (*dlp)
                dlp = &(*dlp)->next;
        *dlp = list;
 }
 
-mddev_dev_t conf_get_devs()
+struct mddev_dev *conf_get_devs()
 {
        glob_t globbuf;
        struct conf_dev *cd;
        int flags = 0;
-       static mddev_dev_t dlist = NULL;
+       static struct mddev_dev *dlist = NULL;
        unsigned int i;
 
        while (dlist) {
-               mddev_dev_t t = dlist;
+               struct mddev_dev *t = dlist;
                dlist = dlist->next;
                free(t->devname);
                free(t);
@@ -960,7 +960,7 @@ mddev_dev_t conf_get_devs()
        }
        if (flags & GLOB_APPEND) {
                for (i=0; i<globbuf.gl_pathc; i++) {
-                       mddev_dev_t t = malloc(sizeof(*t));
+                       struct mddev_dev *t = malloc(sizeof(*t));
                        t->devname = strdup(globbuf.gl_pathv[i]);
                        t->next = dlist;
                        t->used = 0;
diff --git a/mdadm.c b/mdadm.c
index a1b5aaeaff2eae3a7d98af5caa55f888559565b8..efb2e67b4d27999fd8a45fe873fcaa460cf72187 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -62,9 +62,9 @@ int main(int argc, char *argv[])
        char *backup_file = NULL;
        int bitmap_chunk = UnSet;
        int SparcAdjust = 0;
-       mddev_dev_t devlist = NULL;
-       mddev_dev_t *devlistend = & devlist;
-       mddev_dev_t dv;
+       struct mddev_dev *devlist = NULL;
+       struct mddev_dev **devlistend = & devlist;
+       struct mddev_dev *dv;
        int devs_found = 0;
        int verbose = 0;
        int quiet = 0;
@@ -1159,7 +1159,7 @@ int main(int argc, char *argv[])
                        }
                } else {
                        struct mddev_ident *a, *array_list =  conf_get_ident(NULL);
-                       mddev_dev_t devlist = conf_get_devs();
+                       struct mddev_dev *devlist = conf_get_devs();
                        int cnt = 0;
                        int failures, successes;
                        if (devlist == NULL) {
@@ -1215,7 +1215,7 @@ int main(int argc, char *argv[])
                                int acnt;
                                ident.autof = autof;
                                do {
-                                       mddev_dev_t devlist = conf_get_devs();
+                                       struct mddev_dev *devlist = conf_get_devs();
                                        acnt = 0;
                                        do {
                                                rv2 = Assemble(ss, NULL,
diff --git a/mdadm.h b/mdadm.h
index e5203ef568936646f4deeeac67d0fb3abb20ce88..614dc69029ad42bdf6de9784969545e84c99ca85 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -329,7 +329,7 @@ struct mddev_ident {
 };
 
 /* List of device names - wildcards expanded */
-typedef struct mddev_dev_s {
+struct mddev_dev {
        char *devname;
        char disposition;       /* 'a' for add, 'r' for remove, 'f' for fail.
                                 * Not set for names read from .config
@@ -339,8 +339,8 @@ typedef struct mddev_dev_s {
        char used;              /* set when used */
        struct mdinfo *content; /* If devname is a container, this might list
                                 * the remaining member arrays. */
-       struct mddev_dev_s *next;
-} *mddev_dev_t;
+       struct mddev_dev *next;
+};
 
 typedef struct mapping {
        char *name;
@@ -878,7 +878,7 @@ extern int Manage_ro(char *devname, int fd, int readonly);
 extern int Manage_runstop(char *devname, int fd, int runstop, int quiet);
 extern int Manage_resize(char *devname, int fd, long long size, int raid_disks);
 extern int Manage_subdevs(char *devname, int fd,
-                         mddev_dev_t devlist, int verbose, int test);
+                         struct mddev_dev *devlist, int verbose, int test);
 extern int autodetect(void);
 extern int Grow_Add_device(char *devname, int fd, char *newdev);
 extern int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int write_behind, int force);
@@ -892,13 +892,13 @@ extern int Grow_continue(int mdfd, struct supertype *st,
 
 extern int Assemble(struct supertype *st, char *mddev,
                    struct mddev_ident *ident,
-                   mddev_dev_t devlist, char *backup_file,
+                   struct mddev_dev *devlist, char *backup_file,
                    int readonly, int runstop,
                    char *update, char *homehost, int require_homehost,
                    int verbose, int force);
 
 extern int Build(char *mddev, int chunk, int level, int layout,
-                int raiddisks, mddev_dev_t devlist, int assume_clean,
+                int raiddisks, struct mddev_dev *devlist, int assume_clean,
                 char *bitmap_file, int bitmap_chunk, int write_behind,
                 int delay, int verbose, int autof, unsigned long long size);
 
@@ -906,16 +906,16 @@ extern int Build(char *mddev, int chunk, int level, int layout,
 extern int Create(struct supertype *st, char *mddev,
                  int chunk, int level, int layout, unsigned long long size, int raiddisks, int sparedisks,
                  char *name, char *homehost, int *uuid,
-                 int subdevs, mddev_dev_t devlist,
+                 int subdevs, struct mddev_dev *devlist,
                  int runstop, int verbose, int force, int assume_clean,
                  char *bitmap_file, int bitmap_chunk, int write_behind, int delay, int autof);
 
 extern int Detail(char *dev, int brief, int export, int test, char *homehost);
 extern int Detail_Platform(struct superswitch *ss, int scan, int verbose);
 extern int Query(char *dev);
-extern int Examine(mddev_dev_t devlist, int brief, int export, int scan,
+extern int Examine(struct mddev_dev *devlist, int brief, int export, int scan,
                   int SparcAdjust, struct supertype *forcest, char *homehost);
-extern int Monitor(mddev_dev_t devlist,
+extern int Monitor(struct mddev_dev *devlist,
                   char *mailaddr, char *alert_cmd,
                   int period, int daemonise, int scan, int oneshot,
                   int dosyslog, int test, char *pidfile, int increments);
@@ -961,7 +961,7 @@ extern int same_dev(char *one, char *two);
 
 extern int parse_auto(char *str, char *msg, int config);
 extern struct mddev_ident *conf_get_ident(char *dev);
-extern mddev_dev_t conf_get_devs(void);
+extern struct mddev_dev *conf_get_devs(void);
 extern int conf_test_dev(char *devname);
 extern int conf_test_metadata(const char *version, struct dev_policy *pol, int is_homehost);
 extern struct createinfo *conf_get_create_info(void);