summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-01-30 10:53:46 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-25 11:18:59 +0100
commit9366d6b2e48ba409366adc0516825c41a86dec9b (patch)
tree10431eba7bdaf8bfbb8811a5c4fed93616c5eb0d /libdiskfs
parentd4129a39dda08e8cfbc002461e1e76103de8f108 (diff)
hurd: fix the get-children and get-source procedures
* hurd/fs.defs: Add file_get_children and file_get_source. * hurd/fsys.defs: Remove fsys_get_children and fsys_get_source. * libdiskfs/fsys-get-children.c: Rename and adapt accordingly. * libdiskfs/fsys-get-source.c: Likewise. * libnetfs/fsys-get-children.c: Likewise. * libnetfs/fsys-get-source.c: Likewise. * libtrivfs/fsys-get-children.c: Likewise. * libtrivfs/fsys-get-source.c: Likewise. * libdiskfs/diskfs.h: Adapt prototype and comment. * libnetfs/netfs.h: Likewise. * libtrivfs/trivfs.h: Likewise. * libdiskfs/get-source.c: Adapt default implementation, provide diskfs_disk_name by default. * libnetfs/netfs.h: Adapt default implementation. * libtrivfs/get-source.c: Likewise. * libdiskfs/Makefile: Adapt accordingly. * libnetfs/Makefile: Likewise. * libtrivfs/Makefile: Likewise. * trans/symlink.c: Likewise. * trans/mtab.c: Likewise.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/Makefile2
-rw-r--r--libdiskfs/diskfs.h9
-rw-r--r--libdiskfs/file-get-children.c (renamed from libdiskfs/fsys-get-children.c)16
-rw-r--r--libdiskfs/file-get-source.c (renamed from libdiskfs/fsys-get-source.c)15
-rw-r--r--libdiskfs/get-source.c9
5 files changed, 28 insertions, 23 deletions
diff --git a/libdiskfs/Makefile b/libdiskfs/Makefile
index 03c2e2b3..aeebe4e9 100644
--- a/libdiskfs/Makefile
+++ b/libdiskfs/Makefile
@@ -35,7 +35,7 @@ IOSRCS= io-async-icky.c io-async.c io-duplicate.c io-get-conch.c io-revoke.c \
io-select.c io-stat.c io-stubs.c io-write.c io-version.c io-sigio.c
FSYSSRCS=fsys-getroot.c fsys-goaway.c fsys-startup.c fsys-getfile.c \
fsys-options.c fsys-syncfs.c fsys-forward.c \
- fsys-get-children.c fsys-get-source.c
+ file-get-children.c file-get-source.c
IFSOCKSRCS=ifsock.c
OTHERSRCS = conch-fetch.c conch-set.c dir-clear.c dir-init.c dir-renamed.c \
extern-inline.c \
diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h
index 22262aa8..db6a1d84 100644
--- a/libdiskfs/diskfs.h
+++ b/libdiskfs/diskfs.h
@@ -569,10 +569,11 @@ error_t (*diskfs_create_symlink_hook)(struct node *np, const char *target);
error_t (*diskfs_read_symlink_hook)(struct node *np, char *target);
/* The user may define this function. The function must set source to
- the source device of the filesystem. The function may return an
- EOPNOTSUPP to indicate that the concept of a source device is not
- applicable. The default function always returns EOPNOTSUPP. */
-error_t diskfs_get_source (char *source);
+ the source of CRED. The function may return an EOPNOTSUPP to
+ indicate that the concept of a source device is not applicable. The
+ default function always returns EOPNOTSUPP. */
+error_t diskfs_get_source (struct protid *cred,
+ char *source, size_t source_len);
/* The library exports the following functions for general use */
diff --git a/libdiskfs/fsys-get-children.c b/libdiskfs/file-get-children.c
index 69c9963e..4581e4e0 100644
--- a/libdiskfs/fsys-get-children.c
+++ b/libdiskfs/file-get-children.c
@@ -1,4 +1,4 @@
-/* fsys_get_children
+/* file_get_children
Copyright (C) 2013 Free Software Foundation, Inc.
@@ -20,7 +20,7 @@
along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
#include "priv.h"
-#include "fsys_S.h"
+#include "fs_S.h"
#include <argz.h>
@@ -28,18 +28,14 @@
filesystem. CHILDREN is an argz vector containing file names
relative to the root of the receiving translator. */
error_t
-diskfs_S_fsys_get_children (fsys_t server,
- mach_port_t reply,
- mach_msg_type_name_t replyPoly,
+diskfs_S_file_get_children (struct protid *cred,
char **children,
mach_msg_type_number_t *children_len)
{
error_t err;
-
- struct protid *cred = ports_lookup_port (diskfs_port_bucket,
- server,
- diskfs_protid_class);
- if (! cred)
+ if (! cred
+ || cred->pi.bucket != diskfs_port_bucket
+ || cred->pi.class != diskfs_protid_class)
return EOPNOTSUPP;
/* check_access performs the same permission check as is normally
diff --git a/libdiskfs/fsys-get-source.c b/libdiskfs/file-get-source.c
index 08f227c9..b5c31845 100644
--- a/libdiskfs/fsys-get-source.c
+++ b/libdiskfs/file-get-source.c
@@ -1,4 +1,4 @@
-/* fsys_get_source
+/* file_get_source
Copyright (C) 2013 Free Software Foundation, Inc.
@@ -20,15 +20,18 @@
along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
#include "priv.h"
-#include "fsys_S.h"
+#include "fs_S.h"
/* Return information about the source of the receiving
filesystem. */
error_t
-diskfs_S_fsys_get_source (fsys_t server,
- mach_port_t reply,
- mach_msg_type_name_t replyPoly,
+diskfs_S_file_get_source (struct protid *cred,
char *source)
{
- return diskfs_get_source (source);
+ if (! cred
+ || cred->pi.bucket != diskfs_port_bucket
+ || cred->pi.class != diskfs_protid_class)
+ return EOPNOTSUPP;
+
+ return diskfs_get_source (cred, source, 1024 /* XXX */);
}
diff --git a/libdiskfs/get-source.c b/libdiskfs/get-source.c
index d0c143be..43994464 100644
--- a/libdiskfs/get-source.c
+++ b/libdiskfs/get-source.c
@@ -22,7 +22,12 @@
#include "priv.h"
error_t
-diskfs_get_source (char *source)
+diskfs_get_source (struct protid *cred, char *source, size_t source_len)
{
- return EOPNOTSUPP;
+ if (diskfs_disk_name == NULL)
+ return EOPNOTSUPP;
+
+ strncpy (source, diskfs_disk_name, source_len - 1);
+ source[source_len - 1] = '\0';
+ return 0;
}