diff options
Diffstat (limited to 'libnetfs')
-rw-r--r-- | libnetfs/Makefile | 4 | ||||
-rw-r--r-- | libnetfs/dead-name.c | 45 | ||||
-rw-r--r-- | libnetfs/file-get-transcntl.c | 52 | ||||
-rw-r--r-- | libnetfs/file-get-translator.c | 14 | ||||
-rw-r--r-- | libnetfs/fsstubs.c | 8 |
5 files changed, 113 insertions, 10 deletions
diff --git a/libnetfs/Makefile b/libnetfs/Makefile index 24b5acae..a9810d23 100644 --- a/libnetfs/Makefile +++ b/libnetfs/Makefile @@ -34,7 +34,7 @@ FSSRCS= dir-link.c dir-lookup.c dir-mkdir.c dir-mkfile.c \ file-get-translator.c file-getcontrol.c file-getlinknode.c \ file-lock-stat.c file-lock.c file-set-size.c \ file-set-translator.c file-statfs.c file-sync.c file-syncfs.c \ - file-utimes.c file-reparent.c fsstubs.c + file-utimes.c file-reparent.c fsstubs.c file-get-transcntl.c IOSRCS= io-read.c io-readable.c io-seek.c io-write.c io-stat.c io-async.c \ io-set-all-openmodes.c io-get-openmodes.c io-set-some-openmodes.c \ @@ -52,7 +52,7 @@ OTHERSRCS= drop-node.c init-init.c make-node.c make-peropen.c make-protid.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 file-get-storage-info-default.c + nref.c nrele.c nput.c file-get-storage-info-default.c dead-name.c SRCS= $(OTHERSRCS) $(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(IFSOCKSRCS) diff --git a/libnetfs/dead-name.c b/libnetfs/dead-name.c new file mode 100644 index 00000000..ff29cfe6 --- /dev/null +++ b/libnetfs/dead-name.c @@ -0,0 +1,45 @@ +/* Handle dead name notifications on ports + Copyright (C) 1996 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 "priv.h" + +void +ports_dead_name (void *notify, mach_port_t dead_name) +{ + struct protid *pi = ports_lookup_port (netfs_port_bucket, dead_name, + netfs_protid_class); + struct node *np; + + if (pi) + { + np = pi->po->np; + pthread_mutex_lock (&np->lock); + if (dead_name == np->sockaddr) + { + mach_port_deallocate (mach_task_self (), np->sockaddr); + np->sockaddr = MACH_PORT_NULL; + netfs_nput (np); + } + else + pthread_mutex_unlock (&np->lock); + } + + ports_interrupt_notified_rpcs (notify, dead_name, MACH_NOTIFY_DEAD_NAME); +} diff --git a/libnetfs/file-get-transcntl.c b/libnetfs/file-get-transcntl.c new file mode 100644 index 00000000..04596d72 --- /dev/null +++ b/libnetfs/file-get-transcntl.c @@ -0,0 +1,52 @@ +/* libnetfs implementation of fs.defs: file_get_translator_cntl + + Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation + + This is a trivially adapted version of + libdiskfs/file-get-transcntl.c. + + 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 "fs_S.h" + +/* Implement file_get_translator_cntl as described in <hurd/fs.defs>. */ +error_t +netfs_S_file_get_translator_cntl (struct protid *cred, + mach_port_t *ctl, + mach_msg_type_name_t *ctltype) +{ + struct node *np; + error_t err; + + if (!cred) + return EOPNOTSUPP; + + np = cred->po->np; + + pthread_mutex_lock (&np->lock); + + err = fshelp_isowner (&np->nn_stat, cred->user); + if (!err) + err = fshelp_fetch_control (&np->transbox, ctl); + if (!err && *ctl == MACH_PORT_NULL) + err = ENXIO; + if (!err) + *ctltype = MACH_MSG_TYPE_MOVE_SEND; + + pthread_mutex_unlock (&np->lock); + + return err; +} diff --git a/libnetfs/file-get-translator.c b/libnetfs/file-get-translator.c index 59e61020..3a54ff10 100644 --- a/libnetfs/file-get-translator.c +++ b/libnetfs/file-get-translator.c @@ -109,6 +109,20 @@ netfs_S_file_get_translator (struct protid *user, *translen = len; err = 0; } + else if (np->nn_translated & S_IPTRANS) + { + char *string = NULL; + size_t len = 0; + err = netfs_get_translator (np, &string, &len); + if (!err) + { + if (len > *translen) + *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); + memcpy (*trans, string, len); + *translen = len; + free (string); + } + } else err = EINVAL; diff --git a/libnetfs/fsstubs.c b/libnetfs/fsstubs.c index 708cbb82..f1b9bf7e 100644 --- a/libnetfs/fsstubs.c +++ b/libnetfs/fsstubs.c @@ -30,14 +30,6 @@ netfs_S_file_notice_changes (struct protid *user, } error_t -netfs_S_file_get_translator_cntl (struct protid *user, - mach_port_t *trans, - mach_msg_type_name_t *transtype) -{ - return EOPNOTSUPP; -} - -error_t netfs_S_file_getfh (struct protid *user, char **data, mach_msg_type_number_t *ndata) { |