[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 33/53: libtrivfs: improve the mig mutator functions
From: |
Samuel Thibault |
Subject: |
[hurd] 33/53: libtrivfs: improve the mig mutator functions |
Date: |
Thu, 20 Mar 2014 02:23:51 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 8287b6ffdf2cb631591decb17429701218122259
Author: Justus Winter <address@hidden>
Date: Tue Feb 25 01:01:09 2014 +0100
libtrivfs: improve the mig mutator functions
Previously, the mig mutator functions were in migsupport.c, preventing
them from being inlined into the mig-generated server functions. Put
them in mig-decls.h instead. Rename mutations.h to mig-mutate.h.
This is the naming convention used for pflocal.
* libtrivfs/fsmutations.h: Rename to mig-mutate.h, adopt imports.
* libtrivfs/Makefile: Adopt accordingly.
* libtrivfs/migsupport.c: Rename to mig-decls.h.
* libtrivfs/trivfs.h: Move dynamic classes/buckets declarations to
mig-decls.h, remove superfluous imports.
* exec/execmutations.h: Fix import.
* pfinet/mig-mutate.h: Likewise.
* trans/Makefile: Likewise.
---
exec/execmutations.h | 4 ++-
libtrivfs/Makefile | 6 ++---
libtrivfs/{migsupport.c => mig-decls.h} | 31 +++++++++++++++++-----
libtrivfs/{fsmutations.h => mig-mutate.h} | 7 +++--
libtrivfs/trivfs.h | 44 +------------------------------
pfinet/mig-mutate.h | 4 ++-
trans/Makefile | 2 +-
7 files changed, 39 insertions(+), 59 deletions(-)
diff --git a/exec/execmutations.h b/exec/execmutations.h
index 96b4772..ffcba9c 100644
--- a/exec/execmutations.h
+++ b/exec/execmutations.h
@@ -3,6 +3,8 @@
#define FILE_INTRAN trivfs_protid_t trivfs_begin_using_protid (file_t)
#define FILE_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t)
-#define EXEC_IMPORTS import "priv.h";
+#define EXEC_IMPORTS \
+ import "priv.h"; \
+ import "../libtrivfs/mig-decls.h"; \
#define SERVERCOPY 1
diff --git a/libtrivfs/Makefile b/libtrivfs/Makefile
index 3e4c039..921acbe 100644
--- a/libtrivfs/Makefile
+++ b/libtrivfs/Makefile
@@ -38,7 +38,7 @@ FSYSSRCS=fsys-getroot.c fsys-goaway.c fsys-stubs.c
fsys-syncfs.c \
file-get-children.c file-get-source.c
OTHERSRCS=demuxer.c protid-clean.c protid-dup.c cntl-create.c \
- cntl-clean.c migsupport.c times.c startup.c open.c \
+ cntl-clean.c times.c startup.c open.c \
runtime-argp.c set-options.c append-args.c dyn-classes.c \
protid-classes.c cntl-classes.c
@@ -49,7 +49,7 @@ MIGSTUBS=fsServer.o ioServer.o fsysServer.o fsys_replyUser.o
libname = libtrivfs
HURDLIBS = fshelp iohelp ports shouldbeinlibc
OBJS= $(sort $(subst .c,.o,$(SRCS)) $(MIGSTUBS))
-MIGSFLAGS=-imacros $(srcdir)/fsmutations.h
+MIGSFLAGS=-imacros $(srcdir)/mig-mutate.h
MIGCOMSFLAGS = -prefix trivfs_
installhdrs := trivfs.h
mig-sheader-prefix = trivfs_
@@ -59,4 +59,4 @@ endif
include ../Makeconf
-$(MIGSTUBS:%Server.o=%.sdefsi): $(srcdir)/fsmutations.h
+$(MIGSTUBS:%Server.o=%.sdefsi): $(srcdir)/mig-mutate.h
diff --git a/libtrivfs/migsupport.c b/libtrivfs/mig-decls.h
similarity index 76%
rename from libtrivfs/migsupport.c
rename to libtrivfs/mig-decls.h
index b2d98e1..2baaee8 100644
--- a/libtrivfs/migsupport.c
+++ b/libtrivfs/mig-decls.h
@@ -15,9 +15,26 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#ifndef __TRIVFS_MIG_DECLS_H__
+#define __TRIVFS_MIG_DECLS_H__
+
#include "priv.h"
-struct trivfs_protid *
+/* Vectors of dynamically allocated port classes/buckets. */
+
+/* Protid port classes. */
+extern struct port_class **trivfs_dynamic_protid_port_classes;
+extern size_t trivfs_num_dynamic_protid_port_classes;
+
+/* Control port classes. */
+extern struct port_class **trivfs_dynamic_control_port_classes;
+extern size_t trivfs_num_dynamic_control_port_classes;
+
+/* Port buckets. */
+extern struct port_bucket **trivfs_dynamic_port_buckets;
+extern size_t trivfs_num_dynamic_port_buckets;
+
+static inline struct trivfs_protid * __attribute__ ((unused))
trivfs_begin_using_protid (mach_port_t port)
{
if (trivfs_protid_nportclasses + trivfs_num_dynamic_protid_port_classes > 1)
@@ -35,7 +52,7 @@ trivfs_begin_using_protid (mach_port_t port)
return (struct trivfs_protid *) pi;
ports_port_deref (pi);
}
-
+
return 0;
}
else if (trivfs_protid_nportclasses == 1)
@@ -44,14 +61,14 @@ trivfs_begin_using_protid (mach_port_t port)
return ports_lookup_port (0, port, trivfs_dynamic_protid_port_classes[0]);
}
-void
+static inline void __attribute__ ((unused))
trivfs_end_using_protid (struct trivfs_protid *cred)
{
if (cred)
ports_port_deref (cred);
}
-struct trivfs_control *
+static inline struct trivfs_control * __attribute__ ((unused))
trivfs_begin_using_control (mach_port_t port)
{
if (trivfs_cntl_nportclasses + trivfs_num_dynamic_control_port_classes > 1)
@@ -69,7 +86,7 @@ trivfs_begin_using_control (mach_port_t port)
return (struct trivfs_control *) pi;
ports_port_deref (pi);
}
-
+
return 0;
}
else if (trivfs_cntl_nportclasses == 1)
@@ -78,9 +95,11 @@ trivfs_begin_using_control (mach_port_t port)
return ports_lookup_port (0, port, trivfs_dynamic_control_port_classes[0]);
}
-void
+static inline void __attribute__ ((unused))
trivfs_end_using_control (struct trivfs_control *cred)
{
if (cred)
ports_port_deref (cred);
}
+
+#endif /* __TRIVFS_MIG_DECLS_H__ */
diff --git a/libtrivfs/fsmutations.h b/libtrivfs/mig-mutate.h
similarity index 90%
rename from libtrivfs/fsmutations.h
rename to libtrivfs/mig-mutate.h
index d81e5a8..fad5389 100644
--- a/libtrivfs/fsmutations.h
+++ b/libtrivfs/mig-mutate.h
@@ -21,13 +21,12 @@
#define FILE_INTRAN trivfs_protid_t trivfs_begin_using_protid (file_t)
#define FILE_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t)
+#define FILE_IMPORTS import "mig-decls.h";
#define IO_INTRAN trivfs_protid_t trivfs_begin_using_protid (io_t)
#define IO_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t)
+#define IO_IMPORTS import "mig-decls.h";
#define FSYS_INTRAN trivfs_control_t trivfs_begin_using_control (fsys_t)
#define FSYS_DESTRUCTOR trivfs_end_using_control (trivfs_control_t)
-
-#define FILE_IMPORTS import <hurd/trivfs.h>;
-#define IO_IMPORTS import <hurd/trivfs.h>;
-#define FSYS_IMPORTS import <hurd/trivfs.h>;
+#define FSYS_IMPORTS import "mig-decls.h";
diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h
index 306a430..bb456ff 100644
--- a/libtrivfs/trivfs.h
+++ b/libtrivfs/trivfs.h
@@ -37,11 +37,6 @@ struct trivfs_protid
struct trivfs_peropen *po;
};
-/* These can be used as `intran' and `destructor' functions for
- a MiG port type, to have the stubs called with the protid pointer. */
-struct trivfs_protid *trivfs_begin_using_protid (mach_port_t);
-void trivfs_end_using_protid (struct trivfs_protid *);
-
struct trivfs_peropen
{
void *hook; /* for user use */
@@ -62,11 +57,6 @@ struct trivfs_control
void *hook; /* for user use */
};
-/* These can be used as `intran' and `destructor' functions for
- a MiG port type, to have the stubs called with the control pointer. */
-struct trivfs_control *trivfs_begin_using_control (mach_port_t);
-void trivfs_end_using_control (struct trivfs_control *);
-
/* The user must define these variables. */
extern int trivfs_fstype;
@@ -267,41 +257,9 @@ error_t trivfs_add_port_bucket (struct port_bucket
**bucket);
/* Remove the previously added dynamic port bucket BUCKET, freeing it
if it was allocated by trivfs_add_port_bucket. */
void trivfs_remove_port_bucket (struct port_bucket *bucket);
-
-/* This stuff is for the sake of MiG stubs and could be in a private
- header. But it might be handy for users that override parts of the
- library. Moreover, since the stub headers will use all the imports we
- need for the stubs, we couldn't make the stub headers public without
- making this public too. */
-
+/* Type-aliases for mig. */
typedef struct trivfs_protid *trivfs_protid_t;
typedef struct trivfs_control *trivfs_control_t;
-struct trivfs_protid *_trivfs_begin_using_protid (mach_port_t);
-void _trivfs_end_using_protid (struct trivfs_protid *);
-struct trivfs_control *_trivfs_begin_using_control (mach_port_t);
-void _trivfs_end_using_control (struct trivfs_control *);
-
-/* Vectors of dynamically allocated port classes/buckets. */
-
-/* Protid port classes. */
-extern struct port_class **trivfs_dynamic_protid_port_classes;
-extern size_t trivfs_num_dynamic_protid_port_classes;
-
-/* Control port classes. */
-extern struct port_class **trivfs_dynamic_control_port_classes;
-extern size_t trivfs_num_dynamic_control_port_classes;
-
-/* Port buckets. */
-extern struct port_bucket **trivfs_dynamic_port_buckets;
-extern size_t trivfs_num_dynamic_port_buckets;
-
-/* These are the MiG-generated headers that declare prototypes
- for the server functions. */
-#include <hurd/trivfs_fs_S.h>
-#include <hurd/trivfs_io_S.h>
-#include <hurd/trivfs_fsys_S.h>
-
-
#endif /* __TRIVFS_H__ */
diff --git a/pfinet/mig-mutate.h b/pfinet/mig-mutate.h
index 4d97408..b778077 100644
--- a/pfinet/mig-mutate.h
+++ b/pfinet/mig-mutate.h
@@ -28,7 +28,9 @@
#define SOCKET_INTRAN sock_user_t begin_using_socket_port (socket_t)
#define SOCKET_DESTRUCTOR end_using_socket_port (sock_user_t)
-#define SOCKET_IMPORTS import "mig-decls.h";
+#define SOCKET_IMPORTS \
+ import "mig-decls.h"; \
+ import "../libtrivfs/mig-decls.h"; \
#define ADDRPORT_INTRAN sock_addr_t begin_using_sockaddr_port (addr_port_t)
#define ADDRPORT_DESTRUCTOR end_using_sockaddr_port (sock_addr_t)
diff --git a/trans/Makefile b/trans/Makefile
index 90df479..e74a869 100644
--- a/trans/Makefile
+++ b/trans/Makefile
@@ -35,7 +35,7 @@ password-LDLIBS = $(LIBCRYPT)
password-MIGSFLAGS=\
"-DIO_INTRAN=trivfs_protid_t trivfs_begin_using_protid (io_t)" \
"-DIO_DESTRUCTOR=trivfs_end_using_protid (trivfs_protid_t)" \
- "-DPASSWORD_IMPORTS=import <hurd/trivfs.h>;"
+ "-DPASSWORD_IMPORTS=import \"../libtrivfs/mig-decls.h\";"
include ../Makeconf
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 45/53: mach-defpager: fix warnings about uninitialized variables, (continued)
- [hurd] 45/53: mach-defpager: fix warnings about uninitialized variables, Samuel Thibault, 2014/03/19
- [hurd] 41/53: mach-defpager: fix warnings about unused variables, Samuel Thibault, 2014/03/19
- [hurd] 32/53: pfinet: improve the mig mutator functions, Samuel Thibault, 2014/03/19
- [hurd] 47/53: mach-defpager: silently ignore requests to page to active partition, Samuel Thibault, 2014/03/19
- [hurd] 46/53: mach-defpager: fix type of size arguments, Samuel Thibault, 2014/03/19
- [hurd] 35/53: pfinet: fix receiver lookups in iioctl-ops.c, Samuel Thibault, 2014/03/19
- [hurd] 49/53: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/03/19
- [hurd] 30/53: libnetfs: fix receiver lookups in fsys server functions, Samuel Thibault, 2014/03/19
- [hurd] 50/53: Fix crash on accessing vcs without a console being active, Samuel Thibault, 2014/03/19
- [hurd] 37/53: term: fix receiver lookups in the term server functions, Samuel Thibault, 2014/03/19
- [hurd] 33/53: libtrivfs: improve the mig mutator functions,
Samuel Thibault <=
- [hurd] 51/53: Fix vcs_readlink propagating error returned by console_current_id, Samuel Thibault, 2014/03/19
- [hurd] 53/53: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2014/03/19
- [hurd] 52/53: Fix handling of console readlink errors, Samuel Thibault, 2014/03/19
- [hurd] 04/53: isofs: add bz2 to OTHERLIBS, Samuel Thibault, 2014/03/19
- [hurd] 11/53: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/03/19
- [hurd] 09/53: libdiskfs: fix typo, Samuel Thibault, 2014/03/19
- [hurd] 13/53: Add missing copyright notice, Samuel Thibault, 2014/03/19
- [hurd] 42/53: mach-defpager: add and use synchronized_printf for dprintf, Samuel Thibault, 2014/03/19
- [hurd] 05/53: fatfs: add bz2 to OTHERLIBS, Samuel Thibault, 2014/03/19
- [hurd] 07/53: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/03/19