diff options
author | Neil Brown <neilb@suse.de> | 2008-05-27 09:18:55 +1000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2008-05-27 09:18:55 +1000 |
commit | 159c3a1a7785693d21f5226182f9c066882bef66 (patch) | |
tree | 60eb38558c53783bcf7c2b7a6cdf387880c1c58d /util.c | |
parent | ed9d66aadec7ae41751e3a95352628814b47fbad (diff) |
Remove st->text_version in favour of info->text_version
I want the metadata handler to have more control over the 'version',
particularly for arrays which are members of containers.
So discard st->text_version and instead use info->text_version
which getinfo_super can initialise.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 29 |
1 files changed, 9 insertions, 20 deletions
@@ -834,30 +834,19 @@ struct supertype *super_by_fd(int fd) #endif /* !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO) */ -struct supertype *dup_super(struct supertype *st) +struct supertype *dup_super(struct supertype *orig) { - struct supertype *stnew = NULL; - char *verstr = NULL; - char version[20]; - int i; + struct supertype *st; + st = malloc(sizeof(*st)); if (!st) return st; - - if (st->ss->text_version) - strcpy(version, st->ss->text_version); - else if (st->minor_version == -1) - sprintf(version, "%d", st->ss->major); - else - sprintf(version, "%d.%d", st->ss->major, st->minor_version); - verstr = version; - - for (i = 0; stnew == NULL && superlist[i] ; i++) - stnew = superlist[i]->match_metadata_desc(verstr); - - if (stnew) - stnew->sb = NULL; - return stnew; + st->ss = orig->ss; + st->max_devs = orig->max_devs; + st->minor_version = orig->minor_version; + st->sb = NULL; + st->info = NULL; + return st; } struct supertype *guess_super(int fd) |