summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-11 20:05:29 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-11 20:05:29 +0100
commit79a36e27a55fa14f8d7fc690e2a37aa4d6960d61 (patch)
treebbdd5938360373c464b2a31c7a9b5166d952afeb
parent4933da643d9697c0bd9e474de4eb03c902944b36 (diff)
add diskfs-fix-fsys-receiver-lookups.patch
-rw-r--r--debian/patches/diskfs-fix-fsys-receiver-lookups.patch399
-rw-r--r--debian/patches/series1
2 files changed, 400 insertions, 0 deletions
diff --git a/debian/patches/diskfs-fix-fsys-receiver-lookups.patch b/debian/patches/diskfs-fix-fsys-receiver-lookups.patch
new file mode 100644
index 00000000..87397c8e
--- /dev/null
+++ b/debian/patches/diskfs-fix-fsys-receiver-lookups.patch
@@ -0,0 +1,399 @@
+diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c
+index 6d9a773..10bd2ee 100644
+--- a/libdiskfs/boot-start.c
++++ b/libdiskfs/boot-start.c
+@@ -426,17 +426,17 @@ diskfs_execboot_fsys_startup (mach_port_t port, int flags,
+ /* Called by init to get the privileged ports as described
+ in <hurd/fsys.defs>. */
+ kern_return_t
+-diskfs_S_fsys_getpriv (mach_port_t port,
++diskfs_S_fsys_getpriv (control_t init_bootstrap_port,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ mach_port_t *host_priv, mach_msg_type_name_t *hp_type,
+ mach_port_t *dev_master, mach_msg_type_name_t *dm_type,
+ mach_port_t *fstask, mach_msg_type_name_t *task_type)
+ {
+ error_t err;
+- struct port_info *init_bootstrap_port =
+- ports_lookup_port (diskfs_port_bucket, port, diskfs_initboot_class);
+
+- if (!init_bootstrap_port)
++ if (!init_bootstrap_port
++ || init_bootstrap_port->pi.bucket != diskfs_port_bucket
++ || init_bootstrap_port->pi.class != diskfs_initboot_class)
+ return EOPNOTSUPP;
+
+ err = get_privileged_ports (host_priv, dev_master);
+@@ -447,20 +447,17 @@ diskfs_S_fsys_getpriv (mach_port_t port,
+ *task_type = MACH_MSG_TYPE_COPY_SEND;
+ }
+
+- ports_port_deref (init_bootstrap_port);
+-
+ return err;
+ }
+
+ /* Called by init to give us ports to the procserver and authserver as
+ described in <hurd/fsys.defs>. */
+ kern_return_t
+-diskfs_S_fsys_init (mach_port_t port,
++diskfs_S_fsys_init (control_t pt,
+ mach_port_t reply, mach_msg_type_name_t replytype,
+ mach_port_t procserver,
+ mach_port_t authhandle)
+ {
+- struct port_infe *pt;
+ static int initdone = 0;
+ mach_port_t host, startup;
+ error_t err;
+@@ -468,10 +465,12 @@ diskfs_S_fsys_init (mach_port_t port,
+ struct protid *rootpi;
+ struct peropen *rootpo;
+
+- pt = ports_lookup_port (diskfs_port_bucket, port, diskfs_initboot_class);
+- if (!pt)
++
++ if (!pt
++ || pt->pi.bucket != diskfs_port_bucket
++ || pt->pi.class != diskfs_initboot_class)
+ return EOPNOTSUPP;
+- ports_port_deref (pt);
++
+ if (initdone)
+ return EOPNOTSUPP;
+ initdone = 1;
+diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h
+index db6a1d8..19859ac 100644
+--- a/libdiskfs/diskfs.h
++++ b/libdiskfs/diskfs.h
+@@ -121,6 +121,12 @@ struct node
+ int author_tracks_uid;
+ };
+
++/* XXX */
++struct diskfs_control
++{
++ struct port_info pi;
++};
++
+ /* Possibly lookup types for diskfs_lookup call */
+ enum lookup_type
+ {
+@@ -795,8 +801,10 @@ error_t diskfs_start_protid (struct peropen *po, struct protid **cred);
+ void diskfs_finish_protid (struct protid *cred, struct iouser *user);
+
+ extern struct protid * diskfs_begin_using_protid_port (file_t port);
++extern struct diskfs_control * diskfs_begin_using_control_port (fsys_t port);
+
+ extern void diskfs_end_using_protid_port (struct protid *cred);
++extern void diskfs_end_using_control_port (struct diskfs_control *cred);
+
+ #if defined(__USE_EXTERN_INLINES) || defined(DISKFS_DEFINE_EXTERN_INLINE)
+
+@@ -809,6 +817,13 @@ diskfs_begin_using_protid_port (file_t port)
+ return ports_lookup_port (diskfs_port_bucket, port, diskfs_protid_class);
+ }
+
++/* And for the fsys interface. */
++DISKFS_EXTERN_INLINE struct diskfs_control *
++diskfs_begin_using_control_port (fsys_t port)
++{
++ return ports_lookup_port (diskfs_port_bucket, port, diskfs_control_class);
++}
++
+ /* Called by MiG after server routines have been run; this
+ balances begin_using_protid_port, and is arranged for the io
+ and fs interfaces by fsmutations.h. */
+@@ -819,6 +834,14 @@ diskfs_end_using_protid_port (struct protid *cred)
+ ports_port_deref (cred);
+ }
+
++/* And for the fsys interface. */
++DISKFS_EXTERN_INLINE void
++diskfs_end_using_control_port (struct diskfs_control *cred)
++{
++ if (cred)
++ ports_port_deref (cred);
++}
++
+ #endif /* Use extern inlines. */
+
+ /* Called when a protid CRED has no more references. (Because references\
+diff --git a/libdiskfs/fsmutations.h b/libdiskfs/fsmutations.h
+index 5026810..68b6ae3 100644
+--- a/libdiskfs/fsmutations.h
++++ b/libdiskfs/fsmutations.h
+@@ -23,6 +23,9 @@
+ #define IO_INTRAN protid_t diskfs_begin_using_protid_port (io_t)
+ #define IO_DESTRUCTOR diskfs_end_using_protid_port (protid_t)
+
++#define FSYS_INTRAN control_t diskfs_begin_using_control_port (fsys_t)
++#define FSYS_DESTRUCTOR diskfs_end_using_control_port (control_t)
++
+ #define FILE_IMPORTS import "priv.h";
+ #define IO_IMPORTS import "priv.h";
+ #define FSYS_IMPORTS import "priv.h";
+diff --git a/libdiskfs/fsys-getfile.c b/libdiskfs/fsys-getfile.c
+index 2fe9495..374033f 100644
+--- a/libdiskfs/fsys-getfile.c
++++ b/libdiskfs/fsys-getfile.c
+@@ -27,7 +27,7 @@
+ /* Return in FILE & FILE_TYPE the file in FSYS corresponding to the NFS file
+ handle HANDLE & HANDLE_LEN. */
+ error_t
+-diskfs_S_fsys_getfile (mach_port_t fsys,
++diskfs_S_fsys_getfile (control_t pt,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ uid_t *uids, mach_msg_type_number_t nuids,
+ gid_t *gids, mach_msg_type_number_t ngids,
+@@ -41,15 +41,14 @@ diskfs_S_fsys_getfile (mach_port_t fsys,
+ struct protid *new_cred;
+ struct peropen *new_po;
+ struct iouser *user;
+- struct port_info *pt =
+- ports_lookup_port (diskfs_port_bucket, fsys, diskfs_control_class);
+
+- if (!pt)
++ if (!pt
++ || pt->pi.bucket != diskfs_port_bucket
++ || pt->pi.class != diskfs_control_class)
+ return EOPNOTSUPP;
+
+ if (handle_len != sizeof *f)
+ {
+- ports_port_deref (pt);
+ return EINVAL;
+ }
+
+@@ -58,14 +57,12 @@ diskfs_S_fsys_getfile (mach_port_t fsys,
+ err = diskfs_cached_lookup (f->data.cache_id, &node);
+ if (err)
+ {
+- ports_port_deref (pt);
+ return err;
+ }
+
+ if (node->dn_stat.st_gen != f->data.gen)
+ {
+ diskfs_nput (node);
+- ports_port_deref (pt);
+ return ESTALE;
+ }
+
+@@ -73,7 +70,6 @@ diskfs_S_fsys_getfile (mach_port_t fsys,
+ if (err)
+ {
+ diskfs_nput (node);
+- ports_port_deref (pt);
+ return err;
+ }
+
+@@ -98,7 +94,6 @@ diskfs_S_fsys_getfile (mach_port_t fsys,
+ iohelp_free_iouser (user);
+
+ diskfs_nput (node);
+- ports_port_deref (pt);
+
+ if (! err)
+ {
+diff --git a/libdiskfs/fsys-getroot.c b/libdiskfs/fsys-getroot.c
+index 85e1167..bae2582 100644
+--- a/libdiskfs/fsys-getroot.c
++++ b/libdiskfs/fsys-getroot.c
+@@ -26,7 +26,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+ /* Implement fsys_getroot as described in <hurd/fsys.defs>. */
+ kern_return_t
+-diskfs_S_fsys_getroot (fsys_t controlport,
++diskfs_S_fsys_getroot (control_t pt,
+ mach_port_t reply,
+ mach_msg_type_name_t replytype,
+ mach_port_t dotdot,
+@@ -40,8 +40,6 @@ diskfs_S_fsys_getroot (fsys_t controlport,
+ file_t *returned_port,
+ mach_msg_type_name_t *returned_port_poly)
+ {
+- struct port_info *pt = ports_lookup_port (diskfs_port_bucket, controlport,
+- diskfs_control_class);
+ error_t err = 0;
+ mode_t type;
+ struct protid *newpi;
+@@ -55,7 +53,9 @@ diskfs_S_fsys_getroot (fsys_t controlport,
+ path: NULL,
+ };
+
+- if (!pt)
++ if (!pt
++ || pt->pi.bucket != diskfs_port_bucket
++ || pt->pi.class != diskfs_control_class)
+ return EOPNOTSUPP;
+
+ flags &= O_HURD;
+@@ -200,8 +200,6 @@ diskfs_S_fsys_getroot (fsys_t controlport,
+ pthread_mutex_unlock (&diskfs_root_node->lock);
+ pthread_rwlock_unlock (&diskfs_fsys_lock);
+
+- ports_port_deref (pt);
+-
+ drop_idvec ();
+
+ return err;
+diff --git a/libdiskfs/fsys-goaway.c b/libdiskfs/fsys-goaway.c
+index 2aabce8..b70c0e8 100644
+--- a/libdiskfs/fsys-goaway.c
++++ b/libdiskfs/fsys-goaway.c
+@@ -25,16 +25,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+ /* Implement fsys_goaway as described in <hurd/fsys.defs>. */
+ error_t
+-diskfs_S_fsys_goaway (fsys_t controlport,
++diskfs_S_fsys_goaway (control_t pt,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ int flags)
+ {
+- struct port_info *pt = ports_lookup_port (diskfs_port_bucket, controlport,
+- diskfs_control_class);
+ error_t ret;
+
+- if (!pt)
++ if (!pt
++ || pt->pi.bucket != diskfs_port_bucket
++ || pt->pi.class != diskfs_control_class)
+ return EOPNOTSUPP;
+
+ /* XXX FSYS_GOAWAY_NOWAIT not implemented. */
+@@ -48,6 +48,5 @@ diskfs_S_fsys_goaway (fsys_t controlport,
+ exit (0);
+ }
+
+- ports_port_deref (pt);
+ return ret;
+ }
+diff --git a/libdiskfs/fsys-options.c b/libdiskfs/fsys-options.c
+index bb18319..771a9c4 100644
+--- a/libdiskfs/fsys-options.c
++++ b/libdiskfs/fsys-options.c
+@@ -28,15 +28,17 @@
+
+ /* Implement fsys_set_options as described in <hurd/fsys.defs>. */
+ kern_return_t
+-diskfs_S_fsys_set_options (fsys_t fsys,
++diskfs_S_fsys_set_options (control_t pt,
+ mach_port_t reply,
+ mach_msg_type_name_t replytype,
+ char *data, mach_msg_type_number_t len,
+ int do_children)
+ {
+ error_t err = 0;
+- struct port_info *pt =
+- ports_lookup_port (diskfs_port_bucket, fsys, diskfs_control_class);
++ if (!pt
++ || pt->pi.bucket != diskfs_port_bucket
++ || pt->pi.class != diskfs_control_class)
++ return EOPNOTSUPP;
+
+ error_t
+ helper (struct node *np)
+@@ -60,9 +62,6 @@ diskfs_S_fsys_set_options (fsys_t fsys,
+ return error;
+ }
+
+- if (!pt)
+- return EOPNOTSUPP;
+-
+ if (do_children)
+ {
+ pthread_rwlock_wrlock (&diskfs_fsys_lock);
+@@ -77,13 +76,12 @@ diskfs_S_fsys_set_options (fsys_t fsys,
+ pthread_rwlock_unlock (&diskfs_fsys_lock);
+ }
+
+- ports_port_deref (pt);
+ return err;
+ }
+
+ /* Implement fsys_get_options as described in <hurd/fsys.defs>. */
+ error_t
+-diskfs_S_fsys_get_options (fsys_t fsys,
++diskfs_S_fsys_get_options (control_t port,
+ mach_port_t reply,
+ mach_msg_type_name_t replytype,
+ char **data, mach_msg_type_number_t *data_len)
+@@ -91,10 +89,10 @@ diskfs_S_fsys_get_options (fsys_t fsys,
+ char *argz = 0;
+ size_t argz_len = 0;
+ error_t err;
+- struct port_info *port =
+- ports_lookup_port (diskfs_port_bucket, fsys, diskfs_control_class);
+
+- if (!port)
++ if (!port
++ || port->pi.bucket != diskfs_port_bucket
++ || port->pi.class != diskfs_control_class)
+ return EOPNOTSUPP;
+
+ err = argz_add (&argz, &argz_len, program_invocation_name);
+@@ -111,6 +109,5 @@ diskfs_S_fsys_get_options (fsys_t fsys,
+ else
+ free (argz);
+
+- ports_port_deref (port);
+ return err;
+ }
+diff --git a/libdiskfs/fsys-syncfs.c b/libdiskfs/fsys-syncfs.c
+index beb8881..f2a8cd7 100644
+--- a/libdiskfs/fsys-syncfs.c
++++ b/libdiskfs/fsys-syncfs.c
+@@ -24,14 +24,17 @@
+
+ /* Implement fsys_syncfs as described in <hurd/fsys.defs>. */
+ kern_return_t
+-diskfs_S_fsys_syncfs (fsys_t controlport,
++diskfs_S_fsys_syncfs (control_t pi,
+ mach_port_t reply,
+ mach_msg_type_name_t replytype,
+ int wait,
+ int children)
+ {
+- struct port_info *pi = ports_lookup_port (diskfs_port_bucket, controlport,
+- diskfs_control_class);
++ if (!pi
++ || pi->pi.bucket != diskfs_port_bucket
++ || pi->pi.class != diskfs_control_class)
++ return EOPNOTSUPP;
++
+ error_t
+ helper (struct node *np)
+ {
+@@ -49,9 +52,6 @@ diskfs_S_fsys_syncfs (fsys_t controlport,
+ return 0;
+ }
+
+- if (!pi)
+- return EOPNOTSUPP;
+-
+ pthread_rwlock_rdlock (&diskfs_fsys_lock);
+
+ if (children)
+@@ -67,8 +67,5 @@ diskfs_S_fsys_syncfs (fsys_t controlport,
+ }
+
+ pthread_rwlock_unlock (&diskfs_fsys_lock);
+-
+- ports_port_deref (pi);
+-
+ return 0;
+ }
+diff --git a/libdiskfs/priv.h b/libdiskfs/priv.h
+index bd23ab9..b41fa43 100644
+--- a/libdiskfs/priv.h
++++ b/libdiskfs/priv.h
+@@ -73,6 +73,7 @@ extern int _diskfs_diskdirty;
+
+ /* Needed for MiG. */
+ typedef struct protid *protid_t;
++typedef struct diskfs_control *control_t;
+
+ /* Actually read or write a file. The file size must already permit
+ the requested access. NP is the file to read/write. DATA is a buffer
diff --git a/debian/patches/series b/debian/patches/series
index 333eca0d..d432ed24 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -46,3 +46,4 @@ newRPC.patch
revert-remove-threadvars-hack.patch
xkb-compat.patch
fix-get-children-source.patch
+diskfs-fix-fsys-receiver-lookups.patch