Date: Sat, 13 Sep 2014 06:45:05 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r271501 - user/nwhitehorn/bsdinstall_zfspartedit/partedit Message-ID: <201409130645.s8D6j5Ac031311@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Sat Sep 13 06:45:04 2014 New Revision: 271501 URL: http://svnweb.freebsd.org/changeset/base/271501 Log: Untested, but simple, machine-dependent screening of bootable root file system types. Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_generic.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_pc98.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_sparc64.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c Sat Sep 13 06:34:31 2014 (r271500) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c Sat Sep 13 06:45:04 2014 (r271501) @@ -994,6 +994,21 @@ addpartform: goto addpartform; } + /* If this is the root partition, check that this file system is + * bootable */ + if (strcmp(items[2].text, "/") == 0 && !is_fs_bootable(scheme, + items[0].text)) { + char message[512]; + sprintf(message, "This file system (%s) is not bootable " + "on this system. Are you sure you want to proceed?", + items[0].text); + dialog_vars.defaultno = TRUE; + choice = dialog_yesno("Warning", message, 0, 0); + dialog_vars.defaultno = FALSE; + if (choice == 1) /* cancel */ + goto addpartform; + } + /* * If this is the root partition, and we need a boot partition, ask * the user to add one. Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h Sat Sep 13 06:34:31 2014 (r271500) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h Sat Sep 13 06:45:04 2014 (r271501) @@ -77,6 +77,7 @@ void set_default_part_metadata(const cha /* machine-dependent bootability checks */ const char *default_scheme(void); int is_scheme_bootable(const char *scheme); +int is_fs_bootable(const char *scheme, const char *fs); size_t bootpart_size(const char *scheme); const char *bootpart_type(const char *scheme); const char *bootcode_path(const char *scheme); Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_generic.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_generic.c Sat Sep 13 06:34:31 2014 (r271500) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_generic.c Sat Sep 13 06:45:04 2014 (r271501) @@ -50,6 +50,11 @@ is_scheme_bootable(const char *part_type return (1); } +int +is_fs_bootable(const char *part_type, const char *fs) { + return (1); +} + /* No clue => no boot partition, bootcode, or partcode */ size_t Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_pc98.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_pc98.c Sat Sep 13 06:34:31 2014 (r271500) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_pc98.c Sat Sep 13 06:45:04 2014 (r271501) @@ -45,6 +45,15 @@ is_scheme_bootable(const char *part_type return (0); } +int +is_fs_bootable(const char *part_type, const char *fs) +{ + if (strcmp(fs, "freebsd-ufs") == 0) + return (1); + + return (0); +} + size_t bootpart_size(const char *part_type) { /* No boot partition */ Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c Sat Sep 13 06:34:31 2014 (r271500) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c Sat Sep 13 06:45:04 2014 (r271501) @@ -67,6 +67,15 @@ is_scheme_bootable(const char *part_type return (0); } +int +is_fs_bootable(const char *part_type, const char *fs) +{ + if (strcmp(fs, "freebsd-ufs") == 0) + return (1); + + return (0); +} + size_t bootpart_size(const char *part_type) { size_t platlen = sizeof(platform); Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_sparc64.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_sparc64.c Sat Sep 13 06:34:31 2014 (r271500) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_sparc64.c Sat Sep 13 06:45:04 2014 (r271501) @@ -42,6 +42,15 @@ is_scheme_bootable(const char *part_type return (0); } +int +is_fs_bootable(const char *part_type, const char *fs) +{ + if (strcmp(fs, "freebsd-ufs") == 0 || strcmp(fs, "freebsd-zfs") == 0) + return (1); + return (0); +} + + size_t bootpart_size(const char *part_type) { /* No standalone boot partition */ Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c Sat Sep 13 06:34:31 2014 (r271500) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c Sat Sep 13 06:45:04 2014 (r271501) @@ -58,6 +58,21 @@ is_scheme_bootable(const char *part_type return (0); } +int +is_fs_bootable(const char *part_type, const char *fs) { + size_t platlen = sizeof(platform); + if (strlen(platform) == 0) + sysctlbyname(platform_sysctl, platform, &platlen, NULL, -1); + + if (strcmp(fs, "freebsd-ufs") == 0) + return (1); + + if (strcmp(fs, "freebsd-zfs") == 0 && strcmp(platform, "BIOS") == 0) + return (1); + + return (0); +} + size_t bootpart_size(const char *scheme) { size_t platlen = sizeof(platform);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409130645.s8D6j5Ac031311>