]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Improve mddev_ident type definitions.
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 typedef and remove the _s suffix from the struct name.

These things do not help readability.

Signed-off-by: NeilBrown <neilb@suse.de>
Assemble.c
Incremental.c
Manage.c
Monitor.c
config.c
mapfile.c
mdadm.c
mdadm.h
mdassemble.c
super-intel.c

index f39aaace7688a08a7889899a079f99962a6c5c5f..e18f9d992d1277fe9e9c385fb3d45016123d1879 100644 (file)
@@ -70,7 +70,7 @@ static int is_member_busy(char *metadata_version)
        return busy;
 }
 
-static int ident_matches(struct mddev_ident_s *ident,
+static int ident_matches(struct mddev_ident *ident,
                         struct mdinfo *content,
                         struct supertype *tst,
                         char *homehost,
@@ -117,7 +117,7 @@ static int ident_matches(struct mddev_ident_s *ident,
                         
 
 int Assemble(struct supertype *st, char *mddev,
-            mddev_ident_t ident,
+            struct mddev_ident *ident,
             mddev_dev_t devlist, char *backup_file,
             int readonly, int runstop,
             char *update, char *homehost, int require_homehost,
index fe85c109b1e90b838693c784b7b3b86979f3c147..0320ce788eed924449a4d0f2e16020507d56f567 100644 (file)
@@ -44,7 +44,7 @@ static int Incremental_container(struct supertype *st, char *devname,
                                 char *homehost,
                                 int verbose, int runstop, int autof);
 
-static struct mddev_ident_s *search_mdstat(struct supertype *st,
+static struct mddev_ident *search_mdstat(struct supertype *st,
                                           struct mdinfo *info,
                                           char *devname,
                                           int verbose, int *rvp);
@@ -92,7 +92,7 @@ int Incremental(char *devname, int verbose, int runstop,
         */
        struct stat stb;
        struct mdinfo info, dinfo;
-       struct mddev_ident_s *match;
+       struct mddev_ident *match;
        char chosen_name[1024];
        int rv = 1;
        struct map_ent *mp, *map = NULL;
@@ -558,12 +558,12 @@ out:
        return rv;
 }
 
-static struct mddev_ident_s *search_mdstat(struct supertype *st,
+static struct mddev_ident *search_mdstat(struct supertype *st,
                                           struct mdinfo *info,
                                           char *devname,
                                           int verbose, int *rvp)
 {
-       struct mddev_ident_s *array_list, *match;
+       struct mddev_ident *array_list, *match;
        array_list = conf_get_ident(NULL);
        match = NULL;
        for (; array_list; array_list = array_list->next) {
@@ -1123,7 +1123,7 @@ int IncrementalScan(int verbose)
         */
        struct map_ent *mapl = NULL;
        struct map_ent *me;
-       mddev_ident_t devs, mddev;
+       struct mddev_ident *devs, *mddev;
        int rv = 0;
 
        map_read(&mapl);
@@ -1230,7 +1230,7 @@ static int Incremental_container(struct supertype *st, char *devname,
        struct map_ent *map = NULL;
        struct mdinfo info;
        int trustworthy;
-       struct mddev_ident_s *match;
+       struct mddev_ident *match;
        int rv = 0;
 
        memset(&info, 0, sizeof(info));
@@ -1268,7 +1268,7 @@ static int Incremental_container(struct supertype *st, char *devname,
                int mdfd;
                char chosen_name[1024];
                struct map_ent *mp;
-               struct mddev_ident_s *match = NULL;
+               struct mddev_ident *match = NULL;
 
                mp = map_by_uuid(&map, ra->uuid);
 
@@ -1284,7 +1284,7 @@ static int Incremental_container(struct supertype *st, char *devname,
                         * member == ra->text_version after second slash.
                         */
                        char *sub = strchr(ra->text_version+1, '/');
-                       struct mddev_ident_s *array_list;
+                       struct mddev_ident *array_list;
                        if (sub) {
                                sub++;
                                array_list = conf_get_ident(NULL);
index 0a4472595f36cc84700ec1e883e7cb154b5c5f5b..2bd3965e9f6cd5119c93ad7f13bfa344deedfd56 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -1032,7 +1032,7 @@ int autodetect(void)
        return rv;
 }
 
-int Update_subarray(char *dev, char *subarray, char *update, mddev_ident_t ident, int quiet)
+int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident *ident, int quiet)
 {
        struct supertype supertype, *st = &supertype;
        int fd, rv = 2;
index 0f0adb54502186095c0463cf0818d70fb95b19fc..b23b488a3ec975038487b7f21fdd16771bdd04bd 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -150,7 +150,7 @@ int Monitor(mddev_dev_t devlist,
        }
 
        if (devlist == NULL) {
-               mddev_ident_t mdlist = conf_get_ident(NULL);
+               struct mddev_ident *mdlist = conf_get_ident(NULL);
                for (; mdlist; mdlist=mdlist->next) {
                        struct state *st;
                        if (mdlist->devname == NULL)
@@ -182,7 +182,7 @@ int Monitor(mddev_dev_t devlist,
        } else {
                mddev_dev_t dv;
                for (dv=devlist ; dv; dv=dv->next) {
-                       mddev_ident_t mdlist = conf_get_ident(dv->devname);
+                       struct mddev_ident *mdlist = conf_get_ident(dv->devname);
                        struct state *st = malloc(sizeof *st);
                        if (st == NULL)
                                continue;
index bc450f9430280521054d6df69ed3c3c32f4a3be1..0f38e205d4f825b10b857120e5295249ed161405 100644 (file)
--- a/config.c
+++ b/config.c
@@ -442,8 +442,8 @@ void devline(char *line)
        }
 }
 
-mddev_ident_t mddevlist = NULL;
-mddev_ident_t *mddevlp = &mddevlist;
+struct mddev_ident *mddevlist = NULL;
+struct mddev_ident **mddevlp = &mddevlist;
 
 static int is_number(char *w)
 {
@@ -460,8 +460,8 @@ void arrayline(char *line)
 {
        char *w;
 
-       struct mddev_ident_s mis;
-       mddev_ident_t mi;
+       struct mddev_ident mis;
+       struct mddev_ident *mi;
 
        mis.uuid_set = 0;
        mis.super_minor = UnSet;
@@ -907,9 +907,9 @@ struct createinfo *conf_get_create_info(void)
        return &createinfo;
 }
 
-mddev_ident_t conf_get_ident(char *dev)
+struct mddev_ident *conf_get_ident(char *dev)
 {
-       mddev_ident_t rv;
+       struct mddev_ident *rv;
        load_conffile();
        rv = mddevlist;
        while (dev && rv && (rv->devname == NULL
@@ -1078,7 +1078,7 @@ int conf_name_is_free(char *name)
         * It can be taken either by a match on devname, name, or
         * even super-minor.
         */
-       mddev_ident_t dev;
+       struct mddev_ident *dev;
 
        load_conffile();
        for (dev = mddevlist; dev; dev = dev->next) {
@@ -1095,9 +1095,9 @@ int conf_name_is_free(char *name)
        return 1;
 }
 
-struct mddev_ident_s *conf_match(struct mdinfo *info, struct supertype *st)
+struct mddev_ident *conf_match(struct mdinfo *info, struct supertype *st)
 {
-       struct mddev_ident_s *array_list, *match;
+       struct mddev_ident *array_list, *match;
        int verbose = 0;
        char *devname = NULL;
        array_list = conf_get_ident(NULL);
index be58436c6e3ad78d0627cb3af80a130cbafcac4f..1cc61d1b82aa702437768fbdfaa2dbb0b6028452 100644 (file)
--- a/mapfile.c
+++ b/mapfile.c
@@ -419,7 +419,7 @@ void RebuildMap(void)
                                 *   find a unique name based on metadata name.
                                 *   
                                 */
-                               struct mddev_ident_s *match = conf_match(info, st);
+                               struct mddev_ident *match = conf_match(info, st);
                                struct stat stb;
                                if (match && match->devname && match->devname[0] == '/') {
                                        path = match->devname;
diff --git a/mdadm.c b/mdadm.c
index 08e8ea4e0052950ce4f695a633318a9eb4721c10..a1b5aaeaff2eae3a7d98af5caa55f888559565b8 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
        int raiddisks = 0;
        int max_disks = MD_SB_DISKS; /* just a default */
        int sparedisks = 0;
-       struct mddev_ident_s ident;
+       struct mddev_ident ident;
        char *configfile = NULL;
        char *cp;
        char *update = NULL;
@@ -1110,7 +1110,7 @@ int main(int argc, char *argv[])
                if (devs_found == 1 && ident.uuid_set == 0 &&
                    ident.super_minor == UnSet && ident.name[0] == 0 && !scan ) {
                        /* Only a device has been given, so get details from config file */
-                       mddev_ident_t array_ident = conf_get_ident(devlist->devname);
+                       struct mddev_ident *array_ident = conf_get_ident(devlist->devname);
                        if (array_ident == NULL) {
                                fprintf(stderr, Name ": %s not identified in config file.\n",
                                        devlist->devname);
@@ -1142,7 +1142,7 @@ int main(int argc, char *argv[])
                                exit(1);
                        }
                        for (dv = devlist ; dv ; dv=dv->next) {
-                               mddev_ident_t array_ident = conf_get_ident(dv->devname);
+                               struct mddev_ident *array_ident = conf_get_ident(dv->devname);
                                if (array_ident == NULL) {
                                        fprintf(stderr, Name ": %s not identified in config file.\n",
                                                dv->devname);
@@ -1158,7 +1158,7 @@ int main(int argc, char *argv[])
                                               verbose-quiet, force);
                        }
                } else {
-                       mddev_ident_t a, array_list =  conf_get_ident(NULL);
+                       struct mddev_ident *a, *array_list =  conf_get_ident(NULL);
                        mddev_dev_t devlist = conf_get_devs();
                        int cnt = 0;
                        int failures, successes;
diff --git a/mdadm.h b/mdadm.h
index 7b651e27c535c4bb47951f5165e0bd14f4ff0a5c..e5203ef568936646f4deeeac67d0fb3abb20ce88 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -293,7 +293,7 @@ enum special_options {
  * devices is considered
  */
 #define UnSet (0xfffe)
-typedef struct mddev_ident_s {
+struct mddev_ident {
        char    *devname;
 
        int     uuid_set;
@@ -321,12 +321,12 @@ typedef struct mddev_ident_s {
                                 */
        char    *member;        /* subarray within a container */
 
-       struct mddev_ident_s *next;
+       struct mddev_ident *next;
        union {
                /* fields needed by different users of this structure */
                int assembled;  /* set when assembly succeeds */
        };
-} *mddev_ident_t;
+};
 
 /* List of device names - wildcards expanded */
 typedef struct mddev_dev_s {
@@ -631,7 +631,7 @@ extern struct superswitch {
        int (*kill_subarray)(struct supertype *st); /* optional */
        /* Permit subarray's to be modified */
        int (*update_subarray)(struct supertype *st, char *subarray,
-                              char *update, mddev_ident_t ident); /* optional */
+                              char *update, struct mddev_ident *ident); /* optional */
 
 /* for mdmon */
        int (*open_new)(struct supertype *c, struct active_array *a,
@@ -891,7 +891,7 @@ extern int Grow_continue(int mdfd, struct supertype *st,
                         struct mdinfo *info, char *backup_file);
 
 extern int Assemble(struct supertype *st, char *mddev,
-                   mddev_ident_t ident,
+                   struct mddev_ident *ident,
                    mddev_dev_t devlist, char *backup_file,
                    int readonly, int runstop,
                    char *update, char *homehost, int require_homehost,
@@ -922,7 +922,7 @@ extern int Monitor(mddev_dev_t devlist,
 
 extern int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl);
 extern int Kill_subarray(char *dev, char *subarray, int quiet);
-extern int Update_subarray(char *dev, char *subarray, char *update, mddev_ident_t ident, int quiet);
+extern int Update_subarray(char *dev, char *subarray, char *update, struct mddev_ident *ident, int quiet);
 extern int Wait(char *dev);
 extern int WaitClean(char *dev, int sock, int verbose);
 
@@ -960,7 +960,7 @@ extern int is_standard(char *dev, int *nump);
 extern int same_dev(char *one, char *two);
 
 extern int parse_auto(char *str, char *msg, int config);
-extern mddev_ident_t conf_get_ident(char *dev);
+extern struct mddev_ident *conf_get_ident(char *dev);
 extern mddev_dev_t 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);
@@ -974,7 +974,7 @@ extern char *conf_line(FILE *file);
 extern char *conf_word(FILE *file, int allow_key);
 extern int conf_name_is_free(char *name);
 extern int devname_matches(char *name, char *match);
-extern struct mddev_ident_s *conf_match(struct mdinfo *info, struct supertype *st);
+extern struct mddev_ident *conf_match(struct mdinfo *info, struct supertype *st);
 
 extern void free_line(char *line);
 extern int match_oneof(char *devices, char *devname);
index d0d0707e123412b6233fad96285ad6eb8114c137..28f431b45d3bb4b16733161ee7c8f793a2973444 100644 (file)
@@ -88,7 +88,7 @@ int verbose = 0;
 int force = 0;
 
 int main(int argc, char *argv[]) {
-       mddev_ident_t array_list =  conf_get_ident(NULL);
+       struct mddev_ident *array_list =  conf_get_ident(NULL);
        if (!array_list) {
                fprintf(stderr, Name ": No arrays found in config file\n");
                rv = 1;
index 430c5edf61c16115c0ec622bd699be7f31a7a771..15ff2b56acaec976859aac22c578fd386fa48a76 100644 (file)
@@ -1533,7 +1533,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
 /* check the config file to see if we can return a real uuid for this spare */
 static void fixup_container_spare_uuid(struct mdinfo *inf)
 {
-       struct mddev_ident_s *array_list;
+       struct mddev_ident *array_list;
 
        if (inf->array.level != LEVEL_CONTAINER ||
            memcmp(inf->uuid, uuid_match_any, sizeof(int[4])) != 0)
@@ -4196,7 +4196,7 @@ static int kill_subarray_imsm(struct supertype *st)
 }
 
 static int update_subarray_imsm(struct supertype *st, char *subarray,
-                               char *update, mddev_ident_t ident)
+                               char *update, struct mddev_ident *ident)
 {
        /* update the subarray currently referenced by ->current_vol */
        struct intel_super *super = st->sb;