summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-06-26 20:50:11 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-06-26 20:50:11 +0000
commit2f4f3e5726ead26956c71c9c0b3180bbd54e7fdc (patch)
tree9597894159ef8d9fa18f0c860d9515d037932fd5 /libdiskfs
parentcd20f2274f1938d03e243984e8569f2b58d59d3b (diff)
(periodic_sync_thread, periodic_sync_lock): Declare static.
(control): Delete var. (pi): New var. (diskfs_set_sync_interval): Set PI instead of CONTROL. (periodic_sync): Do sync by hand; use ports routines around it properly.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/sync-interval.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/libdiskfs/sync-interval.c b/libdiskfs/sync-interval.c
index 4780c6c9..2c1d398f 100644
--- a/libdiskfs/sync-interval.c
+++ b/libdiskfs/sync-interval.c
@@ -27,13 +27,13 @@
#include "priv.h"
/* The thread that's doing the syncing. */
-cthread_t periodic_sync_thread = 0;
+static cthread_t periodic_sync_thread = 0;
/* A lock to lock before changing any of the above. */
-spin_lock_t periodic_sync_lock = SPIN_LOCK_INITIALIZER;
+static spin_lock_t periodic_sync_lock = SPIN_LOCK_INITIALIZER;
+
+static struct port_info *pi = 0;
-/* The filesystem control port to which we send our sync requests. */
-mach_port_t control_port;
static void periodic_sync ();
@@ -50,17 +50,10 @@ diskfs_set_sync_interval (int interval)
spin_lock (&periodic_sync_lock);
- if (control_port == MACH_PORT_NULL)
- {
- control_port =
- ports_get_right (ports_allocate_port
- (diskfs_port_bucket, sizeof (struct port_info),
- diskfs_control_class));
- err =
- mach_port_insert_right (mach_task_self (),
- control_port, control_port,
- MACH_MSG_TYPE_MAKE_SEND);
- }
+ if (!pi)
+ pi = ports_allocate_port (diskfs_port_bucket,
+ sizeof (struct port_info),
+ diskfs_control_class);
if (!err)
/* Here we just set the new thread; any existing thread will notice when it
@@ -93,6 +86,7 @@ periodic_sync (int interval)
for (;;)
{
cthread_t thread;
+ struct rpc_info link;
spin_lock (&periodic_sync_lock);
thread = periodic_sync_thread;
@@ -102,7 +96,10 @@ periodic_sync (int interval)
/* We've been superseded as the sync thread... Just die silently. */
return;
- fsys_syncfs (control_port, 0, 0);
+ ports_begin_rpc (pi, &link);
+ diskfs_sync_everything (0);
+ diskfs_set_hypermetadata (0, 0);
+ ports_end_rpc (pi, &link);
/* Wait until next time. */
sleep (interval);