Compile with -Wextra by default
This produced lots of warning, some of which pointed to actual bugs. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
9aaada0530
commit
f21e18ca89
26
Assemble.c
26
Assemble.c
|
@ -146,11 +146,11 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
struct mdinfo i;
|
||||
} *devices;
|
||||
int *best = NULL; /* indexed by raid_disk */
|
||||
unsigned int bestcnt = 0;
|
||||
int bestcnt = 0;
|
||||
int devcnt = 0;
|
||||
unsigned int okcnt, sparecnt, rebuilding_cnt;
|
||||
unsigned int req_cnt;
|
||||
unsigned int i;
|
||||
int i;
|
||||
int most_recent = 0;
|
||||
int chosen_drive;
|
||||
int change = 0;
|
||||
|
@ -182,7 +182,7 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
|
||||
if (!devlist &&
|
||||
ident->uuid_set == 0 &&
|
||||
ident->super_minor < 0 &&
|
||||
(ident->super_minor < 0 || ident->super_minor == UnSet) &&
|
||||
ident->name[0] == 0 &&
|
||||
(ident->container == NULL || ident->member == NULL) &&
|
||||
ident->devices == NULL) {
|
||||
|
@ -715,9 +715,9 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
}
|
||||
if (i < 10000) {
|
||||
if (i >= bestcnt) {
|
||||
unsigned int newbestcnt = i+10;
|
||||
int newbestcnt = i+10;
|
||||
int *newbest = malloc(sizeof(int)*newbestcnt);
|
||||
unsigned int c;
|
||||
int c;
|
||||
for (c=0; c < newbestcnt; c++)
|
||||
if (c < bestcnt)
|
||||
newbest[c] = best[c];
|
||||
|
@ -784,7 +784,7 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
okcnt = 0;
|
||||
sparecnt=0;
|
||||
rebuilding_cnt=0;
|
||||
for (i=0; i< bestcnt ;i++) {
|
||||
for (i=0; i< bestcnt; i++) {
|
||||
int j = best[i];
|
||||
int event_margin = 1; /* always allow a difference of '1'
|
||||
* like the kernel does
|
||||
|
@ -822,9 +822,9 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
*/
|
||||
int fd;
|
||||
struct supertype *tst;
|
||||
long long current_events;
|
||||
unsigned long long current_events;
|
||||
chosen_drive = -1;
|
||||
for (i=0; i<content->array.raid_disks && i < bestcnt; i++) {
|
||||
for (i = 0; i < content->array.raid_disks && i < bestcnt; i++) {
|
||||
int j = best[i];
|
||||
if (j>=0 &&
|
||||
!devices[j].uptodate &&
|
||||
|
@ -882,7 +882,7 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
/* If there are any other drives of the same vintage,
|
||||
* add them in as well. We can't lose and we might gain
|
||||
*/
|
||||
for (i=0; i<content->array.raid_disks && i < bestcnt ; i++) {
|
||||
for (i = 0; i < content->array.raid_disks && i < bestcnt ; i++) {
|
||||
int j = best[i];
|
||||
if (j >= 0 &&
|
||||
!devices[j].uptodate &&
|
||||
|
@ -1133,7 +1133,7 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
fprintf(stderr, Name ": Container %s has been "
|
||||
"assembled with %d drive%s",
|
||||
mddev, okcnt+sparecnt, okcnt+sparecnt==1?"":"s");
|
||||
if (okcnt < content->array.raid_disks)
|
||||
if (okcnt < (unsigned)content->array.raid_disks)
|
||||
fprintf(stderr, " (out of %d)",
|
||||
content->array.raid_disks);
|
||||
fprintf(stderr, "\n");
|
||||
|
@ -1167,7 +1167,7 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
if (verbose >= 0) {
|
||||
fprintf(stderr, Name ": %s has been started with %d drive%s",
|
||||
mddev, okcnt, okcnt==1?"":"s");
|
||||
if (okcnt < content->array.raid_disks)
|
||||
if (okcnt < (unsigned)content->array.raid_disks)
|
||||
fprintf(stderr, " (out of %d)", content->array.raid_disks);
|
||||
if (rebuilding_cnt)
|
||||
fprintf(stderr, "%s %d rebuilding", sparecnt?",":" and", rebuilding_cnt);
|
||||
|
@ -1242,7 +1242,7 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
if (runstop == -1) {
|
||||
fprintf(stderr, Name ": %s assembled from %d drive%s",
|
||||
mddev, okcnt, okcnt==1?"":"s");
|
||||
if (okcnt != content->array.raid_disks)
|
||||
if (okcnt != (unsigned)content->array.raid_disks)
|
||||
fprintf(stderr, " (out of %d)", content->array.raid_disks);
|
||||
fprintf(stderr, ", but not started.\n");
|
||||
close(mdfd);
|
||||
|
@ -1265,7 +1265,7 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
"array while not clean - consider "
|
||||
"--force.\n");
|
||||
else {
|
||||
if (req_cnt == content->array.raid_disks)
|
||||
if (req_cnt == (unsigned)content->array.raid_disks)
|
||||
fprintf(stderr, " - need all %d to start it", req_cnt);
|
||||
else
|
||||
fprintf(stderr, " - need %d of %d to start", req_cnt, content->array.raid_disks);
|
||||
|
|
2
Detail.c
2
Detail.c
|
@ -290,7 +290,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
|
|||
struct mdstat_ent *ms = mdstat_read(0, 0);
|
||||
struct mdstat_ent *e;
|
||||
int devnum = array.md_minor;
|
||||
if (major(stb.st_rdev) == get_mdp_major())
|
||||
if (major(stb.st_rdev) == (unsigned)get_mdp_major())
|
||||
devnum = -1 - devnum;
|
||||
|
||||
for (e=ms; e; e=e->next)
|
||||
|
|
39
Grow.c
39
Grow.c
|
@ -409,7 +409,7 @@ static struct mdp_backup_super {
|
|||
__u8 pad[512-68-32];
|
||||
} __attribute__((aligned(512))) bsb, bsb2;
|
||||
|
||||
int bsb_csum(char *buf, int len)
|
||||
__u32 bsb_csum(char *buf, int len)
|
||||
{
|
||||
int i;
|
||||
int csum = 0;
|
||||
|
@ -505,7 +505,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
|
|||
int nchunk, ochunk;
|
||||
int nlayout, olayout;
|
||||
int ndisks, odisks;
|
||||
int ndata, odata;
|
||||
unsigned int ndata, odata;
|
||||
int orig_level = UnSet;
|
||||
char alt_layout[40];
|
||||
int *fdlist;
|
||||
|
@ -515,7 +515,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
|
|||
int err;
|
||||
int frozen;
|
||||
unsigned long a,b, blocks, stripes;
|
||||
int cache;
|
||||
unsigned long cache;
|
||||
unsigned long long array_size;
|
||||
int changed = 0;
|
||||
int done;
|
||||
|
@ -923,7 +923,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
|
|||
|
||||
/* Check that we can hold all the data */
|
||||
get_dev_size(fd, NULL, &array_size);
|
||||
if (ndata * size < (array_size/1024)) {
|
||||
if (ndata * (unsigned long long)size < (array_size/1024)) {
|
||||
fprintf(stderr, Name ": this change will reduce the size of the array.\n"
|
||||
" use --grow --array-size first to truncate array.\n"
|
||||
" e.g. mdadm --grow %s --array-size %llu\n",
|
||||
|
@ -1054,7 +1054,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
|
|||
break;
|
||||
}
|
||||
memset(buf, 0, 512);
|
||||
for (i=0; i < blocks + 1 ; i++) {
|
||||
for (i=0; i < (signed)blocks + 1 ; i++) {
|
||||
if (write(fdlist[d], buf, 512) != 512) {
|
||||
fprintf(stderr, Name ": %s: cannot create backup file %s: %s\n",
|
||||
devname, backup_file, strerror(errno));
|
||||
|
@ -1284,7 +1284,8 @@ int grow_backup(struct mdinfo *sra,
|
|||
int odata = disks;
|
||||
int rv = 0;
|
||||
int i;
|
||||
unsigned long long new_degraded;
|
||||
unsigned long long ll;
|
||||
int new_degraded;
|
||||
//printf("offset %llu\n", offset);
|
||||
if (level >= 4)
|
||||
odata--;
|
||||
|
@ -1292,7 +1293,8 @@ int grow_backup(struct mdinfo *sra,
|
|||
odata--;
|
||||
sysfs_set_num(sra, NULL, "suspend_hi", (offset + stripes * (chunk/512)) * odata);
|
||||
/* Check that array hasn't become degraded, else we might backup the wrong data */
|
||||
sysfs_get_ll(sra, NULL, "degraded", &new_degraded);
|
||||
sysfs_get_ll(sra, NULL, "degraded", &ll);
|
||||
new_degraded = (int)ll;
|
||||
if (new_degraded != *degraded) {
|
||||
/* check each device to ensure it is still working */
|
||||
struct mdinfo *sd;
|
||||
|
@ -1348,11 +1350,12 @@ int grow_backup(struct mdinfo *sra,
|
|||
bsb.sb_csum2 = bsb_csum((char*)&bsb,
|
||||
((char*)&bsb.sb_csum2)-((char*)&bsb));
|
||||
|
||||
if (lseek64(destfd[i], destoffsets[i] - 4096, 0) != destoffsets[i] - 4096)
|
||||
if ((unsigned long long)lseek64(destfd[i], destoffsets[i] - 4096, 0)
|
||||
!= destoffsets[i] - 4096)
|
||||
rv = 1;
|
||||
rv = rv ?: write(destfd[i], &bsb, 512);
|
||||
if (destoffsets[i] > 4096) {
|
||||
if (lseek64(destfd[i], destoffsets[i]+stripes*chunk*odata, 0) !=
|
||||
if ((unsigned long long)lseek64(destfd[i], destoffsets[i]+stripes*chunk*odata, 0) !=
|
||||
destoffsets[i]+stripes*chunk*odata)
|
||||
rv = 1;
|
||||
rv = rv ?: write(destfd[i], &bsb, 512);
|
||||
|
@ -1426,7 +1429,7 @@ int wait_backup(struct mdinfo *sra,
|
|||
if (memcmp(bsb.magic, "md_backup_data-2", 16) == 0)
|
||||
bsb.sb_csum2 = bsb_csum((char*)&bsb,
|
||||
((char*)&bsb.sb_csum2)-((char*)&bsb));
|
||||
if (lseek64(destfd[i], destoffsets[i]-4096, 0) !=
|
||||
if ((unsigned long long)lseek64(destfd[i], destoffsets[i]-4096, 0) !=
|
||||
destoffsets[i]-4096)
|
||||
rv = 1;
|
||||
rv = rv ?: write(destfd[i], &bsb, 512);
|
||||
|
@ -1444,7 +1447,7 @@ static void fail(char *msg)
|
|||
}
|
||||
|
||||
static char *abuf, *bbuf;
|
||||
static int abuflen;
|
||||
static unsigned long long abuflen;
|
||||
static void validate(int afd, int bfd, unsigned long long offset)
|
||||
{
|
||||
/* check that the data in the backup against the array.
|
||||
|
@ -1485,12 +1488,12 @@ static void validate(int afd, int bfd, unsigned long long offset)
|
|||
}
|
||||
|
||||
lseek64(bfd, offset, 0);
|
||||
if (read(bfd, bbuf, len) != len) {
|
||||
if ((unsigned long long)read(bfd, bbuf, len) != len) {
|
||||
//printf("len %llu\n", len);
|
||||
fail("read first backup failed");
|
||||
}
|
||||
lseek64(afd, __le64_to_cpu(bsb2.arraystart)*512, 0);
|
||||
if (read(afd, abuf, len) != len)
|
||||
if ((unsigned long long)read(afd, abuf, len) != len)
|
||||
fail("read first from array failed");
|
||||
if (memcmp(bbuf, abuf, len) != 0) {
|
||||
#if 0
|
||||
|
@ -1518,10 +1521,10 @@ static void validate(int afd, int bfd, unsigned long long offset)
|
|||
}
|
||||
|
||||
lseek64(bfd, offset+__le64_to_cpu(bsb2.devstart2)*512, 0);
|
||||
if (read(bfd, bbuf, len) != len)
|
||||
if ((unsigned long long)read(bfd, bbuf, len) != len)
|
||||
fail("read second backup failed");
|
||||
lseek64(afd, __le64_to_cpu(bsb2.arraystart2)*512, 0);
|
||||
if (read(afd, abuf, len) != len)
|
||||
if ((unsigned long long)read(afd, abuf, len) != len)
|
||||
fail("read second from array failed");
|
||||
if (memcmp(bbuf, abuf, len) != 0)
|
||||
fail("data2 compare failed");
|
||||
|
@ -1763,8 +1766,8 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
|
|||
* sometimes they aren't... So allow considerable flexability in matching, and allow
|
||||
* this test to be overridden by an environment variable.
|
||||
*/
|
||||
if (info->array.utime > __le64_to_cpu(bsb.mtime) + 2*60*60 ||
|
||||
info->array.utime < __le64_to_cpu(bsb.mtime) - 10*60) {
|
||||
if (info->array.utime > (int)__le64_to_cpu(bsb.mtime) + 2*60*60 ||
|
||||
info->array.utime < (int)__le64_to_cpu(bsb.mtime) - 10*60) {
|
||||
if (check_env("MDADM_GROW_ALLOW_OLD")) {
|
||||
fprintf(stderr, Name ": accepting backup with timestamp %lu "
|
||||
"for array with timestamp %lu\n",
|
||||
|
@ -1973,7 +1976,7 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
|
|||
int d;
|
||||
struct mdinfo *sra, *sd;
|
||||
int rv;
|
||||
int cache;
|
||||
unsigned long cache;
|
||||
int done = 0;
|
||||
|
||||
err = sysfs_set_str(info, NULL, "array_state", "readonly");
|
||||
|
|
2
Kill.c
2
Kill.c
|
@ -97,7 +97,7 @@ int Kill_subarray(char *dev, char *subarray, int quiet)
|
|||
memset(st, 0, sizeof(*st));
|
||||
|
||||
if (snprintf(st->subarray, sizeof(st->subarray), "%s", subarray) >=
|
||||
sizeof(st->subarray)) {
|
||||
(int)sizeof(st->subarray)) {
|
||||
if (!quiet)
|
||||
fprintf(stderr,
|
||||
Name ": Input overflow for subarray '%s' > %zu bytes\n",
|
||||
|
|
2
Makefile
2
Makefile
|
@ -42,7 +42,7 @@ KLIBC_GCC = gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIB
|
|||
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXFLAGS = -ggdb
|
||||
CWFLAGS = -Wall -Werror -Wstrict-prototypes
|
||||
CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
|
||||
ifdef WARN_UNUSED
|
||||
CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O
|
||||
endif
|
||||
|
|
12
Manage.c
12
Manage.c
|
@ -156,7 +156,7 @@ static void remove_devices(int devnum, char *path)
|
|||
unlink(base);
|
||||
if (path) {
|
||||
n = readlink(path2, link, sizeof(link));
|
||||
if (n && strlen(base) == n &&
|
||||
if (n && (int)strlen(base) == n &&
|
||||
strncmp(link, base, n) == 0)
|
||||
unlink(path2);
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ int Manage_subdevs(char *devname, int fd,
|
|||
return 1;
|
||||
}
|
||||
for (; j < array.raid_disks + array.nr_disks ; j++) {
|
||||
int dev;
|
||||
unsigned dev;
|
||||
disc.number = j;
|
||||
if (ioctl(fd, GET_DISK_INFO, &disc))
|
||||
continue;
|
||||
|
@ -430,7 +430,7 @@ int Manage_subdevs(char *devname, int fd,
|
|||
}
|
||||
for (; j < array.raid_disks + array.nr_disks; j++) {
|
||||
int sfd;
|
||||
int dev;
|
||||
unsigned dev;
|
||||
disc.number = j;
|
||||
if (ioctl(fd, GET_DISK_INFO, &disc))
|
||||
continue;
|
||||
|
@ -930,8 +930,8 @@ int Manage_subdevs(char *devname, int fd,
|
|||
if (sra)
|
||||
dv = sra->devs;
|
||||
for ( ; dv ; dv=dv->next)
|
||||
if (dv->disk.major == major(stb.st_rdev) &&
|
||||
dv->disk.minor == minor(stb.st_rdev))
|
||||
if (dv->disk.major == (int)major(stb.st_rdev) &&
|
||||
dv->disk.minor == (int)minor(stb.st_rdev))
|
||||
break;
|
||||
if (dv)
|
||||
err = sysfs_set_str(sra, dv,
|
||||
|
@ -1021,7 +1021,7 @@ int Update_subarray(char *dev, char *subarray, char *update, mddev_ident_t ident
|
|||
|
||||
memset(st, 0, sizeof(*st));
|
||||
if (snprintf(st->subarray, sizeof(st->subarray), "%s", subarray) >=
|
||||
sizeof(st->subarray)) {
|
||||
(signed)sizeof(st->subarray)) {
|
||||
if (!quiet)
|
||||
fprintf(stderr,
|
||||
Name ": Input overflow for subarray '%s' > %zu bytes\n",
|
||||
|
|
14
Monitor.c
14
Monitor.c
|
@ -94,7 +94,7 @@ int Monitor(mddev_dev_t devlist,
|
|||
int active, working, failed, spare, raid;
|
||||
int expected_spares;
|
||||
int devstate[MaxDisks];
|
||||
int devid[MaxDisks];
|
||||
unsigned devid[MaxDisks];
|
||||
int percent;
|
||||
struct state *next;
|
||||
} *statelist = NULL;
|
||||
|
@ -218,7 +218,7 @@ int Monitor(mddev_dev_t devlist,
|
|||
struct mdstat_ent *mse = NULL, *mse2;
|
||||
char *dev = st->devname;
|
||||
int fd;
|
||||
unsigned int i;
|
||||
int i;
|
||||
|
||||
if (test)
|
||||
alert("TestMessage", dev, NULL, mailaddr, mailfrom, alert_cmd, dosyslog);
|
||||
|
@ -352,7 +352,7 @@ int Monitor(mddev_dev_t devlist,
|
|||
close(fd);
|
||||
|
||||
for (i=0; i<MaxDisks; i++) {
|
||||
mdu_disk_info_t disc = {0};
|
||||
mdu_disk_info_t disc = {0,0,0,0,0};
|
||||
int newstate=0;
|
||||
int change;
|
||||
char *dv = NULL;
|
||||
|
@ -366,7 +366,7 @@ int Monitor(mddev_dev_t devlist,
|
|||
disc.state = newstate;
|
||||
disc.major = info[i].major;
|
||||
disc.minor = info[i].minor;
|
||||
} else if (mse && mse->pattern && i < strlen(mse->pattern)) {
|
||||
} else if (mse && mse->pattern && i < (int)strlen(mse->pattern)) {
|
||||
switch(mse->pattern[i]) {
|
||||
case 'U': newstate = 6 /* ACTIVE/SYNC */; break;
|
||||
case '_': newstate = 0; break;
|
||||
|
@ -378,19 +378,19 @@ int Monitor(mddev_dev_t devlist,
|
|||
minor(st->devid[i]), 1);
|
||||
change = newstate ^ st->devstate[i];
|
||||
if (st->utime && change && !st->err) {
|
||||
if (i < (unsigned)array.raid_disks &&
|
||||
if (i < array.raid_disks &&
|
||||
(((newstate&change)&(1<<MD_DISK_FAULTY)) ||
|
||||
((st->devstate[i]&change)&(1<<MD_DISK_ACTIVE)) ||
|
||||
((st->devstate[i]&change)&(1<<MD_DISK_SYNC)))
|
||||
)
|
||||
alert("Fail", dev, dv, mailaddr, mailfrom, alert_cmd, dosyslog);
|
||||
else if (i >= (unsigned)array.raid_disks &&
|
||||
else if (i >= array.raid_disks &&
|
||||
(disc.major || disc.minor) &&
|
||||
st->devid[i] == makedev(disc.major, disc.minor) &&
|
||||
((newstate&change)&(1<<MD_DISK_FAULTY))
|
||||
)
|
||||
alert("FailSpare", dev, dv, mailaddr, mailfrom, alert_cmd, dosyslog);
|
||||
else if (i < (unsigned)array.raid_disks &&
|
||||
else if (i < array.raid_disks &&
|
||||
! (newstate & (1<<MD_DISK_REMOVED)) &&
|
||||
(((st->devstate[i]&change)&(1<<MD_DISK_FAULTY)) ||
|
||||
((newstate&change)&(1<<MD_DISK_ACTIVE)) ||
|
||||
|
|
2
bitmap.c
2
bitmap.c
|
@ -130,7 +130,7 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
|
|||
unsigned long long total_bits = 0, read_bits = 0, dirty_bits = 0;
|
||||
bitmap_info_t *info;
|
||||
void *buf;
|
||||
int n, skip;
|
||||
unsigned int n, skip;
|
||||
|
||||
if (posix_memalign(&buf, 512, 8192) != 0) {
|
||||
fprintf(stderr, Name ": failed to allocate 8192 bytes\n");
|
||||
|
|
9
config.c
9
config.c
|
@ -524,12 +524,13 @@ void arrayline(char *line)
|
|||
w);
|
||||
else {
|
||||
char *endptr;
|
||||
mis.super_minor= strtol(w+12, &endptr, 10);
|
||||
if (w[12]==0 || endptr[0]!=0 || mis.super_minor < 0) {
|
||||
int minor = strtol(w+12, &endptr, 10);
|
||||
|
||||
if (w[12]==0 || endptr[0]!=0 || minor < 0)
|
||||
fprintf(stderr, Name ": invalid super-minor number: %s\n",
|
||||
w);
|
||||
mis.super_minor = UnSet;
|
||||
}
|
||||
else
|
||||
mis.super_minor = minor;
|
||||
}
|
||||
} else if (strncasecmp(w, "name=", 5)==0) {
|
||||
if (mis.name[0])
|
||||
|
|
8
mdadm.h
8
mdadm.h
|
@ -195,7 +195,7 @@ struct mdinfo {
|
|||
unsigned long safe_mode_delay; /* ms delay to mark clean */
|
||||
int new_level, delta_disks, new_layout, new_chunk;
|
||||
int errors;
|
||||
int cache_size; /* size of raid456 stripe cache*/
|
||||
unsigned long cache_size; /* size of raid456 stripe cache*/
|
||||
int mismatch_cnt;
|
||||
char text_version[50];
|
||||
void *update_private; /* for passing metadata-format
|
||||
|
@ -300,14 +300,14 @@ typedef struct mddev_ident_s {
|
|||
int uuid[4];
|
||||
char name[33];
|
||||
|
||||
unsigned int super_minor;
|
||||
int super_minor;
|
||||
|
||||
char *devices; /* comma separated list of device
|
||||
* names with wild cards
|
||||
*/
|
||||
int level;
|
||||
unsigned int raid_disks;
|
||||
unsigned int spare_disks;
|
||||
int raid_disks;
|
||||
int spare_disks;
|
||||
struct supertype *st;
|
||||
int autof; /* 1 for normal, 2 for partitioned */
|
||||
char *spare_group;
|
||||
|
|
2
mdmon.c
2
mdmon.c
|
@ -306,7 +306,7 @@ int main(int argc, char *argv[])
|
|||
/* update cmdline so this mdmon instance can be
|
||||
* distinguished from others in a call to ps(1)
|
||||
*/
|
||||
if (strlen(devname) <= container_len) {
|
||||
if (strlen(devname) <= (unsigned)container_len) {
|
||||
memset(container_name, 0, container_len);
|
||||
sprintf(container_name, "%s", devname);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver)
|
|||
sprintf(path, "/sys/bus/%s/drivers/%s/%s/subsystem",
|
||||
bus, driver, de->d_name);
|
||||
n = readlink(path, link, sizeof(link));
|
||||
if (n < 0 || n >= sizeof(link))
|
||||
if (n < 0 || n >= (int)sizeof(link))
|
||||
continue;
|
||||
link[n] = '\0';
|
||||
c = strrchr(link, '/');
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
static void *rom_mem = MAP_FAILED;
|
||||
static int rom_fd = -1;
|
||||
const static int rom_len = 0xf0000 - 0xc0000; /* option-rom memory region */
|
||||
static const int rom_len = 0xf0000 - 0xc0000; /* option-rom memory region */
|
||||
static int _sigbus;
|
||||
static unsigned long rom_align;
|
||||
|
||||
|
@ -199,7 +199,7 @@ static int romchecksum(const unsigned char *rom, unsigned long length)
|
|||
int scan_adapter_roms(scan_fn fn)
|
||||
{
|
||||
/* let scan_fn examing each of the adapter roms found by probe_roms */
|
||||
int i;
|
||||
unsigned int i;
|
||||
int found;
|
||||
|
||||
if (rom_fd < 0)
|
||||
|
@ -231,7 +231,7 @@ void probe_roms(void)
|
|||
const void *rom;
|
||||
unsigned long start, length, upper;
|
||||
unsigned char c;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (rom_fd < 0)
|
||||
return;
|
||||
|
|
|
@ -583,7 +583,7 @@ int restore_stripes(int *dest, unsigned long long *offsets,
|
|||
for (i=0; i<raid_disks; i++)
|
||||
stripes[i] = stripe_buf + i * chunk_size;
|
||||
while (length > 0) {
|
||||
int len = data_disks * chunk_size;
|
||||
unsigned int len = data_disks * chunk_size;
|
||||
unsigned long long offset;
|
||||
int disk, qdisk;
|
||||
int syndrome_disks;
|
||||
|
@ -592,9 +592,11 @@ int restore_stripes(int *dest, unsigned long long *offsets,
|
|||
for (i=0; i < data_disks; i++) {
|
||||
int disk = geo_map(i, start/chunk_size/data_disks,
|
||||
raid_disks, level, layout);
|
||||
if (lseek64(source, read_offset, 0) != read_offset)
|
||||
if ((unsigned long long)lseek64(source, read_offset, 0)
|
||||
!= read_offset)
|
||||
return -1;
|
||||
if (read(source, stripes[disk], chunk_size) != chunk_size)
|
||||
if (read(source, stripes[disk],
|
||||
chunk_size) != chunk_size)
|
||||
return -1;
|
||||
read_offset += chunk_size;
|
||||
}
|
||||
|
|
88
super-ddf.c
88
super-ddf.c
|
@ -396,7 +396,7 @@ struct ddf_super {
|
|||
struct phys_disk *phys;
|
||||
struct virtual_disk *virt;
|
||||
int pdsize, vdsize;
|
||||
int max_part, mppe, conf_rec_len;
|
||||
unsigned int max_part, mppe, conf_rec_len;
|
||||
int currentdev;
|
||||
int updates_pending;
|
||||
struct vcl {
|
||||
|
@ -406,7 +406,7 @@ struct ddf_super {
|
|||
struct vcl *next;
|
||||
__u64 *lba_offset; /* location in 'conf' of
|
||||
* the lba table */
|
||||
int vcnum; /* index into ->virt */
|
||||
unsigned int vcnum; /* index into ->virt */
|
||||
__u64 *block_sizes; /* NULL if all the same */
|
||||
};
|
||||
};
|
||||
|
@ -440,7 +440,7 @@ struct ddf_super {
|
|||
#endif
|
||||
|
||||
|
||||
static int calc_crc(void *buf, int len)
|
||||
static unsigned int calc_crc(void *buf, int len)
|
||||
{
|
||||
/* crcs are always at the same place as in the ddf_header */
|
||||
struct ddf_header *ddf = buf;
|
||||
|
@ -522,12 +522,12 @@ static void *load_section(int fd, struct ddf_super *super, void *buf,
|
|||
else
|
||||
offset += __be64_to_cpu(super->active->secondary_lba);
|
||||
|
||||
if (lseek64(fd, offset<<9, 0) != (offset<<9)) {
|
||||
if ((unsigned long long)lseek64(fd, offset<<9, 0) != (offset<<9)) {
|
||||
if (dofree)
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
if (read(fd, buf, len<<9) != (len<<9)) {
|
||||
if ((unsigned long long)read(fd, buf, len<<9) != (len<<9)) {
|
||||
if (dofree)
|
||||
free(buf);
|
||||
return NULL;
|
||||
|
@ -642,10 +642,10 @@ static int load_ddf_local(int fd, struct ddf_super *super,
|
|||
struct dl *dl;
|
||||
struct stat stb;
|
||||
char *conf;
|
||||
int i;
|
||||
int confsec;
|
||||
unsigned int i;
|
||||
unsigned int confsec;
|
||||
int vnum;
|
||||
int max_virt_disks = __be16_to_cpu(super->active->max_vd_entries);
|
||||
unsigned int max_virt_disks = __be16_to_cpu(super->active->max_vd_entries);
|
||||
unsigned long long dsize;
|
||||
|
||||
/* First the local disk info */
|
||||
|
@ -673,11 +673,11 @@ static int load_ddf_local(int fd, struct ddf_super *super,
|
|||
if (get_dev_size(fd, devname, &dsize))
|
||||
dl->size = dsize >> 9;
|
||||
dl->spare = NULL;
|
||||
for (i=0 ; i < super->max_part ; i++)
|
||||
for (i = 0 ; i < super->max_part ; i++)
|
||||
dl->vlist[i] = NULL;
|
||||
super->dlist = dl;
|
||||
dl->pdnum = -1;
|
||||
for (i=0; i < __be16_to_cpu(super->active->max_pd_entries); i++)
|
||||
for (i = 0; i < __be16_to_cpu(super->active->max_pd_entries); i++)
|
||||
if (memcmp(super->phys->entries[i].guid,
|
||||
dl->disk.guid, DDF_GUID_LEN) == 0)
|
||||
dl->pdnum = i;
|
||||
|
@ -1054,7 +1054,7 @@ static void examine_vd(int n, struct ddf_super *sb, char *guid)
|
|||
struct vcl *vcl;
|
||||
|
||||
for (vcl = sb->conflist ; vcl ; vcl = vcl->next) {
|
||||
int i;
|
||||
unsigned int i;
|
||||
struct vd_config *vc = &vcl->conf;
|
||||
|
||||
if (calc_crc(vc, crl*512) != vc->crc)
|
||||
|
@ -1065,7 +1065,7 @@ static void examine_vd(int n, struct ddf_super *sb, char *guid)
|
|||
/* Ok, we know about this VD, let's give more details */
|
||||
printf(" Raid Devices[%d] : %d (", n,
|
||||
__be16_to_cpu(vc->prim_elmnt_count));
|
||||
for (i=0; i<__be16_to_cpu(vc->prim_elmnt_count); i++) {
|
||||
for (i = 0; i < __be16_to_cpu(vc->prim_elmnt_count); i++) {
|
||||
int j;
|
||||
int cnt = __be16_to_cpu(sb->phys->used_pdes);
|
||||
for (j=0; j<cnt; j++)
|
||||
|
@ -1209,12 +1209,12 @@ static void brief_examine_subarrays_ddf(struct supertype *st, int verbose)
|
|||
*/
|
||||
struct ddf_super *ddf = st->sb;
|
||||
struct mdinfo info;
|
||||
int i;
|
||||
unsigned int i;
|
||||
char nbuf[64];
|
||||
getinfo_super_ddf(st, &info);
|
||||
fname_from_uuid(st, &info, nbuf, ':');
|
||||
|
||||
for (i=0; i<__be16_to_cpu(ddf->virt->max_vdes); i++) {
|
||||
for (i = 0; i < __be16_to_cpu(ddf->virt->max_vdes); i++) {
|
||||
struct virtual_entry *ve = &ddf->virt->entries[i];
|
||||
struct vcl vcl;
|
||||
char nbuf1[64];
|
||||
|
@ -1272,7 +1272,7 @@ static int match_home_ddf(struct supertype *st, char *homehost)
|
|||
* the hostname
|
||||
*/
|
||||
struct ddf_super *ddf = st->sb;
|
||||
int len;
|
||||
unsigned int len;
|
||||
|
||||
if (!homehost)
|
||||
return 0;
|
||||
|
@ -1285,7 +1285,7 @@ static int match_home_ddf(struct supertype *st, char *homehost)
|
|||
}
|
||||
|
||||
#ifndef MDASSEMBLE
|
||||
static struct vd_config *find_vdcr(struct ddf_super *ddf, int inst)
|
||||
static struct vd_config *find_vdcr(struct ddf_super *ddf, unsigned int inst)
|
||||
{
|
||||
struct vcl *v;
|
||||
|
||||
|
@ -1301,8 +1301,8 @@ static int find_phys(struct ddf_super *ddf, __u32 phys_refnum)
|
|||
/* Find the entry in phys_disk which has the given refnum
|
||||
* and return it's index
|
||||
*/
|
||||
int i;
|
||||
for (i=0; i < __be16_to_cpu(ddf->phys->max_pdes); i++)
|
||||
unsigned int i;
|
||||
for (i = 0; i < __be16_to_cpu(ddf->phys->max_pdes); i++)
|
||||
if (ddf->phys->entries[i].refnum == phys_refnum)
|
||||
return i;
|
||||
return -1;
|
||||
|
@ -1422,7 +1422,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info)
|
|||
info->array.chunk_size = 512 << vc->conf.chunk_shift;
|
||||
info->custom_array_size = 0;
|
||||
|
||||
if (cd >= 0 && cd < ddf->mppe) {
|
||||
if (cd >= 0 && (unsigned)cd < ddf->mppe) {
|
||||
info->data_offset = __be64_to_cpu(vc->lba_offset[cd]);
|
||||
if (vc->block_sizes)
|
||||
info->component_size = vc->block_sizes[cd];
|
||||
|
@ -1909,7 +1909,7 @@ FIXME ignore DDF_Legacy devices?
|
|||
*/
|
||||
struct extent *rv;
|
||||
int n = 0;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
|
||||
rv = malloc(sizeof(struct extent) * (ddf->max_part + 2));
|
||||
if (!rv)
|
||||
|
@ -1919,7 +1919,7 @@ FIXME ignore DDF_Legacy devices?
|
|||
struct vcl *v = dl->vlist[i];
|
||||
if (v == NULL)
|
||||
continue;
|
||||
for (j=0; j < v->conf.prim_elmnt_count; j++)
|
||||
for (j = 0; j < v->conf.prim_elmnt_count; j++)
|
||||
if (v->conf.phys_refnum[j] == dl->disk.refnum) {
|
||||
/* This device plays role 'j' in 'v'. */
|
||||
rv[n].start = __be64_to_cpu(v->lba_offset[j]);
|
||||
|
@ -1947,7 +1947,7 @@ static int init_super_ddf_bvd(struct supertype *st,
|
|||
* We need to create a new vd_config and a new virtual_entry
|
||||
*/
|
||||
struct ddf_super *ddf = st->sb;
|
||||
int venum;
|
||||
unsigned int venum;
|
||||
struct virtual_entry *ve;
|
||||
struct vcl *vcl;
|
||||
struct vd_config *vc;
|
||||
|
@ -2068,8 +2068,8 @@ static void add_to_super_ddf_bvd(struct supertype *st,
|
|||
struct ddf_super *ddf = st->sb;
|
||||
struct vd_config *vc;
|
||||
__u64 *lba_offset;
|
||||
int working;
|
||||
int i;
|
||||
unsigned int working;
|
||||
unsigned int i;
|
||||
unsigned long long blocks, pos, esize;
|
||||
struct extent *ex;
|
||||
|
||||
|
@ -2114,7 +2114,7 @@ static void add_to_super_ddf_bvd(struct supertype *st,
|
|||
vc->phys_refnum[dk->raid_disk] = dl->disk.refnum;
|
||||
lba_offset[dk->raid_disk] = __cpu_to_be64(pos);
|
||||
|
||||
for (i=0; i < ddf->max_part ; i++)
|
||||
for (i = 0; i < ddf->max_part ; i++)
|
||||
if (dl->vlist[i] == NULL)
|
||||
break;
|
||||
if (i == ddf->max_part)
|
||||
|
@ -2131,7 +2131,7 @@ static void add_to_super_ddf_bvd(struct supertype *st,
|
|||
*/
|
||||
working = 0;
|
||||
|
||||
for (i=0; i < __be16_to_cpu(vc->prim_elmnt_count); i++)
|
||||
for (i = 0; i < __be16_to_cpu(vc->prim_elmnt_count); i++)
|
||||
if (vc->phys_refnum[i] != 0xffffffff)
|
||||
working++;
|
||||
|
||||
|
@ -2165,7 +2165,7 @@ static int add_to_super_ddf(struct supertype *st,
|
|||
struct tm *tm;
|
||||
unsigned long long size;
|
||||
struct phys_disk_entry *pde;
|
||||
int n, i;
|
||||
unsigned int n, i;
|
||||
struct stat stb;
|
||||
|
||||
if (ddf->currentconf) {
|
||||
|
@ -2201,11 +2201,11 @@ static int add_to_super_ddf(struct supertype *st,
|
|||
do {
|
||||
/* Cannot be bothered finding a CRC of some irrelevant details*/
|
||||
dd->disk.refnum = random32();
|
||||
for (i = __be16_to_cpu(ddf->active->max_pd_entries) - 1;
|
||||
i >= 0; i--)
|
||||
if (ddf->phys->entries[i].refnum == dd->disk.refnum)
|
||||
for (i = __be16_to_cpu(ddf->active->max_pd_entries);
|
||||
i > 0; i--)
|
||||
if (ddf->phys->entries[i-1].refnum == dd->disk.refnum)
|
||||
break;
|
||||
} while (i >= 0);
|
||||
} while (i > 0);
|
||||
|
||||
dd->disk.forced_ref = 1;
|
||||
dd->disk.forced_guid = 1;
|
||||
|
@ -2348,7 +2348,7 @@ static int __write_init_super_ddf(struct supertype *st, int do_close)
|
|||
char *null_aligned = (char*)((((unsigned long)null_conf)+511)&~511UL);
|
||||
if (null_conf[0] != 0xff)
|
||||
memset(null_conf, 0xff, sizeof(null_conf));
|
||||
int togo = conf_size;
|
||||
unsigned int togo = conf_size;
|
||||
while (togo > sizeof(null_conf)-512) {
|
||||
if (write(fd, null_aligned, sizeof(null_conf)-512) < 0)
|
||||
break;
|
||||
|
@ -2777,8 +2777,8 @@ static int validate_geometry_ddf_bvd(struct supertype *st,
|
|||
if ((S_IFMT & stb.st_mode) != S_IFBLK)
|
||||
return 0;
|
||||
for (dl = ddf->dlist ; dl ; dl = dl->next) {
|
||||
if (dl->major == major(stb.st_rdev) &&
|
||||
dl->minor == minor(stb.st_rdev))
|
||||
if (dl->major == (int)major(stb.st_rdev) &&
|
||||
dl->minor == (int)minor(stb.st_rdev))
|
||||
break;
|
||||
}
|
||||
if (!dl) {
|
||||
|
@ -2920,8 +2920,8 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
|
|||
|
||||
for (vc = ddf->conflist ; vc ; vc=vc->next)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
struct mdinfo *this;
|
||||
this = malloc(sizeof(*this));
|
||||
memset(this, 0, sizeof(*this));
|
||||
|
@ -2971,7 +2971,7 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
|
|||
devnum2devname(st->container_dev),
|
||||
this->container_member);
|
||||
|
||||
for (i=0 ; i < ddf->mppe ; i++) {
|
||||
for (i = 0 ; i < ddf->mppe ; i++) {
|
||||
struct mdinfo *dev;
|
||||
struct dl *d;
|
||||
|
||||
|
@ -3139,7 +3139,7 @@ static int ddf_set_array_state(struct active_array *a, int consistent)
|
|||
static void ddf_set_disk(struct active_array *a, int n, int state)
|
||||
{
|
||||
struct ddf_super *ddf = a->container->sb;
|
||||
int inst = a->info.container_member;
|
||||
unsigned int inst = a->info.container_member;
|
||||
struct vd_config *vc = find_vdcr(ddf, inst);
|
||||
int pd = find_phys(ddf, vc->phys_refnum[n]);
|
||||
int i, st, working;
|
||||
|
@ -3280,8 +3280,8 @@ static void ddf_process_update(struct supertype *st,
|
|||
struct vd_config *vc;
|
||||
struct vcl *vcl;
|
||||
struct dl *dl;
|
||||
int mppe;
|
||||
int ent;
|
||||
unsigned int mppe;
|
||||
unsigned int ent;
|
||||
|
||||
dprintf("Process update %x\n", *magic);
|
||||
|
||||
|
@ -3340,7 +3340,7 @@ static void ddf_process_update(struct supertype *st,
|
|||
dprintf("len %d %d\n", update->len, ddf->conf_rec_len);
|
||||
|
||||
mppe = __be16_to_cpu(ddf->anchor.max_primary_element_entries);
|
||||
if (update->len != ddf->conf_rec_len * 512)
|
||||
if ((unsigned)update->len != ddf->conf_rec_len * 512)
|
||||
return;
|
||||
vc = (struct vd_config*)update->buf;
|
||||
for (vcl = ddf->conflist; vcl ; vcl = vcl->next)
|
||||
|
@ -3367,8 +3367,8 @@ static void ddf_process_update(struct supertype *st,
|
|||
}
|
||||
/* Now make sure vlist is correct for each dl. */
|
||||
for (dl = ddf->dlist; dl; dl = dl->next) {
|
||||
int dn;
|
||||
int vn = 0;
|
||||
unsigned int dn;
|
||||
unsigned int vn = 0;
|
||||
for (vcl = ddf->conflist; vcl ; vcl = vcl->next)
|
||||
for (dn=0; dn < ddf->mppe ; dn++)
|
||||
if (vcl->conf.phys_refnum[dn] ==
|
||||
|
@ -3503,7 +3503,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
|||
int is_global = 0;
|
||||
int is_dedicated = 0;
|
||||
struct extent *ex;
|
||||
int j;
|
||||
unsigned int j;
|
||||
/* If in this array, skip */
|
||||
for (d2 = a->info.devs ; d2 ; d2 = d2->next)
|
||||
if (d2->disk.major == dl->major &&
|
||||
|
|
|
@ -230,7 +230,7 @@ static unsigned int mpb_sectors(struct imsm_super *mpb)
|
|||
struct intel_dev {
|
||||
struct imsm_dev *dev;
|
||||
struct intel_dev *next;
|
||||
int index;
|
||||
unsigned index;
|
||||
};
|
||||
|
||||
/* internal representation of IMSM metadata */
|
||||
|
@ -496,7 +496,7 @@ static void set_imsm_ord_tbl_ent(struct imsm_map *map, int slot, __u32 ord)
|
|||
map->disk_ord_tbl[slot] = __cpu_to_le32(ord);
|
||||
}
|
||||
|
||||
static int get_imsm_disk_slot(struct imsm_map *map, int idx)
|
||||
static int get_imsm_disk_slot(struct imsm_map *map, unsigned idx)
|
||||
{
|
||||
int slot;
|
||||
__u32 ord;
|
||||
|
@ -590,7 +590,7 @@ static struct extent *get_extents(struct intel_super *super, struct dl *dl)
|
|||
*/
|
||||
remainder &= ~1UL;
|
||||
/* make sure remainder is still sane */
|
||||
if (remainder < ROUND_UP(super->len, 512) >> 9)
|
||||
if (remainder < (unsigned)ROUND_UP(super->len, 512) >> 9)
|
||||
remainder = ROUND_UP(super->len, 512) >> 9;
|
||||
if (reservation > remainder)
|
||||
reservation = remainder;
|
||||
|
@ -891,7 +891,7 @@ static int imsm_enumerate_ports(const char *hba_path, int port_count, int host_b
|
|||
int err = 0;
|
||||
unsigned long port_mask = (1 << port_count) - 1;
|
||||
|
||||
if (port_count > sizeof(port_mask) * 8) {
|
||||
if (port_count > (int)sizeof(port_mask) * 8) {
|
||||
if (verbose)
|
||||
fprintf(stderr, Name ": port_count %d out of range\n", port_count);
|
||||
return 2;
|
||||
|
@ -2270,7 +2270,7 @@ static int load_imsm_mpb(int fd, struct intel_super *super, char *devname)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (read(fd, super->buf + 512, super->len - 512) != super->len - 512) {
|
||||
if ((unsigned)read(fd, super->buf + 512, super->len - 512) != super->len - 512) {
|
||||
if (devname)
|
||||
fprintf(stderr,
|
||||
Name ": Cannot read extended mpb on %s: %s\n",
|
||||
|
@ -3873,8 +3873,8 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
|
|||
if ((S_IFMT & stb.st_mode) != S_IFBLK)
|
||||
return 0;
|
||||
for (dl = super->disks ; dl ; dl = dl->next) {
|
||||
if (dl->major == major(stb.st_rdev) &&
|
||||
dl->minor == minor(stb.st_rdev))
|
||||
if (dl->major == (int)major(stb.st_rdev) &&
|
||||
dl->minor == (int)minor(stb.st_rdev))
|
||||
break;
|
||||
}
|
||||
if (!dl) {
|
||||
|
@ -4581,7 +4581,7 @@ static int mark_failure(struct imsm_dev *dev, struct imsm_disk *disk, int idx)
|
|||
disk->status |= FAILED_DISK;
|
||||
disk->status &= ~CONFIGURED_DISK;
|
||||
set_imsm_ord_tbl_ent(map, slot, idx | IMSM_ORD_REBUILD);
|
||||
if (~map->failed_disk_num == 0)
|
||||
if (map->failed_disk_num == 0xff)
|
||||
map->failed_disk_num = slot;
|
||||
return 1;
|
||||
}
|
||||
|
@ -4773,7 +4773,8 @@ static int store_imsm_mpb(int fd, struct imsm_super *mpb)
|
|||
if (lseek64(fd, dsize - (512 * (2 + sectors)), SEEK_SET) < 0)
|
||||
return 1;
|
||||
|
||||
if (write(fd, buf + 512, 512 * sectors) != 512 * sectors)
|
||||
if ((unsigned long long)write(fd, buf + 512, 512 * sectors)
|
||||
!= 512 * sectors)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -5082,7 +5083,7 @@ static int disks_overlap(struct intel_super *super, int idx, struct imsm_update_
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void imsm_delete(struct intel_super *super, struct dl **dlp, int index);
|
||||
static void imsm_delete(struct intel_super *super, struct dl **dlp, unsigned index);
|
||||
|
||||
static void imsm_process_update(struct supertype *st,
|
||||
struct metadata_update *update)
|
||||
|
@ -5357,10 +5358,10 @@ static void imsm_process_update(struct supertype *st,
|
|||
}
|
||||
|
||||
for (dp = &super->devlist; *dp;)
|
||||
if ((*dp)->index == super->current_vol) {
|
||||
if ((*dp)->index == (unsigned)super->current_vol) {
|
||||
*dp = (*dp)->next;
|
||||
} else {
|
||||
if ((*dp)->index > victim)
|
||||
if ((*dp)->index > (unsigned)victim)
|
||||
(*dp)->index--;
|
||||
dp = &(*dp)->next;
|
||||
}
|
||||
|
@ -5504,7 +5505,7 @@ static void imsm_prepare_update(struct supertype *st,
|
|||
}
|
||||
|
||||
/* must be called while manager is quiesced */
|
||||
static void imsm_delete(struct intel_super *super, struct dl **dlp, int index)
|
||||
static void imsm_delete(struct intel_super *super, struct dl **dlp, unsigned index)
|
||||
{
|
||||
struct imsm_super *mpb = super->anchor;
|
||||
struct dl *iter;
|
||||
|
@ -5518,10 +5519,10 @@ static void imsm_delete(struct intel_super *super, struct dl **dlp, int index)
|
|||
|
||||
/* shift all indexes down one */
|
||||
for (iter = super->disks; iter; iter = iter->next)
|
||||
if (iter->index > index)
|
||||
if (iter->index > (int)index)
|
||||
iter->index--;
|
||||
for (iter = super->missing; iter; iter = iter->next)
|
||||
if (iter->index > index)
|
||||
if (iter->index > (int)index)
|
||||
iter->index--;
|
||||
|
||||
for (i = 0; i < mpb->num_raid_devs; i++) {
|
||||
|
@ -5595,7 +5596,6 @@ struct superswitch super_imsm = {
|
|||
#ifndef MDASSEMBLE
|
||||
/* for mdmon */
|
||||
.open_new = imsm_open_new,
|
||||
.load_super = load_super_imsm,
|
||||
.set_array_state= imsm_set_array_state,
|
||||
.set_disk = imsm_set_disk,
|
||||
.sync_metadata = imsm_sync_metadata,
|
||||
|
|
10
super0.c
10
super0.c
|
@ -389,7 +389,7 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info)
|
|||
/* work_disks is calculated rather than read directly */
|
||||
for (i=0; i < MD_SB_DISKS; i++)
|
||||
if ((sb->disks[i].state & (1<<MD_DISK_SYNC)) &&
|
||||
(sb->disks[i].raid_disk < info->array.raid_disks) &&
|
||||
(sb->disks[i].raid_disk < (unsigned)info->array.raid_disks) &&
|
||||
(sb->disks[i].state & (1<<MD_DISK_ACTIVE)) &&
|
||||
!(sb->disks[i].state & (1<<MD_DISK_FAULTY)))
|
||||
working ++;
|
||||
|
@ -427,7 +427,7 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
|
|||
devname, info->array.md_minor);
|
||||
}
|
||||
if (strcmp(update, "summaries") == 0) {
|
||||
int i;
|
||||
unsigned int i;
|
||||
/* set nr_disks, active_disks, working_disks,
|
||||
* failed_disks, spare_disks based on disks[]
|
||||
* array in superblock.
|
||||
|
@ -487,7 +487,7 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
|
|||
*/
|
||||
add = (1<<MD_DISK_SYNC);
|
||||
if (((sb->disks[d].state & ~mask) | add)
|
||||
!= info->disk.state) {
|
||||
!= (unsigned)info->disk.state) {
|
||||
sb->disks[d].state = info->disk.state | wonly;
|
||||
rv = 1;
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
|
|||
sb->gvalid_words = 0; /* ignored */
|
||||
sb->ctime = time(0);
|
||||
sb->level = info->level;
|
||||
if (size != info->size)
|
||||
if (size != (unsigned long long)info->size)
|
||||
return 0;
|
||||
sb->size = info->size;
|
||||
sb->nr_disks = info->nr_disks;
|
||||
|
@ -982,7 +982,7 @@ static int add_internal_bitmap0(struct supertype *st, int *chunkp,
|
|||
chunk = min_chunk;
|
||||
if (chunk < 64*1024*1024)
|
||||
chunk = 64*1024*1024;
|
||||
} else if (chunk < min_chunk)
|
||||
} else if ((unsigned long long)chunk < min_chunk)
|
||||
return 0; /* chunk size too small */
|
||||
|
||||
sb->state |= (1<<MD_SB_BITMAP_PRESENT);
|
||||
|
|
24
super1.c
24
super1.c
|
@ -199,7 +199,7 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|||
{
|
||||
struct mdp_superblock_1 *sb = st->sb;
|
||||
time_t atime;
|
||||
int d;
|
||||
unsigned int d;
|
||||
int role;
|
||||
int delta_extra = 0;
|
||||
int i;
|
||||
|
@ -388,9 +388,9 @@ static void examine_super1(struct supertype *st, char *homehost)
|
|||
for (d=0; d<__le32_to_cpu(sb->raid_disks) + delta_extra; d++) {
|
||||
int cnt = 0;
|
||||
int me = 0;
|
||||
int i;
|
||||
unsigned int i;
|
||||
for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
|
||||
int role = __le16_to_cpu(sb->dev_roles[i]);
|
||||
unsigned int role = __le16_to_cpu(sb->dev_roles[i]);
|
||||
if (role == d) {
|
||||
if (i == __le32_to_cpu(sb->dev_number))
|
||||
me = 1;
|
||||
|
@ -562,7 +562,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info)
|
|||
{
|
||||
struct mdp_superblock_1 *sb = st->sb;
|
||||
int working = 0;
|
||||
int i;
|
||||
unsigned int i;
|
||||
int role;
|
||||
|
||||
info->array.major_version = 1;
|
||||
|
@ -629,7 +629,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info)
|
|||
} else
|
||||
info->reshape_active = 0;
|
||||
|
||||
for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
|
||||
for (i = 0; i < __le32_to_cpu(sb->max_dev); i++) {
|
||||
role = __le16_to_cpu(sb->dev_roles[i]);
|
||||
if (/*role == 0xFFFF || */role < info->array.raid_disks)
|
||||
working++;
|
||||
|
@ -682,9 +682,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
|||
}
|
||||
}
|
||||
if (strcmp(update, "linear-grow-new") == 0) {
|
||||
int i;
|
||||
unsigned int i;
|
||||
int rfd, fd;
|
||||
int max = __le32_to_cpu(sb->max_dev);
|
||||
unsigned int max = __le32_to_cpu(sb->max_dev);
|
||||
|
||||
for (i=0 ; i < max ; i++)
|
||||
if (__le16_to_cpu(sb->dev_roles[i]) >= 0xfffe)
|
||||
|
@ -894,7 +894,7 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
|
|||
else
|
||||
*rp = 0xfffe;
|
||||
|
||||
if (dk->number >= __le32_to_cpu(sb->max_dev) &&
|
||||
if (dk->number >= (int)__le32_to_cpu(sb->max_dev) &&
|
||||
__le32_to_cpu(sb->max_dev) < 384)
|
||||
sb->max_dev = __cpu_to_le32(dk->number+1);
|
||||
|
||||
|
@ -1012,11 +1012,11 @@ static int write_init_super1(struct supertype *st)
|
|||
struct supertype refst;
|
||||
int rfd;
|
||||
int rv = 0;
|
||||
int bm_space;
|
||||
unsigned long long bm_space;
|
||||
unsigned long long reserved;
|
||||
struct devinfo *di;
|
||||
unsigned long long dsize, array_size;
|
||||
long long sb_offset;
|
||||
unsigned long long sb_offset;
|
||||
|
||||
for (di = st->info; di && ! rv ; di = di->next) {
|
||||
if (di->disk.state == 1)
|
||||
|
@ -1091,7 +1091,7 @@ static int write_init_super1(struct supertype *st)
|
|||
sb_offset &= ~(4*2-1);
|
||||
sb->super_offset = __cpu_to_le64(sb_offset);
|
||||
sb->data_offset = __cpu_to_le64(0);
|
||||
if (sb_offset - bm_space < array_size)
|
||||
if (sb_offset < array_size + bm_space)
|
||||
bm_space = sb_offset - array_size;
|
||||
sb->data_size = __cpu_to_le64(sb_offset - bm_space);
|
||||
break;
|
||||
|
@ -1467,7 +1467,7 @@ add_internal_bitmap1(struct supertype *st,
|
|||
unsigned long long max_bits;
|
||||
unsigned long long min_chunk;
|
||||
long offset;
|
||||
int chunk = *chunkp;
|
||||
unsigned long long chunk = *chunkp;
|
||||
int room = 0;
|
||||
struct mdp_superblock_1 *sb = st->sb;
|
||||
bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + 1024);
|
||||
|
|
6
sysfs.c
6
sysfs.c
|
@ -195,7 +195,7 @@ struct mdinfo *sysfs_read(int fd, int devnum, unsigned long options)
|
|||
if (options & GET_SAFEMODE) {
|
||||
int scale = 1;
|
||||
int dot = 0;
|
||||
int i;
|
||||
unsigned i;
|
||||
unsigned long msec;
|
||||
size_t len;
|
||||
|
||||
|
@ -372,7 +372,7 @@ unsigned long long get_component_size(int fd)
|
|||
char fname[50];
|
||||
int n;
|
||||
if (fstat(fd, &stb)) return 0;
|
||||
if (major(stb.st_rdev) != get_mdp_major())
|
||||
if (major(stb.st_rdev) != (unsigned)get_mdp_major())
|
||||
sprintf(fname, "/sys/block/md%d/md/component_size",
|
||||
(int)minor(stb.st_rdev));
|
||||
else
|
||||
|
@ -393,7 +393,7 @@ int sysfs_set_str(struct mdinfo *sra, struct mdinfo *dev,
|
|||
char *name, char *val)
|
||||
{
|
||||
char fname[50];
|
||||
int n;
|
||||
unsigned int n;
|
||||
int fd;
|
||||
|
||||
sprintf(fname, "/sys/block/%s/md/%s/%s",
|
||||
|
|
10
util.c
10
util.c
|
@ -1131,7 +1131,7 @@ struct supertype *guess_super(int fd)
|
|||
*/
|
||||
struct superswitch *ss;
|
||||
struct supertype *st;
|
||||
unsigned long besttime = 0;
|
||||
time_t besttime = 0;
|
||||
int bestsuper = -1;
|
||||
int i;
|
||||
|
||||
|
@ -1207,7 +1207,7 @@ static int get_gpt_last_partition_end(int fd, unsigned long long *endofpart)
|
|||
struct GPT_part_entry *part;
|
||||
unsigned long long curr_part_end;
|
||||
unsigned all_partitions, entry_size;
|
||||
int part_nr;
|
||||
unsigned part_nr;
|
||||
|
||||
*endofpart = 0;
|
||||
|
||||
|
@ -1266,7 +1266,7 @@ static int get_last_partition_end(int fd, unsigned long long *endofpart)
|
|||
struct MBR boot_sect;
|
||||
struct MBR_part_record *part;
|
||||
unsigned long long curr_part_end;
|
||||
int part_nr;
|
||||
unsigned part_nr;
|
||||
int retval = 0;
|
||||
|
||||
*endofpart = 0;
|
||||
|
@ -1376,7 +1376,7 @@ int open_container(int fd)
|
|||
continue;
|
||||
n = read(dfd, buf, sizeof(buf));
|
||||
close(dfd);
|
||||
if (n <= 0 || n >= sizeof(buf))
|
||||
if (n <= 0 || (unsigned)n >= sizeof(buf))
|
||||
continue;
|
||||
buf[n] = 0;
|
||||
if (sscanf(buf, "%d:%d", &major, &minor) != 2)
|
||||
|
@ -1635,7 +1635,7 @@ int stat2devnum(struct stat *st)
|
|||
if ((S_IFMT & st->st_mode) == S_IFBLK) {
|
||||
if (major(st->st_rdev) == MD_MAJOR)
|
||||
return minor(st->st_rdev);
|
||||
else if (major(st->st_rdev) == get_mdp_major())
|
||||
else if (major(st->st_rdev) == (unsigned)get_mdp_major())
|
||||
return -1- (minor(st->st_rdev)>>MdpMinorShift);
|
||||
|
||||
/* must be an extended-minor partition. Look at the
|
||||
|
|
Loading…
Reference in New Issue