util: Get rid of unused enough_fd()

enough_fd() is no longer used, so lets get rid of it.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Jes Sorensen 2017-04-20 11:53:30 -04:00
parent 5e8e35fb7e
commit 44356754ec
2 changed files with 0 additions and 32 deletions

View File

@ -1485,7 +1485,6 @@ extern char *fname_from_uuid(struct supertype *st,
extern unsigned long calc_csum(void *super, int bytes);
extern int enough(int level, int raid_disks, int layout, int clean,
char *avail);
extern int enough_fd(int fd);
extern int ask(char *mesg);
extern unsigned long long get_component_size(int fd);
extern void remove_partitions(int fd);

31
util.c
View File

@ -542,37 +542,6 @@ int enough(int level, int raid_disks, int layout, int clean, char *avail)
}
}
int enough_fd(int fd)
{
struct mdu_array_info_s array;
struct mdu_disk_info_s disk;
int i, rv;
char *avail;
if (md_get_array_info(fd, &array) != 0 || array.raid_disks <= 0)
return 0;
avail = xcalloc(array.raid_disks, 1);
for (i = 0; i < MAX_DISKS && array.nr_disks > 0; i++) {
disk.number = i;
if (md_get_disk_info(fd, &disk) != 0)
continue;
if (disk.major == 0 && disk.minor == 0)
continue;
array.nr_disks--;
if (! (disk.state & (1<<MD_DISK_SYNC)))
continue;
if (disk.raid_disk < 0 || disk.raid_disk >= array.raid_disks)
continue;
avail[disk.raid_disk] = 1;
}
/* This is used on an active array, so assume it is clean */
rv = enough(array.level, array.raid_disks, array.layout,
1, avail);
free(avail);
return rv;
}
const int uuid_zero[4] = { 0, 0, 0, 0 };
int same_uuid(int a[4], int b[4], int swapuuid)