summaryrefslogtreecommitdiff
path: root/libnetfs
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-12 11:24:14 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-25 11:19:00 +0100
commit982261fec4707d0c8d0723d90d9c0e465d98aa93 (patch)
treea62031c4393800cdcc9717455f55c16245c8b995 /libnetfs
parent41b88dab57df5a1b490550fd8c4b80788ce55a81 (diff)
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.
Diffstat (limited to 'libnetfs')
-rw-r--r--libnetfs/fsys-get-options.c6
-rw-r--r--libnetfs/fsys-getroot.c5
-rw-r--r--libnetfs/fsys-goaway.c10
-rw-r--r--libnetfs/fsys-set-options.c11
-rw-r--r--libnetfs/fsys-syncfs.c2
-rw-r--r--libnetfs/fsysstubs.c8
-rw-r--r--libnetfs/mutations.h3
-rw-r--r--libnetfs/netfs.h6
-rw-r--r--libnetfs/priv.h14
9 files changed, 36 insertions, 29 deletions
diff --git a/libnetfs/fsys-get-options.c b/libnetfs/fsys-get-options.c
index 54bd9a00..836806b2 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,8 +39,6 @@ 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)
return EOPNOTSUPP;
@@ -63,7 +61,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 0d801114..2d02120e 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;
@@ -51,7 +49,6 @@ netfs_S_fsys_getroot (mach_port_t cntl,
if (!pt)
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 0ac36d3c..872d0730 100644
--- a/libnetfs/fsys-goaway.c
+++ b/libnetfs/fsys-goaway.c
@@ -26,17 +26,15 @@
#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)
return EOPNOTSUPP;
err = netfs_shutdown (flags);
@@ -46,7 +44,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 d7dc743b..fb1c87ef 100644
--- a/libnetfs/fsys-set-options.c
+++ b/libnetfs/fsys-set-options.c
@@ -31,15 +31,15 @@
/* 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)
+ return EOPNOTSUPP;
error_t
helper (struct node *np)
@@ -64,9 +64,6 @@ netfs_S_fsys_set_options (fsys_t fsys,
return error;
}
- if (!pt)
- return EOPNOTSUPP;
-
#if NOT_YET
if (do_children)
{
@@ -87,7 +84,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 f57cb144..e232936e 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 f44155da..a64fd643 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 e6700f54..51ca871a 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 5d50f57d..aef4a3dd 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 00db9faa..ba310802 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