diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-07-18 04:35:29 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-07-18 04:35:29 +0000 |
commit | 94cef36797600d11a50d09828fa80df8a73dfd1c (patch) | |
tree | b7cba9afef95489eedef534d3e6946eb13f595ba /mount | |
parent | 88dbbbf9e48e24f1ac007c1e4eeffd9caf8e2fad (diff) |
*** empty log message ***
Diffstat (limited to 'mount')
-rw-r--r-- | mount/mount.defs | 109 | ||||
-rw-r--r-- | mount/mount.h | 72 | ||||
-rw-r--r-- | mount/mount_types.h | 61 |
3 files changed, 242 insertions, 0 deletions
diff --git a/mount/mount.defs b/mount/mount.defs new file mode 100644 index 00000000..7e97bb9b --- /dev/null +++ b/mount/mount.defs @@ -0,0 +1,109 @@ +/* A server for keeping track of filesystems + + Copyright (C) 1996 Free Software Foundation, Inc. + + Written by Miles Bader <miles@gnu.ai.mit.edu> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include <hurd/hurd_types.defs> + +subsystem mount 37000; + +import <hurd/mount_defs.h>; + +type mount_t = mach_port_t +#ifdef MOUNT_INTRAN +intran: MOUNT_INTRAN +#endif +#ifdef MOUNT_OUTTRAN +outtran: MOUNT_OUTTRAN +#endif +#ifdef MOUNT_DESTRUCTOR +destructor: MOUNT_DESTRUCTOR +#endif +; +type mount_server_t = mach_port_t +#ifdef MOUNT_SERVER_INTRAN +intran: MOUNT_SERVER_INTRAN +#endif +#ifdef MOUNT_SERVER_OUTTRAN +outtran: MOUNT_SERVER_OUTTRAN +#endif +#ifdef MOUNT_SERVER_DESTRUCTOR +destructor: MOUNT_SERVER_DESTRUCTOR +#endif +; + +type mount_state_t = int ctype: mount_state_t; +type mount_key_class_t = int ctype: mount_key_class_t; +type mount_excl_t = int ctype: mount_excl_t; + +#ifdef MOUNT_IMPORTS +MOUNT_IMPORTS +#endif + +INTR_INTERFACE + +/* RPCs */ + +/* Begin mounting the filesystem designated by KEY & KEY_CLASS; the mount is + initially assumed to have a mode of 0 (see mount_set_mode). EXCL is the + mount exclusion mode which applies to KEY (only the first EXCL argument + for a particular KEY is used). A mount reference is returned in MOUNT, + and the current state of that filesystem is returned in STATE (and may be + used to, e.g., cause the mount to be read-only if STATE is SUSPICIOUS). */ +routine mount_begin ( + server : mount_server_t; + key : string_t; + key_class : mount_key_class_t; + excl : mount_excl_t; + out mount : mount_t; + out state : mount_state_t); + +/* Assert that MOUNT is no longer active. If CLEAN is true, then the state + of the filesystem should be changed to CLEAN; however if the state was + previously SUSPICIOUS, this is only done if CHECKED is true. */ +routine mount_end ( + mount : mount_t; + clean : boolean_t; + checked : boolean_t); + +/* Indicate that MOUNT is a real mount. TRANSLATOR and MPOINT should be the + filesystem control port and the node which is being translated. TIMESTAMP + is used to validate this mount if a reconnection to the mount server + becomes necessary. */ +routine mount_set_translator ( + mount : mount_t; + translator : fsys_t; + mpoint : file_t; + timestamp : time_spec_t); + +/* If CLEAN is true, then the state of the filesystem should be changed to + CLEAN; however if the state was previously SUSPICIOUS, this is only done + if CHECKED is true. */ +routine mount_set_clean ( + mount : mount_t + clean : boolean_t; + checked : boolean_t); + +/* Change the current writable state of MOUNT to MODE, which should be a + bitmask containg MOUNT_READ and/or MOUNT_WRITE. If other current mounts + preclude this, then EBUSY is returned. If MODE contains MOUNT_FORCE and + there are conflicting mounts, an attempt is made to use the --suspend + option on the other filesystems in order to force the issue. */ +routine mount_set_mode ( + mount : mount_t + mode : int); diff --git a/mount/mount.h b/mount/mount.h new file mode 100644 index 00000000..0d3eb855 --- /dev/null +++ b/mount/mount.h @@ -0,0 +1,72 @@ +/* Private definitions for the mount server + + Copyright (C) 1996 Free Software Foundation, Inc. + + Written by Miles Bader <miles@gnu.ai.mit.edu> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include <hurd/ports.h> + +#include "mount_types.h" + +/* A particular mount of a filesystem. */ +struct mount +{ + struct port_info pi; /* libports header. */ + + /* The filesystem this a mount of. */ + struct mount_fsys *fsys; + + /* Modes of this mount, from the set MOUNT_READ, MOUNT_WRITE, &c. */ + int mode; + + /* The filesystem control port for its translator. This may + MACH_PORT_NULL, in which case it's not actually a filesystem (maybe it's + a fsck or something). */ + fsys_t translator; + + /* A timestamp associated with TRANSLATOR, used to validate state if the + mount server is restarted. */ + struct timespec timestamp; + + /* The place in the filesystem where this filesystem is mounted, using the + mount server's root node. */ + char *mount_point; + + /* The next mount of this filesystem. */ + struct mount *next; +}; + +struct mount_fsys +{ + /* A string identifying the `backing store' associated with this + filesystem, who's interpretation depends on KEY_CLASS: + MOUNT_KEY_UNKNOWN -- no interpretation, just a string + MOUNT_KEY_FILE -- KEY is a filename + MOUNT_KEY_DEVICE -- KEY is a (mach) device name + No two filesystems can have the same KEY and KEY_CLASS. */ + char *key; + enum mount_key_class key_class; + + /* In what condition we think the filesystem is. */ + enum mount_state state; + + /* How this file system deals with multiple mount requests. */ + enum mount_excl excl; + + /* Active mounts of this filesystem. */ + struct mount *mounts; +}; diff --git a/mount/mount_types.h b/mount/mount_types.h new file mode 100644 index 00000000..f72d3a53 --- /dev/null +++ b/mount/mount_types.h @@ -0,0 +1,61 @@ +/* Exported types for the mount server + + Copyright (C) 1996 Free Software Foundation, Inc. + + Written by Miles Bader <miles@gnu.ai.mit.edu> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* Modes a particular mount may have. */ +#define MOUNT_READ 0x1 /* We only read. */ +#define MOUNT_WRITE 0x2 /* We write too. */ +#define MOUNT_FORCE 0x4 /* Used to try forcing a writable mount. */ + +/* The condition we think a file system is in (this refers to the permanent + storage from which it is backed, not an active file system). */ +enum mount_state +{ + MOUNT_STATE_UNKNOWN, /* Just so. When this value is passed to a + mount routine that takes a state argument, + it usually means `keep the last known + state'. */ + MOUNT_STATE_SUSPICIOUS, /* We think it may have been compromised. */ + MOUNT_STATE_DIRTY, /* May be transiently inconsistent. This is + the normal state for an active writable + file system. */ + MOUNT_STATE_CLEAN /* Peachy. */ +}; +typedef enum mount_state mount_state_t; /* For mig's use. */ + +/* How the key associated with a filesystem is interpreted. */ +enum mount_key_class +{ + MOUNT_KEY_UNKNOWN, /* */ + MOUNT_KEY_FILE, /* A file (including e.g., `/dev/rsd0a'). */ + MOUNT_KEY_DEVICE /* A mach device name. */ +}; +typedef enum mount_key_class mount_key_class_t; /* For mig's use. */ + +/* Types of multiple mounts of a single filesystem that are allowed. */ +enum mount_excl +{ + MOUNT_EXCL_NONE, /* Both multiple readers and multiple writers + allowed; some external private protocol + must be used to main consistency. */ + MOUNT_EXCL_WRITE, /* Multiple readers allowed, but if there's a + writer, it must be the only mount. */ + MOUNT_EXCL_RDWR /* Only a single mount of any type allowed. */ +}; +typedef enum mount_excl mount_excl_t; /* For mig */ |