@node loopback
@subsection loopback
-@deffn Command loopback [@option{-d}] device file
+@deffn Command loopback [@option{-d}] [@option{-D}] device file
Make the device named @var{device} correspond to the contents of the
filesystem image in @var{file}. For example:
ls (loop0)/
@end example
+Specifying the @option{-D} option allows the loopback file to be tranparently
+decompressed if there is an appropriate decompressor loaded.
+
With the @option{-d} option, delete a device previously created using this
command.
@end deffn
/* TRANSLATORS: The disk is simply removed from the list of available ones,
not wiped, avoid to scare user. */
{"delete", 'd', 0, N_("Delete the specified loopback drive."), 0, 0},
+ {"decompress", 'D', 0, N_("Transparently decompress backing file."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
{
struct grub_arg_list *state = ctxt->state;
grub_file_t file;
+ enum grub_file_type type = GRUB_FILE_TYPE_LOOPBACK;
struct grub_loopback *newdev;
grub_err_t ret;
if (state[0].set)
return delete_loopback (args[0]);
+ if (!state[1].set)
+ type |= GRUB_FILE_TYPE_NO_DECOMPRESS;
+
if (argc < 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
if (grub_strcmp (newdev->devname, args[0]) == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name already exists");
- file = grub_file_open (args[1], GRUB_FILE_TYPE_LOOPBACK
- | GRUB_FILE_TYPE_NO_DECOMPRESS);
+ file = grub_file_open (args[1], type);
if (! file)
return grub_errno;
GRUB_MOD_INIT(loopback)
{
cmd = grub_register_extcmd ("loopback", grub_cmd_loopback, 0,
- N_("[-d] DEVICENAME FILE."),
+ N_("[-d] [-D] DEVICENAME FILE."),
/* TRANSLATORS: The file itself is not destroyed
or transformed into drive. */
N_("Make a virtual drive from a file."), options);