summaryrefslogtreecommitdiff
path: root/libtrivfs
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-10-11 07:42:26 +0000
committerRoland McGrath <roland@gnu.org>1999-10-11 07:42:26 +0000
commitd2b8b83a78fc568b4b48bcde196bf1d585da58df (patch)
tree2377c833a5016a3d8b38510429a06b02a8f645f0 /libtrivfs
parent8d004d675bffdad6c82ef2c4408da6a74094c17b (diff)
1999-10-11 Roland McGrath <roland@baalperazim.frob.com>
* trivfs.h (trivfs_open_hook): New variable. * fsys-getroot.c (trivfs_S_fsys_getroot): Use it.
Diffstat (limited to 'libtrivfs')
-rw-r--r--libtrivfs/fsys-getroot.c19
-rw-r--r--libtrivfs/trivfs.h16
2 files changed, 26 insertions, 9 deletions
diff --git a/libtrivfs/fsys-getroot.c b/libtrivfs/fsys-getroot.c
index 9d173f9a..ed23dd94 100644
--- a/libtrivfs/fsys-getroot.c
+++ b/libtrivfs/fsys-getroot.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation
+ Copyright (C) 1993,94,95,97,99 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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,
+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.
@@ -63,7 +63,7 @@ trivfs_S_fsys_getroot (struct trivfs_control *cntl,
return EOPNOTSUPP;
/* O_CREAT and O_EXCL are not meaningful here; O_NOLINK and O_NOTRANS
- will only be useful when trivfs supports translators (which it doesn't
+ will only be useful when trivfs supports translators (which it doesn't
now). */
flags &= O_HURD;
flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS);
@@ -91,7 +91,17 @@ trivfs_S_fsys_getroot (struct trivfs_control *cntl,
if (!err && trivfs_check_open_hook)
err = (*trivfs_check_open_hook) (cntl, user, flags);
if (!err)
- err = trivfs_open (cntl, user, flags, new_realnode, &cred);
+ {
+ if (! trivfs_open_hook)
+ {
+ err = trivfs_open (cntl, user, flags, new_realnode, &cred);
+ if (!err)
+ mach_port_deallocate (mach_task_self (), dotdot);
+ }
+ else
+ err = (*trivfs_open_hook) (cntl, user, dotdot, flags, new_realnode,
+ &cred);
+ }
if (err)
{
@@ -105,7 +115,6 @@ trivfs_S_fsys_getroot (struct trivfs_control *cntl,
*newpt = ports_get_right (cred);
*newpttype = MACH_MSG_TYPE_MAKE_SEND;
ports_port_deref (cred);
- mach_port_deallocate (mach_task_self (), dotdot);
}
return err;
diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h
index 5f91cac3..dc32b0e4 100644
--- a/libtrivfs/trivfs.h
+++ b/libtrivfs/trivfs.h
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation
+/*
+ Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -72,7 +72,7 @@ void trivfs_end_using_control (struct trivfs_control *);
extern int trivfs_fstype;
extern int trivfs_fsid;
-/* Set these if trivfs should allow read, write,
+/* Set these if trivfs should allow read, write,
or execute of file. */
extern int trivfs_support_read;
extern int trivfs_support_write;
@@ -94,7 +94,7 @@ extern int trivfs_protid_nportclasses;
extern struct port_class *trivfs_cntl_portclasses[];
extern int trivfs_cntl_nportclasses;
-/* The user must define this function. This should modify a struct
+/* The user must define this function. This should modify a struct
stat (as returned from the underlying node) for presentation to
callers of io_stat. It is permissable for this function to do
nothing. */
@@ -118,6 +118,14 @@ error_t (*trivfs_check_access_hook) (struct trivfs_control *cntl,
error_t (*trivfs_check_open_hook) (struct trivfs_control *cntl,
struct iouser *user, int flags);
+/* If this variable is set, it is called in place of `trivfs_open' (below). */
+error_t (*trivfs_open_hook) (struct trivfs_control *fsys,
+ struct iouser *user,
+ mach_port_t dotdot,
+ int flags,
+ mach_port_t realnode,
+ struct trivfs_protid **cred);
+
/* If this variable is set, it is called every time a new protid
structure is created and initialized. */
error_t (*trivfs_protid_create_hook) (struct trivfs_protid *);