diff options
Diffstat (limited to 'libdiskfs/file-syncfs.c')
-rw-r--r-- | libdiskfs/file-syncfs.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/libdiskfs/file-syncfs.c b/libdiskfs/file-syncfs.c index 8cd4003b..d271ab1e 100644 --- a/libdiskfs/file-syncfs.c +++ b/libdiskfs/file-syncfs.c @@ -19,33 +19,35 @@ #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; -} - /* Implement file_syncfs as described in <hurd/fs.defs>. */ kern_return_t diskfs_S_file_syncfs (struct protid *cred, int wait, int dochildren) { - struct args args = { wait }; - if (!cred) return EOPNOTSUPP; if (dochildren) - fshelp_map_active_translators (helper, &args); + { + error_t err; + 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; + } if (diskfs_synchronous) wait = 1; |