Justus Winter, le Wed 12 Feb 2014 18:22:25 +0100, a écrit : > * 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.
Ack. > --- > libnetfs/fsys-get-options.c | 6 +----- > libnetfs/fsys-getroot.c | 5 +---- > libnetfs/fsys-goaway.c | 10 +++------- > libnetfs/fsys-set-options.c | 11 +++-------- > libnetfs/fsys-syncfs.c | 2 +- > libnetfs/fsysstubs.c | 8 ++++---- > libnetfs/mutations.h | 3 +++ > libnetfs/netfs.h | 6 ++++++ > libnetfs/priv.h | 14 ++++++++++++++ > 9 files changed, 36 insertions(+), 29 deletions(-) > > diff --git a/libnetfs/fsys-get-options.c b/libnetfs/fsys-get-options.c > index 54bd9a0..836806b 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 0d80111..2d02120 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 0ac36d3..872d073 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 d7dc743..fb1c87e 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 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 > -- > 1.8.5.2 > -- Samuel CN > J'ai enseigné l'algorythmique. GLG> C'est quoi l'algorythmique ? Une contrebasse programmée en Algol ? -+- in : Guide du Neuneu d'Usenet - Neuneu fait ses gammes. -+-