diff options
author | Justus Winter <justus@gnupg.org> | 2016-10-05 15:38:58 +0200 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2017-09-12 10:41:35 +0200 |
commit | 5fef1b7f22ec0ee3730b80bbf972dbf9a8995091 (patch) | |
tree | 29890aef362b5a8ebffb4721a1967b818a22a3af /libnetfs/shutdown.c | |
parent | 116552c075abf1d22057a608fee9d27684bcbbe5 (diff) | |
download | hurd-5fef1b7f22ec0ee3730b80bbf972dbf9a8995091.tar.gz hurd-5fef1b7f22ec0ee3730b80bbf972dbf9a8995091.tar.bz2 hurd-5fef1b7f22ec0ee3730b80bbf972dbf9a8995091.zip |
libfshelp: Add function to map over all active translators.
* libdiskfs/file-syncfs.c (diskfs_S_file_syncfs): Use the new function.
* libdiskfs/fsys-options.c (diskfs_S_fsys_set_options): Likewise.
* libdiskfs/fsys-syncfs.c (diskfs_S_fsys_syncfs): Likewise.
* libdiskfs/shutdown.c (diskfs_shutdown): Likewise.
* libfshelp/fshelp.h (fshelp_map_active_translators): New declaration.
* libfshelp/translator-list.c (fshelp_map_active_translators): New
function.
* libnetfs/file-syncfs.c (netfs_S_file_syncfs): Use the new function.
* libnetfs/fsys-set-options.c (netfs_S_fsys_set_options): Likewise.
* libnetfs/fsys-syncfs.c (netfs_S_fsys_syncfs): Likewise.
* libnetfs/shutdown.c (netfs_shutdown): Likewise.
Diffstat (limited to 'libnetfs/shutdown.c')
-rw-r--r-- | libnetfs/shutdown.c | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/libnetfs/shutdown.c b/libnetfs/shutdown.c index 7fa05cdb..082f2bcd 100644 --- a/libnetfs/shutdown.c +++ b/libnetfs/shutdown.c @@ -26,33 +26,28 @@ #include <hurd/fshelp.h> #include <pthread.h> +struct args +{ + int flags; +}; + +static error_t +helper (void *cookie, const char *name, mach_port_t control) +{ + struct args *args = cookie; + error_t err; + (void) name; + err = fsys_goaway (control, args->flags); + if (err == MIG_SERVER_DIED || err == MACH_SEND_INVALID_DEST) + err = 0; + return err; +} + /* Shutdown the filesystem; flags are as for fsys_goaway. */ error_t netfs_shutdown (int flags) { - error_t - helper (struct node *node) - { - error_t err; - mach_port_t control; - - err = fshelp_fetch_control (&node->transbox, &control); - if (!err && (control != MACH_PORT_NULL)) - { - pthread_mutex_unlock (&node->lock); - err = fsys_goaway (control, flags); - mach_port_deallocate (mach_task_self (), control); - pthread_mutex_lock (&node->lock); - } - else - err = 0; - - if ((err == MIG_SERVER_DIED) || (err == MACH_SEND_INVALID_DEST)) - err = 0; - - return err; - } - + struct args args = { flags }; int nports; int err; @@ -60,14 +55,12 @@ netfs_shutdown (int flags) && S_ISDIR (netfs_root_node->nn_stat.st_mode)) return EBUSY; -#ifdef NOTYET if (flags & FSYS_GOAWAY_RECURSE) { - err = netfs_node_iterate (helper); + err = fshelp_map_active_translators (helper, &args); if (err) return err; } -#endif #ifdef NOTYET pthread_rwlock_wrlock (&netfs_fsys_lock); |