[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fs_notify patch
From: |
Marcus Brinkmann |
Subject: |
fs_notify patch |
Date: |
Tue, 25 Jun 2002 23:14:36 -0400 |
User-agent: |
Mutt/1.3.25i |
Hi,
this is my patch for fs_notify, which currently only touches hurd/ and
diskfs/. I have a pending patch for the console server which adds
dir notification support to it, which also requires this patch.
It might be that I had a tag or so on my repository, so this might not
be against the current CVS version. If that is the case I can update it
before check-in, no problem. (I didn't follow Roland's recent changes,
because I definitely need my main system to be stable right now).
This implements the changes we discussed here, and should also mostly
cover a requets and patch by Wolfgang:
* fs_notify interfaces are simpleroutines.
* Send timeout of 0 (because of MiG deficiencies, the timeout value
is implicit because MACH_MSG_TIMEOUT_NONE is zero. WaitTime is
ignored for simplereoutines. We might want to fix that).
* fs_notify interfaces have a tickno argument, which tells the user
if he missed a notification message because of a send timeout.
* send timeouts are ignored by the server
* tickno is maintained as part of the node structure in the server.
* A new port type fs_notify_t allows to set intran/outtran for the
fs_notify_t interfaces (I will use this in my console client).
If there are no objections, I will check this in. I did a quick test
that it compiles allright, and the tickno scheme etc I tested
independently before, too.
Thanks,
Marcus
hurd/
2002-06-26 Marcus Brinkmann <marcus@gnu.org>
* fs_notify.defs: Add MsgOption for send timeout.
(dir_changed): Changed to simpleroutine. Change type of first
argument to fs_notify_t. Add TICKNO argument.
(file_changed): Likewise.
* hurd_types.defs (fs_notify_t): New type.
* hurd_types.h (fs_notify_t): Likewise.
Index: fs_notify.defs
===================================================================
RCS file: /cvsroot/hurd/hurd/hurd/fs_notify.defs,v
retrieving revision 1.1
diff -u -p -r1.1 fs_notify.defs
--- fs_notify.defs 17 Jan 1995 09:23:36 -0000 1.1
+++ fs_notify.defs 26 Jun 2002 02:38:49 -0000
@@ -1,5 +1,5 @@
/* Miscellaneous callbacks from Hurd fs servers to their clients.
- Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1991,92,93,94,95,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -25,22 +25,31 @@ subsystem fs_notify 20500;
FS_NOTIFY_IMPORTS
#endif
+/* For maximum robustness, the server must not wait for the client to
+ receive the notification message. This is achieved by setting a
+ send timeout (which is implicitely 0 with MACH_MSG_TIMEOUT_NONE). */
+MsgOption MACH_SEND_TIMEOUT;
/* This is sent by a filesystem (after being requested with
dir_notice_changes) every time a directory is changed.
CHANGE identifies the sort of change that has occurred (see hurd_types.h);
- NAME is the name that was changed. */
-routine dir_changed (
- notify_port: mach_port_t;
+ NAME is the name that was changed. TICKNO is a sequential number
+ that allows the client to verify that it got all notifications. */
+simpleroutine dir_changed (
+ notify_port: fs_notify_t;
+ tickno: natural_t;
change: dir_changed_type_t;
name: string_t);
/* This is sent by a filesystem (after being requested with
file_notice_changes) every time a file or its stat info is changed.
CHANGE identifies the sort of change that has occurred (see hurd_types.h);
- START and END identify the affected regions of the file's data. */
-routine file_changed (
- notify_port: mach_port_t;
+ START and END identify the affected regions of the file's data.
+ TICKNO is a sequential number that allows the client to verify that
+ it got all notifications. */
+simpleroutine file_changed (
+ notify_port: fs_notify_t;
+ tickno: natural_t;
change: file_changed_type_t;
start: off_t;
end: off_t);
Index: hurd_types.defs
===================================================================
RCS file: /cvsroot/hurd/hurd/hurd/hurd_types.defs,v
retrieving revision 1.22
diff -u -p -r1.22 hurd_types.defs
--- hurd_types.defs 2 Jan 2002 02:08:11 -0000 1.22
+++ hurd_types.defs 26 Jun 2002 02:38:49 -0000
@@ -1,5 +1,5 @@
/* MiG type declarations for Hurd interfaces -*- C -*-
- Copyright (C) 1993,94,95,96,98,2001 Free Software Foundation, Inc.
+ Copyright (C) 1993,94,95,96,98,2001,02 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -143,6 +143,19 @@ outtran: STARTUP_OUTTRAN
destructor: STARTUP_DESTRUCTOR
#endif
;
+
+type fs_notify_t = mach_port_copy_send_t
+#ifdef FS_NOTIFY_INTRAN
+intran: FS_NOTIFY_INTRAN
+#endif
+#ifdef FS_NOTIFY_OUTTRAN
+outtran: FS_NOTIFY_OUTTRAN
+#endif
+#ifdef FS_NOTIFY_DESTRUCTOR
+destructor: FS_NOTIFY_DESTRUCTOR
+#endif
+;
+
type proccoll_t = mach_port_copy_send_t;
Index: hurd_types.h
===================================================================
RCS file: /cvsroot/hurd/hurd/hurd/hurd_types.h,v
retrieving revision 1.43
diff -u -p -r1.43 hurd_types.h
--- hurd_types.h 8 May 2002 09:20:29 -0000 1.43
+++ hurd_types.h 26 Jun 2002 02:38:50 -0000
@@ -44,6 +44,7 @@ typedef mach_port_t socket_t;
typedef mach_port_t pf_t; /* Protocol family */
typedef mach_port_t addr_port_t;
typedef mach_port_t startup_t;
+typedef mach_port_t fs_notify_t;
typedef mach_port_t proccoll_t;
#include <errno.h> /* Defines `error_t'. */
libdiskfs/
2002-06-26 Marcus Brinkmann <marcus@gnu.org>
* Makefile (DIST_FILES): Variable removed.
(MIGSTUBS): Use fs_notifyUser.o, not ourfs_notifyUser.o.
* ourfs_notify.defs: File removed.
* diskfs.h (struct node): New members DIRMOD_TICK and
FILEMOD_TICK.
* node-make.c (diskfs_make_node): Initialize DIRMOD_TICK and
FILEMOD_TICK.
* dir-chg.c: Include "fs_notify_U.h" instead "ourfs_notify_U.h".
(diskfs_S_dir_notice_changes): Use new dir_changed invocation
instead nowait_dir_changed.
(diskfs_notice_dirchange): Likewise. Increase tick number.
Ignore send timeout error.
* file-chg.c: Include "fs_notify_U.h" instead "ourfs_notify_U.h".
(diskfs_S_file_notice_changes): Use new file_changed invocation
instead nowait_file_changed.
(diskfs_notice_filechange): Likewise. Increase tick number.
Ignore send timeout error.
Index: Makefile
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/Makefile,v
retrieving revision 1.70
diff -u -p -r1.70 Makefile
--- Makefile 16 Jun 2001 02:13:44 -0000 1.70
+++ Makefile 26 Jun 2002 02:57:02 -0000
@@ -55,10 +55,9 @@ OTHERSRCS = conch-fetch.c conch-set.c di
SRCS = $(OTHERSRCS) $(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(IFSOCKSRCS)
LCLHDRS = diskfs.h priv.h lithp.h fsmutations.h diskfs-pager.h fhandle.h
installhdrs = diskfs.h diskfs-pager.h
-DIST_FILES = ourfs_notify.defs
MIGSTUBS = fsServer.o ioServer.o fsysServer.o exec_startupServer.o \
- fsys_replyUser.o ourfs_notifyUser.o ifsockServer.o \
+ fsys_replyUser.o fs_notifyUser.o ifsockServer.o \
startup_notifyServer.o
OBJS = $(sort $(SRCS:.c=.o) $(MIGSTUBS))
Index: dir-chg.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/dir-chg.c,v
retrieving revision 1.10
diff -u -p -r1.10 dir-chg.c
--- dir-chg.c 1 Apr 2001 01:39:47 -0000 1.10
+++ dir-chg.c 26 Jun 2002 02:57:02 -0000
@@ -17,7 +17,7 @@
#include "priv.h"
#include "fs_S.h"
-#include "ourfs_notify_U.h"
+#include "fs_notify_U.h"
kern_return_t
diskfs_S_dir_notice_changes (struct protid *cred,
@@ -37,7 +37,7 @@ diskfs_S_dir_notice_changes (struct prot
mutex_unlock (&np->lock);
return ENOTDIR;
}
- err = nowait_dir_changed (notify, DIR_CHANGED_NULL, "");
+ err = dir_changed (notify, np->dirmod_tick, DIR_CHANGED_NULL, "");
if (err)
{
mutex_unlock (&np->lock);
@@ -63,13 +63,15 @@ diskfs_notice_dirchange (struct node *dp
error_t err;
struct modreq **preq;
+ dp->dirmod_tick++;
preq = &dp->dirmod_reqs;
while (*preq)
{
struct modreq *req = *preq;
- err = nowait_dir_changed (req->port, type, name);
- if (err)
- { /* remove notify port */
+ err = dir_changed (req->port, dp->dirmod_tick, type, name);
+ if (err && err != MACH_SEND_TIMED_OUT)
+ {
+ /* Remove notify port. */
*preq = req->next;
mach_port_deallocate (mach_task_self (), req->port);
free (req);
Index: diskfs.h
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/diskfs.h,v
retrieving revision 1.96
diff -u -p -r1.96 diskfs.h
--- diskfs.h 11 May 2002 19:12:42 -0000 1.96
+++ diskfs.h 26 Jun 2002 02:57:05 -0000
@@ -101,8 +101,10 @@ struct node
struct conch conch;
struct modreq *dirmod_reqs;
+ unsigned int dirmod_tick;
struct modreq *filemod_reqs;
+ unsigned int filemod_tick;
off_t allocsize;
Index: file-chg.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/file-chg.c,v
retrieving revision 1.5
diff -u -p -r1.5 file-chg.c
--- file-chg.c 10 Aug 1998 17:42:35 -0000 1.5
+++ file-chg.c 26 Jun 2002 02:57:05 -0000
@@ -17,7 +17,7 @@
#include "priv.h"
#include "fs_S.h"
-#include "ourfs_notify_U.h"
+#include "fs_notify_U.h"
kern_return_t
diskfs_S_file_notice_changes (struct protid *cred, mach_port_t notify)
@@ -31,7 +31,7 @@ diskfs_S_file_notice_changes (struct pro
np = cred->po->np;
mutex_lock (&np->lock);
- err = nowait_file_changed (notify, FILE_CHANGED_NULL, 0, 0);
+ err = file_changed (notify, np->filemod_tick, FILE_CHANGED_NULL, 0, 0);
if (err)
{
mutex_unlock (&np->lock);
@@ -51,14 +51,16 @@ diskfs_notice_filechange (struct node *d
{
error_t err;
struct modreq **preq;
-
+
+ dp->filemod_tick++;
preq = &dp->filemod_reqs;
while (*preq)
{
struct modreq *req = *preq;
- err = nowait_file_changed (req->port, type, start, end);
- if (err)
- { /* remove notify port */
+ err = file_changed (req->port, dp->filemod_tick, type, start, end);
+ if (err && err != MACH_SEND_TIMED_OUT)
+ {
+ /* Remove notify port. */
*preq = req->next;
mach_port_deallocate (mach_task_self (), req->port);
free (req);
Index: node-make.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/node-make.c,v
retrieving revision 1.16
diff -u -p -r1.16 node-make.c
--- node-make.c 5 May 2002 03:27:11 -0000 1.16
+++ node-make.c 26 Jun 2002 02:57:06 -0000
@@ -42,7 +42,9 @@ diskfs_make_node (struct disknode *dn)
np->sockaddr = MACH_PORT_NULL;
np->dirmod_reqs = 0;
+ np->dirmod_tick = 0;
np->filemod_reqs = 0;
+ np->filemod_tick = 0;
fshelp_transbox_init (&np->transbox, &np->lock, np);
iohelp_initialize_conch (&np->conch, &np->lock);
- fs_notify patch,
Marcus Brinkmann <=