summaryrefslogtreecommitdiff
path: root/libdiskfs/sync-interval.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-01-27 16:49:22 +0000
committerMiles Bader <miles@gnu.org>1996-01-27 16:49:22 +0000
commitf841438e951fca51fa926795e551a45ae60c3a63 (patch)
tree10f38c34034e1509e64f509109b2bb2855402dc7 /libdiskfs/sync-interval.c
parent417a3d63fa06862935f8f79ff5cddaeec5777ffc (diff)
(diskfs_set_sync_interval):
Use ports_create_port instead of ports_allocate_port. Deal with ports_inhibit_class_rpcs returning an error. (periodic_sync): Pass in the MSG_ID arg to ports_begin_rpc, and deal with any error returned.
Diffstat (limited to 'libdiskfs/sync-interval.c')
-rw-r--r--libdiskfs/sync-interval.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/libdiskfs/sync-interval.c b/libdiskfs/sync-interval.c
index c86eba6a..c2b578a8 100644
--- a/libdiskfs/sync-interval.c
+++ b/libdiskfs/sync-interval.c
@@ -1,6 +1,6 @@
/* Support for periodic syncing
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -49,12 +49,17 @@ diskfs_set_sync_interval (int interval)
{
error_t err = 0;
- if (!pi)
- pi = ports_allocate_port (diskfs_port_bucket,
- sizeof (struct port_info),
- diskfs_control_class);
+ if (! pi)
+ {
+ err = ports_create_port (diskfs_control_class, diskfs_port_bucket,
+ sizeof (struct port_info), &pi);
+ if (err)
+ return err;
+ }
- ports_inhibit_port_rpcs (pi);
+ err = ports_inhibit_port_rpcs (pi);
+ if (err)
+ return err;
/* Here we just set the new thread; any existing thread will notice when it
wakes up and go away silently. */
@@ -88,11 +93,12 @@ periodic_sync (int interval)
{
for (;;)
{
+ error_t err;
struct rpc_info link;
/* This acts as a lock against creation of a new sync thread
while we are in the process of syncing. */
- ports_begin_rpc (pi, &link);
+ err = ports_begin_rpc (pi, 0, &link);
if (periodic_sync_thread != cthread_self ())
{
@@ -101,12 +107,14 @@ periodic_sync (int interval)
return;
}
- rwlock_reader_lock (&diskfs_fsys_lock);
- diskfs_sync_everything (0);
- diskfs_set_hypermetadata (0, 0);
- rwlock_reader_unlock (&diskfs_fsys_lock);
-
- ports_end_rpc (pi, &link);
+ if (! err)
+ {
+ rwlock_reader_lock (&diskfs_fsys_lock);
+ diskfs_sync_everything (0);
+ diskfs_set_hypermetadata (0, 0);
+ rwlock_reader_unlock (&diskfs_fsys_lock);
+ ports_end_rpc (pi, &link);
+ }
/* Wait until next time. */
sleep (interval);