From owner-svn-src-user@FreeBSD.ORG Sat Sep 13 06:45:06 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9672D10F; Sat, 13 Sep 2014 06:45:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77E15324; Sat, 13 Sep 2014 06:45:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8D6j6DQ031323; Sat, 13 Sep 2014 06:45:06 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8D6j5Ac031311; Sat, 13 Sep 2014 06:45:05 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201409130645.s8D6j5Ac031311@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 13 Sep 2014 06:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r271501 - user/nwhitehorn/bsdinstall_zfspartedit/partedit X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2014 06:45:06 -0000 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);