From a655e5506478c540db06649fe7833c3c0982f80c Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 22 Nov 2010 20:58:05 +1100 Subject: [PATCH] Improve type names for mddev_dev Remove the _t pointer typedef and remove the _s suffix for the structure, These things do not help readability. Signed-off-by: NeilBrown --- Assemble.c | 6 +++--- Build.c | 4 ++-- Create.c | 6 +++--- Examine.c | 2 +- Incremental.c | 4 ++-- Manage.c | 6 +++--- Monitor.c | 6 +++--- config.c | 22 +++++++++++----------- mdadm.c | 10 +++++----- mdadm.h | 20 ++++++++++---------- 10 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Assemble.c b/Assemble.c index e18f9d99..6ba78a86 100644 --- a/Assemble.c +++ b/Assemble.c @@ -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 7f392586..cb9f01e3 100644 --- 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; diff --git a/Create.c b/Create.c index 337040c2..b9fe7998 100644 --- 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++) { diff --git a/Examine.c b/Examine.c index c8a44b01..3c1e73f9 100644 --- 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) { diff --git a/Incremental.c b/Incremental.c index 0320ce78..0df69b7d 100644 --- a/Incremental.c +++ b/Incremental.c @@ -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 " diff --git a/Manage.c b/Manage.c index 2bd3965e..f0b197c5 100644 --- 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; diff --git a/Monitor.c b/Monitor.c index b23b488a..fa275126 100644 --- 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; diff --git a/config.c b/config.c index 0f38e205..f4d46ff4 100644 --- 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; idevname = strdup(globbuf.gl_pathv[i]); t->next = dlist; t->used = 0; diff --git a/mdadm.c b/mdadm.c index a1b5aaea..efb2e67b 100644 --- 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 e5203ef5..614dc690 100644 --- 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); -- 2.39.2