From 334801c52c9844c06eacbe2e3af65852f7412e3c Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sun, 31 Aug 2014 14:47:42 +0200 Subject: hurd: fix semantic of file_get_children When first introduced as fsys_get_children, it made sense to return the list of children using paths relative to the root of the filesystem that was queried. Making the get_children method part of the fsys protocol was a mistake that has since been corrected in 9366d6b2. Instead of returning paths relative to the root of the translator, return paths relative to the path of the receiving node. This fixes a problem with the mtab translator. Previously, the mtab translator invoked on a target that was not the root directory of a translator would compute invalid paths, e.g.: /hurd/mtab: /any/path/servers/socket/26 No such file or directory * hurd/fs.defs (file_get_children): Update comment. * libfshelp/translator-list.c (fshelp_get_active_translators): Add argument PREFIX. Filter entries not beginning with PREFIX if non-NULL, and omit PREFIX from the returned paths. * libfshelp/fshelp.h (fshelp_get_active_translators): Update comment accordingly. Also clarify that both FILTER and PREFIX can be NULL. * libdiskfs/file-get-children.c (diskfs_S_file_get_children): Update comment, pass prefix to fshelp_get_active_translators. * libnetfs/file-get-children.c (netfs_S_file_get_children): Likewise. --- libnetfs/file-get-children.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libnetfs') diff --git a/libnetfs/file-get-children.c b/libnetfs/file-get-children.c index bd7e8fcf..e8ceddf3 100644 --- a/libnetfs/file-get-children.c +++ b/libnetfs/file-get-children.c @@ -24,9 +24,9 @@ #include -/* 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. */ +/* Return any active translators bound to nodes below CRED. CHILDREN + is an argz vector containing file names relative to the path of + CRED. */ error_t netfs_S_file_get_children (struct protid *cred, char **children, @@ -93,7 +93,8 @@ netfs_S_file_get_children (struct protid *cred, char *c = NULL; size_t c_len = 0; - err = fshelp_get_active_translators (&c, &c_len, check_access); + err = fshelp_get_active_translators (&c, &c_len, check_access, + cred->po->path); if (err) goto errout; -- cgit v1.2.3