bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] libnetfs


From: Neal H Walfield
Subject: [PATCH] libnetfs
Date: Mon, 15 Jan 2001 22:17:03 -0500
User-agent: Mutt/1.2.5i

This patch adds direct support for netfs_file_get_storage_info to
libnetfs.

-Neal


diff -ru --new-file --exclude=CVS hurd-20000115/libnetfs/ChangeLog 
hurd/libnetfs/ChangeLog
--- hurd-20000115/libnetfs/ChangeLog    Sat Dec 30 17:14:39 2000
+++ hurd/libnetfs/ChangeLog     Mon Jan 15 22:00:03 2001
@@ -1,3 +1,11 @@
+2001-01-15  Neal H Walfield   <neal@cs.uml.edu>
+
+       * netfs.h: Added netfs_get_storage_info.
+       * file-get-storage-info.c (netfs_S_get_storage_info): Calls
+       netfs_get_storage_info instead of providing default response.
+       * file-get-storage-info-default.c: New file.
+       (netfs_get_storage_info):  Provides default response.
+
 2000-12-30  Marcus Brinkmann  <marcus@gnu.org>
 
        * netfs.h: Revert doc "fix" of netfs_attempt_chmod.
diff -ru --new-file --exclude=CVS hurd-20000115/libnetfs/Makefile 
hurd/libnetfs/Makefile
--- hurd-20000115/libnetfs/Makefile     Thu Sep  9 01:17:20 1999
+++ hurd/libnetfs/Makefile      Mon Jan 15 21:56:00 2001
@@ -1,5 +1,5 @@
 # 
-#   Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation
+#   Copyright (C) 1995, 1996, 1997, 1999, 2001 Free Software Foundation
 #   Written by Michael I. Bushnell.
 #
 #   This file is part of the GNU Hurd.
@@ -46,8 +46,8 @@
        init-loop.c demuxer.c shutdown.c release-protid.c release-peropen.c   \
        init-startup.c startup-argp.c set-options.c append-args.c             \
        runtime-argp.c std-runtime-argp.c std-startup-argp.c                  \
-       append-std-options.c trans-callback.c set-get-trans.c \
-       nref.c nrele.c nput.c
+       append-std-options.c trans-callback.c set-get-trans.c                 \
+       nref.c nrele.c nput.c file-get-storage-info-default.c
 
 SRCS= $(OTHERSRCS) $(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(IFSOCKSRCS)
 
diff -ru --new-file --exclude=CVS 
hurd-20000115/libnetfs/file-get-storage-info-default.c 
hurd/libnetfs/file-get-storage-info-default.c
--- hurd-20000115/libnetfs/file-get-storage-info-default.c      Wed Dec 31 
19:00:00 1969
+++ hurd/libnetfs/file-get-storage-info-default.c       Mon Jan 15 22:12:38 2001
@@ -0,0 +1,55 @@
+/*
+   Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
+   Written by Michael I. Bushnell, p/BSG.
+
+   This file is part of the GNU Hurd.
+
+   The GNU Hurd 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.
+
+   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.
+
+   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., 59 Temple Place - Suite 330, Boston, MA  02111, USA. */
+
+#include "netfs.h"
+#include "fs_S.h"
+#include <sys/mman.h>
+
+
+error_t
+netfs_file_get_storage_info (struct iouser *cred,
+                            struct node *np,
+                            mach_port_t **ports,
+                            mach_msg_type_name_t *ports_type,
+                            mach_msg_type_number_t *num_ports,
+                            int **ints,
+                            mach_msg_type_number_t *num_ints,
+                            off_t **offsets,
+                            mach_msg_type_number_t *num_offsets,
+                            char **data,
+                            mach_msg_type_number_t *data_len)
+{
+  *data_len = 0;
+  *num_offsets = 0;
+  *num_ports = 0;
+
+  if (*num_ints == 0)
+    /* Argh */
+    {
+      *ints = mmap (0, sizeof (int), PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
+      if (*ints == (int *) -1)
+       return errno;
+    }
+
+  *num_ints = 1;
+  (*ints)[0] = STORAGE_NETWORK;
+
+  return 0;
+}
diff -ru --new-file --exclude=CVS 
hurd-20000115/libnetfs/file-get-storage-info.c 
hurd/libnetfs/file-get-storage-info.c
--- hurd-20000115/libnetfs/file-get-storage-info.c      Sun Jul 11 14:41:19 1999
+++ hurd/libnetfs/file-get-storage-info.c       Mon Jan 15 21:56:00 2001
@@ -1,6 +1,6 @@
 /*
-   Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
-   Written by Michael I. Bushnell, p/BSG.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   Written by Neal H Walfield <neal@cs.uml.edu>
 
    This file is part of the GNU Hurd.
 
@@ -20,35 +20,28 @@
 
 #include "netfs.h"
 #include "fs_S.h"
-#include <sys/mman.h>
 
 error_t
 netfs_S_file_get_storage_info (struct protid *user,
-                               mach_port_t **ports,
-                               mach_msg_type_name_t *ports_type,
-                               mach_msg_type_number_t *num_ports,
-                               int **ints, mach_msg_type_number_t *num_ints,
-                               off_t **offsets,
-                               mach_msg_type_number_t *num_offsets,
-                               char **data, mach_msg_type_number_t *data_len)
+                              mach_port_t **ports,
+                              mach_msg_type_name_t *ports_type,
+                              mach_msg_type_number_t *num_ports,
+                              int **ints, mach_msg_type_number_t *num_ints,
+                              off_t **offsets,
+                              mach_msg_type_number_t *num_offsets,
+                              char **data, mach_msg_type_number_t *data_len)
 {
+  error_t err;
+
   if (!user)
     return EOPNOTSUPP;
 
-  *data_len = 0;
-  *num_offsets = 0;
-  *num_ports = 0;
-
-  if (*num_ints == 0)
-    /* Argh */
-    {
-      *ints = mmap (0, sizeof (int), PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
-      if (*ints == (int *) -1)
-       return errno;
-    }
-
-  *num_ints = 1;
-  (*ints)[0] = STORAGE_NETWORK;
+  mutex_lock (&user->po->np->lock);
+  err = netfs_file_get_storage_info (user->user, user->po->np, ports,
+                                    ports_type, num_ports, ints,
+                                    num_ints, offsets, num_offsets,
+                                    data, data_len);
+  mutex_unlock (&user->po->np->lock);
 
-  return 0;
+  return err;
 }
diff -ru --new-file --exclude=CVS hurd-20000115/libnetfs/netfs.h 
hurd/libnetfs/netfs.h
--- hurd-20000115/libnetfs/netfs.h      Sat Dec 30 17:14:39 2000
+++ hurd/libnetfs/netfs.h       Mon Jan 15 21:56:00 2001
@@ -282,6 +282,22 @@
                            int entry, int nentries, char **data,
                           mach_msg_type_number_t *datacnt,
                           vm_size_t bufsize, int *amt);
+
+/* The user may define this function.  For a full description,
+   see hurd/hurd_types.h.  The default response indicates a network
+   store.  If the supplied buffers are not large enough, they should
+   be grown as necessary.  NP is locked.  */
+error_t netfs_file_get_storage_info (struct iouser *cred,
+                                    struct node *np,
+                                    mach_port_t **ports,
+                                    mach_msg_type_name_t *ports_type,
+                                    mach_msg_type_number_t *num_ports,
+                                    int **ints,
+                                    mach_msg_type_number_t *num_ints,
+                                    off_t **offsets,
+                                    mach_msg_type_number_t *num_offsets,
+                                    char **data,
+                                    mach_msg_type_number_t *data_len);
 
 /* Option parsing */
 

Attachment: pgp3BTMrBGRmZ.pgp
Description: PGP signature


reply via email to

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