Fix some compiler warnings.

Original by Luca, with various changes by Neil

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Luca Berra 2011-06-17 14:35:06 +10:00 committed by NeilBrown
parent 9e2d750d4c
commit e4c72d1dc6
5 changed files with 16 additions and 9 deletions

View File

@ -705,7 +705,7 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
int cnt = 0; int cnt = 0;
__u64 max_events = 0; __u64 max_events = 0;
char *avail = NULL; char *avail = NULL;
int *best; int *best = NULL;
char *devmap = NULL; char *devmap = NULL;
int numdevs = 0; int numdevs = 0;
int devnum; int devnum;

View File

@ -514,6 +514,12 @@ static int mdmon(char *devname, int devnum, int must_fork, int takeover)
ignore = dup(0); ignore = dup(0);
#endif #endif
/* This silliness is to stop the compiler complaining
* that we ignore 'ignore'
*/
if (ignore)
ignore++;
do_manager(container); do_manager(container);
exit(0); exit(0);

View File

@ -7009,7 +7009,7 @@ static int apply_takeover_update(struct imsm_update_takeover *u,
for (du = super->missing; du; du = du->next) for (du = super->missing; du; du = du->next)
if (du->index >= 0) { if (du->index >= 0) {
set_imsm_ord_tbl_ent(map, du->index, du->index); set_imsm_ord_tbl_ent(map, du->index, du->index);
mark_missing(dev_new, &du->disk, du->index); mark_missing(dv->dev, &du->disk, du->index);
} }
return 1; return 1;
@ -8301,6 +8301,7 @@ static int imsm_create_metadata_update_for_reshape(
|| delta_disks > spares->array.spare_disks) { || delta_disks > spares->array.spare_disks) {
fprintf(stderr, Name ": imsm: ERROR: Cannot get spare devices " fprintf(stderr, Name ": imsm: ERROR: Cannot get spare devices "
"for %s.\n", geo->dev_name); "for %s.\n", geo->dev_name);
i = -1;
goto abort; goto abort;
} }

View File

@ -111,7 +111,6 @@ static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
unsigned long long newcsum; unsigned long long newcsum;
int size = sizeof(*sb) + __le32_to_cpu(sb->max_dev)*2; int size = sizeof(*sb) + __le32_to_cpu(sb->max_dev)*2;
unsigned int *isuper = (unsigned int*)sb; unsigned int *isuper = (unsigned int*)sb;
int i;
/* make sure I can count... */ /* make sure I can count... */
if (offsetof(struct mdp_superblock_1,data_offset) != 128 || if (offsetof(struct mdp_superblock_1,data_offset) != 128 ||
@ -123,7 +122,7 @@ static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
disk_csum = sb->sb_csum; disk_csum = sb->sb_csum;
sb->sb_csum = 0; sb->sb_csum = 0;
newcsum = 0; newcsum = 0;
for (i=0; size>=4; size -= 4 ) { for (; size>=4; size -= 4 ) {
newcsum += __le32_to_cpu(*isuper); newcsum += __le32_to_cpu(*isuper);
isuper++; isuper++;
} }
@ -387,15 +386,11 @@ static void examine_super1(struct supertype *st, char *homehost)
printf(" Array State : "); printf(" Array State : ");
for (d=0; d<__le32_to_cpu(sb->raid_disks) + delta_extra; d++) { for (d=0; d<__le32_to_cpu(sb->raid_disks) + delta_extra; d++) {
int cnt = 0; int cnt = 0;
int me = 0;
unsigned int i; unsigned int i;
for (i=0; i< __le32_to_cpu(sb->max_dev); i++) { for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
unsigned int role = __le16_to_cpu(sb->dev_roles[i]); unsigned int role = __le16_to_cpu(sb->dev_roles[i]);
if (role == d) { if (role == d)
if (i == __le32_to_cpu(sb->dev_number))
me = 1;
cnt++; cnt++;
}
} }
if (cnt > 1) printf("?"); if (cnt > 1) printf("?");
else if (cnt == 1) printf("A"); else if (cnt == 1) printf("A");

View File

@ -428,6 +428,11 @@ int sysfs_uevent(struct mdinfo *sra, char *event)
return -1; return -1;
n = write(fd, event, strlen(event)); n = write(fd, event, strlen(event));
close(fd); close(fd);
if (n != (int)strlen(event)) {
dprintf(Name ": failed to write '%s' to '%s' (%s)\n",
event, fname, strerror(errno));
return -1;
}
return 0; return 0;
} }