From cff25ce181b3a330f12809373407f4d54f4cc5c4 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sat, 1 Mar 2014 12:26:59 +0100 Subject: auth: improve the mig mutator functions Previously, the mig mutator function auth_port_to_handle was defined in auth.c (fakeauth.c), preventing it from being inlined into the mig-generated server functions. Put it in mig-decls.h instead. Rename authmutations.h to mig-mutate.h, auth_mig.h to mig-decls.h. This is the naming convention used for pflocal. * auth/auth.h: New file. * auth/auth_mig.h: Rename to mig-decls.h, add copyright notice, define mutator functions. * auth/authmutations.h: Rename to mig-mutate.h, restore copyright notice, adjust accordingly. * auth/auth.c: Include auth.h, remove auth_port_to_handle. * utils/fakeauth.c: Likewise. * auth/Makefile: Adjust accordingly. * utils/Makefile: Likewise. --- auth/Makefile | 2 +- auth/auth.c | 10 ++-------- auth/auth.h | 28 ++++++++++++++++++++++++++++ auth/auth_mig.h | 5 ----- auth/authmutations.h | 6 ------ auth/mig-decls.h | 42 ++++++++++++++++++++++++++++++++++++++++++ auth/mig-mutate.h | 24 ++++++++++++++++++++++++ 7 files changed, 97 insertions(+), 20 deletions(-) create mode 100644 auth/auth.h delete mode 100644 auth/auth_mig.h delete mode 100644 auth/authmutations.h create mode 100644 auth/mig-decls.h create mode 100644 auth/mig-mutate.h (limited to 'auth') diff --git a/auth/Makefile b/auth/Makefile index 75910c77..b9eedda5 100644 --- a/auth/Makefile +++ b/auth/Makefile @@ -25,6 +25,6 @@ target = auth HURDLIBS = ports ihash shouldbeinlibc OTHERLIBS = -lpthread -MIGSFLAGS = -imacros $(srcdir)/authmutations.h +MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h include ../Makeconf diff --git a/auth/auth.c b/auth/auth.c index e69c4f86..7d35bd37 100644 --- a/auth/auth.c +++ b/auth/auth.c @@ -35,6 +35,8 @@ #include "auth_S.h" #include "auth_reply_U.h" +#include "auth.h" + const char *argp_program_version = STANDARD_HURD_VERSION(auth); @@ -72,14 +74,6 @@ destroy_authhandle (void *p) idvec_free_contents (&h->auids); idvec_free_contents (&h->agids); } - -/* Called by server stub functions. */ - -authhandle_t -auth_port_to_handle (auth_t auth) -{ - return ports_lookup_port (auth_bucket, auth, authhandle_portclass); -} /* id management. */ diff --git a/auth/auth.h b/auth/auth.h new file mode 100644 index 00000000..0bc341d3 --- /dev/null +++ b/auth/auth.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2014 Free Software Foundation, Inc. + Written by Justus Winter. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see . */ + +#ifndef __AUTH_H__ +#define __AUTH_H__ + +#include + +extern struct port_bucket *auth_bucket; +extern struct port_class *authhandle_portclass; + +#endif /* __AUTH_H__ */ diff --git a/auth/auth_mig.h b/auth/auth_mig.h deleted file mode 100644 index d919c1b9..00000000 --- a/auth/auth_mig.h +++ /dev/null @@ -1,5 +0,0 @@ -typedef struct authhandle *authhandle_t; - -authhandle_t auth_port_to_handle (auth_t); - -#include diff --git a/auth/authmutations.h b/auth/authmutations.h deleted file mode 100644 index 63b2f540..00000000 --- a/auth/authmutations.h +++ /dev/null @@ -1,6 +0,0 @@ -/* CPP definitions for MiG processing of auth.defs for auth server. */ - -#define AUTH_INTRAN authhandle_t auth_port_to_handle (auth_t) -#define AUTH_DESTRUCTOR ports_port_deref (authhandle_t) - -#define AUTH_IMPORTS import "auth_mig.h"; diff --git a/auth/mig-decls.h b/auth/mig-decls.h new file mode 100644 index 00000000..09c7c70a --- /dev/null +++ b/auth/mig-decls.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2014 Free Software Foundation, Inc. + Written by Justus Winter. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see . */ + +#ifndef __AUTH_MIG_DECLS_H__ +#define __AUTH_MIG_DECLS_H__ + +#include "auth.h" + +typedef struct authhandle *authhandle_t; + +/* Called by server stub functions. */ + +static inline struct authhandle * __attribute__ ((unused)) +auth_port_to_handle (mach_port_t auth) +{ + return ports_lookup_port (auth_bucket, auth, authhandle_portclass); +} + +static inline void __attribute__ ((unused)) +end_using_authhandle (struct authhandle *auth) +{ + if (auth) + ports_port_deref (auth); +} + +#endif /* __AUTH_MIG_DECLS_H__ */ diff --git a/auth/mig-mutate.h b/auth/mig-mutate.h new file mode 100644 index 00000000..ea40c707 --- /dev/null +++ b/auth/mig-mutate.h @@ -0,0 +1,24 @@ +/* + Copyright (C) 1991,93,94,2014 Free Software Foundation, Inc. + Written by Michael I. Bushnell. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see . */ + +/* CPP definitions for MiG processing of auth.defs for auth server. */ + +#define AUTH_INTRAN authhandle_t auth_port_to_handle (auth_t) +#define AUTH_DESTRUCTOR end_using_authhandle (authhandle_t) +#define AUTH_IMPORTS import "mig-decls.h"; -- cgit v1.2.3