diff options
author | Keith M Wesolowski <wesolows@foobazco.org> | 2013-07-15 17:06:26 +0000 |
---|---|---|
committer | Keith M Wesolowski <wesolows@foobazco.org> | 2013-07-15 17:06:32 +0000 |
commit | a0bda88c32e1ace5ddcb0d9f6a2cb71d37a7ed63 (patch) | |
tree | 8574e38e96ca5ef37d1e82f6eb11ab9c20098c43 | |
parent | 126f347ed26e9335d90a606b0097d9ccb6096d39 (diff) | |
parent | 01f9868a8d2cedd96c3aeefbd7233aa77f7b72ff (diff) | |
download | illumos-joyent-a0bda88c32e1ace5ddcb0d9f6a2cb71d37a7ed63.tar.gz |
[illumos-gate merge]
commit 01f9868a8d2cedd96c3aeefbd7233aa77f7b72ff
3877 fast reboot does not work with extended partition
-rw-r--r-- | usr/src/lib/libgrubmgmt/common/libgrub_fs.c | 36 | ||||
-rw-r--r-- | usr/src/lib/libgrubmgmt/common/libgrub_impl.h | 6 | ||||
-rw-r--r-- | usr/src/lib/libgrubmgmt/i386/Makefile | 6 |
3 files changed, 45 insertions, 3 deletions
diff --git a/usr/src/lib/libgrubmgmt/common/libgrub_fs.c b/usr/src/lib/libgrubmgmt/common/libgrub_fs.c index db1576b828..ff2884b6b3 100644 --- a/usr/src/lib/libgrubmgmt/common/libgrub_fs.c +++ b/usr/src/lib/libgrubmgmt/common/libgrub_fs.c @@ -24,9 +24,12 @@ * * Copyright 2011 Joyent, Inc. All rights reserved. */ +/* + * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + */ /* - * This file contains all the functions that manipualte the file + * This file contains all the functions that manipulate the file * system where the GRUB menu resides. */ #include <stdio.h> @@ -44,6 +47,9 @@ #include <sys/fs/ufs_mount.h> #include <sys/dktp/fdisk.h> #include <libfstyp.h> +#if defined(i386) || defined(__amd64) +#include <libfdisk.h> +#endif #include "libgrub_impl.h" @@ -86,6 +92,10 @@ get_sol_prtnum(const char *physpath) struct ipart *ipart; char boot_sect[512]; char rdev[MAXNAMELEN]; +#if defined(i386) || defined(__amd64) + ext_part_t *epp; + int ext_part_found = 0; +#endif (void) snprintf(rdev, sizeof (rdev), "/devices%s,raw", physpath); @@ -107,6 +117,28 @@ get_sol_prtnum(const char *physpath) for (i = 0; i < FD_NUMPART; ++i) { if (ipart[i].systid == SUNIXOS || ipart[i].systid == SUNIXOS2) return (i); + +#if defined(i386) || defined(__amd64) + if (!fdisk_is_dos_extended(ipart[i].systid) || + (ext_part_found == 1)) + continue; + + ext_part_found = 1; + + if (libfdisk_init(&epp, rdev, NULL, FDISK_READ_DISK) == + FDISK_SUCCESS) { + uint32_t begs, nums; + int pno; + int rval; + + rval = fdisk_get_solaris_part(epp, &pno, &begs, &nums); + + libfdisk_fini(&epp); + + if (rval == FDISK_SUCCESS) + return (pno - 1); + } +#endif } return (PRTNUM_INVALID); } @@ -149,7 +181,7 @@ get_zfs_root(zfs_handle_t *zfh, grub_fs_t *fs, grub_root_t *root) /* * On entry physpath parameter supposed to contain: * <disk_physpath>[<space><disk_physpath>]*. - * Retireives first <disk_physpath> that matches both partition and slice. + * Retrieves first <disk_physpath> that matches both partition and slice. * If any partition and slice is acceptable, first <disk_physpath> is returned. */ static int diff --git a/usr/src/lib/libgrubmgmt/common/libgrub_impl.h b/usr/src/lib/libgrubmgmt/common/libgrub_impl.h index 0d33400e7d..5d973b20d2 100644 --- a/usr/src/lib/libgrubmgmt/common/libgrub_impl.h +++ b/usr/src/lib/libgrubmgmt/common/libgrub_impl.h @@ -22,6 +22,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + */ #ifndef _GRBMIMPL_H #define _GRBMIMPL_H @@ -34,6 +37,7 @@ extern "C" { #include <sys/param.h> #include <sys/mntent.h> #include <sys/uadmin.h> +#include <sys/dktp/fdisk.h> #include <libzfs.h> #include <libdevinfo.h> #include "libgrubmgmt.h" @@ -55,7 +59,7 @@ extern "C" { #define SLCNUM_WHOLE_DISK 'q' #define IS_SLCNUM_VALID(x) ((x) >= SLCNUM_FIRST && (x) < SLCNUM_WHOLE_DISK) -#define IS_PRTNUM_VALID(x) ((uint_t)(x) < FD_NUMPART) +#define IS_PRTNUM_VALID(x) ((uint_t)(x) < FD_NUMPART + MAX_EXT_PARTS) #define GRBM_VALID_FLAG ((uint_t)1 << 31) #define GRBM_MAXLINE 8192 diff --git a/usr/src/lib/libgrubmgmt/i386/Makefile b/usr/src/lib/libgrubmgmt/i386/Makefile index 0ef5233f44..9b91a98d13 100644 --- a/usr/src/lib/libgrubmgmt/i386/Makefile +++ b/usr/src/lib/libgrubmgmt/i386/Makefile @@ -22,8 +22,14 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2013 Nexenta Systems, Inc. All rights reserved. # include ../Makefile.com +# +# Libraries added to the next line must be present in miniroot +# +LDLIBS += -lfdisk + install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) |