diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-10-10 23:33:02 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-10-10 23:33:02 +0000 |
commit | eb0850f322ed78963a733146388cd6229d87b100 (patch) | |
tree | 748620157b52d966b1a71ad0f148e76a216bc716 /sys | |
parent | 50f98f5a49a7b92597776797ff315f5c8e778bf8 (diff) |
Oops. Need to handle the case of nfs diskless machines, where the block
device name is NULL.
From Tim Wiess
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/hibernate_machdep.c | 9 | ||||
-rw-r--r-- | sys/arch/i386/i386/hibernate_machdep.c | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/hibernate_machdep.c b/sys/arch/amd64/amd64/hibernate_machdep.c index 923576d7ebd..c793aca1287 100644 --- a/sys/arch/amd64/amd64/hibernate_machdep.c +++ b/sys/arch/amd64/amd64/hibernate_machdep.c @@ -71,13 +71,18 @@ extern struct hibernate_state *hibernate_state; hibio_fn get_hibernate_io_function(void) { + char *blkname = findblkname(major(swdevt[0].sw_dev)); + + if (blkname == NULL) + return NULL; + #if NWD > 0 /* XXX - Only support wd hibernate presently */ - if (strcmp(findblkname(major(swdevt[0].sw_dev)), "wd") == 0) + if (strcmp(blkname, "wd") == 0) return wd_hibernate_io; #endif #if NAHCI > 0 && NSD > 0 - if (strcmp(findblkname(major(swdevt[0].sw_dev)), "sd") == 0) { + if (strcmp(blkname, "sd") == 0) { extern struct cfdriver sd_cd; extern int ahci_hibernate_io(dev_t dev, daddr_t blkno, vaddr_t addr, size_t size, int op, void *page); diff --git a/sys/arch/i386/i386/hibernate_machdep.c b/sys/arch/i386/i386/hibernate_machdep.c index 5df2656cd20..699dd615e85 100644 --- a/sys/arch/i386/i386/hibernate_machdep.c +++ b/sys/arch/i386/i386/hibernate_machdep.c @@ -70,13 +70,17 @@ extern struct hibernate_state *hibernate_state; hibio_fn get_hibernate_io_function(void) { + char *blkname = findblkname(major(swdevt[0].sw_dev)); + + if (blkname == NULL) + return NULL; #if NWD > 0 /* XXX - Only support wd hibernate presently */ - if (strcmp(findblkname(major(swdevt[0].sw_dev)), "wd") == 0) + if (strcmp(blkname, "wd") == 0) return wd_hibernate_io; #endif #if NAHCI > 0 && NSD > 0 - if (strcmp(findblkname(major(swdevt[0].sw_dev)), "sd") == 0) { + if (strcmp(blkname, "sd") == 0) { extern struct cfdriver sd_cd; extern int ahci_hibernate_io(dev_t dev, daddr_t blkno, vaddr_t addr, size_t size, int op, void *page); |