[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/16] libnetfs: implement file_get_translator_cntl
From: |
Justus Winter |
Subject: |
[PATCH 01/16] libnetfs: implement file_get_translator_cntl |
Date: |
Tue, 30 Jul 2013 11:59:09 +0200 |
This is a trivially adapted version of libdiskfs/file-get-transcntl.c.
* libnetfs/file-get-transcntl.c: New file.
---
libnetfs/Makefile | 2 +-
libnetfs/file-get-transcntl.c | 52 +++++++++++++++++++++++++++++++++++++++++
libnetfs/fsstubs.c | 8 -------
3 files changed, 53 insertions(+), 9 deletions(-)
create mode 100644 libnetfs/file-get-transcntl.c
diff --git a/libnetfs/Makefile b/libnetfs/Makefile
index 24b5aca..13c9b53 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 0000000..04596d7
--- /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 708cbb8..f1b9bf7 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)
{
--
1.7.10.4
- mtab translator (v4), Justus Winter, 2013/07/30
- [PATCH 02/16] libnetfs: handle dead-name notifications, Justus Winter, 2013/07/30
- [PATCH 01/16] libnetfs: implement file_get_translator_cntl,
Justus Winter <=
- [PATCH 03/16] libdiskfs: track file name in struct peropen, Justus Winter, 2013/07/30
- [PATCH 04/16] libnetfs: track file name in struct peropen, Justus Winter, 2013/07/30
- [PATCH 05/16] libfshelp: add translator-list.c, Justus Winter, 2013/07/30
- [PATCH 06/16] libdiskfs: add fsys_get_children, Justus Winter, 2013/07/30
- [PATCH 08/16] libtrivfs: add fsys_get_children, Justus Winter, 2013/07/30
- [PATCH 07/16] libnetfs: add fsys_get_children, Justus Winter, 2013/07/30
- [PATCH 09/16] trans/symlink.c: add fsys_get_children, Justus Winter, 2013/07/30
- [PATCH 10/16] hurd: add fsys_get_children, Justus Winter, 2013/07/30