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