<listitem><para>Attach the specified disk image to an automatically allocated loopback block device,
and print the path to the loopback block device to standard output. This is similar to an invocation
- of <command>losetup --find --show</command>, but will validate the image as DDI before attaching, and
- derive the correct sector size to use automatically. Moreover, it ensures the per-partition block
- devices are created before returning. Takes a path to a disk image file.</para>
+ of <command>losetup --find --show --partscan</command>, but will validate the image as DDI before
+ attaching, and derive the correct sector size to use automatically. Moreover, it ensures the
+ per-partition block devices are created before returning and attempts to enable direct IO mode, if
+ possible. Takes a path to a disk image file.</para>
+
+ <para>If combined with <option>--quiet</option> output of the block device name is suppressed.</para>
<xi:include href="version-info.xml" xpointer="v254"/></listitem>
</varlistentry>
<xi:include href="version-info.xml" xpointer="v258"/></listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--quiet</option></term>
+ <term><option>-q</option></term>
+
+ <listitem><para>If combined with <option>--attach</option>, suppresses output of the used loopback
+ block device path.</para>
+
+ <xi:include href="version-info.xml" xpointer="v258"/></listitem>
+ </varlistentry>
+
<xi:include href="standard-options.xml" xpointer="image-policy-open" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
<xi:include href="standard-options.xml" xpointer="no-legend" />
static RuntimeScope arg_runtime_scope = _RUNTIME_SCOPE_INVALID;
static bool arg_all = false;
static uid_t arg_uid_base = UID_INVALID;
+static bool arg_quiet = false;
STATIC_DESTRUCTOR_REGISTER(arg_image, freep);
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
" --discover Discover DDIs in well known directories\n"
" --validate Validate image and image policy\n"
" --shift Shift UID range to selected base\n"
+ " -q --quiet Suppress output of chosen loopback block device\n"
"\nSee the %2$s for details.\n",
program_invocation_short_name,
link,
{ "system", no_argument, NULL, ARG_SYSTEM },
{ "user", no_argument, NULL, ARG_USER },
{ "all", no_argument, NULL, ARG_ALL },
+ { "quiet", no_argument, NULL, 'q' },
{}
};
if (r < 0)
return r;
- while ((c = getopt_long(argc, argv, "hmurMUlxa", options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "hmurMUlxaq", options, NULL)) >= 0) {
switch (c) {
arg_all = true;
break;
+ case 'q':
+ arg_quiet = true;
+ break;
+
case '?':
return -EINVAL;
if (r < 0)
return log_error_errno(r, "Failed to relinquish DM and loopback block devices: %m");
- puts(d->node);
+ if (!arg_quiet)
+ puts(d->node);
+
return 0;
}