From 0e64f4e5701389ae3df1f6c388173e3ec254fc89 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Tue, 30 Jan 2001 00:50:25 +0000 Subject: 2001-01-15 Neal H Walfield * 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. --- libnetfs/ChangeLog | 8 ++++++++ libnetfs/Makefile | 6 +++--- libnetfs/file-get-storage-info.c | 43 +++++++++++++++++----------------------- libnetfs/netfs.h | 16 +++++++++++++++ 4 files changed, 45 insertions(+), 28 deletions(-) (limited to 'libnetfs') diff --git a/libnetfs/ChangeLog b/libnetfs/ChangeLog index 625075a5..834d39c9 100644 --- a/libnetfs/ChangeLog +++ b/libnetfs/ChangeLog @@ -1,3 +1,11 @@ +2001-01-15 Neal H Walfield + + * 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. + 2001-01-30 Neal H Walfield * netfs.h: Fix comment for netfs_nref (finally). diff --git a/libnetfs/Makefile b/libnetfs/Makefile index b11f1ecd..026c6cbb 100644 --- a/libnetfs/Makefile +++ b/libnetfs/Makefile @@ -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 @@ OTHERSRCS= drop-node.c init-init.c make-node.c make-peropen.c make-protid.c \ 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 --git a/libnetfs/file-get-storage-info.c b/libnetfs/file-get-storage-info.c index e9eb32bb..ac977be3 100644 --- a/libnetfs/file-get-storage-info.c +++ b/libnetfs/file-get-storage-info.c @@ -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 This file is part of the GNU Hurd. @@ -20,35 +20,28 @@ #include "netfs.h" #include "fs_S.h" -#include 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 --git a/libnetfs/netfs.h b/libnetfs/netfs.h index a3ba5203..5310040f 100644 --- a/libnetfs/netfs.h +++ b/libnetfs/netfs.h @@ -282,6 +282,22 @@ error_t netfs_get_dirents (struct iouser *cred, struct node *dir, 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 */ -- cgit v1.2.3