diff options
Diffstat (limited to 'libdiskfs/fsys-syncfs.c')
-rw-r--r-- | libdiskfs/fsys-syncfs.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/libdiskfs/fsys-syncfs.c b/libdiskfs/fsys-syncfs.c index 17b83ee0..1a40fcda 100644 --- a/libdiskfs/fsys-syncfs.c +++ b/libdiskfs/fsys-syncfs.c @@ -22,6 +22,20 @@ #include "fsys_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 fsys_syncfs as described in <hurd/fsys.defs>. */ kern_return_t diskfs_S_fsys_syncfs (struct diskfs_control *pi, @@ -30,22 +44,7 @@ diskfs_S_fsys_syncfs (struct diskfs_control *pi, int wait, int children) { - error_t - helper (struct node *np) - { - error_t error; - mach_port_t control; - - error = fshelp_fetch_control (&np->transbox, &control); - pthread_mutex_unlock (&np->lock); - if (!error && (control != MACH_PORT_NULL)) - { - fsys_syncfs (control, wait, 1); - mach_port_deallocate (mach_task_self (), control); - } - pthread_mutex_lock (&np->lock); - return 0; - } + struct args args = { wait }; if (!pi) return EOPNOTSUPP; @@ -53,7 +52,7 @@ diskfs_S_fsys_syncfs (struct diskfs_control *pi, pthread_rwlock_rdlock (&diskfs_fsys_lock); if (children) - diskfs_node_iterate (helper); + fshelp_map_active_translators (helper, &args); if (diskfs_synchronous) wait = 1; |