[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 24/53: hurd: fix the get-children and get-source procedures
From: |
Samuel Thibault |
Subject: |
[hurd] 24/53: hurd: fix the get-children and get-source procedures |
Date: |
Thu, 20 Mar 2014 02:23:51 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 9366d6b2e48ba409366adc0516825c41a86dec9b
Author: Justus Winter <address@hidden>
Date: Thu Jan 30 10:53:46 2014 +0100
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.
---
hurd/fs.defs | 19 +++++++++++++++++++
hurd/fsys.defs | 20 ++------------------
libdiskfs/Makefile | 2 +-
libdiskfs/diskfs.h | 9 +++++----
.../{fsys-get-children.c => file-get-children.c} | 16 ++++++----------
.../fsys-get-source.c => libdiskfs/file-get-source.c | 14 +++++++++-----
libdiskfs/get-source.c | 9 +++++++--
libnetfs/Makefile | 2 +-
.../{fsys-get-children.c => file-get-children.c} | 14 +++++---------
libnetfs/{fsys-get-source.c => file-get-source.c} | 15 +++++++++------
libnetfs/get-source.c | 2 +-
libnetfs/netfs.h | 9 +++++----
libtrivfs/Makefile | 2 +-
.../{fsys-get-children.c => file-get-children.c} | 4 ++--
.../fsys-get-source.c => libtrivfs/file-get-source.c | 7 +++----
libtrivfs/get-source.c | 2 +-
libtrivfs/trivfs.h | 9 +++++----
trans/mtab.c | 6 +++---
trans/symlink.c | 15 ---------------
19 files changed, 85 insertions(+), 91 deletions(-)
diff --git a/hurd/fs.defs b/hurd/fs.defs
index 52d83bd..2452682 100644
--- a/hurd/fs.defs
+++ b/hurd/fs.defs
@@ -352,3 +352,22 @@ routine file_reparent (
RPT
parent: mach_port_t;
out new_file: mach_port_send_t);
+
+/* Return any active translators bound to nodes below FILE. CHILDREN
+ is an argz vector containing file names relative to the root of the
+ receiving translator. */
+routine file_get_children (
+ file: file_t;
+ RPT
+ out children: data_t);
+
+/* Return information about the source of FILE. If the concept of a
+ source is applicable, SOURCE should refer to the source of FILE and
+ should be a description considered appropriate in the context of
+ the translator. For example, if FILE refers to a node on a
+ filesystems, SOURCE should be the file name of the underlying block
+ device. */
+routine file_get_source (
+ file: file_t;
+ RPT
+ out source: string_t);
diff --git a/hurd/fsys.defs b/hurd/fsys.defs
index 7f99f7f..b36b944 100644
--- a/hurd/fsys.defs
+++ b/hurd/fsys.defs
@@ -128,21 +128,5 @@ routine fsys_get_options (
RPT
out options: data_t, dealloc);
-/* Return any active translators bound to nodes of the receiving
- filesystem. CHILDREN is an argz vector containing file names
- relative to the root of the receiving translator. */
-routine fsys_get_children (
- server: fsys_t;
- RPT
- out children: data_t);
-
-/* Return information about the source of the receiving filesystem.
- If the concept of a source is applicable, SOURCE should refer to
- the source of the receiving translator and should be a description
- considered appropriate in the context of the translator. For
- example for the case of block device based filesystems, SOURCE
- should be the file name of the underlying block device. */
-routine fsys_get_source (
- server: fsys_t;
- RPT
- out source: string_t);
+skip; /* Was fsys_get_children */
+skip; /* Was fsys_get_source */
diff --git a/libdiskfs/Makefile b/libdiskfs/Makefile
index 03c2e2b..aeebe4e 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 22262aa..db6a1d8 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
similarity index 89%
rename from libdiskfs/fsys-get-children.c
rename to libdiskfs/file-get-children.c
index 69c9963..4581e4e 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/libtrivfs/fsys-get-source.c b/libdiskfs/file-get-source.c
similarity index 76%
rename from libtrivfs/fsys-get-source.c
rename to libdiskfs/file-get-source.c
index 64aec2f..b5c3184 100644
--- a/libtrivfs/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,14 +20,18 @@
along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
#include "priv.h"
+#include "fs_S.h"
/* Return information about the source of the receiving
filesystem. */
error_t
-trivfs_S_fsys_get_source (trivfs_control_t server,
- mach_port_t reply,
- mach_msg_type_name_t replyPoly,
+diskfs_S_file_get_source (struct protid *cred,
char *source)
{
- return trivfs_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 d0c143b..4399446 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;
}
diff --git a/libnetfs/Makefile b/libnetfs/Makefile
index 1a71b49..c3830c0 100644
--- a/libnetfs/Makefile
+++ b/libnetfs/Makefile
@@ -45,7 +45,7 @@ IOSRCS= io-read.c io-readable.c io-seek.c io-write.c
io-stat.c io-async.c \
io-version.c
FSYSSRCS= fsys-syncfs.c fsys-getroot.c fsys-get-options.c fsys-set-options.c \
- fsys-goaway.c fsysstubs.c fsys-get-children.c fsys-get-source.c
+ fsys-goaway.c fsysstubs.c file-get-children.c file-get-source.c
IFSOCKSRCS=
OTHERSRCS= drop-node.c init-init.c make-node.c make-peropen.c make-protid.c \
diff --git a/libnetfs/fsys-get-children.c b/libnetfs/file-get-children.c
similarity index 91%
rename from libnetfs/fsys-get-children.c
rename to libnetfs/file-get-children.c
index fb3af91..80a727f 100644
--- a/libnetfs/fsys-get-children.c
+++ b/libnetfs/file-get-children.c
@@ -1,4 +1,4 @@
-/* fsys_get_children
+/* file_get_children
Copyright (C) 2013 Free Software Foundation, Inc.
@@ -27,18 +27,14 @@
filesystem. CHILDREN is an argz vector containing file names
relative to the root of the receiving translator. */
error_t
-netfs_S_fsys_get_children (fsys_t server,
- mach_port_t reply,
- mach_msg_type_name_t replyPoly,
+netfs_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 (netfs_port_bucket,
- server,
- netfs_protid_class);
- if (! cred)
+ if (! cred
+ || cred->pi.bucket != netfs_port_bucket
+ || cred->pi.class != netfs_protid_class)
return EOPNOTSUPP;
/* check_access performs the same permission check as is normally
diff --git a/libnetfs/fsys-get-source.c b/libnetfs/file-get-source.c
similarity index 77%
rename from libnetfs/fsys-get-source.c
rename to libnetfs/file-get-source.c
index 6143d10..8b73d5a 100644
--- a/libnetfs/fsys-get-source.c
+++ b/libnetfs/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
-netfs_S_fsys_get_source (fsys_t server,
- mach_port_t reply,
- mach_msg_type_name_t replyPoly,
+netfs_S_file_get_source (struct protid *cred,
char *source)
{
- return netfs_get_source (source);
+ if (! cred
+ || cred->pi.bucket != netfs_port_bucket
+ || cred->pi.class != netfs_protid_class)
+ return EOPNOTSUPP;
+
+ return netfs_get_source (cred, source, 1024 /* XXX */);
}
diff --git a/libnetfs/get-source.c b/libnetfs/get-source.c
index 71a9639..73e48be 100644
--- a/libnetfs/get-source.c
+++ b/libnetfs/get-source.c
@@ -22,7 +22,7 @@
#include "priv.h"
error_t
-netfs_get_source (char *source)
+netfs_get_source (struct protid *cred, char *source, size_t source_len)
{
return EOPNOTSUPP;
}
diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h
index e10ccae..5d50f57 100644
--- a/libnetfs/netfs.h
+++ b/libnetfs/netfs.h
@@ -315,10 +315,11 @@ error_t netfs_file_get_storage_info (struct iouser *cred,
mach_msg_type_number_t *data_len);
/* 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 netfs_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 netfs_get_source (struct protid *cred,
+ char *source, size_t source_len);
/* Option parsing */
diff --git a/libtrivfs/Makefile b/libtrivfs/Makefile
index 241b76d..3e4c039 100644
--- a/libtrivfs/Makefile
+++ b/libtrivfs/Makefile
@@ -35,7 +35,7 @@ IOSRCS=io-async-icky.c io-async.c io-duplicate.c io-map.c
io-modes-get.c \
FSYSSRCS=fsys-getroot.c fsys-goaway.c fsys-stubs.c fsys-syncfs.c \
fsys-forward.c fsys-set-options.c fsys-get-options.c \
- fsys-get-children.c fsys-get-source.c
+ file-get-children.c file-get-source.c
OTHERSRCS=demuxer.c protid-clean.c protid-dup.c cntl-create.c \
cntl-clean.c migsupport.c times.c startup.c open.c \
diff --git a/libtrivfs/fsys-get-children.c b/libtrivfs/file-get-children.c
similarity index 93%
rename from libtrivfs/fsys-get-children.c
rename to libtrivfs/file-get-children.c
index 4697cc5..a3afbba 100644
--- a/libtrivfs/fsys-get-children.c
+++ b/libtrivfs/file-get-children.c
@@ -1,4 +1,4 @@
-/* fsys_get_children
+/* file_get_children
Copyright (C) 2013 Free Software Foundation, Inc.
@@ -25,7 +25,7 @@
filesystem. CHILDREN is an argz vector containing file names
relative to the root of the receiving translator. */
error_t
-trivfs_S_fsys_get_children (trivfs_control_t server,
+trivfs_S_file_get_children (struct trivfs_protid *cred,
mach_port_t reply,
mach_msg_type_name_t replyPoly,
char **children,
diff --git a/libdiskfs/fsys-get-source.c b/libtrivfs/file-get-source.c
similarity index 86%
rename from libdiskfs/fsys-get-source.c
rename to libtrivfs/file-get-source.c
index 08f227c..35636b5 100644
--- a/libdiskfs/fsys-get-source.c
+++ b/libtrivfs/file-get-source.c
@@ -1,4 +1,4 @@
-/* fsys_get_source
+/* file_get_source
Copyright (C) 2013 Free Software Foundation, Inc.
@@ -20,15 +20,14 @@
along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
#include "priv.h"
-#include "fsys_S.h"
/* Return information about the source of the receiving
filesystem. */
error_t
-diskfs_S_fsys_get_source (fsys_t server,
+trivfs_S_file_get_source (struct trivfs_protid *cred,
mach_port_t reply,
mach_msg_type_name_t replyPoly,
char *source)
{
- return diskfs_get_source (source);
+ return cred? trivfs_get_source (cred, source, 1024 /* XXX */): EOPNOTSUPP;
}
diff --git a/libtrivfs/get-source.c b/libtrivfs/get-source.c
index 9ea5693..2605dac 100644
--- a/libtrivfs/get-source.c
+++ b/libtrivfs/get-source.c
@@ -22,7 +22,7 @@
#include "priv.h"
error_t
-trivfs_get_source (char *source)
+trivfs_get_source (struct trivfs_protid *cred, char *source, size_t source_len)
{
return EOPNOTSUPP;
}
diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h
index cf817b5..306a430 100644
--- a/libtrivfs/trivfs.h
+++ b/libtrivfs/trivfs.h
@@ -235,10 +235,11 @@ error_t trivfs_append_args (struct trivfs_control *fsys,
char **argz, size_t *argz_len);
/* 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 trivfs_get_source (char *source);
+ the source device 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 trivfs_get_source (struct trivfs_protid *cred,
+ char *source, size_t source_len);
/* Add the port class *CLASS to the list of control port classes recognized
by trivfs; if *CLASS is 0, an attempt is made to allocate a new port
diff --git a/trans/mtab.c b/trans/mtab.c
index 75ef1d3..9a2c5a6 100644
--- a/trans/mtab.c
+++ b/trans/mtab.c
@@ -36,7 +36,7 @@
#include <unistd.h>
#include <version.h>
-#include "fsys_U.h"
+#include "fs_U.h"
static char *target_path = NULL;
static int insecure = 0;
@@ -421,7 +421,7 @@ mtab_populate (struct mtab *mtab, const char *path, int
insecure)
argz_stringify (options, options_len, ',');
string_t source;
- err = fsys_get_source (node, source);
+ err = file_get_source (node, source);
if (err)
{
if (err == EOPNOTSUPP)
@@ -450,7 +450,7 @@ mtab_populate (struct mtab *mtab, const char *path, int
insecure)
goto errout;
/* path has an active translator, query its children. */
- err = fsys_get_children (node, &children, &children_len);
+ err = file_get_children (node, &children, &children_len);
if (err == EOPNOTSUPP)
{
err = 0;
diff --git a/trans/symlink.c b/trans/symlink.c
index 8562662..845a112 100644
--- a/trans/symlink.c
+++ b/trans/symlink.c
@@ -234,18 +234,3 @@ S_fsys_forward (mach_port_t server, mach_port_t requestor,
{
return EOPNOTSUPP;
}
-
-error_t
-S_fsys_get_children (mach_port_t server,
- char **children,
- mach_msg_type_number_t *children_len)
-{
- return EOPNOTSUPP;
-}
-
-error_t
-S_fsys_get_source (mach_port_t server,
- char *source)
-{
- return EOPNOTSUPP;
-}
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 21/53: mach-defpager: fix definition of seqnos_memory_object_data_unlock, (continued)
- [hurd] 21/53: mach-defpager: fix definition of seqnos_memory_object_data_unlock, Samuel Thibault, 2014/03/19
- [hurd] 23/53: mach-defpager: improve the default_pager_demux_object function, Samuel Thibault, 2014/03/19
- [hurd] 18/53: Fix fakeroot and remap parsing corner cases, Samuel Thibault, 2014/03/19
- [hurd] 15/53: libports: work around bugs in server termination, Samuel Thibault, 2014/03/19
- [hurd] 27/53: tmpfs: set diskfs_disk_name to "none", Samuel Thibault, 2014/03/19
- [hurd] 25/53: nfs: implement netfs_get_source, Samuel Thibault, 2014/03/19
- [hurd] 26/53: trans/mtab: ignore translators that do not implement file_get_source, Samuel Thibault, 2014/03/19
- [hurd] 08/53: Add --font-width option to force 8/9 pixel font width, Samuel Thibault, 2014/03/19
- [hurd] 36/53: term: fix receiver lookups in the tioctl server functions, Samuel Thibault, 2014/03/19
- [hurd] 29/53: New RPCs, fix build, Samuel Thibault, 2014/03/19
- [hurd] 24/53: hurd: fix the get-children and get-source procedures,
Samuel Thibault <=
- [hurd] 12/53: libstore: replaced gz decompression code with libz, Samuel Thibault, 2014/03/19
- [hurd] 02/53: Replaced bz2 decompression code with libbz2, Samuel Thibault, 2014/03/19