summaryrefslogtreecommitdiff
path: root/usr/src/cmd/lofiadm/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/lofiadm/main.c')
-rw-r--r--usr/src/cmd/lofiadm/main.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/usr/src/cmd/lofiadm/main.c b/usr/src/cmd/lofiadm/main.c
index 758632b8ec..f1c360ec6f 100644
--- a/usr/src/cmd/lofiadm/main.c
+++ b/usr/src/cmd/lofiadm/main.c
@@ -412,7 +412,8 @@ out:
* DO NOT use this function if the filename is actually the device name.
*/
static int
-lofi_map_file(int lfd, struct lofi_ioctl *li, const char *filename)
+lofi_map_file(int lfd, struct lofi_ioctl *li, const char *filename,
+ boolean_t no_devlink_flag)
{
int minor;
@@ -425,7 +426,8 @@ lofi_map_file(int lfd, struct lofi_ioctl *li, const char *filename)
"unsupported"));
die(gettext("could not map file %s"), filename);
}
- wait_until_dev_complete(li);
+ if (!no_devlink_flag)
+ wait_until_dev_complete(li);
return (minor);
}
@@ -436,7 +438,7 @@ lofi_map_file(int lfd, struct lofi_ioctl *li, const char *filename)
static void
add_mapping(int lfd, const char *devicename, const char *filename,
mech_alias_t *cipher, const char *rkey, size_t rksz, boolean_t rdonly,
- boolean_t label)
+ boolean_t label, boolean_t no_devlink_flag)
{
struct lofi_ioctl li;
@@ -475,7 +477,7 @@ add_mapping(int lfd, const char *devicename, const char *filename,
char path[MAXPATHLEN];
/* pick one via the driver */
- minor = lofi_map_file(lfd, &li, filename);
+ minor = lofi_map_file(lfd, &li, filename, no_devlink_flag);
if (minor > 0) {
make_blkdevname(&li, path, sizeof (path));
@@ -500,7 +502,8 @@ add_mapping(int lfd, const char *devicename, const char *filename,
die(gettext("could not map file %s to %s"), filename,
devicename);
}
- wait_until_dev_complete(&li);
+ if (!no_devlink_flag)
+ wait_until_dev_complete(&li);
}
/*
@@ -1393,7 +1396,7 @@ lofi_uncompress(int lfd, const char *filename)
if (statbuf.st_size == 0)
return;
- minor = lofi_map_file(lfd, &li, filename);
+ minor = lofi_map_file(lfd, &li, filename, B_FALSE);
(void) snprintf(devicename, sizeof (devicename), "/dev/%s/%d",
LOFI_BLOCK_NAME, minor);
@@ -1935,6 +1938,7 @@ main(int argc, char *argv[])
boolean_t ephflag = B_FALSE;
boolean_t compressflag = B_FALSE;
boolean_t uncompressflag = B_FALSE;
+ boolean_t no_devlink_flag = B_FALSE;
/* the next two work together for -c, -k, -T, -e options only */
boolean_t need_crypto = B_FALSE; /* if any -c, -k, -T, -e */
boolean_t cipher_only = B_TRUE; /* if -c only */
@@ -1950,7 +1954,7 @@ main(int argc, char *argv[])
(void) setlocale(LC_ALL, "");
(void) textdomain(TEXT_DOMAIN);
- while ((c = getopt(argc, argv, "a:c:Cd:efk:lrs:T:U")) != EOF) {
+ while ((c = getopt(argc, argv, "a:c:Cd:efk:lrs:T:UX")) != EOF) {
switch (c) {
case 'a':
addflag = B_TRUE;
@@ -2031,6 +2035,13 @@ main(int argc, char *argv[])
case 'U':
uncompressflag = B_TRUE;
break;
+ case 'X':
+ /*
+ * Private flag to skip the wait for the /dev links to
+ * be created.
+ */
+ no_devlink_flag = B_TRUE;
+ break;
case '?':
default:
errflag = B_TRUE;
@@ -2163,7 +2174,7 @@ main(int argc, char *argv[])
*/
if (addflag)
add_mapping(lfd, devicename, filename, cipher, rkey, rksz,
- rdflag, labelflag);
+ rdflag, labelflag, no_devlink_flag);
else if (compressflag)
lofi_compress(&lfd, filename, compress_index, segsize);
else if (uncompressflag)