struct grub_diskfilter_pv *pv;
grub_err_t err;
- /* We choose not to support more than 1024 disks. */
- if (nmemb < 1 || nmemb > 1024)
+ /* We choose not to support more than the specified number of disks. */
+ if (nmemb < 1 || nmemb > GRUB_MDRAID_MAX_DISKS)
{
grub_free (uuid);
return NULL;
#include <grub/mm.h>
#include <grub/misc.h>
+#include <grub/disk.h>
#include <grub/emu/misc.h>
#include <grub/emu/hostdisk.h>
#include <grub/emu/getroot.h>
char fstype[ESCAPED_PATH_MAX + 1], device[ESCAPED_PATH_MAX + 1];
};
-/*
- * GET_DISK_INFO nr_disks (total count) does not map to disk.number,
- * which is an internal kernel index. Instead, do what mdadm does
- * and keep scanning until we find enough valid disks. The limit is
- * copied from there, which notes that it is sufficiently high given
- * that the on-disk metadata for v1.x can only support 1920.
- */
-#define MD_MAX_DISKS 4096
-
static char **
grub_util_raid_getmembers (const char *name, int bootable)
{
devicelist = xcalloc (info.nr_disks + 1, sizeof (char *));
remaining = info.nr_disks;
- for (i = 0, j = 0; i < MD_MAX_DISKS && remaining > 0; i++)
+ for (i = 0, j = 0; i < GRUB_MDRAID_MAX_DISKS && remaining > 0; i++)
{
disk.number = i;
ret = ioctl (fd, GET_DISK_INFO, &disk);
/* The maximum number of disk caches. */
#define GRUB_DISK_CACHE_NUM 1021
+/*
+ * The maximum number of disks in an mdraid device.
+ *
+ * GET_DISK_INFO nr_disks (total count) does not map to disk.number,
+ * which is an internal kernel index. Instead, do what mdadm does
+ * and keep scanning until we find enough valid disks. The limit is
+ * copied from there, which notes that it is sufficiently high given
+ * that the on-disk metadata for v1.x can only support 1920.
+ */
+#define GRUB_MDRAID_MAX_DISKS 4096
+
/* The size of a disk cache in 512B units. Must be at least as big as the
largest supported sector size, currently 16K. */
#define GRUB_DISK_CACHE_BITS 6