diff options
| author | sjelinek <none@none> | 2005-10-27 09:01:18 -0700 |
|---|---|---|
| committer | sjelinek <none@none> | 2005-10-27 09:01:18 -0700 |
| commit | 3e1bd7a2aaeb6188caef90679b98088cfef1edc6 (patch) | |
| tree | f96d6ce4a25ea39514dd8b1fd2a23978cabc5055 /usr/src/cmd/format/menu_command.c | |
| parent | 108322fb1c3ed341aba9c80c9774df0ed9e35768 (diff) | |
| download | illumos-joyent-3e1bd7a2aaeb6188caef90679b98088cfef1edc6.tar.gz | |
PSARC 2004/776 device checking for fs utilities
PSARC 2005/461 Device in use checking environment variables
5084421 libdiskmgt needs to detect in use ZFS data
5085739 remove workaround for bug 4725434
6194015 Device in use checking for Solaris utilities-PSARC/2004/776
6261853 libdiskmgt does not work correctly in all cases on amd64
6268374 libdiskmgt allocates incorrect size for readdir_r() dirent argument
6291309 PSARC/2005/461 - libdiskmgt should enable bypassing of inuse checking
6301815 PSARC/2005/461-Need Sun private libdiskmgt flag for use during install to disable sysevent starting
--HG--
rename : usr/src/cmd/format/checkmount.c => usr/src/cmd/format/checkdev.c
rename : usr/src/cmd/format/checkmount.h => usr/src/cmd/format/checkdev.h
Diffstat (limited to 'usr/src/cmd/format/menu_command.c')
| -rw-r--r-- | usr/src/cmd/format/menu_command.c | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/usr/src/cmd/format/menu_command.c b/usr/src/cmd/format/menu_command.c index b679017d7d..e570d07dcb 100644 --- a/usr/src/cmd/format/menu_command.c +++ b/usr/src/cmd/format/menu_command.c @@ -56,7 +56,7 @@ #include "startup.h" #include "partition.h" #include "prompts.h" -#include "checkmount.h" +#include "checkdev.h" #include "io.h" #include "ctlr_scsi.h" #include "auto_sense.h" @@ -607,6 +607,18 @@ c_type() currently being used for swapping.\n"); return (-1); } + + /* + * Check for partitions being used in SVM, VxVM or LU devices + */ + + if ((tptr != oldtype) && + checkdevinuse(cur_disk->disk_name, (diskaddr_t)-1, + (diskaddr_t)-1, 0, 0)) { + err_print("Cannot set disk type while its " + "partitions are currently in use.\n"); + return (-1); + } /* * If the type selected is different from the previous type, * mark the disk as not labelled and reload the current @@ -748,7 +760,6 @@ c_current() fmt_print("\n"); return (0); } - /* * This routine implements the 'format' command. It allows the user * to format and verify any portion of the disk. @@ -757,11 +768,11 @@ int c_format() { diskaddr_t start, end; - time_t clock; - int format_time, format_tracks, format_cyls; - int format_interval; - int deflt, status; - u_ioparam_t ioparam; + time_t clock; + int format_time, format_tracks, format_cyls; + int format_interval; + int deflt, status; + u_ioparam_t ioparam; /* * There must be a current disk type and a current disk @@ -857,6 +868,16 @@ c_format() currently being used for swapping.\n"); return (-1); } + /* + * Check for partitions being used in SVM, VxVM or LU devices + * in this format zone + */ + if (checkdevinuse(cur_disk->disk_name, start, end, 0, 0)) { + err_print("Cannot format disk while its partitions " + "are currently in use.\n"); + return (-1); + } + if (SCSI && (format_time = scsi_format_time()) > 0) { fmt_print( "Ready to format. Formatting cannot be interrupted\n" @@ -1118,6 +1139,12 @@ being used for swapping.\ncontinue")) return (-1); } + if (checkdevinuse(cur_disk->disk_name, bn, bn, 0, 0)) { + if (check("Repair is in a partition which is currently " + "in use.\ncontinue")) + return (-1); + } + /* * Try to read the sector before repairing it. If we can * get good data out of it, we can write that data back @@ -1288,8 +1315,8 @@ c_show() int c_label() { - int status; - int deflt, *defltptr = NULL; + int status; + int deflt, *defltptr = NULL; /* * There must be a current disk type (and therefore a current disk). @@ -1341,6 +1368,17 @@ c_label() } } + /* + * Check to see if any partitions used for svm, vxvm or live upgrade + * are on the disk. If so, refuse to label the disk, but only + * if we are trying to shrink a partition in use. + */ + if (checkdevinuse(cur_disk->disk_name, (diskaddr_t)-1, + (diskaddr_t)-1, 0, 1)) { + err_print("Cannot label disk when " + "partitions are in use as described.\n"); + return (-1); + } /* * If there is not a current partition map, warn the user we |
