summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-06-29 19:24:18 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-06-29 19:24:18 +0000
commitf6cd517c34f552e883abbaf811ccfb8c718ca525 (patch)
tree2ff609e5bc722f88e8ec98ab04d4e9595a242c3c
parentd5717ce6f31a81dd8a02b595c2833ede66d7561a (diff)
make mount more compatible with Linux'
patches/mount-{f,n,remount}.patch from Justus Winter
-rw-r--r--debian/changelog7
-rw-r--r--debian/patches/mount-f.patch88
-rw-r--r--debian/patches/mount-n.patch37
-rw-r--r--debian/patches/mount-remount.patch67
-rw-r--r--debian/patches/series3
5 files changed, 202 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 8ea0ae9a..c516e854 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+hurd (20130620-1.1) UNRELEASED; urgency=low
+
+ * patches/mount-{f,n,remount}.patch: New patches from Justus Winter to make
+ mount more compatible with Linux'.
+
+ -- Samuel Thibault <sthibault@debian.org> Wed, 19 Jun 2013 23:32:07 +0000
+
hurd (20130620-1) unstable; urgency=low
* New upstream release.
diff --git a/debian/patches/mount-f.patch b/debian/patches/mount-f.patch
new file mode 100644
index 00000000..aabc47b7
--- /dev/null
+++ b/debian/patches/mount-f.patch
@@ -0,0 +1,88 @@
+Add -f and --fake arguments. This makes our mount more compatible with
+Linux mount.
+
+* utils/mount.c (argp_opts): Add -f and --fake.
+(do_mount): Fake the translator startup if --fake is given.
+---
+ utils/mount.c | 29 ++++++++++++++++++++++++++++-
+ 1 file changed, 28 insertions(+), 1 deletion(-)
+
+diff --git a/utils/mount.c b/utils/mount.c
+index f1d5750..f8928f1 100644
+--- a/utils/mount.c
++++ b/utils/mount.c
+@@ -24,6 +24,7 @@
+ #include <error.h>
+ #include <stdlib.h>
+ #include <fcntl.h>
++#include <unistd.h>
+ #include <hurd/fsys.h>
+ #include <hurd/fshelp.h>
+ #include <hurd/paths.h>
+@@ -34,6 +35,7 @@
+ static char *fstype = DEFAULT_FSTYPE;
+ static char *device, *mountpoint;
+ static int verbose;
++static int fake;
+ static char *options;
+ static size_t options_len;
+ static mach_msg_timeout_t timeout;
+@@ -55,6 +57,7 @@ static const struct argp_option argp_opts[] =
+ {"remount", 0, 0, OPTION_ALIAS},
+ {"verbose", 'v', 0, 0, "Give more detailed information"},
+ {"no-mtab", 'n', 0, 0, "Do not update /etc/mtab"},
++ {"fake", 'f', 0, 0, "Do not actually mount, just pretend"},
+ {0, 0}
+ };
+
+@@ -115,6 +118,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
+ /* do nothing */
+ break;
+
++ case 'f':
++ fake = 1;
++ break;
++
+ case ARGP_KEY_ARG:
+ if (mountpoint == 0) /* One arg: mountpoint */
+ mountpoint = arg;
+@@ -312,7 +319,10 @@ do_mount (struct fs *fs, int remount)
+ return 0;
+ }
+
+- if (mounted != MACH_PORT_NULL)
++ /* Do not fail if there is an active translator if --fake is
++ given. This mimics Linux mount utility more closely which
++ just looks into the mtab file. */
++ if (mounted != MACH_PORT_NULL && !fake)
+ {
+ error (0, 0, "%s already mounted", fs->mntent.mnt_fsname);
+ return EBUSY;
+@@ -342,6 +352,23 @@ do_mount (struct fs *fs, int remount)
+
+ /* Now we have a translator command line argz in FSOPTS. */
+
++ if (fake) {
++ /* Fake the translator startup. */
++ mach_port_t underlying;
++ mach_msg_type_name_t underlying_type;
++ err = open_node (O_READ, &underlying, &underlying_type, 0, NULL);
++ if (err)
++ error (1, errno, "cannot mount on %s", fs->mntent.mnt_dir);
++
++ mach_port_deallocate (mach_task_self (), underlying);
++
++ /* See if the translator is at least executable. */
++ if (access(type->program, X_OK) == -1)
++ error (1, errno, "can not execute %s", type->program);
++
++ return 0;
++ }
++
+ explain ("settrans -a");
+ err = fshelp_start_translator (open_node, NULL, fsopts,
+ fsopts, fsopts_len, timeout,
+--
+1.7.10.4
+
+
diff --git a/debian/patches/mount-n.patch b/debian/patches/mount-n.patch
new file mode 100644
index 00000000..9b860877
--- /dev/null
+++ b/debian/patches/mount-n.patch
@@ -0,0 +1,37 @@
+Add -n and --no-mtab arguments. As we do not write an mtab file, this
+is a trivial patch that just ignores this argument to be more
+compatible with Linux mount.
+
+* utils/mount.c (argp_opts): Add -n and --no-mtab.
+(parse_opt): Do nothing on 'n'.
+---
+ utils/mount.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/utils/mount.c b/utils/mount.c
+index 8b059c2..ea30f7a 100644
+--- a/utils/mount.c
++++ b/utils/mount.c
+@@ -54,6 +54,7 @@ static const struct argp_option argp_opts[] =
+ {"update", 'u', 0, 0, "Flush any meta-data cached in core"},
+ {"remount", 0, 0, OPTION_ALIAS},
+ {"verbose", 'v', 0, 0, "Give more detailed information"},
++ {"no-mtab", 'n', 0, 0, "Do not update /etc/mtab"},
+ {0, 0}
+ };
+
+@@ -110,6 +111,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
+ }
+ break;
+
++ case 'n':
++ /* do nothing */
++ break;
++
+ case ARGP_KEY_ARG:
+ if (mountpoint == 0) /* One arg: mountpoint */
+ mountpoint = arg;
+--
+1.7.10.4
+
+
diff --git a/debian/patches/mount-remount.patch b/debian/patches/mount-remount.patch
new file mode 100644
index 00000000..53eccb2b
--- /dev/null
+++ b/debian/patches/mount-remount.patch
@@ -0,0 +1,67 @@
+This fixes mount -oremount when just given the mountpoint, e. g.:
+
+ % mount -oremount,ro /tmp
+
+* util/mount.c (main): Add a one-argument form for remount.
+---
+ utils/mount.c | 29 +++++++++++++++++++++++------
+ 1 file changed, 23 insertions(+), 6 deletions(-)
+
+diff --git a/utils/mount.c b/utils/mount.c
+index ea30f7a..f1d5750 100644
+--- a/utils/mount.c
++++ b/utils/mount.c
+@@ -526,6 +526,12 @@ main (int argc, char **argv)
+
+ fstab = fstab_argp_create (&fstab_params, SEARCH_FMTS, sizeof SEARCH_FMTS);
+
++ /* This is a convenient way of checking for any `remount' options. */
++ remount = 0;
++ err = argz_replace (&options, &options_len, "remount", "update", &remount);
++ if (err)
++ error (3, ENOMEM, "collecting mount options");
++
+ if (device) /* two-argument form */
+ {
+ struct mntent m =
+@@ -548,6 +554,23 @@ main (int argc, char **argv)
+ if (err)
+ error (2, err, "%s", mountpoint);
+ }
++ else if (mountpoint && remount) /* one-argument remount */
++ {
++ struct mntent m =
++ {
++ mnt_fsname: mountpoint, /* since we cannot know the device,
++ using mountpoint here leads to more
++ helpful error messages */
++ mnt_dir: mountpoint,
++ mnt_type: fstype,
++ mnt_opts: 0,
++ mnt_freq: 0, mnt_passno: 0
++ };
++
++ err = fstab_add_mntent (fstab, &m, &fs);
++ if (err)
++ error (2, err, "%s", mountpoint);
++ }
+ else if (mountpoint) /* one-argument form */
+ {
+ fs = fstab_find (fstab, mountpoint);
+@@ -557,12 +580,6 @@ main (int argc, char **argv)
+ else
+ fs = 0;
+
+- /* This is a convenient way of checking for any `remount' options. */
+- remount = 0;
+- err = argz_replace (&options, &options_len, "remount", "update", &remount);
+- if (err)
+- error (3, ENOMEM, "collecting mount options");
+-
+ if (fs != 0)
+ err = do_mount (fs, remount);
+ else
+--
+1.7.10.4
+
+
diff --git a/debian/patches/series b/debian/patches/series
index 299b9452..e8f140a3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -41,3 +41,6 @@ libmachdev.patch
exec_filename_exec.patch
exec_filename_fs.patch
exec_filename_use.patch
+mount-n.patch
+mount-f.patch
+mount-remount.patch