int showdev = 0;
int ro = 0;
int pfd = -1;
- unsigned long long off, slimit;
+ int keysz = 0;
+ int hash_pass = 1;
+ uintmax_t off = 0, slimit = 0;
struct option longopts[] = {
{ "all", 0, 0, 'a' },
{ "set-capacity", 0, 0, 'c' },
textdomain(PACKAGE);
capacity = delete = find = all = 0;
- off = 0;
- slimit = 0;
assoc = offset = sizelimit = encryption = passfd = NULL;
+ keysize = NULL;
progname = argv[0];
if ((p = strrchr(progname, '/')) != NULL)
static const char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_sizelimit,
*opt_encryption, *opt_speed, *opt_comment, *opt_uhelper;
+static const char *opt_keybits, *opt_nohashpass;
+ static int is_readonly(const char *node);
static int mounted (const char *spec0, const char *node0);
static int check_special_mountprog(const char *spec, const char *node,
const char *type, int flags, char *extra_opts, int *status);
*type = opt_vfstype;
}
- *loop = ((*flags & MS_LOOP) || *loopdev || opt_offset || opt_sizelimit || opt_encryption);
+ *loop = ((*flags & MS_LOOP) || *loopdev || opt_offset || opt_sizelimit || opt_encryption || opt_keybits);
*loopfile = *spec;
+ /* Automatically create a loop device from a regular file if a filesystem
+ * is not specified or the filesystem is known for libblkid (these
+ * filesystems work with block devices only).
+ *
+ * Note that there is not a restriction (on kernel side) that prevents regular
+ * file as a mount(2) source argument. A filesystem that is able to mount
+ * regular files could be implemented.
+ */
+ if (!*loop && (!*type || strcmp(*type, "auto") == 0 ||
+ fsprobe_known_fstype(*type))) {
+ struct stat st;
+ if (stat(*loopfile, &st) == 0)
+ *loop = S_ISREG(st.st_mode);
+ }
+
if (*loop) {
*flags |= MS_LOOP;
if (fake) {