"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Detail.c" between
mdadm-4.2-rc1.tar.xz and mdadm-4.2-rc2.tar.xz

About: mdadm is a tool for creating, managing and monitoring device arrays using the "md" driver in Linux, also known as Software RAID arrays.

Detail.c  (mdadm-4.2-rc1.tar.xz):Detail.c  (mdadm-4.2-rc2.tar.xz)
skipping to change at line 69 skipping to change at line 69
mdu_disk_info_t *disks = NULL; mdu_disk_info_t *disks = NULL;
int next; int next;
int d; int d;
time_t atime; time_t atime;
char *str; char *str;
char **devices = NULL; char **devices = NULL;
int max_devices = 0, n_devices = 0; int max_devices = 0, n_devices = 0;
int spares = 0; int spares = 0;
struct stat stb; struct stat stb;
int failed = 0; int failed = 0;
struct supertype *st; struct supertype *st = NULL;
char *subarray = NULL; char *subarray = NULL;
int max_disks = MD_SB_DISKS; /* just a default */ int max_disks = MD_SB_DISKS; /* just a default */
struct mdinfo *info = NULL; struct mdinfo *info = NULL;
struct mdinfo *sra; struct mdinfo *sra = NULL;
struct mdinfo *subdev; struct mdinfo *subdev;
char *member = NULL; char *member = NULL;
char *container = NULL; char *container = NULL;
int rv = c->test ? 4 : 1; int rv = c->test ? 4 : 1;
int avail_disks = 0; int avail_disks = 0;
char *avail = NULL; char *avail = NULL;
int external; int external;
int inactive; int inactive;
int is_container = 0; int is_container = 0;
skipping to change at line 96 skipping to change at line 96
if (fd < 0) { if (fd < 0) {
pr_err("cannot open %s: %s\n", pr_err("cannot open %s: %s\n",
dev, strerror(errno)); dev, strerror(errno));
return rv; return rv;
} }
sra = sysfs_read(fd, NULL, GET_VERSION | GET_DEVS | sra = sysfs_read(fd, NULL, GET_VERSION | GET_DEVS |
GET_ARRAY_STATE | GET_STATE); GET_ARRAY_STATE | GET_STATE);
if (!sra) { if (!sra) {
if (md_get_array_info(fd, &array)) { if (md_get_array_info(fd, &array)) {
pr_err("%s does not appear to be an md device\n", dev); pr_err("%s does not appear to be an md device\n", dev);
close(fd); goto out;
return rv;
} }
} }
external = (sra != NULL && sra->array.major_version == -1 && external = (sra != NULL && sra->array.major_version == -1 &&
sra->array.minor_version == -2); sra->array.minor_version == -2);
inactive = (sra != NULL && !md_array_is_active(sra)); inactive = (sra != NULL && !md_array_is_active(sra));
st = super_by_fd(fd, &subarray); st = super_by_fd(fd, &subarray);
if (md_get_array_info(fd, &array)) { if (md_get_array_info(fd, &array)) {
if (errno == ENODEV) { if (errno == ENODEV) {
if (sra->array.major_version == -1 && if (sra->array.major_version == -1 &&
sra->array.minor_version == -1 && sra->array.minor_version == -1 &&
sra->devs == NULL) { sra->devs == NULL) {
pr_err("Array associated with md device %s does n ot exist.\n", pr_err("Array associated with md device %s does n ot exist.\n",
dev); dev);
close(fd); goto out;
sysfs_free(sra);
return rv;
} }
array = sra->array; array = sra->array;
} else { } else {
pr_err("cannot get array detail for %s: %s\n", pr_err("cannot get array detail for %s: %s\n",
dev, strerror(errno)); dev, strerror(errno));
close(fd); goto out;
return rv;
} }
} }
if (array.raid_disks == 0 && external) if (array.raid_disks == 0 && external)
is_container = 1; is_container = 1;
if (fstat(fd, &stb) != 0 && !S_ISBLK(stb.st_mode)) if (fstat(fd, &stb) != 0 && !S_ISBLK(stb.st_mode))
stb.st_rdev = 0; stb.st_rdev = 0;
rv = 0; rv = 0;
if (st) if (st)
skipping to change at line 551 skipping to change at line 547
} else if (inactive && !is_container) { } else if (inactive && !is_container) {
printf(" State : inactive\n"); printf(" State : inactive\n");
} }
if (array.raid_disks) if (array.raid_disks)
printf(" Active Devices : %d\n", array.active_disks); printf(" Active Devices : %d\n", array.active_disks);
if (array.working_disks > 0) if (array.working_disks > 0)
printf(" Working Devices : %d\n", printf(" Working Devices : %d\n",
array.working_disks); array.working_disks);
if (array.raid_disks) { if (array.raid_disks) {
printf(" Failed Devices : %d\n", array.failed_disks); printf(" Failed Devices : %d\n", array.failed_disks);
printf(" Spare Devices : %d\n", array.spare_disks); if (!external)
printf(" Spare Devices : %d\n", array.spare_d
isks);
} }
printf("\n"); printf("\n");
if (array.level == 5) { if (array.level == 5) {
str = map_num(r5layout, array.layout); str = map_num(r5layout, array.layout);
printf(" Layout : %s\n", printf(" Layout : %s\n",
str ? str : "-unknown-"); str ? str : "-unknown-");
} }
if (array.level == 0 && array.layout) { if (array.level == 0 && array.layout) {
str = map_num(r0layout, array.layout); str = map_num(r0layout, array.layout);
printf(" Layout : %s\n", printf(" Layout : %s\n",
skipping to change at line 829 skipping to change at line 826
if (c->test && if (c->test &&
!enough(array.level, array.raid_disks, array.layout, 1, avail)) !enough(array.level, array.raid_disks, array.layout, 1, avail))
rv = 2; rv = 2;
out: out:
free(info); free(info);
free(disks); free(disks);
close(fd); close(fd);
free(subarray); free(subarray);
free(avail); free(avail);
for (d = 0; d < n_devices; d++) if (devices)
free(devices[d]); for (d = 0; d < n_devices; d++)
free(devices[d]);
free(devices); free(devices);
sysfs_free(sra); sysfs_free(sra);
free(st);
return rv; return rv;
} }
int Detail_Platform(struct superswitch *ss, int scan, int verbose, int export, c har *controller_path) int Detail_Platform(struct superswitch *ss, int scan, int verbose, int export, c har *controller_path)
{ {
/* display platform capabilities for the given metadata format /* display platform capabilities for the given metadata format
* 'scan' in this context means iterate over all metadata types * 'scan' in this context means iterate over all metadata types
*/ */
int i; int i;
int err = 1; int err = 1;
 End of changes. 8 change blocks. 
12 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)