Mercurial > illumos > illumos-gate
changeset 14078:4ba9d5323304
3877 fast reboot does not work with extended partition
Reviewed by: Saso Kiselkov <skiselkov.ml@gmail.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
author | Marcel Telka <Marcel.Telka@nexenta.com> |
---|---|
date | Tue, 09 Jul 2013 11:56:37 +0200 |
parents | 47f42be153c1 |
children | eecf57cad0d1 |
files | usr/src/lib/libgrubmgmt/common/libgrub_fs.c usr/src/lib/libgrubmgmt/common/libgrub_impl.h usr/src/lib/libgrubmgmt/i386/Makefile |
diffstat | 3 files changed, 45 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/libgrubmgmt/common/libgrub_fs.c Mon Jul 01 22:48:16 2013 +0200 +++ b/usr/src/lib/libgrubmgmt/common/libgrub_fs.c Tue Jul 09 11:56:37 2013 +0200 @@ -22,9 +22,12 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * 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> @@ -42,6 +45,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" @@ -84,6 +90,10 @@ 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); @@ -105,6 +115,28 @@ 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); } @@ -146,7 +178,7 @@ /* * 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
--- a/usr/src/lib/libgrubmgmt/common/libgrub_impl.h Mon Jul 01 22:48:16 2013 +0200 +++ b/usr/src/lib/libgrubmgmt/common/libgrub_impl.h Tue Jul 09 11:56:37 2013 +0200 @@ -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 @@ #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 @@ #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
--- a/usr/src/lib/libgrubmgmt/i386/Makefile Mon Jul 01 22:48:16 2013 +0200 +++ b/usr/src/lib/libgrubmgmt/i386/Makefile Tue Jul 09 11:56:37 2013 +0200 @@ -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)