summaryrefslogtreecommitdiff
path: root/debian/patches/fix-get-children-source.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/fix-get-children-source.patch')
-rw-r--r--debian/patches/fix-get-children-source.patch213
1 files changed, 184 insertions, 29 deletions
diff --git a/debian/patches/fix-get-children-source.patch b/debian/patches/fix-get-children-source.patch
index 59848829..9a538f20 100644
--- a/debian/patches/fix-get-children-source.patch
+++ b/debian/patches/fix-get-children-source.patch
@@ -1,28 +1,26 @@
diff --git a/hurd/fs.defs b/hurd/fs.defs
-index 52d83bd..cb7abe5 100644
+index 52d83bd..2452682 100644
--- a/hurd/fs.defs
+++ b/hurd/fs.defs
-@@ -352,3 +352,24 @@ routine file_reparent (
+@@ -352,3 +352,22 @@ routine file_reparent (
RPT
parent: mach_port_t;
out new_file: mach_port_send_t);
+
-+/* XXX: update description */
-+/* Return any active translators bound to nodes of the receiving
-+ filesystem. CHILDREN is an argz vector containing file names
-+ relative to the root of the receiving translator. */
++/* Return any active translators bound to nodes below FILE. CHILDREN
++ is an argz vector containing file names relative to the root of the
++ receiving translator. */
+routine file_get_children (
+ file: file_t;
+ RPT
+ out children: data_t);
+
-+/* XXX: update description */
-+/* Return information about the source of the receiving filesystem.
-+ If the concept of a source is applicable, SOURCE should refer to
-+ the source of the receiving translator and should be a description
-+ considered appropriate in the context of the translator. For
-+ example for the case of block device based filesystems, SOURCE
-+ should be the file name of the underlying block device. */
++/* Return information about the source of FILE. If the concept of a
++ source is applicable, SOURCE should refer to the source of FILE and
++ should be a description considered appropriate in the context of
++ the translator. For example, if FILE refers to a node on a
++ filesystems, SOURCE should be the file name of the underlying block
++ device. */
+routine file_get_source (
+ file: file_t;
+ RPT
@@ -68,6 +66,26 @@ index 03c2e2b..aeebe4e 100644
IFSOCKSRCS=ifsock.c
OTHERSRCS = conch-fetch.c conch-set.c dir-clear.c dir-init.c dir-renamed.c \
extern-inline.c \
+diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h
+index 22262aa..db6a1d8 100644
+--- a/libdiskfs/diskfs.h
++++ b/libdiskfs/diskfs.h
+@@ -569,10 +569,11 @@ error_t (*diskfs_create_symlink_hook)(struct node *np, const char *target);
+ error_t (*diskfs_read_symlink_hook)(struct node *np, char *target);
+
+ /* The user may define this function. The function must set source to
+- the source device of the filesystem. The function may return an
+- EOPNOTSUPP to indicate that the concept of a source device is not
+- applicable. The default function always returns EOPNOTSUPP. */
+-error_t diskfs_get_source (char *source);
++ the source of CRED. The function may return an EOPNOTSUPP to
++ indicate that the concept of a source device is not applicable. The
++ default function always returns EOPNOTSUPP. */
++error_t diskfs_get_source (struct protid *cred,
++ char *source, size_t source_len);
+
+ /* The library exports the following functions for general use */
+
diff --git a/libdiskfs/file-get-children.c b/libdiskfs/file-get-children.c
new file mode 100644
index 0000000..4581e4e
@@ -171,7 +189,7 @@ index 0000000..4581e4e
+}
diff --git a/libdiskfs/file-get-source.c b/libdiskfs/file-get-source.c
new file mode 100644
-index 0000000..4fbb445
+index 0000000..b5c3184
--- /dev/null
+++ b/libdiskfs/file-get-source.c
@@ -0,0 +1,37 @@
@@ -209,8 +227,8 @@ index 0000000..4fbb445
+ || cred->pi.bucket != diskfs_port_bucket
+ || cred->pi.class != diskfs_protid_class)
+ return EOPNOTSUPP;
-+ // XXX use cred
-+ return diskfs_get_source (source);
++
++ return diskfs_get_source (cred, source, 1024 /* XXX */);
+}
diff --git a/libdiskfs/fsys-get-children.c b/libdiskfs/fsys-get-children.c
deleted file mode 100644
@@ -357,6 +375,25 @@ index 08f227c..0000000
-{
- return diskfs_get_source (source);
-}
+diff --git a/libdiskfs/get-source.c b/libdiskfs/get-source.c
+index d0c143b..4399446 100644
+--- a/libdiskfs/get-source.c
++++ b/libdiskfs/get-source.c
+@@ -22,7 +22,12 @@
+ #include "priv.h"
+
+ error_t
+-diskfs_get_source (char *source)
++diskfs_get_source (struct protid *cred, char *source, size_t source_len)
+ {
+- return EOPNOTSUPP;
++ if (diskfs_disk_name == NULL)
++ return EOPNOTSUPP;
++
++ strncpy (source, diskfs_disk_name, source_len - 1);
++ source[source_len - 1] = '\0';
++ return 0;
+ }
diff --git a/libnetfs/Makefile b/libnetfs/Makefile
index 1a71b49..c3830c0 100644
--- a/libnetfs/Makefile
@@ -486,10 +523,10 @@ index 0000000..80a727f
+}
diff --git a/libnetfs/file-get-source.c b/libnetfs/file-get-source.c
new file mode 100644
-index 0000000..33db4e4
+index 0000000..8b73d5a
--- /dev/null
+++ b/libnetfs/file-get-source.c
-@@ -0,0 +1,38 @@
+@@ -0,0 +1,37 @@
+/* file_get_source
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
@@ -525,8 +562,7 @@ index 0000000..33db4e4
+ || cred->pi.class != netfs_protid_class)
+ return EOPNOTSUPP;
+
-+ // use cred
-+ return netfs_get_source (source);
++ return netfs_get_source (cred, source, 1024 /* XXX */);
+}
diff --git a/libnetfs/fsys-get-children.c b/libnetfs/fsys-get-children.c
deleted file mode 100644
@@ -686,6 +722,39 @@ index 6143d10..0000000
-{
- return netfs_get_source (source);
-}
+diff --git a/libnetfs/get-source.c b/libnetfs/get-source.c
+index 71a9639..73e48be 100644
+--- a/libnetfs/get-source.c
++++ b/libnetfs/get-source.c
+@@ -22,7 +22,7 @@
+ #include "priv.h"
+
+ error_t
+-netfs_get_source (char *source)
++netfs_get_source (struct protid *cred, char *source, size_t source_len)
+ {
+ return EOPNOTSUPP;
+ }
+diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h
+index e10ccae..5d50f57 100644
+--- a/libnetfs/netfs.h
++++ b/libnetfs/netfs.h
+@@ -315,10 +315,11 @@ error_t netfs_file_get_storage_info (struct iouser *cred,
+ mach_msg_type_number_t *data_len);
+
+ /* The user may define this function. The function must set source to
+- the source device of the filesystem. The function may return an
+- EOPNOTSUPP to indicate that the concept of a source device is not
+- applicable. The default function always returns EOPNOTSUPP. */
+-error_t netfs_get_source (char *source);
++ the source of CRED. The function may return an EOPNOTSUPP to
++ indicate that the concept of a source device is not applicable. The
++ default function always returns EOPNOTSUPP. */
++error_t netfs_get_source (struct protid *cred,
++ char *source, size_t source_len);
+
+ /* Option parsing */
+
diff --git a/libtrivfs/Makefile b/libtrivfs/Makefile
index 241b76d..3e4c039 100644
--- a/libtrivfs/Makefile
@@ -742,10 +811,10 @@ index 0000000..a3afbba
+}
diff --git a/libtrivfs/file-get-source.c b/libtrivfs/file-get-source.c
new file mode 100644
-index 0000000..dd6d7d7
+index 0000000..35636b5
--- /dev/null
+++ b/libtrivfs/file-get-source.c
-@@ -0,0 +1,34 @@
+@@ -0,0 +1,33 @@
+/* file_get_source
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
@@ -777,8 +846,7 @@ index 0000000..dd6d7d7
+ mach_msg_type_name_t replyPoly,
+ char *source)
+{
-+ // xxx use cred
-+ return cred ? trivfs_get_source (source) : EOPNOTSUPP;
++ return cred? trivfs_get_source (cred, source, 1024 /* XXX */): EOPNOTSUPP;
+}
diff --git a/libtrivfs/fsys-get-children.c b/libtrivfs/fsys-get-children.c
deleted file mode 100644
@@ -860,6 +928,64 @@ index 64aec2f..0000000
-{
- return trivfs_get_source (source);
-}
+diff --git a/libtrivfs/get-source.c b/libtrivfs/get-source.c
+index 9ea5693..2605dac 100644
+--- a/libtrivfs/get-source.c
++++ b/libtrivfs/get-source.c
+@@ -22,7 +22,7 @@
+ #include "priv.h"
+
+ error_t
+-trivfs_get_source (char *source)
++trivfs_get_source (struct trivfs_protid *cred, char *source, size_t source_len)
+ {
+ return EOPNOTSUPP;
+ }
+diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h
+index cf817b5..306a430 100644
+--- a/libtrivfs/trivfs.h
++++ b/libtrivfs/trivfs.h
+@@ -235,10 +235,11 @@ error_t trivfs_append_args (struct trivfs_control *fsys,
+ char **argz, size_t *argz_len);
+
+ /* The user may define this function. The function must set source to
+- the source device of the filesystem. The function may return an
+- EOPNOTSUPP to indicate that the concept of a source device is not
+- applicable. The default function always returns EOPNOTSUPP. */
+-error_t trivfs_get_source (char *source);
++ the source device of CRED. The function may return an EOPNOTSUPP to
++ indicate that the concept of a source device is not applicable. The
++ default function always returns EOPNOTSUPP. */
++error_t trivfs_get_source (struct trivfs_protid *cred,
++ char *source, size_t source_len);
+
+ /* Add the port class *CLASS to the list of control port classes recognized
+ by trivfs; if *CLASS is 0, an attempt is made to allocate a new port
+diff --git a/nfs/main.c b/nfs/main.c
+index 3ce75a9..33cda67 100644
+--- a/nfs/main.c
++++ b/nfs/main.c
+@@ -269,6 +269,20 @@ netfs_append_args (char **argz, size_t *argz_len)
+ return err;
+ }
+
++/* The user may define this function. The function must set source to
++ the source of CRED. The function may return an EOPNOTSUPP to
++ indicate that the concept of a source device is not applicable. The
++ default function always returns EOPNOTSUPP. */
++error_t
++netfs_get_source (struct protid *cred, char *source, size_t source_len)
++{
++ if (! cred)
++ return EOPNOTSUPP;
++
++ asprintf (source, source_len, "%s:%s", host, remote_fs);
++ return 0;
++}
++
+ /* Extract the host and remote filesystem names from SPEC, which should use
+ either HOST:FS or FS@HOST notation. Returns the malloced storage into
+ which both REMOTE_FS and HOST point, or 0 if SPEC is invalid. */
diff --git a/trans/Makefile b/trans/Makefile
index c0386d0..90df479 100644
--- a/trans/Makefile
@@ -874,19 +1000,48 @@ index c0386d0..90df479 100644
$(targets): %: %.o
diff --git a/trans/mtab.c b/trans/mtab.c
-index 75ef1d3..d5fc7a0 100644
+index 75ef1d3..744c435 100644
--- a/trans/mtab.c
+++ b/trans/mtab.c
-@@ -421,7 +421,7 @@ mtab_populate (struct mtab *mtab, const char *path, int insecure)
+@@ -36,7 +36,7 @@
+ #include <unistd.h>
+ #include <version.h>
+
+-#include "fsys_U.h"
++#include "fs_U.h"
+
+ static char *target_path = NULL;
+ static int insecure = 0;
+@@ -421,21 +421,14 @@ mtab_populate (struct mtab *mtab, const char *path, int insecure)
argz_stringify (options, options_len, ',');
string_t source;
- err = fsys_get_source (node, source);
+ err = file_get_source (node, source);
if (err)
- {
- if (err == EOPNOTSUPP)
-@@ -450,7 +450,7 @@ mtab_populate (struct mtab *mtab, const char *path, int insecure)
+- {
+- if (err == EOPNOTSUPP)
+- {
+- /* Guess based on the last argument. */
+- err = map_device_to_path (argv[count - 1], &src);
+- if (err)
+- goto errout;
+- }
+- else
+- goto errout;
+- }
+- else
+- src = source;
++ goto errout;
++
++ /* Guess based on the last argument. */
++ err = map_device_to_path (source, &src);
++ if (err)
++ goto errout;
+
+ entry_len = asprintf (&entry, "%s %s %s %s 0 0\n", src, path, type,
+ options? options: MNTOPT_DEFAULTS);
+@@ -450,7 +443,7 @@ mtab_populate (struct mtab *mtab, const char *path, int insecure)
goto errout;
/* path has an active translator, query its children. */