mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-27 02:14:28 +03:00
linux/libzutil: use ARRAY_SIZE instead of constant for search paths
Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12105
This commit is contained in:
parent
1a345d645a
commit
3aa81a6635
@ -168,7 +168,7 @@ out:
|
|||||||
(void) close(fd);
|
(void) close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char * const
|
||||||
zpool_default_import_path[] = {
|
zpool_default_import_path[] = {
|
||||||
"/dev"
|
"/dev"
|
||||||
};
|
};
|
||||||
|
@ -74,7 +74,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <blkid/blkid.h>
|
#include <blkid/blkid.h>
|
||||||
|
|
||||||
#define DEFAULT_IMPORT_PATH_SIZE 9
|
|
||||||
#define DEV_BYID_PATH "/dev/disk/by-id/"
|
#define DEV_BYID_PATH "/dev/disk/by-id/"
|
||||||
|
|
||||||
static boolean_t
|
static boolean_t
|
||||||
@ -255,8 +254,8 @@ zpool_open_func(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char * const
|
||||||
zpool_default_import_path[DEFAULT_IMPORT_PATH_SIZE] = {
|
zpool_default_import_path[] = {
|
||||||
"/dev/disk/by-vdev", /* Custom rules, use first if they exist */
|
"/dev/disk/by-vdev", /* Custom rules, use first if they exist */
|
||||||
"/dev/mapper", /* Use multipath devices before components */
|
"/dev/mapper", /* Use multipath devices before components */
|
||||||
"/dev/disk/by-partlabel", /* Single unique entry set by user */
|
"/dev/disk/by-partlabel", /* Single unique entry set by user */
|
||||||
@ -271,8 +270,8 @@ zpool_default_import_path[DEFAULT_IMPORT_PATH_SIZE] = {
|
|||||||
const char * const *
|
const char * const *
|
||||||
zpool_default_search_paths(size_t *count)
|
zpool_default_search_paths(size_t *count)
|
||||||
{
|
{
|
||||||
*count = DEFAULT_IMPORT_PATH_SIZE;
|
*count = ARRAY_SIZE(zpool_default_import_path);
|
||||||
return ((const char * const *)zpool_default_import_path);
|
return (zpool_default_import_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -300,7 +299,7 @@ zfs_path_order(char *name, int *order)
|
|||||||
}
|
}
|
||||||
free(envdup);
|
free(envdup);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < DEFAULT_IMPORT_PATH_SIZE; i++) {
|
for (i = 0; i < ARRAY_SIZE(zpool_default_import_path); i++) {
|
||||||
if (strncmp(name, zpool_default_import_path[i],
|
if (strncmp(name, zpool_default_import_path[i],
|
||||||
strlen(zpool_default_import_path[i])) == 0) {
|
strlen(zpool_default_import_path[i])) == 0) {
|
||||||
*order = i;
|
*order = i;
|
||||||
|
Loading…
Reference in New Issue
Block a user