summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorws195443 <none@none>2008-06-27 01:38:17 -0700
committerws195443 <none@none>2008-06-27 01:38:17 -0700
commit8b7c2cdfd19b48f91fe2d0ab46db208679fc8444 (patch)
treee9870b65a0cb8640ad3c6f789a217af502c8a52b
parent19bf07850cb62bf88c7ef23b77f50210c1895c22 (diff)
downloadillumos-joyent-8b7c2cdfd19b48f91fe2d0ab46db208679fc8444.tar.gz
6622821 newfs/mkfs should use DKIOCHOTPLUGGABLE in addition to DKIOCREMOVABLE to determine media type
-rw-r--r--usr/src/cmd/fs.d/ufs/mkfs/mkfs.c15
-rw-r--r--usr/src/cmd/fs.d/ufs/newfs/newfs.c22
2 files changed, 28 insertions, 9 deletions
diff --git a/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c b/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c
index 492b851b40..95d017027b 100644
--- a/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c
+++ b/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c
@@ -646,7 +646,7 @@ main(int argc, char *argv[])
uint64_t nbytes64;
int remaining_cg;
int do_dot = 0;
- int use_efi_dflts = 0, retry = 0, isremovable = 0;
+ int use_efi_dflts = 0, retry = 0, isremovable = 0, ishotpluggable = 0;
int invalid_sb_cnt, ret, skip_this_sb, cg_too_small;
int geom_nsect, geom_ntrack, geom_cpg;
@@ -1149,8 +1149,14 @@ main(int argc, char *argv[])
" determined parameters.\n", fsys));
isremovable = 0;
}
+ if (ioctl(fsi, DKIOCHOTPLUGGABLE, &ishotpluggable)) {
+ dprintf(("DeBuG Unable to determine if %s is"
+ " Hotpluggable Media. Proceeding with "
+ "system determined parameters.\n", fsys));
+ ishotpluggable = 0;
+ }
if (((dkg.dkg_ncyl * dkg.dkg_nhead * dkg.dkg_nsect)
- > CHSLIMIT) || isremovable) {
+ > CHSLIMIT) || isremovable || ishotpluggable) {
use_efi_dflts = 1;
retry = 1;
}
@@ -1158,8 +1164,9 @@ main(int argc, char *argv[])
}
dprintf(("DeBuG CHSLIMIT = %d geom = %ld\n", CHSLIMIT,
dkg.dkg_ncyl * dkg.dkg_nhead * dkg.dkg_nsect));
- dprintf(("DeBuG label_type = %d isremovable = %d use_efi_dflts = %d\n",
- label_type, isremovable, use_efi_dflts));
+ dprintf(("DeBuG label_type = %d isremovable = %d ishotpluggable = %d "
+ "use_efi_dflts = %d\n", label_type, isremovable, ishotpluggable,
+ use_efi_dflts));
/*
* For the newfs -N case, even if the disksize is > CHSLIMIT, do not
diff --git a/usr/src/cmd/fs.d/ufs/newfs/newfs.c b/usr/src/cmd/fs.d/ufs/newfs/newfs.c
index a683fcd4cb..950a1c3e43 100644
--- a/usr/src/cmd/fs.d/ufs/newfs/newfs.c
+++ b/usr/src/cmd/fs.d/ufs/newfs/newfs.c
@@ -147,6 +147,7 @@ static int label_type; /* see types below */
*/
static int use_efi_dflts = 0;
static int isremovable = 0;
+static int ishotpluggable = 0;
static char device[MAXPATHLEN];
static char cmd[BUFSIZ];
@@ -731,16 +732,27 @@ getdiskbydev(char *disk)
actual_size = get_device_size(fd, disk);
if (label_type == LABEL_TYPE_VTOC) {
+
/*
- * Geometry information does not make sense for removable media
- * anyway, so indicate mkfs to use EFI default parameters.
+ * Geometry information does not make sense for removable or
+ * hotpluggable media anyway, so indicate mkfs to use EFI
+ * default parameters.
*/
if (ioctl(fd, DKIOCREMOVABLE, &isremovable)) {
dprintf(("DeBuG newfs : Unable to determine if %s is"
" Removable Media. Proceeding with system"
" determined parameters.\n", disk));
isremovable = 0;
- } else if (isremovable && !Tflag)
+ }
+
+ if (ioctl(fd, DKIOCHOTPLUGGABLE, &ishotpluggable)) {
+ dprintf(("DeBuG newfs : Unable to determine if %s is"
+ " Hotpluggable Media. Proceeding with system"
+ " determined parameters.\n", disk));
+ ishotpluggable = 0;
+ }
+
+ if ((isremovable || ishotpluggable) && !Tflag)
use_efi_dflts = 1;
if (ioctl(fd, DKIOCGGEOM, &g))
@@ -751,9 +763,9 @@ getdiskbydev(char *disk)
use_efi_dflts = 1;
}
dprintf(("DeBuG newfs : geom=%ld, CHSLIMIT=%d "
- "isremovable = %d use_efi_dflts = %d\n",
+ "isremovable = %d ishotpluggable = %d use_efi_dflts = %d\n",
g.dkg_ncyl * g.dkg_nhead * g.dkg_nsect, CHSLIMIT,
- isremovable, use_efi_dflts));
+ isremovable, ishotpluggable, use_efi_dflts));
/*
* The ntracks that is passed to mkfs is decided here based
* on 'use_efi_dflts' and whether ntracks was specified as a