bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] libdiskfs: publish begin_using_protid, end_using_protid and disk


From: Neal H Walfield
Subject: [PATCH] libdiskfs: publish begin_using_protid, end_using_protid and diskfs_demuxer
Date: Tue, 1 May 2001 16:33:00 +0200
User-agent: Mutt/1.3.15i

This patch publishes begin_using_protid_port and end_using_protid_port
as diskfs_* as well as diskfs_demuxer.  This allows filesystems built
around libdiskfs to support additional MiG interfaces using the same
port classs and port bucket as that used internally in libdiskfs.  In
this case, a file system will also wish to use its own demuxer, as such,
diskfs_spawn_first_thread now takes an additional argument, the demuxer
to use.  These changes only effect tmpfs which is the only file system
to call diskfs_spawn_first_thread directly.  A patch to fix tmpfs is
included here:


2001-04-23  Neal H Walfield  <neal@cs.uml.edu>

        * tmpfs.c (main): Pass diskfs_demuxer to
        diskfs_spawn_first_thread to conform to new libdiskfs semantics.


Index: tmpfs.c
===================================================================
RCS file: /home/neal/shared/CVS/hurd/tmpfs/tmpfs.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 tmpfs.c
--- tmpfs.c     2001/04/19 12:42:41     1.1.1.1
+++ tmpfs.c     2001/04/23 14:06:57
@@ -255,7 +255,7 @@
   if (err)
     error (4, err, "cannot create root directory");
 
-  diskfs_spawn_first_thread ();
+  diskfs_spawn_first_thread (diskfs_demuxer);
 
   /* Now that we are all set up to handle requests, and diskfs_root_node is
      set properly, it is safe to export our fsys control port to the


Here is the patch to libdiskfs:
 
2001-04-22  Neal H Walfield  <neal@cs.uml.edu>

        * Makefile (OTHERSRCS): Add extern-inline.c.
        * diskfs.h (DISKFS_EXTERN_INLINE): New macro.
        (diskfs_spawn_first_thread): Update prototype to include the
        additional parameter, a demuxer.
        (diskfs_begin_using_protid_port): Moved and renamed function
        begin_using_protid_port from priv.h.
        (diskfs_end_using_protid_port): Moved and renamed function
        end_using_protid_port from priv.h.
        * extern-inline.c: New file.
        * fsmutations.h (FILE_INTRAN): Use new function name.
        (FILE_DESTRUCTOR): Likewise.
        (IO_INTRAN): Likewise.
        (IO_DESTRUCTOR): Likewise.
        * init-first.c: Include <hurd/ports.h>.
        (master_thread_function): Unnamed parameter is now the demuxer.
        Use that rather than diskfs_demuxer directly.
        (diskfs_spawn_first_thread): New parameter DEMUXER.
        * init-main.c (diskfs_init_main): Pass diskfs_demuxer to
        diskfs_spawn_first_thread to conform to new semantics.
        * priv.h (begin_using_protid_port): Moved to diskfs.h.
        (end_using_protid_port): Likewise.


Index: libdiskfs/Makefile
===================================================================
RCS file: /home/neal/shared/CVS/hurd/libdiskfs/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- libdiskfs/Makefile  2001/04/19 12:40:47     1.1.1.1
+++ libdiskfs/Makefile  2001/05/01 12:20:29     1.1.1.1.2.1
@@ -37,6 +37,7 @@
        fsys-options.c fsys-syncfs.c fsys-forward.c
 IFSOCKSRCS=ifsock.c
 OTHERSRCS = conch-fetch.c conch-set.c dir-clear.c dir-init.c dir-renamed.c \
+       extern-inline.c \
        node-create.c node-drop.c node-make.c node-rdwr.c node-update.c \
        node-nref.c node-nput.c node-nrele.c node-nrefl.c node-nputl.c \
        node-nrelel.c \
Index: libdiskfs/diskfs.h
===================================================================
RCS file: /home/neal/shared/CVS/hurd/libdiskfs/diskfs.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- libdiskfs/diskfs.h  2001/04/19 12:40:48     1.1.1.1
+++ libdiskfs/diskfs.h  2001/05/01 12:20:29     1.1.1.1.2.1
@@ -1,5 +1,5 @@
 /* Definitions for fileserver helper functions
-   Copyright (C) 1994, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+   Copyright (C) 1994,95,96,97,98,99,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
@@ -26,6 +26,10 @@
 #include <hurd/iohelp.h>
 #include <idvec.h>
 
+#ifndef DISKFS_EXTERN_INLINE
+#define DISKFS_EXTERN_INLINE extern inline
+#endif
+
 /* Each user port referring to a file points to one of these
    (with the aid of the ports library).  */
 struct protid
@@ -560,8 +564,9 @@
 
 /* Call this after all format-specific initialization is done (except
    for setting diskfs_root_node); at this point the pagers should be
-   ready to go.  */
-void diskfs_spawn_first_thread (void);
+   ready to go.  DEMUXER is the demuxer to user.  Normally, this is
+   just diskfs_demuxer.  */
+void diskfs_spawn_first_thread (ports_demuxer_type demuxer);
 
 /* Once diskfs_root_node is set, call this if we are a bootstrap
    filesystem.  If you call this, then the library will call
@@ -761,6 +766,25 @@
 /* Finish building protid CRED started with diskfs_start_protid;
    the user to install is USER.  */
 void diskfs_finish_protid (struct protid *cred, struct iouser *user);
+
+/* Called by MiG to translate ports into struct protid *.
+   fsmutations.h arranges for this to happen for the io and
+   fs interfaces. */
+DISKFS_EXTERN_INLINE struct protid *
+diskfs_begin_using_protid_port (file_t port)
+{
+  return ports_lookup_port (diskfs_port_bucket, port, diskfs_protid_class);
+}
+
+/* Called by MiG after server routines have been run; this
+   balances begin_using_protid_port, and is arranged for the io
+   and fs interfaces by fsmutations.h. */
+DISKFS_EXTERN_INLINE void
+diskfs_end_using_protid_port (struct protid *cred)
+{
+  if (cred)
+    ports_port_deref (cred);
+}
 
 /* Create and return a new peropen structure on node NP with open
    flags FLAGS.  The initial values for the root_parent, shadow_root, and
Index: libdiskfs/extern-inline.c
===================================================================
RCS file: /home/neal/shared/CVS/hurd/libdiskfs/extern-inline.c,v
diff -N extern-inline.c
--- /dev/null   Fri Apr 13 19:52:55 2001
+++ libdiskfs/extern-inline.c   Tue May  1 16:30:11 2001
@@ -0,0 +1,20 @@
+/* Run time callable functions for extern inlines.
+   Copyright (C) 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
+   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. */
+
+#define DISKFS_EXTERN_INLINE
+
+#include "diskfs.h"
Index: libdiskfs/fsmutations.h
===================================================================
RCS file: /home/neal/shared/CVS/hurd/libdiskfs/fsmutations.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- libdiskfs/fsmutations.h     2001/04/19 12:40:51     1.1.1.1
+++ libdiskfs/fsmutations.h     2001/05/01 12:20:30     1.1.1.1.2.1
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1994 Free Software Foundation
+   Copyright (C) 1994,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
@@ -17,11 +17,11 @@
 
 /* Only CPP macro definitions should go in this file. */
 
-#define FILE_INTRAN protid_t begin_using_protid_port (file_t)
-#define FILE_DESTRUCTOR end_using_protid_port (protid_t)
+#define FILE_INTRAN protid_t diskfs_begin_using_protid_port (file_t)
+#define FILE_DESTRUCTOR diskfs_end_using_protid_port (protid_t)
 
-#define IO_INTRAN protid_t begin_using_protid_port (io_t)
-#define IO_DESTRUCTOR end_using_protid_port (protid_t)
+#define IO_INTRAN protid_t diskfs_begin_using_protid_port (io_t)
+#define IO_DESTRUCTOR diskfs_end_using_protid_port (protid_t)
 
 #define FILE_IMPORTS import "priv.h";
 #define IO_IMPORTS import "priv.h";
Index: libdiskfs/init-first.c
===================================================================
RCS file: /home/neal/shared/CVS/hurd/libdiskfs/init-first.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- libdiskfs/init-first.c      2001/04/19 12:40:51     1.1.1.1
+++ libdiskfs/init-first.c      2001/05/01 12:20:30     1.1.1.1.2.1
@@ -21,20 +21,21 @@
 
 #include "priv.h"
 #include <stdlib.h>
+#include <hurd/ports.h>
 
 static int thread_timeout = 1000 * 60 * 2; /* two minutes */
 static int server_timeout = 1000 * 60 * 10; /* ten minutes */
 
 
 static any_t
-master_thread_function (any_t foo __attribute__ ((unused)))
+master_thread_function (any_t demuxer)
 {
   error_t err;
 
   do
     {
       ports_manage_port_operations_multithread (diskfs_port_bucket,
-                                               diskfs_demuxer,
+                                               (ports_demuxer_type) demuxer,
                                                thread_timeout,
                                                server_timeout,
                                                0);
@@ -48,8 +49,8 @@
 }
 
 void
-diskfs_spawn_first_thread (void)
+diskfs_spawn_first_thread (ports_demuxer_type demuxer)
 {
   cthread_detach (cthread_fork ((cthread_fn_t) master_thread_function,
-                               (any_t) 0));
+                               (any_t) demuxer));
 }
Index: libdiskfs/init-main.c
===================================================================
RCS file: /home/neal/shared/CVS/hurd/libdiskfs/init-main.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- libdiskfs/init-main.c       2001/04/19 12:40:52     1.1.1.1
+++ libdiskfs/init-main.c       2001/05/01 12:20:31     1.1.1.1.2.1
@@ -1,5 +1,5 @@
 /* diskfs_init_main -- initialize diskfs world, parse arguments, and open store
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -72,7 +72,7 @@
     diskfs_readonly = diskfs_hard_readonly = 1;
 
   /* Start the first request thread, to handle RPCs and page requests. */
-  diskfs_spawn_first_thread ();
+  diskfs_spawn_first_thread (diskfs_demuxer);
 
   return store;
 }
Index: libdiskfs/priv.h
===================================================================
RCS file: /home/neal/shared/CVS/hurd/libdiskfs/priv.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- libdiskfs/priv.h    2001/04/19 12:40:56     1.1.1.1
+++ libdiskfs/priv.h    2001/05/01 12:20:33     1.1.1.1.2.1
@@ -1,5 +1,5 @@
 /* Private declarations for fileserver library
-   Copyright (C) 1994,95,96,97,98,99 Free Software Foundation, Inc.
+   Copyright (C) 1994,95,96,97,98,99,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
@@ -63,25 +63,6 @@
 
 /* Needed for MiG. */
 typedef struct protid *protid_t;
-
-/* Called by MiG to translate ports into struct protid *.
-   fsmutations.h arranges for this to happen for the io and
-   fs interfaces. */
-extern inline struct protid *
-begin_using_protid_port (file_t port)
-{
-  return ports_lookup_port (diskfs_port_bucket, port, diskfs_protid_class);
-}
-
-/* Called by MiG after server routines have been run; this
-   balances begin_using_protid_port, and is arranged for the io
-   and fs interfaces by fsmutations.h. */
-extern inline void
-end_using_protid_port (struct protid *cred)
-{
-  if (cred)
-    ports_port_deref (cred);
-}
 
 /* Actually read or write a file.  The file size must already permit
    the requested access.  NP is the file to read/write.  DATA is a buffer

Attachment: pgpBbDHfF9PGC.pgp
Description: PGP signature


reply via email to

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