summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/patches/netfs-fix-fsys-receiver-lookups.patch278
-rw-r--r--debian/patches/series1
2 files changed, 279 insertions, 0 deletions
diff --git a/debian/patches/netfs-fix-fsys-receiver-lookups.patch b/debian/patches/netfs-fix-fsys-receiver-lookups.patch
new file mode 100644
index 00000000..54d06a09
--- /dev/null
+++ b/debian/patches/netfs-fix-fsys-receiver-lookups.patch
@@ -0,0 +1,278 @@
+commit d9bcd42894027ae75e898d4a143c82f48f6c2eed
+Author: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Wed Feb 12 11:24:14 2014 +0100
+
+ libnetfs: fix receiver lookups in fsys server functions
+
+ * mutations.h: Add translation functions.
+ * netfs.h (struct netfs_control): New declaration.
+ * priv.h: Define translation functions.
+ * fsys-get-options.c: Fix receiver lookups.
+ * fsys-getroot.c: Likewise.
+ * fsys-goaway.c: Likewise.
+ * fsys-set-options.c: Likewise.
+ * fsys-syncfs.c: Likewise.
+ * fsysstubs.c: Likewise.
+
+diff --git a/libnetfs/fsys-get-options.c b/libnetfs/fsys-get-options.c
+index 54bd9a0..bc5be63 100644
+--- a/libnetfs/fsys-get-options.c
++++ b/libnetfs/fsys-get-options.c
+@@ -31,7 +31,7 @@
+
+ /* Implement fsys_get_options as described in <hurd/fsys.defs>. */
+ error_t
+-netfs_S_fsys_get_options (fsys_t fsys,
++netfs_S_fsys_get_options (struct netfs_control *port,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ char **data, mach_msg_type_number_t *data_len)
+@@ -39,10 +39,10 @@ netfs_S_fsys_get_options (fsys_t fsys,
+ error_t err;
+ char *argz = 0;
+ size_t argz_len = 0;
+- struct port_info *port =
+- ports_lookup_port (netfs_port_bucket, fsys, netfs_control_class);
+
+- if (!port)
++ if (!port
++ || port->pi.bucket != netfs_port_bucket
++ || port->pi.class != netfs_control_class)
+ return EOPNOTSUPP;
+
+ err = argz_add (&argz, &argz_len, program_invocation_name);
+@@ -63,7 +63,5 @@ netfs_S_fsys_get_options (fsys_t fsys,
+ else
+ free (argz);
+
+- ports_port_deref (port);
+-
+ return err;
+ }
+diff --git a/libnetfs/fsys-getroot.c b/libnetfs/fsys-getroot.c
+index 0d80111..fc774e1 100644
+--- a/libnetfs/fsys-getroot.c
++++ b/libnetfs/fsys-getroot.c
+@@ -25,7 +25,7 @@
+ #include <fcntl.h>
+
+ error_t
+-netfs_S_fsys_getroot (mach_port_t cntl,
++netfs_S_fsys_getroot (struct netfs_control *pt,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ mach_port_t dotdot,
+@@ -37,8 +37,6 @@ netfs_S_fsys_getroot (mach_port_t cntl,
+ mach_port_t *retry_port,
+ mach_msg_type_name_t *retry_port_type)
+ {
+- struct port_info *pt = ports_lookup_port (netfs_port_bucket, cntl,
+- netfs_control_class);
+ struct iouser *cred;
+ error_t err;
+ struct protid *newpi;
+@@ -49,9 +47,10 @@ netfs_S_fsys_getroot (mach_port_t cntl,
+ path: NULL,
+ };
+
+- if (!pt)
++ if (!pt
++ || pt->pi.bucket != netfs_port_bucket
++ || pt->pi.class != netfs_control_class)
+ return EOPNOTSUPP;
+- ports_port_deref (pt);
+
+ err = iohelp_create_complex_iouser (&cred, uids, nuids, gids, ngids);
+ if (err)
+diff --git a/libnetfs/fsys-goaway.c b/libnetfs/fsys-goaway.c
+index 0ac36d3..ec5db18 100644
+--- a/libnetfs/fsys-goaway.c
++++ b/libnetfs/fsys-goaway.c
+@@ -26,17 +26,17 @@
+ #include <hurd/ports.h>
+
+ error_t
+-netfs_S_fsys_goaway (fsys_t control,
++netfs_S_fsys_goaway (struct netfs_control *pt,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ int flags)
+ {
+ error_t err;
+- struct port_info *pt;
+
+- pt = ports_lookup_port (netfs_port_bucket, control,
+- netfs_control_class);
+- if (! pt)
++
++ if (!pt
++ || pt->pi.bucket != netfs_port_bucket
++ || pt->pi.class != netfs_control_class)
+ return EOPNOTSUPP;
+
+ err = netfs_shutdown (flags);
+@@ -46,7 +46,5 @@ netfs_S_fsys_goaway (fsys_t control,
+ exit (0);
+ }
+
+- ports_port_deref (pt);
+-
+ return err;
+ }
+diff --git a/libnetfs/fsys-set-options.c b/libnetfs/fsys-set-options.c
+index d7dc743..c182ee2 100644
+--- a/libnetfs/fsys-set-options.c
++++ b/libnetfs/fsys-set-options.c
+@@ -31,15 +31,17 @@
+
+ /* Implement fsys_set_options as described in <hurd/fsys.defs>. */
+ error_t
+-netfs_S_fsys_set_options (fsys_t fsys,
++netfs_S_fsys_set_options (struct netfs_control *pt,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ char *data, mach_msg_type_number_t data_len,
+ int do_children)
+ {
+ error_t err = 0;
+- struct port_info *pt =
+- ports_lookup_port (netfs_port_bucket, fsys, netfs_control_class);
++ if (!pt
++ || pt->pi.bucket != netfs_port_bucket
++ || pt->pi.class != netfs_control_class)
++ return EOPNOTSUPP;
+
+ error_t
+ helper (struct node *np)
+@@ -64,9 +66,6 @@ netfs_S_fsys_set_options (fsys_t fsys,
+ return error;
+ }
+
+- if (!pt)
+- return EOPNOTSUPP;
+-
+ #if NOT_YET
+ if (do_children)
+ {
+@@ -87,7 +86,5 @@ netfs_S_fsys_set_options (fsys_t fsys,
+ #endif
+ }
+
+- ports_port_deref (pt);
+-
+ return err;
+ }
+diff --git a/libnetfs/fsys-syncfs.c b/libnetfs/fsys-syncfs.c
+index f57cb14..e232936 100644
+--- a/libnetfs/fsys-syncfs.c
++++ b/libnetfs/fsys-syncfs.c
+@@ -22,7 +22,7 @@
+ #include "fsys_S.h"
+
+ error_t
+-netfs_S_fsys_syncfs (mach_port_t cntl,
++netfs_S_fsys_syncfs (struct netfs_control *cntl,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ int wait,
+diff --git a/libnetfs/fsysstubs.c b/libnetfs/fsysstubs.c
+index f44155d..a64fd64 100644
+--- a/libnetfs/fsysstubs.c
++++ b/libnetfs/fsysstubs.c
+@@ -23,7 +23,7 @@
+ #include "fsys_S.h"
+
+ error_t
+-netfs_S_fsys_getfile (fsys_t cntl,
++netfs_S_fsys_getfile (struct netfs_control *cntl,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ uid_t *uids, mach_msg_type_number_t nuids,
+@@ -35,7 +35,7 @@ netfs_S_fsys_getfile (fsys_t cntl,
+ }
+
+ error_t
+-netfs_S_fsys_getpriv (fsys_t cntl,
++netfs_S_fsys_getpriv (struct netfs_control *cntl,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ mach_port_t *host, mach_msg_type_name_t *hosttp,
+@@ -46,7 +46,7 @@ netfs_S_fsys_getpriv (fsys_t cntl,
+ }
+
+ error_t
+-netfs_S_fsys_init (fsys_t cntl,
++netfs_S_fsys_init (struct netfs_control *cntl,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ mach_port_t proc, auth_t auth)
+@@ -55,7 +55,7 @@ netfs_S_fsys_init (fsys_t cntl,
+ }
+
+ error_t
+-netfs_S_fsys_forward (fsys_t cntl,
++netfs_S_fsys_forward (mach_port_t cntl,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ mach_port_t request,
+diff --git a/libnetfs/mutations.h b/libnetfs/mutations.h
+index e6700f5..51ca871 100644
+--- a/libnetfs/mutations.h
++++ b/libnetfs/mutations.h
+@@ -28,6 +28,9 @@
+ #define IO_INTRAN protid_t begin_using_protid_port (io_t)
+ #define IO_DESTRUCTOR end_using_protid_port (protid_t)
+
++#define FSYS_INTRAN control_t begin_using_control_port (fsys_t)
++#define FSYS_DESTRUCTOR end_using_control_port (control_t)
++
+ #define FILE_IMPORTS import "netfs.h"; import "priv.h";
+ #define IO_IMPORTS import "netfs.h"; import "priv.h";
+ #define FSYS_IMPORTS import "netfs.h"; import "priv.h";
+diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h
+index 5d50f57..aef4a3d 100644
+--- a/libnetfs/netfs.h
++++ b/libnetfs/netfs.h
+@@ -100,6 +100,11 @@ struct node
+ struct dirmod *dirmod_reqs;
+ };
+
++struct netfs_control
++{
++ struct port_info pi;
++};
++
+ /* The user must define this variable. Set this to the name of the
+ filesystem server. */
+ extern char *netfs_server_name;
+@@ -437,6 +442,7 @@ extern auth_t netfs_auth_server_port;
+
+ /* Mig gook. */
+ typedef struct protid *protid_t;
++typedef struct netfs_control *control_t;
+
+
+ #endif /* _HURD_NETFS_H_ */
+diff --git a/libnetfs/priv.h b/libnetfs/priv.h
+index 00db9fa..ba31080 100644
+--- a/libnetfs/priv.h
++++ b/libnetfs/priv.h
+@@ -37,4 +37,18 @@ end_using_protid_port (struct protid *cred)
+ if (cred)
+ ports_port_deref (cred);
+ }
++
++static inline struct netfs_control * __attribute__ ((unused))
++begin_using_control_port (fsys_t port)
++{
++ return ports_lookup_port (netfs_port_bucket, port, netfs_control_class);
++}
++
++static inline void __attribute__ ((unused))
++end_using_control_port (struct netfs_control *cred)
++{
++ if (cred)
++ ports_port_deref (cred);
++}
++
+ #endif
diff --git a/debian/patches/series b/debian/patches/series
index 2171ac28..f3a26d9d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -47,3 +47,4 @@ revert-remove-threadvars-hack.patch
xkb-compat.patch
fix-get-children-source.patch
#diskfs-fix-fsys-receiver-lookups.patch
+netfs-fix-fsys-receiver-lookups.patch