summaryrefslogtreecommitdiff
path: root/libtreefs
diff options
context:
space:
mode:
Diffstat (limited to 'libtreefs')
-rw-r--r--libtreefs/Makefile4
-rw-r--r--libtreefs/dir-lookup.c4
-rw-r--r--libtreefs/mig-decls.h9
-rw-r--r--libtreefs/s-file.c4
-rw-r--r--libtreefs/trans-start.c5
-rw-r--r--libtreefs/treefs.h59
-rw-r--r--libtreefs/xinl.c3
7 files changed, 58 insertions, 30 deletions
diff --git a/libtreefs/Makefile b/libtreefs/Makefile
index 89d95e9b..3cdc30c9 100644
--- a/libtreefs/Makefile
+++ b/libtreefs/Makefile
@@ -25,12 +25,12 @@ installhdrs = treefs.h
S_SRCS = s-file.c s-dir.c s-io.c s-fsys.c
OTHERSRCS = defhooks.c dir-hooks.c dir-lookup.c fsys-getroot.c fsys-hooks.c \
fsys-startup.c hooks.c mdir.c nlist.c node-hooks.c rights.c \
- trans-help.c trans-start.c
+ trans-help.c trans-start.c xinl.c
SRCS = $(OTHERSRCS) $(S_SRCS)
LCLHDRS = treefs.h fs-mutate.h
MIGSTUBS = fsServer.o ioServer.o fsysServer.o
-OBJS = $(sort $(subst .c,.o,$(SRCS)) $(MIGSTUBS)
+OBJS = $(sort $(SRCS:.c=.o)) $(MIGSTUBS)
MIGSFLAGS = -imacros fs-mutate.h
MIGCOMSFLAGS = -prefix treefs_
diff --git a/libtreefs/dir-lookup.c b/libtreefs/dir-lookup.c
index 51c2cbd2..336ce8fd 100644
--- a/libtreefs/dir-lookup.c
+++ b/libtreefs/dir-lookup.c
@@ -1,6 +1,6 @@
/* Default treefs_s_dir_lookup hook
- Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995, 1998 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -55,8 +55,6 @@ _treefs_s_dir_lookup (struct treefs_handle *h,
if (path[0] == '\0')
{
- mustbedir = 1;
-
/* Set things up in the state expected by the code from gotit: on. */
dir = 0;
node = h->po->node;
diff --git a/libtreefs/mig-decls.h b/libtreefs/mig-decls.h
index 0d051e9c..e17f6196 100644
--- a/libtreefs/mig-decls.h
+++ b/libtreefs/mig-decls.h
@@ -25,7 +25,11 @@
/* For mig */
typedef struct treefs_handle *treefs_handle_t;
-extern inline
+extern treefs_handle_t treefs_begin_using_handle_port(mach_port_t port);
+extern void treefs_end_using_handle_port (treefs_handle_t handle);
+
+#if defined(__USE_EXTERN_INLINES) || defined(TREEFS_DEFINE_EI)
+TREEFS_EI
treefs_handle_t treefs_begin_using_handle_port(mach_port_t port)
{
return
@@ -33,9 +37,10 @@ treefs_handle_t treefs_begin_using_handle_port(mach_port_t port)
ports_lookup_port (0, port, treefs_fsys_port_class);
}
-extern inline void
+TREEFS_EI void
treefs_end_using_handle_port (treefs_handle_t handle)
{
if (handle != NULL)
ports_port_deref (&handle->pi);
}
+#endif /* Use extern inlines. */
diff --git a/libtreefs/s-file.c b/libtreefs/s-file.c
index cd9144da..73c32d7f 100644
--- a/libtreefs/s-file.c
+++ b/libtreefs/s-file.c
@@ -1,6 +1,6 @@
/* File_t rpc stubs; see <hurd/fs.defs> for more info
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1997 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -62,7 +62,7 @@ treefs_S_file_chmod (struct treefs_protid *cred, mode_t mode)
{
if (!cred)
return EOPNOTSUPP;
- mode &= ~(S_IFMT | S_ISPARE);
+ mode &= ~(S_IFMT | S_ISPARE | S_ITRANS);
return treefs_s_file_chmod (cred, mode);
}
diff --git a/libtreefs/trans-start.c b/libtreefs/trans-start.c
index 1b0156bf..2196a8dc 100644
--- a/libtreefs/trans-start.c
+++ b/libtreefs/trans-start.c
@@ -1,6 +1,6 @@
/* Starting a passive translator
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -55,8 +55,9 @@ _treefs_node_start_translator (struct treefs_node *node,
uid = auth->nuids > 0 ? auth->uids[0] : -1;
gid = auth->ngids > 0 ? auth->gids[0] : -1;
+ /* XXX this should use fshelp_start_translator_long. */
err =
- fshelp_start_translator (&node->active_trans, trans, trans_len,
+ fshelp_start_translator (&node->active_trans, NULL, trans, trans_len,
parent_port, node_port, uid, gid);
treefs_node_auth_unref (node, auth);
diff --git a/libtreefs/treefs.h b/libtreefs/treefs.h
index b0c26849..d8f30e4e 100644
--- a/libtreefs/treefs.h
+++ b/libtreefs/treefs.h
@@ -1,8 +1,8 @@
/* Hierarchial filesystem support
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2002 Free Software Foundation, Inc.
- Written by Miles Bader <miles@gnu.ai.mit.edu>
+ Written by Miles Bader <miles@gnu.org>
This file is part of the GNU Hurd.
@@ -26,6 +26,7 @@
#include <errno.h>
#include <cthreads.h>
#include <assert.h>
+#include <features.h>
#include <sys/stat.h>
@@ -36,6 +37,12 @@
/* Include the hook calling macros and non-rpc hook definitions (to get
those, include "trees-s-hooks.h"). */
#include "treefs-hooks.h"
+
+#ifdef TREEFS_DEFINE_EI
+#define TREEFS_EI
+#else
+#define TREEFS_EI __extern_inline
+#endif
/* ---------------------------------------------------------------- */
@@ -84,9 +91,9 @@ struct treefs_peropen
};
/* A filesystem node in the tree. */
-struct treefs_node
+struct treefs_node
{
- struct stat stat;
+ io_statbuf_t stat;
struct treefs_fsys *fsys;
struct trans_link active_trans;
@@ -124,7 +131,7 @@ struct treefs_fsys
/* The port for the node which this filesystem is translating. */
mach_port_t underlying_port;
/* And stat info for it. */
- struct stat underlying_stat;
+ io_statbuf_t underlying_stat;
/* Flags from the TREEFS_FSYS_ set. */
int flags;
@@ -237,10 +244,18 @@ void treefs_hooks_set (treefs_hook_vector_t hooks,
extern spin_lock_t treefs_node_refcnt_lock;
-/* Add a hard reference to a node. If there were no hard
- references previously, then the node cannot be locked
+extern void treefs_node_ref (struct treefs_node *node);
+extern void treefs_node_release (struct treefs_node *node);
+extern void treefs_node_unref (struct treefs_node *node);
+extern void treefs_node_ref_weak (struct treefs_node *node);
+extern void treefs_node_release_weak (struct treefs_node *node);
+extern void treefs_node_unref_weak (struct treefs_node *node);
+
+#if defined(__USE_EXTERN_INLINES) || defined(TREEFS_DEFINE_EI)
+/* Add a hard reference to a node. If there were no hard
+ references previously, then the node cannot be locked
(because you must hold a hard reference to hold the lock). */
-extern inline void
+TREEFS_EI void
treefs_node_ref (struct treefs_node *node)
{
int new_ref;
@@ -259,11 +274,11 @@ treefs_node_ref (struct treefs_node *node)
/* Unlock node NODE and release a hard reference; if this is the last
hard reference and there are no links to the file then request
weak references to be dropped. */
-extern inline void
+TREEFS_EI void
treefs_node_release (struct treefs_node *node)
{
int tried_drop_weak_refs = 0;
-
+
loop:
spin_lock (&treefs_node_refcnt_lock);
assert (node->refs);
@@ -306,11 +321,11 @@ treefs_node_release (struct treefs_node *node)
hard reference in order to hold the lock). If this is the last
hard reference and there are no links, then request weak references
to be dropped. */
-extern inline void
+TREEFS_EI void
treefs_node_unref (struct treefs_node *node)
{
int tried_drop_weak_refs = 0;
-
+
loop:
spin_lock (&treefs_node_refcnt_lock);
assert (node->refs);
@@ -331,7 +346,7 @@ treefs_node_unref (struct treefs_node *node)
spin_unlock (&treefs_node_refcnt_lock);
node->refs++;
spin_unlock (&treefs_node_refcnt_lock);
-
+
treefs_node_try_dropping_weak_refs (node);
tried_drop_weak_refs = 1;
@@ -346,7 +361,7 @@ treefs_node_unref (struct treefs_node *node)
}
/* Add a weak reference to a node. */
-extern inline void
+TREEFS_EI void
treefs_node_ref_weak (struct treefs_node *node)
{
spin_lock (&treefs_node_refcnt_lock);
@@ -355,7 +370,7 @@ treefs_node_ref_weak (struct treefs_node *node)
}
/* Unlock node NODE and release a weak reference */
-extern inline void
+TREEFS_EI void
treefs_node_release_weak (struct treefs_node *node)
{
spin_lock (&treefs_node_refcnt_lock);
@@ -372,8 +387,8 @@ treefs_node_release_weak (struct treefs_node *node)
/* Release a weak reference on NODE. If NODE is locked by anyone, then
this cannot be the last reference (because you must hold a
- hard reference in order to hold the lock). */
-extern inline void
+ hard reference in order to hold the lock). */
+TREEFS_EI void
treefs_node_unref_weak (struct treefs_node *node)
{
spin_lock (&treefs_node_refcnt_lock);
@@ -387,6 +402,7 @@ treefs_node_unref_weak (struct treefs_node *node)
else
spin_unlock (&treefs_node_refcnt_lock);
}
+#endif /* Use extern inlines. */
/* ---------------------------------------------------------------- */
@@ -408,8 +424,12 @@ treefs_node_create_right (struct treefs_node *node, int flags,
/* ---------------------------------------------------------------- */
/* Auth functions; copied from diskfs. */
+extern int treefs_auth_has_uid (struct treefs_auth *auth, uid_t uid);
+extern int treefs_auth_in_group (struct treefs_auth *auth, gid_t gid);
+
+#if defined(__USE_EXTERN_INLINES) || defined(TREEFS_DEFINE_EI)
/* Return nonzero iff the user identified by AUTH has uid UID. */
-extern inline int
+TREEFS_EI int
treefs_auth_has_uid (struct treefs_auth *auth, uid_t uid)
{
int i;
@@ -420,7 +440,7 @@ treefs_auth_has_uid (struct treefs_auth *auth, uid_t uid)
}
/* Return nonzero iff the user identified by AUTH has group GID. */
-extern inline int
+TREEFS_EI int
treefs_auth_in_group (struct treefs_auth *auth, gid_t gid)
{
int i;
@@ -429,6 +449,7 @@ treefs_auth_in_group (struct treefs_auth *auth, gid_t gid)
return 1;
return 0;
}
+#endif /* Use extern inlines. */
/* ---------------------------------------------------------------- */
/* Helper routines for dealing with translators. */
diff --git a/libtreefs/xinl.c b/libtreefs/xinl.c
new file mode 100644
index 00000000..fe83e5a3
--- /dev/null
+++ b/libtreefs/xinl.c
@@ -0,0 +1,3 @@
+#define TREEFS_DEFINE_EI
+#include "treefs.h"
+#include "mig-decls.h"