Improve mddev_ident type definitions.

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>
This commit is contained in:
NeilBrown 2010-11-22 20:58:05 +11:00
parent 08fb91a363
commit fa56eddbd1
10 changed files with 38 additions and 38 deletions

View 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,

View 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);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

16
mdadm.h
View File

@ -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);

View 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;

View 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;