kboot: Disks should be at least 16MB
Linux pre-boot environments will often have a number of psuedo disks that are small, all smaller than a few MB. 16MB is a good cutoff since it's big enough to filter these devices, yet small enough to allow a super-minimal partition through (the smallest I've been able to make that's useful lately is around 20MB). Sponsored by: Netflix
This commit is contained in:
parent
538b73578b
commit
0386255bee
@ -60,6 +60,8 @@ struct devsw hostdisk = {
|
|||||||
*/
|
*/
|
||||||
#define SYSBLK "/sys/block"
|
#define SYSBLK "/sys/block"
|
||||||
|
|
||||||
|
#define HOSTDISK_MIN_SIZE (16ul << 20) /* 16MB */
|
||||||
|
|
||||||
typedef STAILQ_HEAD(, hdinfo) hdinfo_list_t;
|
typedef STAILQ_HEAD(, hdinfo) hdinfo_list_t;
|
||||||
typedef struct hdinfo {
|
typedef struct hdinfo {
|
||||||
STAILQ_ENTRY(hdinfo) hd_link; /* link in device list */
|
STAILQ_ENTRY(hdinfo) hd_link; /* link in device list */
|
||||||
@ -162,6 +164,8 @@ hostdisk_add_drive(const char *drv, uint64_t secs)
|
|||||||
if (!file2u64(fn, &hd->hd_sectorsize))
|
if (!file2u64(fn, &hd->hd_sectorsize))
|
||||||
goto err;
|
goto err;
|
||||||
hd->hd_size = hd->hd_sectors * hd->hd_sectorsize;
|
hd->hd_size = hd->hd_sectors * hd->hd_sectorsize;
|
||||||
|
if (hd->hd_size < HOSTDISK_MIN_SIZE)
|
||||||
|
goto err;
|
||||||
hd->hd_flags = 0;
|
hd->hd_flags = 0;
|
||||||
STAILQ_INIT(&hd->hd_children);
|
STAILQ_INIT(&hd->hd_children);
|
||||||
printf("/dev/%s: %ju %ju %ju\n",
|
printf("/dev/%s: %ju %ju %ju\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user