#include "setproctitle.h"
#endif
+/* Quiet mode */
+int mount_quiet = 0;
+
+/* Debug mode (level) */
+int mount_debug = 0;
+
+
/* True for fake mount (-f). */
static int fake = 0;
return 0;
}
-int mount_quiet=0;
/* Report on a single mount. */
static void
if ((flags & MS_MGC_MSK) == 0)
flags |= MS_MGC_VAL;
+ mnt_debug(1, "mount(2) syscall: source=\"%s\" target=\"%s\" "
+ "filesystemtype=\"%s\" mountflags=%lu data=%s",
+ args->spec, args->node, args->type, flags, args->data ? "YES" : "NOT");
+
ret = mount (args->spec, args->node, args->type, flags, args->data);
if (ret == 0)
mountcount++;
res = fork();
if (res == 0) {
const char *oo, *mountargs[10];
- int i = 0;
+ int i = 0, x;
setuid(getuid());
setgid(getgid());
mountargs[i++] = oo;
}
mountargs[i] = NULL;
+
+ for(x = 0; x < 10 && mountargs[x]; x++)
+ mnt_debug(1, "external mount: argv[%d] = \"%s\"",
+ x, mountargs[x]);
+
execv(mountprog, (char **) mountargs);
exit(1); /* exec failed */
} else if (res != -1) {
/* copies for freeing on exit */
const char *opts1, *spec1, *node1, *types1, *extra_opts1;
+ mnt_debug(1, "spec: \"%s\"", spec0);
+ mnt_debug(1, "node: \"%s\"", node0);
+ mnt_debug(1, "types: \"%s\"", types0);
+ mnt_debug(1, "opts: \"%s\"", opts0);
+
spec = spec1 = xstrdup(spec0);
node = node1 = xstrdup(node0);
types = types1 = xstrdup(types0);
static struct option longopts[] = {
{ "all", 0, 0, 'a' },
+ { "debug", 1, 0, 'd' },
{ "fake", 0, 0, 'f' },
{ "fork", 0, 0, 'F' },
{ "help", 0, 0, 'h' },
initproctitle(argc, argv);
#endif
- while ((c = getopt_long (argc, argv, "afFhilL:no:O:p:rsU:vVwt:",
+ while ((c = getopt_long (argc, argv, "ad:fFhilL:no:O:p:rsU:vVwt:",
longopts, NULL)) != -1) {
switch (c) {
case 'a': /* mount everything in fstab */
++mount_all;
break;
+ case 'd':
+ mount_debug = atoi(optarg);
+ break;
case 'f': /* fake: don't actually call mount(2) */
++fake;
break;
}
}
+ mnt_debug(2, "fstab path: \"%s\"", _PATH_FSTAB);
+ mnt_debug(2, "lock path: \"%s\"", MOUNTED_LOCK);
+ mnt_debug(2, "temp path: \"%s\"", MOUNTED_TEMP);
+
argc -= optind;
argv += optind;