bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] libtrivfs variable -> functions


From: Neal H Walfield
Subject: [PATCH] libtrivfs variable -> functions
Date: Tue, 27 Feb 2001 16:10:19 +0100
User-agent: Mutt/1.3.12i

This patch turns the variables in libtrivfs into function calls.
Thus, when writing a translator, it is no longer required to
say:

  error_t open_check_hook (...)
  {
    ...
  }

  (error_t) (*trivfs_open_check_hook) (...) = open_check_hook;

Instead, one can say:

  error_t trivfs_open_check (...)
  {
    ...
  }

This patch also contains the code to fix all translators effected
by this change -- I have been running it for over a week with no
problems.

-Neal


diff -Nur hurd-20010115-snapshot/libtrivfs/ChangeLog 
hurd-20010115/libtrivfs/ChangeLog
--- hurd-20010115-snapshot/libtrivfs/ChangeLog  Fri Mar 17 12:22:56 2000
+++ hurd-20010115/libtrivfs/ChangeLog   Sun Feb 25 05:15:49 2001
@@ -1,3 +1,50 @@
+2001-02-23  Neal H Walfield  <neal@cs.uml.edu>
+
+       * trivfs.h: (trivfs_check_access_hook): Renamed to remove _hook
+       suffix.  Changed from a variable to a function.
+       (trivfs_check_open_hook): Likewise.
+       (trivfs_protid_create_hook): Likewise.
+       (trivfs_peropen_create_hook): Likewise.
+       (trivfs_protid_destroy_hook): Likewise.
+       (trivfs_peropen_destroy_hook): Likewise.
+       (trivfs_getroot_hook): Likewise.
+       (trivfs_open_hook): Likewise.  Overrides definition of trivfs_open.
+       * check-access.c: New file.
+       (trivfs_check_access): New function.  Provide default behavior.
+       * user-hooks.c: New file.
+       (trivfs_check_open): New function.  Weak alias to
+       _trivfs_user_undefined.
+       (trivfs_protid_create): Likewise.
+       (trivfs_peropen_create): Likewise.
+       (trivfs_protid_destroy): Likewise.
+       (trivfs_peropen_destroy): Likewise.
+       (trivfs_getroot): Likewise.
+       (_trivfs_user_undefined): New empty function.
+       * priv.h (FUNC_DEFINED):  New macro.  Determine if the supplied
+       function is defined by the user (i.e. if it is equal to
+       _trivfs_user_undefined).
+       * open.c (_trivfs_open): Renamed from trivfs_open.
+       (trivfs_open): Aliased to _trivfs_open.  Take a new parameter,
+       dotdot to match the obsolete trivfs_open_hook prototype.
+       * dir-lookup.c (trivfs_S_dir_lookup): Update calls to *_hook
+       to reflect new calling conventions.
+       * file-access.c (trivfs_S_file_check_access): Likewise.
+       * fsys-getroot.c (trivfs_S_getroot): Likewise.
+       * io_reauthenticate.c (trivfs_S_io_reauthenticate): Likewise.
+       * io_restrict_auth.c (trivfs_S_io_restrict_auth): Likewise.
+       * open.c (_trivfs_open): Likewise.
+       * protid-clean.c (trivfs_clean_protid): Likewise.
+       * protid-dup.c (trivfs_protid_dup): Likewise.
+
+       * Makefile (OTHERSRCS): Add check-access.c user-hooks.c
+
+       * fsys-getroot.c (trivfs_S_getroot): Always deallocate dotdot.
+
+       * open.c: Remove unnecessary include <string.h>
+
+       * trivfs.h: Regularize and improve documentation as suggested
+       in doc/hurd.texi.
+
 2000-03-17  Thomas Bushnell, BSG  <tb@mit.edu>
 
        * startup.c (trivfs_startup): Don't use MAKE_SEND in Hurd RPC.
diff -Nur hurd-20010115-snapshot/libtrivfs/Makefile 
hurd-20010115/libtrivfs/Makefile
--- hurd-20010115-snapshot/libtrivfs/Makefile   Mon Sep 13 02:34:06 1999
+++ hurd-20010115/libtrivfs/Makefile    Sun Feb 25 05:15:56 2001
@@ -1,5 +1,5 @@
 # 
-#   Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation
+#   Copyright (C) 1994, 1995, 1996, 1997, 1999, 2001 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
@@ -39,7 +39,7 @@
 OTHERSRCS=demuxer.c protid-clean.c protid-dup.c cntl-create.c \
        cntl-clean.c migsupport.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
+       protid-classes.c cntl-classes.c check-access.c user-hooks.c
 
 SRCS=$(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(OTHERSRCS)
 
diff -Nur hurd-20010115-snapshot/libtrivfs/check-access.c 
hurd-20010115/libtrivfs/check-access.c
--- hurd-20010115-snapshot/libtrivfs/check-access.c     Wed Dec 31 19:00:00 1969
+++ hurd-20010115/libtrivfs/check-access.c      Sat Feb 24 04:24:04 2001
@@ -0,0 +1,30 @@
+/*
+   Copyright (C) 2001 Free Software Foundation
+
+   Written by Neal H Walfield <neal@cs.uml.edu>
+
+   This program 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.
+
+   This program 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 this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "priv.h"
+
+error_t
+trivfs_check_access (struct trivfs_control *cntl,
+                    struct iouser *user,
+                    mach_port_t realnode,
+                    int *allowed)
+{
+  return file_check_access (realnode, allowed);
+}
+
diff -Nur hurd-20010115-snapshot/libtrivfs/dir-lookup.c 
hurd-20010115/libtrivfs/dir-lookup.c
--- hurd-20010115-snapshot/libtrivfs/dir-lookup.c       Mon Oct 11 04:38:02 1999
+++ hurd-20010115/libtrivfs/dir-lookup.c        Sat Feb 24 04:24:24 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1994, 1998, 1999 Free Software Foundation
+   Copyright (C) 1994, 1998, 1999, 2001 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
@@ -49,23 +49,22 @@
   flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS);
 
   /* Validate permissions */
-  if (! trivfs_check_access_hook)
-    file_check_access (cred->realnode, &perms);
-  else
-    (*trivfs_check_access_hook) (cred->po->cntl, cred->user,
-                                cred->realnode, &perms);
+  trivfs_check_access (cred->po->cntl, cred->user,
+                      cred->realnode, &perms);
   if ((flags & (O_READ|O_WRITE|O_EXEC) & perms)
       != (flags & (O_READ|O_WRITE|O_EXEC)))
     return EACCES;
 
   /* Execute the open */
   err = 0;
-  if (trivfs_check_open_hook)
-    err = (*trivfs_check_open_hook) (cred->po->cntl, cred->user, flags);
+  if (FUNC_DEFINED (trivfs_check_open))
+    err = trivfs_check_open (cred->po->cntl, cred->user, flags);
   if (!err)
     {
       struct iouser *user = iohelp_dup_iouser (cred->user);
-      err = trivfs_open (cred->po->cntl, user, flags,
+
+      /* XXX: What should we pass in as dotdot?  cred->po->underlying  */
+      err = trivfs_open (cred->po->cntl, user, MACH_PORT_NULL, flags,
                         cred->realnode, &newcred);
       if (err)
        iohelp_free_iouser (user);
diff -Nur hurd-20010115-snapshot/libtrivfs/file-access.c 
hurd-20010115/libtrivfs/file-access.c
--- hurd-20010115-snapshot/libtrivfs/file-access.c      Fri Feb 19 02:45:37 1999
+++ hurd-20010115/libtrivfs/file-access.c       Sat Feb 24 04:24:35 2001
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1994, 1996 Free Software Foundation
+   Copyright (C) 1994, 1996, 2001 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
@@ -26,11 +26,8 @@
   if (! cred)
     return EOPNOTSUPP;
 
-  if (! trivfs_check_access_hook)
-    file_check_access (cred->realnode, allowed);
-  else
-    (*trivfs_check_access_hook) (cred->po->cntl, cred->user,
-                                cred->realnode, allowed);
+  trivfs_check_access (cred->po->cntl, cred->user,
+                      cred->realnode, allowed);
   
   return 0;
 }
diff -Nur hurd-20010115-snapshot/libtrivfs/fsys-getroot.c 
hurd-20010115/libtrivfs/fsys-getroot.c
--- hurd-20010115-snapshot/libtrivfs/fsys-getroot.c     Mon Nov  8 16:52:05 1999
+++ hurd-20010115/libtrivfs/fsys-getroot.c      Sun Feb 25 04:11:26 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1993,94,95,97,99 Free Software Foundation, Inc.
+   Copyright (C) 1993,94,95,97,99, 2001 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -49,11 +49,11 @@
   if (!cntl)
     return EOPNOTSUPP;
 
-  if (trivfs_getroot_hook)
+  if (FUNC_DEFINED (trivfs_getroot))
     {
-      err = (*trivfs_getroot_hook) (cntl, reply_port, reply_port_type, dotdot,
-                                   uids, nuids, gids, ngids, flags,
-                                   do_retry, retry_name, newpt, newpttype);
+      err = trivfs_getroot (cntl, reply_port, reply_port_type, dotdot,
+                           uids, nuids, gids, ngids, flags,
+                           do_retry, retry_name, newpt, newpttype);
       if (err != EAGAIN)
        return err;
     }
@@ -82,27 +82,18 @@
   user = iohelp_create_iouser (uvec, gvec); /* XXX check return value?  */
 
   /* Validate permissions.  */
-  if (! trivfs_check_access_hook)
-    file_check_access (new_realnode, &perms);
-  else
-    (*trivfs_check_access_hook) (cntl, user, new_realnode, &perms);
+  trivfs_check_access (cntl, user, new_realnode, &perms);
   if ((flags & (O_READ|O_WRITE|O_EXEC) & perms)
       != (flags & (O_READ|O_WRITE|O_EXEC)))
     err = EACCES;
 
-  if (!err && trivfs_check_open_hook)
-    err = (*trivfs_check_open_hook) (cntl, user, flags);
+  if (!err && FUNC_DEFINED (trivfs_check_open))
+    err = trivfs_check_open (cntl, user, flags);
   if (!err)
     {
-      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);
+      err = trivfs_open (cntl, user, dotdot, flags, new_realnode, &cred);
+      if (! err)
+       mach_port_deallocate (mach_task_self (), dotdot);
     }
 
   if (err)
diff -Nur hurd-20010115-snapshot/libtrivfs/io-reauthenticate.c 
hurd-20010115/libtrivfs/io-reauthenticate.c
--- hurd-20010115-snapshot/libtrivfs/io-reauthenticate.c        Fri Mar 17 
05:29:22 2000
+++ hurd-20010115/libtrivfs/io-reauthenticate.c Sat Feb 24 04:25:13 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1993,94,95,96,2000 Free Software Foundation, Inc.
+   Copyright (C) 1993,94,95,96,2000, 2001 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -73,10 +73,10 @@
                            newcred->user->gids->ids,
                            newcred->user->gids->num);
   while (err == EINTR);
-  if (!err && trivfs_protid_create_hook)
+  if (!err && FUNC_DEFINED (trivfs_protid_create))
     {
       do
-       err = (*trivfs_protid_create_hook) (newcred);
+       err = trivfs_protid_create (newcred);
       while (err == EINTR);
       if (err)
        mach_port_deallocate (mach_task_self (), newcred->realnode);
diff -Nur hurd-20010115-snapshot/libtrivfs/io-restrict-auth.c 
hurd-20010115/libtrivfs/io-restrict-auth.c
--- hurd-20010115-snapshot/libtrivfs/io-restrict-auth.c Mon Nov 18 18:55:41 1996
+++ hurd-20010115/libtrivfs/io-restrict-auth.c  Sat Feb 24 04:25:20 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation
+   Copyright (C) 1993, 1994, 1995, 1996, 2001 Free Software Foundation
 
 This file is part of the GNU Hurd.
 
@@ -97,9 +97,9 @@
   err = io_restrict_auth (cred->realnode, &newcred->realnode, 
                          user->uids->ids, user->uids->num, 
                          user->gids->ids, user->gids->num);
-  if (!err && trivfs_protid_create_hook)
+  if (!err && FUNC_DEFINED (trivfs_protid_create))
     {
-      err = (*trivfs_protid_create_hook) (newcred);
+      err = trivfs_protid_create (newcred);
       if (err)
        mach_port_deallocate (mach_task_self (), newcred->realnode);
     }
diff -Nur hurd-20010115-snapshot/libtrivfs/open.c hurd-20010115/libtrivfs/open.c
--- hurd-20010115-snapshot/libtrivfs/open.c     Sat Feb 13 04:13:36 1999
+++ hurd-20010115/libtrivfs/open.c      Sat Feb 24 05:05:37 2001
@@ -1,6 +1,6 @@
 /* Make a new trivfs peropen/protid
 
-   Copyright (C) 1993, 1994, 1995, 1996, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1999, 2001 Free Software Foundation, 
Inc.
 
    This file is part of the GNU Hurd.
 
@@ -18,19 +18,18 @@
    along with the GNU Hurd; see the file COPYING.  If not, write to
    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include <string.h>            /* For bcopy() */
-
 #include "priv.h"
 
 /* Return a new protid pointing to a new peropen in CRED, with REALNODE as
    the underlying node reference, with the given identity, and open flags in
    FLAGS.  CNTL is the trivfs control object.  */
 error_t
-trivfs_open (struct trivfs_control *cntl,
-            struct iouser *user,
-            unsigned flags,
-            mach_port_t realnode,
-            struct trivfs_protid **cred)
+_trivfs_open (struct trivfs_control *cntl,
+             struct iouser *user,
+             mach_port_t dotdot,
+             int flags,
+             mach_port_t realnode,
+             struct trivfs_protid **cred)
 {
   error_t err = 0;
   struct trivfs_peropen *po = malloc (sizeof (struct trivfs_peropen));
@@ -45,8 +44,8 @@
   po->openmodes = flags;
   po->hook = 0;
 
-  if (trivfs_peropen_create_hook)
-    err = (*trivfs_peropen_create_hook) (po);
+  if (FUNC_DEFINED (trivfs_peropen_create))
+    err = trivfs_peropen_create (po);
   if (!err)
     {
       struct trivfs_protid *new;
@@ -62,8 +61,8 @@
          new->hook = 0;
          new->realnode = realnode;
 
-         if (!err && trivfs_protid_create_hook)
-           err = (*trivfs_protid_create_hook) (new);
+         if (!err && FUNC_DEFINED (trivfs_protid_create))
+           err = trivfs_protid_create (new);
 
          if (err)
            {
@@ -85,3 +84,11 @@
 
   return err;
 }
+
+error_t
+trivfs_open (struct trivfs_control *cntl,
+            struct iouser *user,
+            mach_port_t dotdot,
+            int flags,
+            mach_port_t realnode,
+            struct trivfs_protid **cred) __attribute__ ((weak, alias 
("_trivfs_open")));
diff -Nur hurd-20010115-snapshot/libtrivfs/priv.h hurd-20010115/libtrivfs/priv.h
--- hurd-20010115-snapshot/libtrivfs/priv.h     Wed Feb 19 23:25:31 1997
+++ hurd-20010115/libtrivfs/priv.h      Sun Feb 25 04:07:17 2001
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1994, 1997 Free Software Foundation
+   Copyright (C) 1994, 1997, 2001 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
@@ -16,6 +16,7 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #ifndef TRIVFS_PRIV_H_INCLUDED
+#define TRIVFS_PRIV_H_INCLUDED
 
 #include <mach.h>
 #include <hurd.h>
@@ -31,6 +32,13 @@
 struct trivfs_control *_trivfs_begin_using_control (mach_port_t);
 void _trivfs_end_using_control (struct trivfs_control *);
 
+/* By default, user hooks are aliased to this function.  This is used
+   to determine if the funtion has been defined, i.e. we should bother
+   calling it.  */
+/* void _trivfs_user_undefined (void); */
+#define FUNC_DEFINED(f) ((void *)(f) != (void *)_trivfs_user_defined)
+void _trivfs_user_defined (void);
+
 /* Vectors of dynamically allocated port classes/buckets.  */
 
 /* Protid port classes.  */
@@ -45,5 +53,4 @@
 extern struct port_bucket **trivfs_dynamic_port_buckets;
 extern size_t trivfs_num_dynamic_port_buckets;
 
-#define TRIVFS_PRIV_H_INCLUDED
 #endif
diff -Nur hurd-20010115-snapshot/libtrivfs/protid-clean.c 
hurd-20010115/libtrivfs/protid-clean.c
--- hurd-20010115-snapshot/libtrivfs/protid-clean.c     Mon Nov 18 18:55:50 1996
+++ hurd-20010115/libtrivfs/protid-clean.c      Sun Feb 25 04:14:39 2001
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1994, 1995, 1996 Free Software Foundation
+   Copyright (C) 1994, 1995, 1996, 2001 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
@@ -24,17 +24,18 @@
 {
   struct trivfs_protid *cred = arg;
   
-  if (trivfs_protid_destroy_hook && cred->realnode != MACH_PORT_NULL)
+  if (FUNC_DEFINED (trivfs_protid_destroy)
+      && cred->realnode != MACH_PORT_NULL)
     /* Allow the user to clean up; If the realnode field is null, then CRED
        wasn't initialized to the point of needing user cleanup.  */
-    (*trivfs_protid_destroy_hook) (cred);
+    trivfs_protid_destroy (cred);
 
   /* If we hold the only reference to the peropen, try to get rid of it. */
   mutex_lock (&cred->po->cntl->lock);
-  if (cred->po->refcnt == 1 && trivfs_peropen_destroy_hook)
+  if (cred->po->refcnt == 1 && FUNC_DEFINED (trivfs_peropen_destroy))
     {
       mutex_unlock (&cred->po->cntl->lock);
-      (*trivfs_peropen_destroy_hook) (cred->po);
+      trivfs_peropen_destroy (cred->po);
       mutex_lock (&cred->po->cntl->lock);
     }
   if (--cred->po->refcnt == 0)
diff -Nur hurd-20010115-snapshot/libtrivfs/protid-dup.c 
hurd-20010115/libtrivfs/protid-dup.c
--- hurd-20010115-snapshot/libtrivfs/protid-dup.c       Mon Nov 18 18:55:54 1996
+++ hurd-20010115/libtrivfs/protid-dup.c        Sat Feb 24 04:26:04 2001
@@ -1,6 +1,6 @@
 /* Duplicate a protid
 
-   Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 2001 Free Software Foundation, Inc.
 
    This file is part of the GNU Hurd.
 
@@ -18,12 +18,11 @@
    along with the GNU Hurd; see the file COPYING.  If not, write to
    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include <string.h>
 #include "priv.h"
 
 /* Return a duplicate of CRED in DUP, sharing the same peropen and hook.  A
    non-null hook may be used to detect that this is a duplicate by
-   trivfs_protid_create_hook.  */
+   trivfs_protid_create.  */
 error_t
 trivfs_protid_dup (struct trivfs_protid *cred, struct trivfs_protid **dup)
 {
@@ -50,8 +49,8 @@
 
       new->hook = cred->hook;
 
-      if (trivfs_protid_create_hook)
-       err = (*trivfs_protid_create_hook) (new);
+      if (FUNC_DEFINED (trivfs_protid_create))
+       err = trivfs_protid_create (new);
       if (err)
        {
          mach_port_deallocate (mach_task_self (), new->realnode);
diff -Nur hurd-20010115-snapshot/libtrivfs/trivfs.h 
hurd-20010115/libtrivfs/trivfs.h
--- hurd-20010115-snapshot/libtrivfs/trivfs.h   Mon Oct 11 03:42:23 1999
+++ hurd-20010115/libtrivfs/trivfs.h    Sun Feb 25 04:00:45 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation
+   Copyright (C) 1994, 1995, 1996, 1997, 1999, 2001 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
@@ -31,7 +31,7 @@
   struct iouser *user;
   int isroot;
   /* REALNODE will be null if this protid wasn't fully created (currently
-     only in the case where trivfs_protid_create_hook returns an error).  */
+     only in the case where trivfs_protid_create returns an error).  */
   mach_port_t realnode;                /* restricted permissions */
   void *hook;                  /* for user use */
   struct trivfs_peropen *po;
@@ -67,93 +67,115 @@
 struct trivfs_control *trivfs_begin_using_control (mach_port_t);
 void trivfs_end_using_control (struct trivfs_control *);
 
+
+/* Definitions provided by the user.  */
 
-/* The user must define these variables. */
+/* The user must define this variable to the file system type.
+   See <hurd/hurd_types.h> for a list of types.  */
 extern int trivfs_fstype;
+
+/* The user must define this variable to the file system id.
+   This is normally, the translator's pid.  */
 extern int trivfs_fsid;
 
-/* Set these if trivfs should allow read, write,
-   or execute of file.    */
+/* The user must define these variables.  They should reflect if
+   trivfs should allow reading, writing, or execution of file
+   respectively.    */
 extern int trivfs_support_read;
 extern int trivfs_support_write;
 extern int trivfs_support_exec;
 
-/* Set this some combination of O_READ, O_WRITE, and O_EXEC;
-   trivfs will only allow opens of the specified modes.
-   (trivfs_support_* is not used to validate opens, only actual
-   operations.)  */
+/* The user must define this variable.  It is expected to be set to
+   some combination of O_READ, O_WRITE, and O_EXEC; trivfs will only
+   allow opens of the specified modes  (The trivfs_support_* variables
+   are not used to validate opens, only actual operations).  */
 extern int trivfs_allow_open;
 
-/* If the user defines these, they should be vectors (and the associated
-   sizes) of port classes that will be translated into control & protid
-   pointers for passing to rpcs, in addition to those passed to or created by
-   trivfs_create_control (or trivfs_startup) will automatically be
-   recognized.  */
+/* The user may define these variables.  If so, they should be vectors
+   and their associated sizes of port classes that will be translated into
+   control & protid pointers for passing to rpcs, in addition to those
+   passed to or created by trivfs_create_control (or trivfs_startup)
+   will automatically be recognized.  */
 extern struct port_class *trivfs_protid_portclasses[];
 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
-   stat (as returned from the underlying node) for presentation to
-   callers of io_stat.  It is permissable for this function to do
-   nothing.  */
+/* The user must define this function.  This function is expected to
+   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.  */
 void trivfs_modify_stat (struct trivfs_protid *cred, struct stat *);
 
-/* If this variable is set, it is called to find out what access this
-   file permits to USER instead of checking the underlying node.
-   REALNODE is the underlying node, and CNTL is the trivfs control
-   object.  The access permissions are returned in ALLOWED.  */
-error_t (*trivfs_check_access_hook) (struct trivfs_control *cntl,
-                                    struct iouser *user,
-                                    mach_port_t realnode,
-                                    int *allowed);
-
-/* If this variable is set, it is called every time an open happens.
-   USER and FLAGS are from the open; CNTL identifies the
-   node being opened.  This call need not check permissions on the underlying
-   node.  This call can block as necessary, unless O_NONBLOCK is set
-   in FLAGS.  Any desired error can be returned, which will be reflected
-   to the user and prevent the open from succeeding.  */
-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,
+/* The user may define this function.  This function is called to
+   determine what access this file permits to USER.  By default,
+   the underlying node, REALNODE, is checked.  CNTL is the trivfs
+   control object.  The access permissions are returned in ALLOWED.  */
+error_t trivfs_check_access (struct trivfs_control *cntl,
                             struct iouser *user,
-                            mach_port_t dotdot,
-                            int flags,
                             mach_port_t realnode,
-                            struct trivfs_protid **cred);
+                            int *allowed);
+
+/* The user may define this function.  If defined, this function is called
+   each time an open happens.  USER and FLAGS are as from the open; CNTL
+   identifies the node being opened.  This call need not check permissions
+   on the underlying node.  This call can block as necessary, unless
+   O_NONBLOCK is set in FLAGS.  Any desired error can be returned, which
+   will be reflected to the user and prevent the open from succeeding.  */
+error_t trivfs_check_open (struct trivfs_control *cntl,
+                          struct iouser *user, int flags);
+
+/* The user may define this function.  If defined, this function is
+   expected to return a new protid pointing to a new peropen in CRED,
+   with REALNODE as the underlying node reference, with the given
+   identity, and open flags in FLAGS.  CNTL is the trivfs control
+   object.  The default implementation is available as
+   _trivfs_open.  */
+error_t trivfs_open (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 *);
-
-/* If this variable is set, it is called every time a new peropen
-   structure is created and initialized. */
-error_t (*trivfs_peropen_create_hook) (struct trivfs_peropen *);
-
-/* If this variable is set, it is called every time a protid structure
-   is about to be destroyed. */
-void (*trivfs_protid_destroy_hook) (struct trivfs_protid *);
-
-/* If this variable is set, it is called every time a peropen structure
-   is about to be destroyed. */
-void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *);
-
-/* If this variable is set, it is called by trivfs_S_fsys_getroot before any
-   other processing takes place; if the return value is EAGAIN, normal trivfs
-   getroot processing continues, otherwise the rpc returns with that return
-   value.  */
-error_t (*trivfs_getroot_hook) (struct trivfs_control *cntl,
-                               mach_port_t reply_port,
-                               mach_msg_type_name_t reply_port_type,
-                               mach_port_t dotdot,
-                               uid_t *uids, u_int nuids, uid_t *gids, u_int 
ngids,
-                               int flags,
-                               retry_type *do_retry, char *retry_name,
-                               mach_port_t *node, mach_msg_type_name_t 
*node_type);
+/* The user may define this function.  If defined, this function is
+   called each time a new protid structure is created and initialized. */
+error_t trivfs_protid_create (struct trivfs_protid *);
+
+/* The user may define this function.  If defined, this function is
+   called each time a new peropen structure is created and initialized. */
+error_t trivfs_peropen_create (struct trivfs_peropen *);
+
+/* The user may define this function.  If defined, this function is
+   called each time a protid structure is about to be destroyed. */
+void trivfs_protid_destroy (struct trivfs_protid *);
+
+/* The user may define this function.  If defined, this function is
+   called each time a peropen structure is about to be destroyed. */
+void trivfs_peropen_destroy (struct trivfs_peropen *);
+
+/* The user may define this function.  If defined, this function is
+   is called by trivfs_S_fsys_getroot before any processing takes
+   place; if the return value is EAGAIN, normal trivfs getroot processing
+   continues, otherwise the rpc returns with that return value.  */
+error_t trivfs_getroot (struct trivfs_control *cntl,
+                       mach_port_t reply_port,
+                       mach_msg_type_name_t reply_port_type,
+                       mach_port_t dotdot,
+                       uid_t *uids, u_int nuids,
+                       uid_t *gids, u_int ngids,
+                       int flags,
+                       retry_type *do_retry, char *retry_name,
+                       mach_port_t *node,
+                       mach_msg_type_name_t *node_type);
+
+/* The user must define this function.  This function is expected
+   to shutdown the translator (i.e. exit).  FLAGS are from the set
+   FSYS_GOAWAY_* (See <hurd/hurd_types.h>).  */
+error_t trivfs_goaway (struct trivfs_control *cntl, int flags);
+
+
+/* Definitions provided by trivfs.  */
 
 /* Creates a control port for this filesystem and sends it to BOOTSTRAP with
    fsys_startup.  CONTROL_CLASS & CONTROL_BUCKET are passed to the ports
@@ -170,7 +192,15 @@
                        struct port_bucket *protid_bucket,
                        struct trivfs_control **control);
 
-/* Create a new trivfs control port, with underlying node UNDERLYING, and
+/* Default implementation of trivfs_open.  */
+error_t _trivfs_open (struct trivfs_control *fsys,
+                    struct iouser *user,
+                    mach_port_t dotdot,
+                    int flags,
+                    mach_port_t realnode,
+                    struct trivfs_protid **cred);
+
+/* Create a new trivfs control port with underlying node UNDERLYING, and
    return it in CONTROL.  CONTROL_CLASS & CONTROL_BUCKET are passed to
    the ports library to create the control port, and PROTID_CLASS &
    PROTID_BUCKET are used when creating ports representing opens of this
@@ -185,36 +215,23 @@
                       struct trivfs_control **control);
 
 /* Install these as libports cleanroutines for trivfs_protid_class
-   and trivfs_cntl_class respectively. */
+   and trivfs_cntl_class respectively.  */
 void trivfs_clean_protid (void *);
 void trivfs_clean_cntl (void *);
 
-/* This demultiplees messages for trivfs ports. */
+/* This demultiplexes messages for trivfs ports.  */
 int trivfs_demuxer (mach_msg_header_t *, mach_msg_header_t *);
 
-/* Return a new protid pointing to a new peropen in CRED, with REALNODE as
-   the underlying node reference, with the given identity, and open flags in
-   FLAGS.  CNTL is the trivfs control object.  */
-error_t trivfs_open (struct trivfs_control *fsys,
-                    struct iouser *user,
-                    unsigned flags,
-                    mach_port_t realnode,
-                    struct trivfs_protid **cred);
-
 /* Return a duplicate of CRED in DUP, sharing the same peropen and hook.  A
    non-null hook may be used to detect that this is a duplicate by
-   trivfs_peropen_create_hook.  */
+   trivfs_peropen_create.  */
 error_t trivfs_protid_dup (struct trivfs_protid *cred,
                           struct trivfs_protid **dup);
 
-/* The user must define this function.  Someone wants the filesystem
-   CNTL to go away.  FLAGS are from the set FSYS_GOAWAY_*. */
-error_t trivfs_goaway (struct trivfs_control *cntl, int flags);
-
 /* Call this to set atime for the node to the current time.  */
 error_t trivfs_set_atime (struct trivfs_control *cntl);
 
-/* Call this to set mtime for the node to the current time. */
+/* Call this to set mtime for the node to the current time.  */
 error_t trivfs_set_mtime (struct trivfs_control *cntl);
 
 /* If this is defined or set to an argp structure, it will be used by the
diff -Nur hurd-20010115-snapshot/libtrivfs/user-hooks.c 
hurd-20010115/libtrivfs/user-hooks.c
--- hurd-20010115-snapshot/libtrivfs/user-hooks.c       Wed Dec 31 19:00:00 1969
+++ hurd-20010115/libtrivfs/user-hooks.c        Sun Feb 25 04:02:05 2001
@@ -0,0 +1,63 @@
+/*
+   Copyright (C) 2001 Free Software Foundation
+
+   Written by Neal H Walfield <neal@cs.uml.edu>
+
+   This program 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.
+
+   This program 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 this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "priv.h"
+#include <assert.h>
+
+void _trivfs_user_defined (void)
+{
+  assert (! "_trivfs_user_defined called!");
+}
+
+/* The default version of these functions should never be called
+   directly.  */
+error_t
+trivfs_check_open (struct trivfs_control *cntl,
+                  struct iouser *user, int flags)
+                    __attribute__ ((weak, alias ("_trivfs_user_defined")));
+
+error_t
+trivfs_protid_create (struct trivfs_protid *)
+                       __attribute__ ((weak, alias ("_trivfs_user_defined")));
+
+error_t
+trivfs_peropen_create (struct trivfs_peropen *)
+                        __attribute__ ((weak, alias ("_trivfs_user_defined")));
+
+void
+trivfs_protid_destroy (struct trivfs_protid *)
+                       __attribute__ ((weak, alias ("_trivfs_user_defined")));
+
+void
+trivfs_peropen_destroy (struct trivfs_peropen *)
+                       __attribute__ ((weak, alias ("_trivfs_user_defined")));
+
+error_t
+trivfs_getroot (struct trivfs_control *cntl,
+               mach_port_t reply_port,
+               mach_msg_type_name_t reply_port_type,
+               mach_port_t dotdot,
+               uid_t *uids, u_int nuids, 
+               uid_t *gids, u_int ngids,
+               int flags,
+               retry_type *do_retry, char *retry_name,
+               mach_port_t *node,
+               mach_msg_type_name_t *node_type)
+                 __attribute__ ((weak, alias ("_trivfs_user_defined")));
+
diff -Nur hurd-20010115-snapshot/trans/ChangeLog hurd-20010115/trans/ChangeLog
--- hurd-20010115-snapshot/trans/ChangeLog      Sun Jan 14 15:44:27 2001
+++ hurd-20010115/trans/ChangeLog       Sun Feb 25 05:19:33 2001
@@ -1,3 +1,26 @@
+2001-02-23  Neal H Walfield  <neal@cs.uml.edu>
+       
+       * fifo.c: Conform to the new trivfs_*_hook semantics
+       * firmlink.c: Likewise.
+       * hello-mt.c: Likewise.
+       * magic.c: Likewise.
+       * new-fifo.c: Likewise.
+       * streamio.c: Likewise.
+
+       * hello-mt.c: Documentation fixes.  Do not define _GNU_SOURCE.
+       * hello.c: Likewise.
+
+       * streamio.c: Documentation fixes.
+       (parse_opt): Be more careful with strtoul.
+
+       * magic.c (trivfs_open_hook):  Do not dereference dotdot,
+       trivfs does this automatically.
+
+2001-01-17  Neal H Walfield  <neal@cs.uml.edu>
+
+       * pump.c (start_pfinet): Conform to new fshelp_start_translator
+       symantics.
+
 2001-01-13  Marcus Brinkmann  <marcus@gnu.org>
 
        * Makefile (SRCS): Add streamio.c
@@ -7,7 +30,7 @@
        (OBJS): Add missing object files to list (crashServer.o
        crash_replyUser.o msgServer.o device_replyServer.o).
 
-       * storeio.c: New file by OKUJI Yoshinori.
+       * steamio.c: New file by OKUJI Yoshinori.
 
 2000-07-26  Mark Kettenis  <kettenis@gnu.org>
 
diff -Nur hurd-20010115-snapshot/trans/fifo.c hurd-20010115/trans/fifo.c
--- hurd-20010115-snapshot/trans/fifo.c Mon Sep 13 02:34:44 1999
+++ hurd-20010115/trans/fifo.c  Sun Feb 25 04:33:51 2001
@@ -1,6 +1,6 @@
 /* A translator for fifos
 
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
 
    Written by Miles Bader <miles@gnu.ai.mit.edu>
 
@@ -113,8 +113,8 @@
 
 /* ---------------------------------------------------------------- */
 
-static error_t
-open_hook (struct trivfs_peropen *po)
+error_t
+trivfs_peropen_create (struct trivfs_peropen *po)
 {
   error_t err = 0;
   int flags = po->openmodes;
@@ -211,8 +211,8 @@
   return err;
 }
 
-static void
-close_hook (struct trivfs_peropen *po)
+void
+trivfs_peropen_destroy (struct trivfs_peropen *po)
 {
   int was_active, detach = 0;
   int flags = po->openmodes;
@@ -258,9 +258,6 @@
 int trivfs_support_exec = 0;
 
 int trivfs_allow_open = O_READ | O_WRITE;
-
-error_t (*trivfs_peropen_create_hook) (struct trivfs_peropen *) = open_hook;
-void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook;
 
 void
 trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
diff -Nur hurd-20010115-snapshot/trans/firmlink.c hurd-20010115/trans/firmlink.c
--- hurd-20010115-snapshot/trans/firmlink.c     Tue Aug 31 22:18:12 1999
+++ hurd-20010115/trans/firmlink.c      Sun Feb 25 04:47:59 2001
@@ -1,6 +1,6 @@
 /* A translator for `firmlinks'
 
-   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
 
    Written by Miles Bader <miles@gnu.ai.mit.edu>
 
@@ -132,14 +132,14 @@
 
 /* Return the root node of our file system:  A firmlink to TARGET, unless
    TARGET doesn't exist, in which case we return a symlink-like node.  */
-static error_t
-getroot (struct trivfs_control *cntl,
-        mach_port_t reply_port, mach_msg_type_name_t reply_port_type,
-        mach_port_t dotdot,
-        uid_t *uids, u_int nuids, uid_t *gids, u_int ngids,
-        int flags,
-        retry_type *do_retry, char *retry_name,
-        mach_port_t *node, mach_msg_type_name_t *node_type)
+error_t
+trivfs_getroot (struct trivfs_control *cntl,
+               mach_port_t reply_port, mach_msg_type_name_t reply_port_type,
+               mach_port_t dotdot,
+               uid_t *uids, u_int nuids, uid_t *gids, u_int ngids,
+               int flags,
+               retry_type *do_retry, char *retry_name,
+               mach_port_t *node, mach_msg_type_name_t *node_type)
 {
   error_t err = firmlink (dotdot, target, flags, node);
 
@@ -156,11 +156,6 @@
 
   return err;
 }
-
-/* Called by trivfs_S_fsys_getroot before any other processing takes place;
-   if the return value is EAGAIN, normal trivfs getroot processing continues,
-   otherwise the rpc returns with that return value.  */
-error_t (*trivfs_getroot_hook) () = getroot;
 
 void
 trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
diff -Nur hurd-20010115-snapshot/trans/hello-mt.c hurd-20010115/trans/hello-mt.c
--- hurd-20010115-snapshot/trans/hello-mt.c     Mon Nov  8 16:40:22 1999
+++ hurd-20010115/trans/hello-mt.c      Sun Feb 25 04:34:54 2001
@@ -1,5 +1,5 @@
 /* hello-mt.c - A trivial single-file translator, multithreaded version
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 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
@@ -15,8 +15,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-#define _GNU_SOURCE 1
-
 #include <hurd/trivfs.h>
 #include <stdio.h>
 #include <argp.h>
@@ -61,7 +59,7 @@
    $
 
    For that reason, you should run this as an active translator
-   `settrans -ac testnode /path/to/thello' so that you can see the
+   `settrans -ac testnode /path/to/hello' so that you can see the
    error messages when they appear. */
 
 /* A hook for us to keep track of the file descriptor state. */
@@ -86,9 +84,8 @@
   exit (0);
 }
 
-
-static error_t
-open_hook (struct trivfs_peropen *peropen)
+error_t
+trivfs_peropen_create (struct trivfs_peropen *peropen)
 {
   struct open *op = malloc (sizeof (struct open));
   if (op == NULL)
@@ -101,17 +98,15 @@
   return 0;
 }
 
-
-static void
-close_hook (struct trivfs_peropen *peropen)
+void
+trivfs_peropen_destroy (struct trivfs_peropen *peropen)
 {
   struct open *op = peropen->hook;
 
   mutex_clear (&op->lock);
   free (op);
 }
-
-
+
 /* Read data from an IO object.  If offset is -1, read from the object
    maintained file pointer.  If the object is not seekable, offset is
    ignored.  The amount desired to be read is in AMOUNT.  */
@@ -202,16 +197,6 @@
 
   return err;
 }
-
-
-/* If this variable is set, it is called every time a new peropen
-   structure is created and initialized. */
-error_t (*trivfs_peropen_create_hook)(struct trivfs_peropen *) = open_hook;
-
-/* If this variable is set, it is called every time a peropen structure
-   is about to be destroyed. */
-void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook;
-
 
 /* Options processing.  We accept the same options on the command line
    and from fsys_set_options.  */
diff -Nur hurd-20010115-snapshot/trans/hello.c hurd-20010115/trans/hello.c
--- hurd-20010115-snapshot/trans/hello.c        Mon Nov  8 16:40:27 1999
+++ hurd-20010115/trans/hello.c Sun Feb 25 04:35:56 2001
@@ -1,5 +1,5 @@
 /* hello.c - A trivial single-file translator
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
    Gordon Matzigkeit <gord@fig.org>, 1999
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -15,8 +15,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-#define _GNU_SOURCE 1
-
 #include <hurd/trivfs.h>
 #include <stdio.h>
 #include <argp.h>
@@ -56,7 +54,7 @@
    $
 
    For that reason, you should run this as an active translator
-   `settrans -ac testnode /path/to/thello' so that you can see the
+   `settrans -ac testnode /path/to/hello' so that you can see the
    error messages when they appear. */
 
 /* A hook for us to keep track of the file descriptor state. */
@@ -80,9 +78,8 @@
   exit (0);
 }
 
-
-static error_t
-open_hook (struct trivfs_peropen *peropen)
+error_t
+trivfs_peropen_create (struct trivfs_peropen *peropen)
 {
   struct open *op = malloc (sizeof (struct open));
   if (op == NULL)
@@ -95,8 +92,8 @@
 }
 
 
-static void
-close_hook (struct trivfs_peropen *peropen)
+void
+trivfs_peropen_destroy (struct trivfs_peropen *peropen)
 {
   free (peropen->hook);
 }
@@ -178,16 +175,6 @@
 
   return err;
 }
-
-
-/* If this variable is set, it is called every time a new peropen
-   structure is created and initialized. */
-error_t (*trivfs_peropen_create_hook)(struct trivfs_peropen *) = open_hook;
-
-/* If this variable is set, it is called every time a peropen structure
-   is about to be destroyed. */
-void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook;
-
 
 /* Options processing.  We accept the same options on the command line
    and from fsys_set_options.  */
diff -Nur hurd-20010115-snapshot/trans/magic.c hurd-20010115/trans/magic.c
--- hurd-20010115-snapshot/trans/magic.c        Mon Oct 11 05:05:42 1999
+++ hurd-20010115/trans/magic.c Sun Feb 25 04:37:38 2001
@@ -1,6 +1,6 @@
 /* A translator for returning FS_RETRY_MAGIC strings.
 
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 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
@@ -85,20 +85,24 @@
 /* This hook is used when running without --directory;
    it circumvents basically all the trivfs machinery.  */
 
-static error_t
-magic_getroot (struct trivfs_control *cntl,
-              mach_port_t reply_port,
-              mach_msg_type_name_t reply_port_type,
-              mach_port_t dotdot,
-              uid_t *uids, u_int nuids, uid_t *gids, u_int ngids,
-              int flags,
-              retry_type *do_retry, char *retry_name,
-              mach_port_t *node, mach_msg_type_name_t *node_type)
+error_t
+trivfs_getroot (struct trivfs_control *cntl,
+               mach_port_t reply_port,
+               mach_msg_type_name_t reply_port_type,
+               mach_port_t dotdot,
+               uid_t *uids, u_int nuids, uid_t *gids, u_int ngids,
+               int flags,
+               retry_type *do_retry, char *retry_name,
+               mach_port_t *node, mach_msg_type_name_t *node_type)
 {
-  strcpy (retry_name, magic);
-  *do_retry = FS_RETRY_MAGICAL;
-  *node = MACH_PORT_NULL;
-  *node_type = MACH_MSG_TYPE_COPY_SEND;
+  if (! directory)
+    {
+      strcpy (retry_name, magic);
+      *do_retry = FS_RETRY_MAGICAL;
+      *node = MACH_PORT_NULL;
+      *node_type = MACH_MSG_TYPE_COPY_SEND;
+    }
+
   return 0;
 }
 
@@ -107,23 +111,21 @@
    the normal trivfs open, but then stash the DOTDOT port
    in the trivfs_peropen.  */
 
-static error_t
-magic_open  (struct trivfs_control *cntl,
-            struct iouser *user,
-            mach_port_t dotdot,
-            int flags,
-            mach_port_t realnode,
-            struct trivfs_protid **cred)
+error_t
+trivfs_open  (struct trivfs_control *cntl,
+             struct iouser *user,
+             mach_port_t dotdot,
+             int flags,
+             mach_port_t realnode,
+             struct trivfs_protid **cred)
 {
-  error_t err = trivfs_open (cntl, user, flags, realnode, cred);
-  if (!err)
+  error_t err = _trivfs_open (cntl, user, dotdot, flags, realnode, cred);
+  if (!err && directory)
     {
       (*cred)->po->hook = (void *) dotdot;
       err = mach_port_mod_refs (mach_task_self (), dotdot,
                                MACH_PORT_RIGHT_SEND, +1);
       assert_perror (err);
-      err = mach_port_deallocate (mach_task_self (), dotdot);
-      assert_perror (err);
     }
   return err;
 }
@@ -201,11 +203,8 @@
   flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS);
 
   /* Validate permissions */
-  if (! trivfs_check_access_hook)
-    file_check_access (cred->realnode, &perms);
-  else
-    (*trivfs_check_access_hook) (cred->po->cntl, cred->user,
-                                cred->realnode, &perms);
+  trivfs_check_access (cred->po->cntl, cred->user,
+                      cred->realnode, &perms);
   if ((flags & (O_READ|O_WRITE|O_EXEC) & perms)
       != (flags & (O_READ|O_WRITE|O_EXEC)))
     return EACCES;
@@ -214,8 +213,8 @@
 
   dotdot = (mach_port_t) cred->po->hook;
   user = iohelp_dup_iouser (cred->user);
-  err = magic_open (cred->po->cntl, user, dotdot, flags,
-                   cred->realnode, &newcred);
+  err = trivfs_open (cred->po->cntl, user, dotdot, flags,
+                    cred->realnode, &newcred);
   if (err)
     {
       iohelp_free_iouser (user);
@@ -353,11 +352,7 @@
       d = add (dirbuf, ".");
       d = add (d, "..");
       dirbufsize = (char *) d - (char *) dirbuf;
-
-      trivfs_open_hook = &magic_open;
     }
-  else
-    trivfs_getroot_hook = &magic_getroot;
 
   /* Launch. */
   ports_manage_port_operations_one_thread (fsys->pi.bucket, trivfs_demuxer,
diff -Nur hurd-20010115-snapshot/trans/new-fifo.c hurd-20010115/trans/new-fifo.c
--- hurd-20010115-snapshot/trans/new-fifo.c     Mon Mar 20 13:15:38 2000
+++ hurd-20010115/trans/new-fifo.c      Sun Feb 25 04:39:27 2001
@@ -1,6 +1,6 @@
 /* A translator for fifos
 
-   Copyright (C) 1995,96,97,98,2000 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,2000, 2001 Free Software Foundation, Inc.
    Written by Miles Bader <miles@gnu.org>
 
    This program is free software; you can redistribute it and/or
@@ -366,8 +366,8 @@
     }
 }
 
-static error_t
-open_hook (struct trivfs_peropen *po)
+error_t
+trivfs_peropen_create (struct trivfs_peropen *po)
 {
   struct fifo_trans *trans = po->cntl->hook;
 
@@ -381,8 +381,8 @@
     return 0;
 }
 
-static void
-close_hook (struct trivfs_peropen *po)
+void
+trivfs_peropen_destroy (struct trivfs_peropen *po)
 {
   struct fifo_trans *trans = po->cntl->hook;
 
@@ -401,9 +401,6 @@
 int trivfs_support_exec = 0;
 
 int trivfs_allow_open = O_READ | O_WRITE;
-
-error_t (*trivfs_peropen_create_hook) (struct trivfs_peropen *) = open_hook;
-void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook;
 
 void
 trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
diff -Nur hurd-20010115-snapshot/trans/streamio.c hurd-20010115/trans/streamio.c
--- hurd-20010115-snapshot/trans/streamio.c     Sun Jan 14 15:44:27 2001
+++ hurd-20010115/trans/streamio.c      Sat Feb 24 05:23:43 2001
@@ -86,14 +86,14 @@
   return b->tail - b->head;
 }
 
-/* Return how much characters can be read from B.  */
+/* Return how many characters can be read from B.  */
 extern inline size_t
 buffer_readable (struct buffer *b)
 {
   return buffer_size (b);
 }
 
-/* Return how much characters can be written to B.  */
+/* Return how many characters can be written to B.  */
 extern inline size_t
 buffer_writable (struct buffer *b)
 {
@@ -108,7 +108,8 @@
   condition_broadcast (b->wait);
 }
 
-/* Read up to LEN bytes from B to DATA, returning the amount actually read.  */
+/* Read up to LEN bytes from B into DATA, returning the amount actually
+   read.  */
 extern inline size_t
 buffer_read (struct buffer *b, void *data, size_t len)
 {
@@ -133,7 +134,7 @@
   return len;
 }
 
-/* Write LEN bytes from DATA to B, returning the amount actually written.  */
+/* Write LEN bytes from DATA into B, returning the amount actually written.  */
 extern inline size_t
 buffer_write (struct buffer *b, void *data, size_t len)
 {
@@ -162,21 +163,21 @@
 
 /* Read up to AMOUNT bytes, returned in BUF and LEN. If NOWAIT is non-zero
    and the buffer is empty, then returns EWOULDBLOCK. If an error occurs,
-   the error code is returned, otherwise 0.  */
+   the error code is returned, otherwise 0 is returned.  */
 error_t dev_read (size_t amount, void **buf, size_t *len, int nowait);
 
 /* Return current readable size in AMOUNT. If an error occurs, the error
-   code is returned, otherwise 0.  */
+   code is returned, otherwise 0 is returned.  */
 error_t dev_readable (size_t *amount);
 
 /* Write LEN bytes from BUF, returning the amount actually written
-   in AMOUNT. If NOWAIT is non-zero and the buffer is full, then returns
-   EWOULDBLOCK. If an error occurs, the error code is returned,
-   otherwise 0.  */
+   in AMOUNT. If NOWAIT is non-zero and the buffer is full, then 
+   EWOULDBLOCK is returned. If an error occurs, the error code is
+   returned, otherwise 0 is returned.  */
 error_t dev_write (void *buf, size_t len, size_t *amount, int nowait);
 
 /* Try and write out any pending writes to the device. If WAIT is non-zero,
-   will wait for any activity to cease.  */
+   wait for any activity to cease.  */
 error_t dev_sync (int wait);
 
 
@@ -222,14 +223,14 @@
        char *end;
 
        rdev = strtoul (start, &end, 0);
-       if (*end == ',')
+       if (end && *end == ',')
          /* MAJOR,MINOR form */
          {
            start = end;
            rdev = (rdev << 8) + strtoul (start, &end, 0);
          }
 
-       if (end == start || *end != '\0')
+       if (! end || end == start || *end != '\0')
          {
            argp_error (state, "%s: Invalid argument to --rdev", arg);
            return EINVAL;
@@ -317,8 +318,8 @@
 
 int trivfs_allow_open = O_READ | O_WRITE;
 
-static error_t
-open_hook (struct trivfs_control *cntl, struct iouser *user, int flags)
+error_t
+trivfs_check_open (struct trivfs_control *cntl, struct iouser *user, int flags)
 {
   error_t err;
   dev_mode_t mode = D_READ;
@@ -367,12 +368,8 @@
   return 0;
 }
 
-error_t (*trivfs_check_open_hook) (struct trivfs_control *,
-                                  struct iouser *, int)
-     = open_hook;
-
-static error_t
-po_create_hook (struct trivfs_peropen *po)
+error_t
+trivfs_peropen_create (struct trivfs_peropen *po)
 {
   mutex_lock (&global_lock);
   nperopens++;
@@ -380,11 +377,8 @@
   return 0;
 }
 
-error_t (*trivfs_peropen_create_hook) (struct trivfs_peropen *) =
-     po_create_hook;
-
-static void
-po_destroy_hook (struct trivfs_peropen *po)
+void
+trivfs_peropen_destroy (struct trivfs_peropen *po)
 {
   mutex_lock (&global_lock);
   nperopens--;
@@ -399,9 +393,6 @@
   mutex_unlock (&global_lock);
 }
 
-void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *)
-     = po_destroy_hook;
-
 void
 trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
 {
@@ -649,7 +640,7 @@
 {
   error_t err;
   
-  if (!cred)
+  if (! cred)
     return EOPNOTSUPP;
 
   mutex_lock (&global_lock);
@@ -665,7 +656,7 @@
 {
   error_t err;
   
-  if (!cred)
+  if (! cred)
     return EOPNOTSUPP;
 
   mutex_lock (&global_lock);
diff -Nur hurd-20010115-snapshot/exec/ChangeLog hurd-20010115/exec/ChangeLog
--- hurd-20010115-snapshot/exec/ChangeLog       Sun Oct  1 17:06:28 2000
+++ hurd-20010115/exec/ChangeLog        Sun Feb 25 04:58:11 2001
@@ -1,3 +1,7 @@
+2001-02-23  Neal H Walfield  <neal@cs.uml.edu>
+
+       * main.c (S_exec_init): Update to use new trivfs_open prototype.
+
 2000-10-01  Roland McGrath  <roland@frob.com>
 
        * exec.c: Comments.
diff -Nur hurd-20010115-snapshot/exec/main.c hurd-20010115/exec/main.c
--- hurd-20010115-snapshot/exec/main.c  Mon Mar 20 13:14:14 2000
+++ hurd-20010115/exec/main.c   Sun Feb 25 04:56:22 2001
@@ -1,6 +1,6 @@
 /* GNU Hurd standard exec server, main program and server mechanics.
 
-   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000 Free Software 
Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001 Free Software 
Foundation, Inc.
    Written by Roland McGrath.
    This file is part of the GNU Hurd.
 
@@ -231,6 +231,7 @@
 
     err = trivfs_open (fsys,
                       iohelp_create_iouser (make_idvec (), make_idvec ()),
+                      /* XXX */ MACH_PORT_NULL, 
                       0, MACH_PORT_NULL, &cred);
     assert_perror (err);
 
diff -Nur hurd-20010115-snapshot/pfinet/ChangeLog hurd-20010115/pfinet/ChangeLog
--- hurd-20010115-snapshot/pfinet/ChangeLog     Thu Jan 11 17:28:29 2001
+++ hurd-20010115/pfinet/ChangeLog      Sun Feb 25 04:59:51 2001
@@ -1,3 +1,7 @@
+2001-02-23  Neal H Walfield  <neal@cs.uml.edu>
+
+       * tunnel.c: Use new trivfs semantics.
+
 2001-01-07  Marcus Brinkmann  <marcus@gnu.org>
 
        * pfinet-ops.c: New file to implement hurd/pfinet.defs.
diff -Nur hurd-20010115-snapshot/pfinet/tunnel.c hurd-20010115/pfinet/tunnel.c
--- hurd-20010115-snapshot/pfinet/tunnel.c      Thu Nov 30 14:10:04 2000
+++ hurd-20010115/pfinet/tunnel.c       Sun Feb 25 05:06:58 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1995,96,98,99,2000 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,98,99,2000, 2001 Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -224,10 +224,10 @@
 
 /* If a new open with read and/or write permissions is requested,
    restrict to exclusive usage.  */
-static error_t
-check_open_hook (struct trivfs_control *cntl,
-                struct iouser *user,
-                int flags)
+error_t
+trivfs_check_open (struct trivfs_control *cntl,
+                  struct iouser *user,
+                  int flags)
 {
   struct tunnel_device *tdev;
 
@@ -247,8 +247,8 @@
 
 /* When a protid is destroyed, check if it is the current user.
    If yes, release the interface for other users.  */
-static void
-pi_destroy_hook (struct trivfs_protid *cred)
+void
+trivfs_protid_destroy (struct trivfs_protid *cred)
 {
   struct tunnel_device *tdev;
 
@@ -260,16 +260,6 @@
   if (tdev->user == cred->user)
     tdev->user = 0;
 }
-
-/* If this variable is set, it is called every time a new peropen
-   structure is created and initialized. */
-error_t (*trivfs_check_open_hook)(struct trivfs_control *,
-                                 struct iouser *, int)
-     = check_open_hook;
-
-/* If this variable is set, it is called every time a protid structure
-   is about to be destroyed. */
-void (*trivfs_protid_destroy_hook) (struct trivfs_protid *) = pi_destroy_hook;
 
 /* Read data from an IO object.  If offset is -1, read from the object
    maintained file pointer.  If the object is not seekable, offset is
diff -Nur hurd-20010115-snapshot/storeio/ChangeLog 
hurd-20010115/storeio/ChangeLog
--- hurd-20010115-snapshot/storeio/ChangeLog    Wed Jul 26 08:22:03 2000
+++ hurd-20010115/storeio/ChangeLog     Sun Feb 25 05:01:22 2001
@@ -1,3 +1,7 @@
+2001-02-23  Neal H Walfield  <neal@cs.uml.edu>
+
+       * io.c: Use new trivfs semantics.
+
 2000-07-26  Mark Kettenis  <kettenis@gnu.org>
 
        * Makefile (HURDLIBS): Reorder libs such that the threads lib
diff -Nur hurd-20010115-snapshot/storeio/io.c hurd-20010115/storeio/io.c
--- hurd-20010115-snapshot/storeio/io.c Sun Mar 19 15:56:46 2000
+++ hurd-20010115/storeio/io.c  Sun Feb 25 05:07:33 2001
@@ -1,6 +1,6 @@
 /* The hurd io interface to storeio
 
-   Copyright (C) 1995,96,97,99,2000 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,99,2000, 2001 Free Software Foundation, Inc.
    Written by Miles Bader <miles@gnu.org>
 
    This program is free software; you can redistribute it and/or
@@ -266,7 +266,7 @@
     }
 }
 
-/* File syncing operations; these all do the same thing, sync the underlying
+/* File syncing operations; these all do the same thing -- sync the underlying
    device.  */
 
 error_t
diff -Nur hurd-20010115-snapshot/storeio/storeio.c 
hurd-20010115/storeio/storeio.c
--- hurd-20010115-snapshot/storeio/storeio.c    Sun Mar 19 15:55:45 2000
+++ hurd-20010115/storeio/storeio.c     Sat Feb 24 09:11:46 2001
@@ -180,19 +180,19 @@
 /* Called whenever a new lookup is done of our node.  The only reason we
    set this hook is to duplicate the check done normally done against
    trivfs_allow_open in trivfs_S_fsys_getroot, but looking at the
-   per-device state.  This gets checked again in check_open_hook, but this
+   per-device state.  This gets checked again in trivfs_check_open, but this
    hook runs before a little but more overhead gets incurred.  In the
    success case, we just return EAGAIN to have trivfs_S_fsys_getroot
    continue with its generic processing.  */
-static error_t
-getroot_hook (struct trivfs_control *cntl,
-             mach_port_t reply_port,
-             mach_msg_type_name_t reply_port_type,
-             mach_port_t dotdot,
-             uid_t *uids, u_int nuids, uid_t *gids, u_int ngids,
-             int flags,
-             retry_type *do_retry, char *retry_name,
-             mach_port_t *node, mach_msg_type_name_t *node_type)
+error_t
+trivfs_getroot (struct trivfs_control *cntl,
+               mach_port_t reply_port,
+               mach_msg_type_name_t reply_port_type,
+               mach_port_t dotdot,
+               uid_t *uids, u_int nuids, uid_t *gids, u_int ngids,
+               int flags,
+               retry_type *do_retry, char *retry_name,
+               mach_port_t *node, mach_msg_type_name_t *node_type)
 {
   struct dev *const dev = cntl->hook;
   return (dev_is_readonly (dev) && (flags & O_WRITE)) ? EROFS : EAGAIN;
@@ -201,10 +201,10 @@
 /* Called whenever someone tries to open our node (even for a stat).  We
    delay opening the kernel device until this point, as we can usefully
    return errors from here.  */
-static error_t
-check_open_hook (struct trivfs_control *trivfs_control,
-                struct iouser *user,
-                int flags)
+error_t
+trivfs_check_open (struct trivfs_control *trivfs_control,
+                  struct iouser *user,
+                  int flags)
 {
   struct dev *const dev = trivfs_control->hook;
   error_t err = 0;
@@ -219,7 +219,7 @@
       err = dev_open (dev);
       if (err && (flags & (O_READ|O_WRITE)) == 0)
        /* If we're not opening for read or write, then just ignore the
-          error, as this allows stat to word correctly.  XXX  */
+          error, as this allows stat to work correctly.  XXX  */
        err = 0;
     }
   mutex_unlock (&dev->lock);
@@ -227,8 +227,8 @@
   return err;
 }
 
-static error_t
-open_hook (struct trivfs_peropen *peropen)
+error_t
+trivfs_peropen_create (struct trivfs_peropen *peropen)
 {
   struct dev *const dev = peropen->cntl->hook;
   if (dev->store)
@@ -237,8 +237,8 @@
     return 0;
 }
 
-static void
-close_hook (struct trivfs_peropen *peropen)
+void
+trivfs_peropen_destroy (struct trivfs_peropen *peropen)
 {
   if (peropen->hook)
     open_free (peropen->hook);
@@ -307,7 +307,7 @@
 
   if (device->store == NULL)
     /* The device is not actually open.
-       XXX note that exitting here nukes non-io users, like someone
+       XXX note that exiting here nukes non-io users, like someone
        in the middle of a stat who will get SIGLOST or something.  */
     exit (0);
 
@@ -353,41 +353,6 @@
   /* Complain that there are still users.  */
   return EBUSY;
 }
-
-/* If this variable is set, it is called by trivfs_S_fsys_getroot before any
-   other processing takes place; if the return value is EAGAIN, normal trivfs
-   getroot processing continues, otherwise the rpc returns with that return
-   value.  */
-error_t (*trivfs_getroot_hook) (struct trivfs_control *cntl,
-                               mach_port_t reply_port,
-                               mach_msg_type_name_t reply_port_type,
-                               mach_port_t dotdot,
-                               uid_t *uids, u_int nuids, uid_t *gids, u_int 
ngids,
-                               int flags,
-                               retry_type *do_retry, char *retry_name,
-                               mach_port_t *node, mach_msg_type_name_t 
*node_type)
-     = getroot_hook;
-
-/* If this variable is set, it is called every time an open happens.
-   USER and FLAGS are from the open; CNTL identifies the
-   node being opened.  This call need not check permissions on the underlying
-   node.  If the open call should block, then return EWOULDBLOCK.  Other
-   errors are immediately reflected to the user.  If O_NONBLOCK
-   is not set in FLAGS and EWOULDBLOCK is returned, then call
-   trivfs_complete_open when all pending open requests for this
-   file can complete. */
-error_t (*trivfs_check_open_hook)(struct trivfs_control *trivfs_control,
-                                 struct iouser *user,
-                                 int flags)
-     = check_open_hook;
-
-/* If this variable is set, it is called every time a new peropen
-   structure is created and initialized. */
-error_t (*trivfs_peropen_create_hook)(struct trivfs_peropen *) = open_hook;
-
-/* If this variable is set, it is called every time a peropen structure
-   is about to be destroyed. */
-void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook;
 
 /* Sync this filesystem.  */
 kern_return_t
diff -Nur hurd-20010115-snapshot/term/ChangeLog hurd-20010115/term/ChangeLog
--- hurd-20010115-snapshot/term/ChangeLog       Wed Jul 26 08:22:49 2000
+++ hurd-20010115/term/ChangeLog        Sun Feb 25 05:05:11 2001
@@ -1,3 +1,9 @@
+2001-02-23  Neal H Walfield  <neal@cs.uml.edu>
+
+       * users.c: Use new trivfs semantics.
+       (trivfs_check_open): bzero -> memset.
+       (S_term_open_ctty): Check return of malloc.
+
 2000-07-26  Mark Kettenis  <kettenis@gnu.org>
 
        * Makefile (HURDLIBS): Reorder libs such that the threads lib
diff -Nur hurd-20010115-snapshot/term/users.c hurd-20010115/term/users.c
--- hurd-20010115-snapshot/term/users.c Fri Mar 17 05:32:21 2000
+++ hurd-20010115/term/users.c  Sun Feb 25 05:07:51 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,99,2000, 2001 Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -106,11 +106,11 @@
 }
 
 
-static error_t
-check_access_hook (struct trivfs_control *cntl,
-                  struct iouser *user,
-                  mach_port_t realnode,
-                  int *allowed)
+error_t
+trivfs_check_access (struct trivfs_control *cntl,
+                    struct iouser *user,
+                    mach_port_t realnode,
+                    int *allowed)
 {
   struct stat st;
 
@@ -129,14 +129,11 @@
   mutex_unlock (&global_lock);
   return 0;
 }
-error_t (*trivfs_check_access_hook) (struct trivfs_control *, struct iouser *,
-                                    mach_port_t, int *)
-     = check_access_hook;
-
-static error_t
-open_hook (struct trivfs_control *cntl,
-          struct iouser *user,
-          int flags)
+
+error_t
+trivfs_check_open (struct trivfs_control *cntl,
+                  struct iouser *user,
+                  int flags)
 {
   static int open_count = 0;   /* XXX debugging */
   int cancel = 0;
@@ -152,7 +149,7 @@
 
   if (!(termflags & TTY_OPEN))
     {
-      bzero (&termstate, sizeof termstate);
+      memset (&termstate, 0, sizeof termstate);
 
       /* This is different from BSD: we don't turn on ISTRIP,
         and we use CS8 rather than CS7|PARENB.  */
@@ -219,12 +216,9 @@
   mutex_unlock (&global_lock);
   return err;
 }
-error_t (*trivfs_check_open_hook) (struct trivfs_control *,
-                                  struct iouser *, int)
-     = open_hook;
 
-static error_t
-pi_create_hook (struct trivfs_protid *cred)
+error_t
+trivfs_protid_create (struct trivfs_protid *cred)
 {
   if (cred->pi.class == pty_class)
     return 0;
@@ -236,10 +230,9 @@
 
   return 0;
 }
-error_t (*trivfs_protid_create_hook) (struct trivfs_protid *) = pi_create_hook;
 
-static void
-pi_destroy_hook (struct trivfs_protid *cred)
+void
+trivfs_protid_destroy (struct trivfs_protid *cred)
 {
   if (cred->pi.class == pty_class)
     return;
@@ -255,10 +248,9 @@
     }
   mutex_unlock (&global_lock);
 }
-void (*trivfs_protid_destroy_hook) (struct trivfs_protid *) = pi_destroy_hook;
 
-static error_t
-po_create_hook (struct trivfs_peropen *po)
+error_t
+trivfs_peropen_create (struct trivfs_peropen *po)
 {
   if (po->cntl == ptyctl)
     return pty_po_create_hook (po);
@@ -274,11 +266,9 @@
   mutex_unlock (&global_lock);
   return 0;
 }
-error_t (*trivfs_peropen_create_hook) (struct trivfs_peropen *) =
-     po_create_hook;
 
-static void
-po_destroy_hook (struct trivfs_peropen *po)
+void
+trivfs_peropen_destroy (struct trivfs_peropen *po)
 {
   if (po->cntl == ptyctl)
     {
@@ -310,8 +300,6 @@
 
   mutex_unlock (&global_lock);
 }
-void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *)
-     = po_destroy_hook;
 
 /* Tell if CRED can do foreground terminal operations */
 static inline int
@@ -392,6 +380,7 @@
     {
       err = trivfs_open (termctl,
                         iohelp_create_iouser (make_idvec (), make_idvec ()),
+                        /* XXX */ MACH_PORT_NULL,
                         flags, new_realnode, &newcred);
       if (!err)
        {
@@ -435,6 +424,12 @@
       if (!err)
        {
          struct protid_hook *hook = malloc (sizeof (struct protid_hook));
+         if (! hook)
+           {
+             mutex_unlock (&global_lock);
+             /* XXX: What else do we need to free?  */
+             return ENOMEM;
+           }
 
          hook->pid = pid;
          hook->pgrp = pgrp;
@@ -442,7 +437,7 @@
 
          if (newcred->hook)
            /* We inherited CRED's hook, get rid of our ref to it. */
-           pi_destroy_hook (newcred);
+           trivfs_protid_destroy (newcred);
          newcred->hook = hook;
 
          *newpt = ports_get_right (newcred);

Attachment: pgp58Wf3CqlyM.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]