From 13efe6721a370c38b65e0da3d33f310f42cfa05f Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 18 Apr 2016 21:53:28 +0200 Subject: Unify the short-circuit translator logic * libdiskfs/dir-lookup.c (short_circuited_callback1): Move function to libfshelp. (diskfs_S_dir_lookup): Use the function from libfshelp instead. * libdiskfs/fsys-getroot.c (diskfs_S_fsys_getroot): Adapt accordingly. * libdiskfs/trans-callback.c (_diskfs_translator_callback2_fn): Likewise. * libfshelp/fetch-root.c (fshelp_short_circuited_callback1): New function. * libfshelp/fshelp.h (struct fshelp_stat_cookie): New definition. (fshelp_short_circuited_callback1): New prototype. * libnetfs/dir-lookup.c (short_circuited_callback1): Drop function. (netfs_S_dir_lookup): Use the function from libfshelp instead. * libnetfs/fsys-getroot.c (netfs_S_fsys_getroot): Adapt accordingly. * libnetfs/trans-callback.c (_netfs_translator_callback2_fn): Likewise. --- libdiskfs/trans-callback.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libdiskfs/trans-callback.c') diff --git a/libdiskfs/trans-callback.c b/libdiskfs/trans-callback.c index 283b184f..15e8f9a1 100644 --- a/libdiskfs/trans-callback.c +++ b/libdiskfs/trans-callback.c @@ -20,6 +20,7 @@ #include "priv.h" #include +#include /* Callback function needed for calls to fshelp_fetch_root. See for the interface description. */ @@ -56,6 +57,7 @@ _diskfs_translator_callback2_fn (void *cookie1, void *cookie2, mach_msg_type_name_t *underlying_type) { struct node *np = cookie1; + struct fshelp_stat_cookie2 *statc = cookie2; struct protid *cred; struct peropen *po; error_t err; @@ -66,7 +68,7 @@ _diskfs_translator_callback2_fn (void *cookie1, void *cookie2, if (err) return err; - err = diskfs_make_peropen (np, flags, cookie2, &po); + err = diskfs_make_peropen (np, flags, statc->next, &po); if (! err) { err = diskfs_create_protid (po, user, &cred); -- cgit v1.2.3