Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Oct 2019 03:52:32 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r354006 - in stable/12/stand: common efi/libefi efi/loader i386/libi386 libsa/zfs mips/beri/loader uboot/common uboot/lib usb/storage userboot/userboot
Message-ID:  <201910240352.x9O3qWfB037260@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Oct 24 03:52:32 2019
New Revision: 354006
URL: https://svnweb.freebsd.org/changeset/base/354006

Log:
  MFC r345477, r346675, r346984, r348748
  
  r345477:
  Distinguish between "no partition" and "choose best partition" with a
  constant.
  
  The values of the d_slice and d_partition fields of a disk_devdesc have a
  few values with special meanings in the disk_open() routine. Through various
  evolutions of the loader code over time, a d_partition value of -1 has
  meant both "use the first ufs partition found in the bsd label" and "don't
  open a bsd partition at all, open the raw slice."
  
  This defines a new special value of -2 to mean open the raw slice, and it
  gives symbolic names to all the special values used in d_slice and
  d_partition, and adjusts all existing uses of those fields to use the new
  constants.
  
  The phab review for this timed out without being accepted, but I'm still
  citing it below because there is useful commentary there.
  
  r346675:
  Restore the ability to open a raw disk or partition in loader(8).
  
  The disk_open() function searches for "the best partition" when slice and
  partition information is not provided as part of the device name.  As of
  r345477 the slice and partition fields of a disk_devdesc are initialized to
  D_SLICEWILD and D_PARTWILD; in the past they were initialized to -1, which
  was sometimes interpreted as meaning 'wildcard' and sometimes as 'open the
  raw partition' depending on the context.  So as an unintended side effect of
  r345477 it became basically impossible to ever open a disk or partition
  without doing the 'best partition' search.  One visible effect of that was
  the inability to open the raw disk to read the partition table correctly in
  zfs_probe_dev(), leading to failures to find the zfs pool unless it was on
  the first partition.
  
  Now instead of always initializing slice and partition to wildcards, the
  disk_parsedev() function initializes them based on the presence of a
  path/file name following the device.  If there is any path or filename
  following the ':' that ends the device name, then slice and partition are
  initialized to D_SLICEWILD and D_PARTWILD.  If there is nothing after the
  ':' then it is considered to be a request to open the raw device or
  partition itself (not a file stored within it), and the fields are
  initialized to D_SLICENONE and D_PARTNONE.
  
  With this change in place, all the tests in src/tools/boot are succesful
  again, including the recently-added cases of booting from a zfs pool on
  a partition other than slice 1 of the device.
  
  r346984:
  Use D_PARTISGPT rather than bare 255
  
  These three cases dovetail with other places in the code where we use
  or set D_PARTISGPT when we mean that the partitioning scheme is
  GPT. Use this #define to make the code easier to undertand.
  
  r348748:
  loader: disk_open() should honor D_PARTNONE
  
  The D_PARTNONE is documented to make it possible to open raw MBR
  partition, but the current disk_open() does not really implement this
  statement.
  
  The current code is checking partition against -1 (D_PARTNONE) but does
  attempt to open partition table in case we do have FreeBSD MBR partition
  type.
  Instead, we should check -2 (D_PARTWILD).
  
  In case we do have MBR + BSD label, this code is only working because
  by default, the first BSD partiton is created starting with relative sector
  0, and we can still access the BSD table from that MBR slice.
  
  PR:		236981

Modified:
  stable/12/stand/common/disk.c
  stable/12/stand/common/disk.h
  stable/12/stand/efi/libefi/efipart.c
  stable/12/stand/efi/loader/main.c
  stable/12/stand/i386/libi386/biosdisk.c
  stable/12/stand/libsa/zfs/zfs.c
  stable/12/stand/mips/beri/loader/beri_disk_cfi.c
  stable/12/stand/mips/beri/loader/beri_disk_sdcard.c
  stable/12/stand/uboot/common/main.c
  stable/12/stand/uboot/lib/disk.c
  stable/12/stand/usb/storage/umass_loader.c
  stable/12/stand/userboot/userboot/main.c
  stable/12/stand/userboot/userboot/userboot_disk.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/disk.c
==============================================================================
--- stable/12/stand/common/disk.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/common/disk.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -142,15 +142,8 @@ ptable_print(void *arg, const char *pname, const struc
 		dev.dd.d_dev = pa->dev->dd.d_dev;
 		dev.dd.d_unit = pa->dev->dd.d_unit;
 		dev.d_slice = part->index;
-		dev.d_partition = -1;
+		dev.d_partition = D_PARTNONE;
 		if (disk_open(&dev, partsize, sectsize) == 0) {
-			/*
-			 * disk_open() for partition -1 on a bsd slice assumes
-			 * you want the first bsd partition.  Reset things so
-			 * that we're looking at the start of the raw slice.
-			 */
-			dev.d_partition = -1;
-			dev.d_offset = part->start;
 			table = ptable_open(&dev, partsize, sectsize, ptblread);
 			if (table != NULL) {
 				snprintf(line, sizeof(line), "  %s%s",
@@ -262,16 +255,16 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
 	 */
 	memcpy(&partdev, dev, sizeof(partdev));
 	partdev.d_offset = 0;
-	partdev.d_slice = -1;
-	partdev.d_partition = -1;
+	partdev.d_slice = D_SLICENONE;
+	partdev.d_partition = D_PARTNONE;
 
 	dev->d_offset = 0;
 	table = NULL;
 	slice = dev->d_slice;
 	partition = dev->d_partition;
 
-	DPRINTF("%s unit %d, slice %d, partition %d => %p",
-	    disk_fmtdev(dev), dev->dd.d_unit, dev->d_slice, dev->d_partition, od);
+	DPRINTF("%s unit %d, slice %d, partition %d => %p", disk_fmtdev(dev),
+	    dev->dd.d_unit, dev->d_slice, dev->d_partition, od);
 
 	/* Determine disk layout. */
 	od->table = ptable_open(&partdev, mediasize / sectorsize, sectorsize,
@@ -311,22 +304,30 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
 		od->entrysize = part.end - part.start + 1;
 		slice = part.index;
 		if (ptable_gettype(od->table) == PTABLE_GPT) {
-			partition = 255;
+			partition = D_PARTISGPT;
 			goto out; /* Nothing more to do */
-		} else if (partition == 255) {
+		} else if (partition == D_PARTISGPT) {
 			/*
 			 * When we try to open GPT partition, but partition
-			 * table isn't GPT, reset d_partition value to -1
-			 * and try to autodetect appropriate value.
+			 * table isn't GPT, reset partition value to
+			 * D_PARTWILD and try to autodetect appropriate value.
 			 */
-			partition = -1;
+			partition = D_PARTWILD;
 		}
+
 		/*
-		 * If d_partition < 0 and we are looking at a BSD slice,
+		 * If partition is D_PARTNONE, then disk_open() was called
+		 * to open raw MBR slice.
+		 */
+		if (partition == D_PARTNONE)
+			goto out;
+
+		/*
+		 * If partition is D_PARTWILD and we are looking at a BSD slice,
 		 * then try to read BSD label, otherwise return the
 		 * whole MBR slice.
 		 */
-		if (partition == -1 &&
+		if (partition == D_PARTWILD &&
 		    part.type != PART_FREEBSD)
 			goto out;
 		/* Try to read BSD label */
@@ -338,7 +339,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
 			goto out;
 		}
 		/*
-		 * If slice contains BSD label and d_partition < 0, then
+		 * If slice contains BSD label and partition < 0, then
 		 * assume the 'a' partition. Otherwise just return the
 		 * whole MBR slice, because it can contain ZFS.
 		 */
@@ -391,9 +392,9 @@ disk_fmtdev(struct disk_devdesc *dev)
 	char *cp;
 
 	cp = buf + sprintf(buf, "%s%d", dev->dd.d_dev->dv_name, dev->dd.d_unit);
-	if (dev->d_slice >= 0) {
+	if (dev->d_slice > D_SLICENONE) {
 #ifdef LOADER_GPT_SUPPORT
-		if (dev->d_partition == 255) {
+		if (dev->d_partition == D_PARTISGPT) {
 			sprintf(cp, "p%d:", dev->d_slice);
 			return (buf);
 		} else
@@ -402,7 +403,7 @@ disk_fmtdev(struct disk_devdesc *dev)
 			cp += sprintf(cp, "s%d", dev->d_slice);
 #endif
 	}
-	if (dev->d_partition >= 0)
+	if (dev->d_partition > D_PARTNONE)
 		cp += sprintf(cp, "%c", dev->d_partition + 'a');
 	strcat(cp, ":");
 	return (buf);
@@ -416,7 +417,21 @@ disk_parsedev(struct disk_devdesc *dev, const char *de
 	char *cp;
 
 	np = devspec;
-	unit = slice = partition = -1;
+	unit = -1;
+	/*
+	 * If there is path/file info after the device info, then any missing
+	 * slice or partition info should be considered a request to search for
+	 * an appropriate partition.  Otherwise we want to open the raw device
+	 * itself and not try to fill in missing info by searching.
+	 */
+	if ((cp = strchr(np, ':')) != NULL && cp[1] != '\0') {
+		slice = D_SLICEWILD;
+		partition = D_PARTWILD;
+	} else {
+		slice = D_SLICENONE;
+		partition = D_PARTNONE;
+	}
+
 	if (*np != '\0' && *np != ':') {
 		unit = strtol(np, &cp, 10);
 		if (cp == np)
@@ -430,7 +445,7 @@ disk_parsedev(struct disk_devdesc *dev, const char *de
 			/* we don't support nested partitions on GPT */
 			if (*cp != '\0' && *cp != ':')
 				return (EINVAL);
-			partition = 255;
+			partition = D_PARTISGPT;
 		} else
 #endif
 #ifdef LOADER_MBR_SUPPORT

Modified: stable/12/stand/common/disk.h
==============================================================================
--- stable/12/stand/common/disk.h	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/common/disk.h	Thu Oct 24 03:52:32 2019	(r354006)
@@ -32,33 +32,36 @@
  *
  * Whole disk access:
  *
- * 	d_slice = -1
- * 	d_partition = -1
+ * 	d_slice = D_SLICENONE
+ * 	d_partition = <doesn't matter>
  *
  * Whole MBR slice:
  *
  * 	d_slice = MBR slice number (typically 1..4)
- * 	d_partition = -1
+ * 	d_partition = D_PARTNONE
  *
  * BSD disklabel partition within an MBR slice:
  *
  * 	d_slice = MBR slice number (typically 1..4)
- * 	d_partition = disklabel partition (typically 0..19)
+ * 	d_partition = disklabel partition (typically 0..19 or D_PARTWILD)
  *
  * BSD disklabel partition on the true dedicated disk:
  *
- * 	d_slice = -1
- * 	d_partition = disklabel partition (typically 0..19)
+ * 	d_slice = D_SLICENONE
+ * 	d_partition = disklabel partition (typically 0..19 or D_PARTWILD)
  *
  * GPT partition:
  *
  * 	d_slice = GPT partition number (typically 1..N)
- * 	d_partition = 255
+ * 	d_partition = D_PARTISGPT
  *
- * For both MBR and GPT, to automatically find the 'best' slice or partition,
- * set d_slice to zero. This uses the partition type to decide which partition
- * to use according to the following list of preferences:
+ * For MBR, setting d_partition to D_PARTWILD will automatically use the first
+ * partition within the slice.
  *
+ * For both MBR and GPT, to automatically find the 'best' slice and partition,
+ * set d_slice to D_SLICEWILD. This uses the partition type to decide which
+ * partition to use according to the following list of preferences:
+ *
  * 	FreeBSD (active)
  * 	FreeBSD (inactive)
  * 	Linux (active)
@@ -80,6 +83,12 @@
 
 #ifndef	_DISK_H
 #define	_DISK_H
+
+#define	D_SLICENONE	-1
+#define	D_SLICEWILD	 0
+#define	D_PARTNONE	-1
+#define	D_PARTWILD	-2
+#define	D_PARTISGPT	255
 
 struct disk_devdesc {
 	struct devdesc	dd;		/* Must be first. */

Modified: stable/12/stand/efi/libefi/efipart.c
==============================================================================
--- stable/12/stand/efi/libefi/efipart.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/efi/libefi/efipart.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -748,8 +748,8 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t 
 			pd->pd_blkio = blkio;
 			pd_dev.dd.d_dev = dev;
 			pd_dev.dd.d_unit = pd->pd_unit;
-			pd_dev.d_slice = -1;
-			pd_dev.d_partition = -1;
+			pd_dev.d_slice = D_SLICENONE;
+			pd_dev.d_partition = D_PARTNONE;
 			ret = disk_open(&pd_dev, blkio->Media->BlockSize *
 			    (blkio->Media->LastBlock + 1),
 			    blkio->Media->BlockSize);

Modified: stable/12/stand/efi/loader/main.c
==============================================================================
--- stable/12/stand/efi/loader/main.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/efi/loader/main.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -220,12 +220,12 @@ set_currdev_pdinfo(pdinfo_t *dp)
 		currdev.dd.d_dev = dp->pd_devsw;
 		if (dp->pd_parent == NULL) {
 			currdev.dd.d_unit = dp->pd_unit;
-			currdev.d_slice = -1;
-			currdev.d_partition = -1;
+			currdev.d_slice = D_SLICENONE;
+			currdev.d_partition = D_PARTNONE;
 		} else {
 			currdev.dd.d_unit = dp->pd_parent->pd_unit;
 			currdev.d_slice = dp->pd_unit;
-			currdev.d_partition = 255;	/* Assumes GPT */
+			currdev.d_partition = D_PARTISGPT; /* XXX Assumes GPT */
 		}
 		set_currdev_devdesc((struct devdesc *)&currdev);
 	} else {

Modified: stable/12/stand/i386/libi386/biosdisk.c
==============================================================================
--- stable/12/stand/i386/libi386/biosdisk.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/i386/libi386/biosdisk.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -691,8 +691,8 @@ bd_print_common(struct devsw *dev, bdinfo_list_t *bdi,
 
 		devd.dd.d_dev = dev;
 		devd.dd.d_unit = i;
-		devd.d_slice = -1;
-		devd.d_partition = -1;
+		devd.d_slice = D_SLICENONE;
+		devd.d_partition = D_PARTNONE;
 		if (disk_open(&devd,
 		    bd->bd_sectorsize * bd->bd_sectors,
 		    bd->bd_sectorsize) == 0) {
@@ -745,8 +745,8 @@ bd_disk_get_sectors(struct disk_devdesc *dev)
 
 	disk.dd.d_dev = dev->dd.d_dev;
 	disk.dd.d_unit = dev->dd.d_unit;
-	disk.d_slice = -1;
-	disk.d_partition = -1;
+	disk.d_slice = D_SLICENONE;
+	disk.d_partition = D_PARTNONE;
 	disk.d_offset = 0;
 
 	size = bd->bd_sectors * bd->bd_sectorsize;

Modified: stable/12/stand/libsa/zfs/zfs.c
==============================================================================
--- stable/12/stand/libsa/zfs/zfs.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/libsa/zfs/zfs.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -590,7 +590,7 @@ zfs_probe_dev(const char *devname, uint64_t *pool_guid
 		int slice = dev->d_slice;
 
 		free(dev);
-		if (partition != -1 && slice != -1) {
+		if (partition != D_PARTNONE && slice != D_SLICENONE) {
 			ret = zfs_probe(pa.fd, pool_guid);
 			if (ret == 0)
 				return (0);

Modified: stable/12/stand/mips/beri/loader/beri_disk_cfi.c
==============================================================================
--- stable/12/stand/mips/beri/loader/beri_disk_cfi.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/mips/beri/loader/beri_disk_cfi.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -129,8 +129,8 @@ beri_cfi_disk_print(int verbose)
 		return (ret);
 	dev.dd.d_dev = &beri_cfi_disk;
 	dev.dd.d_unit = 0;
-	dev.d_slice = -1;
-	dev.d_partition = -1;
+	dev.d_slice = D_SLICENONE;
+	dev.d_partition = D_PARTNONE;
 	if (disk_open(&dev, cfi_get_mediasize(), cfi_get_sectorsize()) == 0) {
 		snprintf(line, sizeof(line), "    cfi%d", 0);
 		ret = disk_print(&dev, line, verbose);

Modified: stable/12/stand/mips/beri/loader/beri_disk_sdcard.c
==============================================================================
--- stable/12/stand/mips/beri/loader/beri_disk_sdcard.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/mips/beri/loader/beri_disk_sdcard.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -135,8 +135,8 @@ beri_sdcard_disk_print(int verbose)
 	    return (ret);
 	dev.dd.d_dev = &beri_sdcard_disk;
 	dev.dd.d_unit = 0;
-	dev.d_slice = -1;
-	dev.d_partition = -1;
+	dev.d_slice = D_SLICENONE;
+	dev.d_partition = D_PARTNONE;
 	if (disk_open(&dev, altera_sdcard_get_mediasize(),
 	    altera_sdcard_get_sectorsize()) == 0) {
 		snprintf(line, sizeof(line), "    sdcard%d", 0);

Modified: stable/12/stand/uboot/common/main.c
==============================================================================
--- stable/12/stand/uboot/common/main.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/uboot/common/main.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -213,8 +213,8 @@ get_load_device(int *type, int *unit, int *slice, int 
 
 	*type = DEV_TYP_NONE;
 	*unit = -1;
-	*slice = 0;
-	*partition = -1;
+	*slice = D_SLICEWILD;
+	*partition = D_PARTWILD;
 
 	devstr = ub_env_get("loaderdev");
 	if (devstr == NULL) {
@@ -295,7 +295,7 @@ get_load_device(int *type, int *unit, int *slice, int 
 	if (p == endp) {
 		*type = DEV_TYP_NONE;
 		*unit = -1;
-		*slice = 0;
+		*slice = D_SLICEWILD;
 		return;
 	}
 
@@ -309,7 +309,7 @@ get_load_device(int *type, int *unit, int *slice, int 
 	if (*p != '.') {
 		*type = DEV_TYP_NONE;
 		*unit = -1;
-		*slice = 0;
+		*slice = D_SLICEWILD;
 		return;
 	}
 
@@ -329,8 +329,8 @@ get_load_device(int *type, int *unit, int *slice, int 
 	/* Junk beyond partition number. */
 	*type = DEV_TYP_NONE;
 	*unit = -1;
-	*slice = 0;
-	*partition = -1;
+	*slice = D_SLICEWILD;
+	*partition = D_PARTWILD;
 } 
 
 static void
@@ -339,15 +339,20 @@ print_disk_probe_info()
 	char slice[32];
 	char partition[32];
 
-	if (currdev.d_disk.d_slice > 0)
-		sprintf(slice, "%d", currdev.d_disk.d_slice);
+	if (currdev.d_disk.d_slice == D_SLICENONE)
+		strlcpy(slice, "<none>", sizeof(slice));
+	else if (currdev.d_disk.d_slice == D_SLICEWILD)
+		strlcpy(slice, "<auto>", sizeof(slice));
 	else
-		strcpy(slice, "<auto>");
+		snprintf(slice, sizeof(slice), "%d", currdev.d_disk.d_slice);
 
-	if (currdev.d_disk.d_partition >= 0)
-		sprintf(partition, "%d", currdev.d_disk.d_partition);
+	if (currdev.d_disk.d_partition == D_PARTNONE)
+		strlcpy(partition, "<none>", sizeof(partition));
+	else if (currdev.d_disk.d_partition == D_PARTWILD)
+		strlcpy(partition, "<auto>", sizeof(partition));
 	else
-		strcpy(partition, "<auto>");
+		snprintf(partition, sizeof(partition), "%d",
+		    currdev.d_disk.d_partition);
 
 	printf("  Checking unit=%d slice=%s partition=%s...",
 	    currdev.dd.d_unit, slice, partition);

Modified: stable/12/stand/uboot/lib/disk.c
==============================================================================
--- stable/12/stand/uboot/lib/disk.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/uboot/lib/disk.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -254,8 +254,8 @@ stor_print(int verbose)
 	for (i = 0; i < stor_info_no; i++) {
 		dev.dd.d_dev = &uboot_storage;
 		dev.dd.d_unit = i;
-		dev.d_slice = -1;
-		dev.d_partition = -1;
+		dev.d_slice = D_SLICENONE;
+		dev.d_partition = D_PARTNONE;
 		snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i,
 		    ub_stor_type(SI(&dev).type));
 		if ((ret = pager_output(line)) != 0)

Modified: stable/12/stand/usb/storage/umass_loader.c
==============================================================================
--- stable/12/stand/usb/storage/umass_loader.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/usb/storage/umass_loader.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -196,8 +196,8 @@ umass_disk_print(int verbose)
 		return (ret);
 	dev.d_dev = &umass_disk;
 	dev.d_unit = 0;
-	dev.d_slice = -1;
-	dev.d_partition = -1;
+	dev.d_slice = D_SLICENONE;
+	dev.d_partition = D_PARTNONE;
 
 	if (umass_disk_open_sub(&dev) == 0) {
 		ret = disk_print(&dev, "    umass0", verbose);

Modified: stable/12/stand/userboot/userboot/main.c
==============================================================================
--- stable/12/stand/userboot/userboot/main.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/userboot/userboot/main.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -240,15 +240,15 @@ extract_currdev(void)
 	if (userboot_disk_maxunit > 0) {
 		dev.dd.d_dev = &userboot_disk;
 		dev.dd.d_unit = 0;
-		dev.d_slice = 0;
-		dev.d_partition = 0;
+		dev.d_slice = D_SLICEWILD;
+		dev.d_partition = D_PARTWILD;
 		/*
 		 * If we cannot auto-detect the partition type then
 		 * access the disk as a raw device.
 		 */
 		if (dev.dd.d_dev->dv_open(NULL, &dev)) {
-			dev.d_slice = -1;
-			dev.d_partition = -1;
+			dev.d_slice = D_SLICENONE;
+			dev.d_partition = D_PARTNONE;
 		}
 		dd = &dev.dd;
 	} else {

Modified: stable/12/stand/userboot/userboot/userboot_disk.c
==============================================================================
--- stable/12/stand/userboot/userboot/userboot_disk.c	Thu Oct 24 03:51:33 2019	(r354005)
+++ stable/12/stand/userboot/userboot/userboot_disk.c	Thu Oct 24 03:52:32 2019	(r354006)
@@ -137,8 +137,8 @@ userdisk_print(int verbose)
 			break;
 		dev.dd.d_dev = &userboot_disk;
 		dev.dd.d_unit = i;
-		dev.d_slice = -1;
-		dev.d_partition = -1;
+		dev.d_slice = D_SLICENONE;
+		dev.d_partition = D_PARTNONE;
 		if (disk_open(&dev, ud_info[i].mediasize,
 		    ud_info[i].sectorsize) == 0) {
 			snprintf(line, sizeof(line), "    disk%d", i);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910240352.x9O3qWfB037260>