summaryrefslogtreecommitdiff
path: root/libnetfs
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-07-30 11:59:09 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-08-29 00:39:44 +0200
commit9bb6c17f3f0e2793ef75339f48425b0ec802c2a3 (patch)
treeee9b274fb84caa3d70da7cbebfa6d6ad026aec74 /libnetfs
parent7f76449a4f7b2d027fa6c085ba931129e16f4fb4 (diff)
libnetfs: implement file_get_translator_cntl
This is a trivially adapted version of libdiskfs/file-get-transcntl.c. * libnetfs/file-get-transcntl.c: New file.
Diffstat (limited to 'libnetfs')
-rw-r--r--libnetfs/Makefile2
-rw-r--r--libnetfs/file-get-transcntl.c52
-rw-r--r--libnetfs/fsstubs.c8
3 files changed, 53 insertions, 9 deletions
diff --git a/libnetfs/Makefile b/libnetfs/Makefile
index 24b5acae..13c9b53b 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 \
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/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)
{