diff options
Diffstat (limited to 'libnetfs')
-rw-r--r-- | libnetfs/file-syncfs.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/libnetfs/file-syncfs.c b/libnetfs/file-syncfs.c index 0b14bb87..6a388daa 100644 --- a/libnetfs/file-syncfs.c +++ b/libnetfs/file-syncfs.c @@ -22,33 +22,36 @@ #include "fs_S.h" #include <hurd/fsys.h> -struct args -{ - int wait; -}; - -static error_t -helper (void *cookie, const char *name, mach_port_t control) -{ - struct args *args = cookie; - (void) name; - fsys_syncfs (control, args->wait, 1); - return 0; -} - error_t netfs_S_file_syncfs (struct protid *user, int wait, int dochildren) { error_t err; - struct args args = { wait }; if (!user) return EOPNOTSUPP; if (dochildren) - fshelp_map_active_translators (helper, &args); + { + char *n = NULL; + size_t n_len = 0; + mach_port_t *c; + size_t c_count, i; + + err = fshelp_get_active_translators (&n, &n_len, &c, &c_count); + if (err) + return err; + free(n); + + for (i = 0; i < c_count; i++) + fsys_syncfs (c[i], wait, 1); + + free(c); + if (err) + return err; + } + pthread_mutex_lock (&user->po->np->lock); err = netfs_attempt_syncfs (user->user, wait); |