aboutsummaryrefslogtreecommitdiff
path: root/libtrivfs
diff options
context:
space:
mode:
Diffstat (limited to 'libtrivfs')
-rw-r--r--libtrivfs/ChangeLog665
-rw-r--r--libtrivfs/Makefile25
-rw-r--r--libtrivfs/append-args.c (renamed from libtrivfs/get-options.c)9
-rw-r--r--libtrivfs/cntl-classes.c (renamed from libtrivfs/file-inv.c)22
-rw-r--r--libtrivfs/cntl-clean.c7
-rw-r--r--libtrivfs/cntl-create.c46
-rw-r--r--libtrivfs/dir-chg.c5
-rw-r--r--libtrivfs/dir-link.c9
-rw-r--r--libtrivfs/dir-lookup.c58
-rw-r--r--libtrivfs/dir-mkdir.c7
-rw-r--r--libtrivfs/dir-mkfile.c5
-rw-r--r--libtrivfs/dir-readdir.c8
-rw-r--r--libtrivfs/dir-rename.c7
-rw-r--r--libtrivfs/dir-rmdir.c9
-rw-r--r--libtrivfs/dir-unlink.c7
-rw-r--r--libtrivfs/dyn-classes.c269
-rw-r--r--libtrivfs/file-access.c17
-rw-r--r--libtrivfs/file-chauthor.c6
-rw-r--r--libtrivfs/file-chflags.c7
-rw-r--r--libtrivfs/file-chg.c5
-rw-r--r--libtrivfs/file-chmod.c5
-rw-r--r--libtrivfs/file-chown.c8
-rw-r--r--libtrivfs/file-exec.c9
-rw-r--r--libtrivfs/file-get-fs-options.c20
-rw-r--r--libtrivfs/file-get-storage-info.c3
-rw-r--r--libtrivfs/file-get-trans.c10
-rw-r--r--libtrivfs/file-get-transcntl.c5
-rw-r--r--libtrivfs/file-getcontrol.c7
-rw-r--r--libtrivfs/file-getfh.c9
-rw-r--r--libtrivfs/file-getlinknode.c5
-rw-r--r--libtrivfs/file-lock.c6
-rw-r--r--libtrivfs/file-reparent.c34
-rw-r--r--libtrivfs/file-set-size.c5
-rw-r--r--libtrivfs/file-set-trans.c10
-rw-r--r--libtrivfs/file-statfs.c7
-rw-r--r--libtrivfs/file-sync.c5
-rw-r--r--libtrivfs/file-syncfs.c5
-rw-r--r--libtrivfs/file-utimes.c5
-rw-r--r--libtrivfs/fsmutations.h10
-rw-r--r--libtrivfs/fsys-forward.c7
-rw-r--r--libtrivfs/fsys-get-options.c20
-rw-r--r--libtrivfs/fsys-getroot.c60
-rw-r--r--libtrivfs/fsys-goaway.c5
-rw-r--r--libtrivfs/fsys-set-options.c5
-rw-r--r--libtrivfs/fsys-stubs.c13
-rw-r--r--libtrivfs/fsys-syncfs.c5
-rw-r--r--libtrivfs/handle-port.c48
-rw-r--r--libtrivfs/interrupt.c34
-rw-r--r--libtrivfs/io-async-icky.c6
-rw-r--r--libtrivfs/io-async.c6
-rw-r--r--libtrivfs/io-duplicate.c10
-rw-r--r--libtrivfs/io-identity.c11
-rw-r--r--libtrivfs/io-map.c6
-rw-r--r--libtrivfs/io-modes-get.c8
-rw-r--r--libtrivfs/io-modes-off.c5
-rw-r--r--libtrivfs/io-modes-on.c5
-rw-r--r--libtrivfs/io-owner-get.c6
-rw-r--r--libtrivfs/io-owner-mod.c6
-rw-r--r--libtrivfs/io-pathconf.c10
-rw-r--r--libtrivfs/io-read.c7
-rw-r--r--libtrivfs/io-readable.c5
-rw-r--r--libtrivfs/io-reauthenticate.c88
-rw-r--r--libtrivfs/io-restrict-auth.c100
-rw-r--r--libtrivfs/io-revoke.c (renamed from libtrivfs/notify-stubs.c)43
-rw-r--r--libtrivfs/io-seek.c5
-rw-r--r--libtrivfs/io-select.c5
-rw-r--r--libtrivfs/io-stat.c9
-rw-r--r--libtrivfs/io-stubs.c15
-rw-r--r--libtrivfs/io-version.c8
-rw-r--r--libtrivfs/io-write.c9
-rw-r--r--libtrivfs/migsupport.c52
-rw-r--r--libtrivfs/nosenders.c43
-rw-r--r--libtrivfs/open.c20
-rw-r--r--libtrivfs/priv.h16
-rw-r--r--libtrivfs/protid-classes.c22
-rw-r--r--libtrivfs/protid-clean.c5
-rw-r--r--libtrivfs/protid-dup.c15
-rw-r--r--libtrivfs/startup.c7
-rw-r--r--libtrivfs/times.c14
-rw-r--r--libtrivfs/trivfs.h143
80 files changed, 965 insertions, 1303 deletions
diff --git a/libtrivfs/ChangeLog b/libtrivfs/ChangeLog
deleted file mode 100644
index 51e946e4..00000000
--- a/libtrivfs/ChangeLog
+++ /dev/null
@@ -1,665 +0,0 @@
-Thu Jul 18 23:14:44 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Use noinstall
- version of ports_create_port. Put it in the port set after the
- node has been fully initialized.
-
-Sat Jul 13 20:15:56 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Repeat
- ports_create_port, auth_server_authenticate, io_restrict_auth, and
- *trivfs_protid_create_hook for as long as we get EINTR. Deal with
- other errors without crashing.
-
-Sun Jul 7 16:06:37 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Don't use
- MACH_MSG_TYPE_MOVE_SEND; it's unreliable.
-
-Thu Jun 20 22:54:01 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * file-get-fs-options.c (trivfs_S_file_get_fs_options):
- Call trivfs_get_options, and package up the results.
- * fsys-get-options.c (trivfs_S_fsys_get_options): Likewise.
- * fsys-set-options.c (trivfs_S_fsys_set_options): Call
- trivfs_set_options.
- * set-options.c, get-options.c: New files.
- * trivfs.h: Add trivfs_set_options & trivfs_get_options.
- * Makefile (OTHERSRCS): Add set-options.c & get-options.c.
-
-Wed Jun 19 21:29:45 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * trivfs.h (trivfs_runtime_argp): New declaration.
- * fsys-set-options.c (trivfs_S_fsys_set_options): Use
- trivfs_runtime_argp to parse options.
- * runtime-argp.c: New file.
- * Makefile (OTHERSRCS): Add runtime-argp.c.
-
-Sat Jun 15 19:50:37 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * fsys-stubs.c (trivfs_S_fsys_set_options, trivfs_S_fsys_get_options,
- trivfs_S_file_get_fs_options): Functions removed.
- * fsys-set-options.c, fsys-get-options.c, file-get-fs-options.c:
- New files.
- * Makefile (FSSRCS): Add file-get-fs-options.c
- (FSYSSRCS): Add fsys-set-options.c & fsys-get-options.c.
-
-Thu May 9 20:03:28 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * io-identity.c: New file.
- * Makefile (IOSRCS): Add io-identity.c.
- * cntl-clean.c (trivfs_clean_cntl): Destroy filesys_id and file_id
- members.
- * cntl-create.c (trivfs_create_control): Initialize filesys_id and
- file_id members of new control.
- * trivfs.h (trivfs_control): New members `filesys_id' and
- `file_id'.
-
-Thu May 9 16:58:31 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * file-get-storage-info.c (trivfs_S_file_get_storage_info): Change
- to new interface.
-
-Thu May 9 15:32:38 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Don't send
- right for CRED to auth_server_authenticate.
-
- * fsys-stubs.c (trivfs_S_fsys_get_options): Expect (and ignore)
- reply port args.
-
- * file-syncfs.c (trivfs_S_file_syncfs): Provide new third arg to
- file_sync.
- * fsys-syncfs.c (trivfs_S_fsys_syncfs): Likewise.
- * file-sync.c (trivfs_S_file_sync): Accept and pass through new
- omitmeta parm.
-
- * file-statfs.c (trivfs_S_file_statfs): Use new struct statfs
- format.
-
- * dir-rename.c (trivfs_S_dir_rename): Accept new excl parm.
- * dir-link.c (trivfs_S_dir_link): Likewise.
-
- * Makefile (OTHERSRCS): Delete handle-port.c.
- * trivfs.h (trivfs_handle_port): Delete declaration.
- * handle-port.c: Delete file.
-
-Thu May 9 12:16:38 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * io-select.c (trivfs_S_io_select): Remove TAG arg.
-
-Tue May 7 16:14:10 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * file-get-storage-info.c (trivfs_S_file_get_storage_info): Swap
- PORTS_TYPE and NUM_PORTS args.
-
-Mon May 6 20:16:20 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * file-get-storage-info.c (trivfs_S_file_get_storage_info):
- Rewrite for new interface.
-
-Mon Apr 29 15:19:26 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * handle-port.c: Comment out warning addition.
-
-Sun Apr 28 15:22:16 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
-
- * handle-port.c: Add obsolescence link warning.
-
-Thu Apr 11 18:03:31 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
-
- * Makefile (MIGSFLAGS): Reference fsmutations.h in $(srcdir).
-
-Thu Jan 25 16:19:29 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * cntl-create.c (trivfs_create_control): New function.
- * trivfs.h (trivfs_create_control): New declaration.
- * startup.c (trivfs_startup): Use trivfs_create_control.
- * handle-port.c (trivfs_handle_port): Likewise.
- * Makefile (OTHERSRCS): Add cntl-create.c.
-
- * open.c (trivfs_open): Use ports_create_port instead of
- ports_allocate_port, and return any error.
- * protid-dup.c (trivfs_protid_dup): Likewise.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Likewise.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise.
-
-Mon Jan 15 12:02:49 1996 Miles Bader <miles@gnu.ai.mit.edu>
-
- * protid-clean.c (trivfs_clean_protid): Don't hold
- CRED->po->cntl->lock while calling TRIVFS_PEROPEN_DESTROY_HOOK.
-
-SUN Nov 5 00:01:53 1995 Miles Bader <miles@gnu.ai.mit.edu>
-
- * fsys-stubs.c (trivfs_S_fsys_get_options,
- trivfs_S_file_get_fs_options): New functions.
-
- * file-get-storage-info.c (trivfs_S_file_get_storage_info): Add
- FLAGS arg.
-
- * dir-chg.c (trivfs_S_dir_notice_changes): Waste some time adding
- reply port args that no one will use.
- * dir-link.c (trivfs_S_dir_link): Ditto.
- * dir-lookup.c (trivfs_S_dir_lookup): Ditto.
- * file-utimes.c (trivfs_S_file_utimes): Ditto.
- * file-statfs.c (trivfs_S_file_statfs)Ditto.
- * file-set-trans.c (trivfs_S_file_set_translator): Ditto.
- * file-lock.c (trivfs_S_file_lock, trivfs_S_file_lock_stat): Ditto.
- * file-getlinknode.c (trivfs_S_file_getlinknode): Ditto.
- * file-getfh.c (trivfs_S_file_getfh): Ditto.
- * file-get-transcntl.c (trivfs_S_file_get_translator_cntl): Ditto.
- * file-get-trans.c (trivfs_S_file_get_translator): Ditto.
- * file-get-storage-info.c (trivfs_S_file_get_storage_info): Ditto.
- * file-chown.c (trivfs_S_file_chown): Ditto.
- * file-chflags.c (trivfs_S_file_chflags): Ditto.
- * file-chg.c (trivfs_S_file_notice_changes): Ditto.
- * dir-unlink.c (trivfs_S_dir_unlink): Ditto.
- * dir-rmdir.c (trivfs_S_dir_rmdir): Ditto.
- * dir-rename.c (trivfs_S_dir_rename): Ditto.
- * dir-readdir.c (trivfs_S_dir_readdir): Ditto.
- * dir-mkfile.c (trivfs_S_dir_mkfile): Ditto.
- * dir-mkdir.c (trivfs_S_dir_mkdir): Ditto.
- * file-chmod.c (trivfs_S_file_chmod): Ditto.
- * file-chauthor.c (trivfs_S_file_chauthor): Ditto.
-
-Wed Nov 1 15:53:38 1995 Miles Bader <miles@gnu.ai.mit.edu>
-
- * startup.c (trivfs_startup): Add FLAGS arg, passed to fsys_startup.
- * trivfs.h (trivfs_startup): Add FLAGS arg.
- * fsys-stubs.c (trivfs_S_fsys_startup): Ditto.
-
-Sat Oct 7 05:04:02 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * fsys-stubs.c (trivfs_S_fsys_getpriv): Add poly args.
-
- * Makefile (libtrivfs.so): Depend on ../libports/libports.so.
-
-Fri Oct 6 17:44:08 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * migsupport.c: Remove leading _ from function names.
- * fsmutations.h: Likewise.
- * trivfs.h (trivfs_{begin,end}_using_{protid,control}): Declare them.
-
-Fri Oct 6 17:28:07 1995 Miles Bader <miles@gnu.ai.mit.edu>
-
- * dir-link.c (trivfs_S_dir_link): Swap first two arguments.
-
- * file-get-storage-info.c (trivfs_S_file_get_storage_info): Change
- type of RUNS to off_t **, and add the BLOCK_SIZE parameter.
-
-Thu Oct 5 00:41:33 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * Makefile (FSSRCS): Add file-get-storage-info.c.
- * file-get-storage-info.c: New file.
-
-Mon Sep 18 14:29:37 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * file-set-size.c (trivfs_S_file_set_size): Renamed from
- file-truncate.c:trivfs_s_file_truncate.
- * io-pathconf.c (trivfs_S_io_pathconf): Renamed from
- file-pathconf.c:trivfs_S_file_pathconf.
- (trivfs_S_io_pathconf): Add reply port to args.
- * Makefile (FSSRCS): Remove file-pathconf.c.
- (IOSRCS): Add io-pathconf.c.
- (FSSRCS): Rename file-truncate.c to file-set-size.c.
-
-Wed Sep 6 10:33:03 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * demuxer.c (trivfs_demuxer): Use ports_notify_server and
- ports_interrupt_server instead of our own versions.
- * Makefile (SRCS): Removed $(NOTIFYSRCS) and $(INTSRCS).
- (NOTIFYSRCS, INTSRCS): Removed.
- (MIGSTUBS): Removed notifyServer.o and interruptServer.o.
- * interrupt.c: File deleted.
-
-Fri Aug 25 12:11:26 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * interrupt.c (trivfs_S_interrupt_operation): Use ports_interrupt_rpc.
-
-Thu Aug 24 11:46:19 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * fsys-forward.c (trivfs_S_fsys_forward): New file.
-
-Wed Aug 23 15:09:31 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * Makefile (REMHDRS): Removed.
- (FSYSSRCS): Added fsys-forward.c.
-
-Mon Aug 21 15:25:36 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * handle-port.c (trivfs_handle_port): Initialize the hook field.
- * io-stat.c (trivfs_S_io_stat): Pass CRED to trivfs_modify_stat.
- * fsys-goaway.c (trivfs_S_fsys_goaway): Use new args for trivfs_goaway.
- * trivfs.h (struct trivfs_control): Add the hook field.
- (trivfs_goaway): Pass the control structure directly instead of
- random fields from it.
- (trivfs_modify_stat): Pass in the node as well.
-
-Mon Aug 21 10:51:24 1995 Michael I. Bushnell, p/BSG <mib@duality.gnu.ai.mit.edu>
-
- * protid-dup.c: Doc fix.
-
-Fri Aug 11 14:01:41 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * open.c (trivfs_open): Actually set the PO field to what we create.
- * Makefile (OTHERSRCS): Add protid-dup.c and open.c.
-
-Tue Aug 8 14:07:04 1995 Miles Bader <miles@geech.gnu.ai.mit.edu>
-
- * open.c: New file, containing trivfs_open.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Guts (except for
- protection check) moved into trivfs_open.
- * protid-dup.c: New file, containing trivfs_protid_dup.
- * io-duplicate.c (trivfs_S_io_duplicate): Guts moved into
- trivfs_protid_dup.
-
- * trivfs.h (trivfs_protid_create_hook, trivfs_peropen_create_hook):
- Change the declarations now that these return an error code.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Allow
- trivfs_protid_create_hook and trivfs_peropen_create_hook to return
- an error code, and abort if either does.
- * protid-clean.c (trivfs_clean_protid): Only call
- trivfs_protid_destroy_hook hook on CRED if it was fully initialized.
- * io-duplicate.c (trivfs_S_io_duplicate): Allow
- trivfs_protid_create_hook to return an error code.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Ditto.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Ditto.
-
-Fri Jul 21 17:01:12 1995 Michael I Bushnell <mib@geech.gnu.ai.mit.edu>
-
- * fsys-getroot.c (trivfs_S_fsys_getroot): Free initial reference
- created by ports_allocate_port.
- * handle-port.c (trivfs_handle_port): Likewise.
- * io-duplicate.c (trivfs_S_io_duplicate): Likewise.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Likewise.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise.
-
-Sun Jul 16 13:00:44 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * trivfs.h: Protect against including twice, and add includes that
- we depend on.
-
-Thu Jul 6 15:38:48 1995 Michael I Bushnell <mib@duality.gnu.ai.mit.edu>
-
- * Makefile: Removed dependencies that are now automatically
- generated.
-
-Tue Jun 27 10:55:16 1995 Michael I Bushnell <mib@duality.gnu.ai.mit.edu>
-
- * fsys-goaway.c (trivfs_S_fsys_goaway): Call trivfs_goaway the new
- way.
- * startup.c (trivfs_startup): New parms CONTROL_BUCKET and
- PROTID_BUCKET; pass them to trivfs_handle_port. Use new ports
- interface.
- * protid-clean.c (trivfs_clean_protid): Use new ports interface.
- Use PREdecrement in reference counting check.
- * nosenders.c (trivfs_do_mach_notify_no_senders): Use new ports
- interface.
- * migsupport.c (_trivfs_begin_using_protid,
- _trivfs_end_using_protid, _trivfs_begin_using_oontrol,
- _trivfs_end_using_control): Use new ports interface.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Use new ports
- interface.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Use new ports
- interface.
- * io-duplicate.c (trivfs_S_io_duplicate): Use new ports interface.
- * handle-port.c (trivfs_handle_port): Take new parms; use new
- ports interface; initialize CNTL->protid_bucket.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Use new form of
- ports_allocate_port call.
- * trivfs.h (trivfs_protid_portclasses): Renamed from
- trivfs_protid_porttypes. Change type to `struct port_class *'.
- (trivfs_protid_nportclasses): Renamed from trivfs_protid_nporttypes.
- (trivfs_cntl_portclasses): Renamed from trivfs_cntl_porttypes. Change
- type to `struct port_class *'.
- (trivfs_cntl_nportclasses): Renamed from trivfs_cntl_nporttypes.
- (trivfs_startup): Pass port classes instead of integer types. New
- parms CONTROL_BUCKET and PROTID_BUCKET.
- (trivfs_handle_port): Pass port classes instead of integer types.
- New parms CONTROL_BUCKET and PROTID_BUCKET.
- (trivfs_goaway): Pass port classes instead of integer types.
- (struct trivfs_control): Renamed member `protid_types' to be
- `protid_class' and changed type to be `stroct port_class *'.
- New member `protid_bucket'.
-
-Fri May 12 19:05:46 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * fsys-stubs.c (trivfs_S_fsys_set_options,
- trivfs_S_fsys_mod_readonly): Change from mod_readonly to set_options.
-
-Sun Apr 9 00:36:36 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
-
- * io-stat.c (trivfs_S_io_stat): Before calling trivfs_modify_stat,
- set the st_fstype & st_fsid fields to trivfs_fstype & trivfs_fsid.
- But first, if trivfs_fsid is zero, set it to our process id, which
- should be a nice unique value.
- * file-statfs.c (trivfs_S_file_statfs): Ditto about the PID.
-
- * startup.c (trivfs_startup): New function, which implements a
- common sequence of steps when starting up a new trivfs.
- * trivfs.h: Declare trivfs_startup.
- * Makefile (OTHERSRCS): Add startup.c.
-
-Thu Mar 30 12:27:59 1995 Michael I Bushnell <mib@geech.gnu.ai.mit.edu>
-
- * trivfs.h (trivfs_check_open_hook): Doc fix.
- (trivfs_complete_open): Delete declaration.
- (struct trivfs_control): Delete members `openshead' and
- `openstail'.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Strip out old
- hack for blocking.
- (struct pending_open): Delete type.
- (trivfs_complete_open): Delete function.
-
- * trivfs.h (struct trivfs_control): New member `lock'.
- * handle-port.c (trivfs_handle_port): Initialize CNTL->lock.
- * io-duplicate.c (trivfs_S_io_duplicate): Lock
- CRED->po->cntl->lock around relevant code.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Likewise.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise.
- * protid-clean.c (trivfs_clean_protid): Likewise.
-
-Tue Jan 17 19:00:28 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * io-select.c: Updated for new io_select interface.
-
-Fri Dec 9 01:35:54 1994 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * io-write.c: Use mach_msg_type_number_t in place of unsigned int
- and int.
- * io-read.c: Likewise.
- * io-readable.c: Likewise.
-
-Tue Oct 25 10:54:06 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu>
-
- * fsys-getroot.c (trivfs_S_fsys_getroot): Don't clear O_NONBLOCK.
-
-Tue Aug 30 13:23:55 1994 Michael I Bushnell <mib@geech.gnu.ai.mit.edu>
-
- * fsys-syncfs.c: New file.
- * Makefile (FSYSSRCS): Added fsys-syncfs.c.
- * fsys-stubs.c (trivfs_S_fsys_mod_readonly): New function.
-
- * Makefile (FSSRCS): Remove dir-pathtrans.c; add dir-lookup.c.
- * dir-lookup.c: Renamed from dir-pathtrans.c
- * dir-pathtrans.c (trivfs_S_dir_lookup): Renamed from
- trivfs_S_dir_pathtrans.
-
- * fsys-getroot.c (trivfs_S_fsys_getroot): Use FS_RETRY_NORMAL
- instead of FS_RETRY_NONE.
- (trivfs_complete_open): Likewise.
-
- * file-set-trans.c (trivfs_S_file_set_translator): Change to args
- as for new file_set_translator procotol.
-
-Mon Aug 29 12:52:43 1994 Michael I Bushnell <mib@geech.gnu.ai.mit.edu>
-
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Use new
- authentication protocol.
-
-Wed Aug 17 20:11:29 1994 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
-
- * io-select.c (trivfs_S_io_select): Take poly arg for notify port.
-
-Thu Aug 11 11:58:48 1994 Michael I Bushnell <mib@geech.gnu.ai.mit.edu>
-
- * io-version.c (trivfs_S_io_server_version): Fix typo in name.
-
-Fri Jul 22 12:41:55 1994 Michael I Bushnell <mib@geech.gnu.ai.mit.edu>
-
- * fsys-goaway.c: Include fsys_S.h with " not with <>.
- * handle-port.c: Include priv.h with " not with <>.
-
- * Makefile: Converted to use new scheme.
- * fsmutations.h (SERVERPREFIX): Deleted macro.
- * fsys-getroot.c: Include "fsys_reply_U.h" instead of "fsys_reply.h".
-
-Wed Jul 20 15:59:36 1994 Michael I Bushnell <mib@geech.gnu.ai.mit.edu>
-
- * file-inv.c: New file.
- * Makefile (FSSRCS): Added file-inv.c.
-
-Tue Jul 19 19:23:33 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * fsys-stubs.c (trivfs_S_fsys_startup): Deleted dotdot args.
- * fsys-getroot.c (trivfs_S_fsys_getroot): New arg `dotdot';
- don't do anything with it.
-
-Mon Jul 11 14:49:03 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * trivfs.h (trivfs_set_atime, trivfs_set_mtime): New functions.
- * times.c: New file.
- * Makefile (OTHERSRCS): Added `times.c'.
-
-Thu Jul 7 10:39:04 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * Makefile (DIST_FILES): Add priv.h.
-
-Tue Jul 5 13:24:59 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * Makefile (DIST_FILES): Added fsmutations.h.
- (TAGSHDRS): New variable.
-
- * fsys-getroot.c: Include "fsys_reply.h".
- (trivfs_S_fsys_getroot, trivfs_complete_open):
- Uncomment code now that we have reply ports.
- (struct pending_open): Delete USERS_PORT, add CRED.
- (trivfs_S_fsys_getroot): When creating PENDO, don't call
- ports_get_right, call ports_port_ref; store CRED in PENDO.
- (trivfs_complete_open): Deal with errors properly. When sending
- port to user, call ports_get_right. Always call
- ports_done_with_port when freeing pending open struct.
- * Makefile (MIGSTUBS): Added fsys_replyUser.o.
- (fsys_reply.h fsys_replyUser.c): New rule.
- (fsys-getroot.c): Add dependency on fsys_reply.h.
-
- * fsmutations.h (REPLY_PORTS): New macro, affecting io and fsys
- interfaces.
- * io-async-icky.c (trivfs_S_io_get_icky_async_id): Added new
- REPLY and REPLYTYPE args.
- * io-async.c (trivfs_S_io_async): Likewise.
- * io-duplicate.c (trivfs_S_io_duplicate): Likewise.
- * io-map.c (trivfs_S_io_map): Likewise.
- * io-modes-get.c (trivfs_S_io_get_openmodes): Likewise.
- * io-modes-off.c (trivfs_S_io_clear_some_openmodes): Likewise.
- * io-modes-on.c (trivfs_S_io_set_some_openmodes): Likewise.
- * io-modes-set.c (trivfs_S_io_set_all_openmodes): Likewise.
- * io-owner-get.c (trivfs_S_io_get_owner): Likewise.
- * io-owner-mod.c (trivfs_S_io_mod_owner): Likewise.
- * io-read.c (trivfs_S_io_read): Likewise.
- * io-readable.c (trivfs_S_io_readable): Likewise.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Likewise.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise.
- * io-seek.c (trivfs_S_io_seek): Likewise.
- * io-select.c (trivfs_S_io_select): Likewise.
- * io-stat.c (trivfs_S_io_stat): Likewise.
- * io-stubs.c (trivfs_S_io_map_cntl): Likewise.
- (trivfs_S_io_get_conch): Likewise.
- (trivfs_S_io_release_conch): Likewise.
- (trivfs_S_io_eofnotify): Likewise.
- (trivfs_S_io_prenotify): Likewise.
- (trivfs_S_io_postnotify): Likewise.
- (trivfs_S_io_readsleep): Likewise.
- (trivfs_S_io_sigio): Likewise.
- (trivfs_S_io_readnotify): Likewise.
- * io-write.c (trivfs_S_io_write): Likewise.
- * io-version.c (trivfs_S_trivfs_io_server_version): Likewise.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Likewise.
- * fsys-goaway.c (trivfs_S_fsys_goaway): Likewise.
- * fsys-stubs.c (trivfs_S_fsys_startup): Likewise.
- (trivfs_S_fsys_getpriv): Likewise.
- (trivfs_S_fsys_init): Likewise.
- (trivfs_S_fsys_getfile): Likewise.
-
-Wed Jun 29 13:02:17 1994 Michael I Bushnell (mib@geech.gnu.ai.mit.edu)
-
- * io-read.c (trivfs_S_io_read): Always return EOPNOTSUPP.
- * io-write.c (trivfs_S_io_write): Likewise.
- * file-truncate.c (trivfs_S_file_truncate): Likewise.
- * io-readable.c (trivfs_S_io_readable): Likewise.
- * io-select.c (trivfs_S_io_select): Likewise.
-
- * fsys-getroot.c (trivfs_S_fsys_getroot): Use trivfs_allow_open
- instead of trivfs_support_* vars.
-
- * trivfs.h (trivfs_allow_open): New variable.
-
- * dir-pathtrans.c (trivfs_S_dir_pathtrans): Delete unused var
- `newcred'.
-
-Mon Jun 27 15:05:06 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * fsys-getroot.c: Comment out code for blocking opens; don't
- permit trivfs_check_open_hook to return EWOULDBLOCK.
-
-Thu Jun 23 12:28:49 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * fsys-getroot.c (trivfs_S_fsys_getroot): Don't call
- ports_done_with_port for CNTL; the MiG destructor function does
- that for us.
-
- * fsys-getroot.c (trivfs_S_fsys_getroot): Call trivfs_check_open_hook
- to allow trivfs users to block or restrict opens.
- * trivfs.h (trivfs_check_open_hook, trivfs_complete_open): New
- declarations.
- (struct trivfs_control): New members `openshead' and `openstail'.
-
-Wed Jun 22 14:49:00 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * fsys-getroot.c (trivfs_S_fsys_getroot): Initialize both hook
- members to 0.
- * io-duplicate.c (trivfs_S_io_duplicate): Copy NEWCRED->hook
- from CRED->hook.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Likewise.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise.
-
- * fsys-getroot.c (trivfs_S_fsys_getroot): Don't force read/write
- systems to redefine this function. If O_foo is set, but
- trivfs_support_foo isn't, then return EACCES. Call
- io_restrict_auth at the front so we can check open permission
- using the result. Initialise CRED->po->openmodes.
-
- * trivfs.h (trivfs_peropen): New member `openmodes'.
- * io-modes-get.c (trivfs_S_io_get_openmodes): Set bits from
- CRED->po->openmodes, but only if we are not a read/write
- server; otherwise the server might be hiding bits elsewhere.
-
- * dir-pathtrans.c (trivfs_S_dir_pathtrans): Strip out code; always
- return ENOTDIR.
-
-Tue Jun 21 13:21:07 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * file-access.c: New file.
- * dir-chg.c: New file.
- * file-chg.c: New file.
- * Makefile (FSSRCS): Added file-access.c, dir-chg.c, and file-chg.c.
-
-Mon Jun 20 14:42:12 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * dir-readdir.c (trivfs_S_dir_readdir): Declare args in accord
- with fs.defs interface change.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Likewise. Set
- DO_RETRY and RETRY_NAME appropriately.
- * file-get-transcntl.c (trivfs_S_file_get_translator_cntl):
- CNTL_TYPE is a pointer.
-
-Fri Jun 17 11:23:47 1994 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * file-get-transcntl.c (trivfs_S_file_get_translator_cntl): Add
- missing poly arg.
-
-Wed Jun 15 21:27:20 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu)
-
- * dir-pathtrans.c: Include <string.h> for bcopy.
- * fsys-getroot.c: Likewise.
- * io-duplicate.c: Likewise.
- * io-reauthenticate.c: Likewise.
- * io-restrict-auth.c: Likewise.
-
-Wed Jun 15 16:58:02 1994 Michael I Bushnell (mib@geech.gnu.ai.mit.edu)
-
- * trivfs.h (trivfs_goaway): New args REALNODE, CNTLTYPE,
- PROTIDTYPE. All callers changed.
-
- * fsmutations.h (FSYS_DESTRUCTOR, FSYS_INTRAN): New macros.
- * priv.h (trivfs_control_t): New type.
- (_trivfs_begin_using_control, _trivfs_end_using_control): New
- declarations.
- * migsupport.c (_trivfs_begin_using_control,
- _trivfs_end_using_control): New functions.
- * fsys-getroot.c (trivfs_S_fsys_getroot): First arg is now
- `struct trivfs_control *'; don't call ports_check_port_type
- ourselves or ports_done_with_port.
- * fsys-goaway.c (trivfs_S_fsys_goaway): Likewise.
- * fsys-stubs.c (trivfs_S_fsys_startup, trivfs_S_fsys_getpriv,
- trivfs_S_fsys_init, trivfs_S_fsys_getfile): Declare first
- arg as `struct trivfs_control *'.
-
- * trivfs.h (trivfs_protid_porttype, trivfs_cntl_porttype):
- Deleted vars.
- (trivfs_protid_porttypes, trivfs_cntl_porttypes,
- trivfs_protid_nporttypes, trivfs_cntl_nporttypes): New vars.
- (trivfs_control): New member protidtypes.
- (trivfs_handle_port): New args PROTIDTYPE and CNTLTYPE.
- * migsupport.h (_trivfs_begin_using_protid): Check
- against all the members of trivfs_protid_porttypes.
- * dir-pathtrans.c (trivfs_S_dir_pathtrans): Copy type of new port
- from existing port.
- * io-duplicate.c (trivfs_S_io_duplicate): Likewise.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Likewise.
- * handle-port.c (trivfs_handle_port): Allocate port of type
- from new arg CNTLTYPE. Initialize CNTL->protidtypes from new arg
- PROTIDTYPE.
- * fsys-getroot (trivfs_S_fsys_getroot): Allocate port of type
- from CNTL->protidtypes.
-
- * trivfs.h (struct trivfs_protid) [hook]: New member.
- (trivfs_protid_create_hook, trivfs_peropen_create_hook,
- trivfs_protid_destroy_hook, trivfs_peropen_destroy_hook): New
- hook functions.
- * dir-pathtrans.c (trivfs_S_dir_pathtrans): Call
- trivfs_peropen_create_hook.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Likewise.
- * dir-pathtrans.c (trivfs_S_dir_pathtrans): Call
- trivfs_protid_create_hook.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Likewise.
- * io-duplicate.c (trivfs_S_io_duplicate): Likewise.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Likewise.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise.
- * protid-clean.c (trivfs_clean_protid): Call
- trivfs_protid_destroy_hook and trivfs_peropen_destroy_hook.
-
- * trivfs.h (struct trivfs_protid) [po]: New member.
- (struct trivfs_protid) [cntl]: Deleted member.
- (struct trivfs_peropen): New type.
- * file-getcontrol.c (trivfs_S_file_getcontrol): Fetch control
- port through peropen structure.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Likewise.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Likewise.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Reference
- peropen, not cntl.
- * io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise.
- * io-duplicate.c (trivfs_S_io_duplicate): Likewise.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Create new peropen
- and reference it.
- * dir-pathtrans (trivfs_S_dir_pathtrans): Actually create new
- peropen and cred.
- * protid-clean.c (trivfs_clean_protid): Drop reference on peropen,
- deallocating it if necessary.
-
- * trivfs.h (struct trivfs_protid) [uids, gids, nuids, ngids]: New
- members.
- * io-reauthenticate.c (trivfs_S_io_reauthenticate): Save received
- ids in newly created protid.
- * io-restrict-auth.c (listmember): New function.
- (trivfs_S_io_restrict_auth): Save uids and gids in newly created
- protid.
- * io-duplicate.c (trivfs_S_io_duplicate): Copy uids and gids.
- * protid-clean.c (trivfs_clean_protid): Free CRED->uids and
- CRED->gids.
- * fsys-getroot.c (trivfs_S_fsys_getroot): Initialize uids
- and gids.
-
-
-
diff --git a/libtrivfs/Makefile b/libtrivfs/Makefile
index 66333f32..ddce1e61 100644
--- a/libtrivfs/Makefile
+++ b/libtrivfs/Makefile
@@ -1,5 +1,6 @@
-#
-# Copyright (C) 1994, 1995, 1996 Free Software Foundation
+#
+# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2001, 2002, 2003, 2008 Free
+# Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
@@ -24,12 +25,12 @@ FSSRCS= dir-link.c dir-mkdir.c dir-mkfile.c dir-lookup.c dir-readdir.c \
file-get-transcntl.c file-getcontrol.c file-getfh.c \
file-getlinknode.c file-lock.c file-set-trans.c file-statfs.c \
file-sync.c file-syncfs.c file-set-size.c file-utimes.c file-exec.c \
- file-access.c dir-chg.c file-chg.c file-inv.c file-get-storage-info.c \
- file-get-fs-options.c
+ file-access.c dir-chg.c file-chg.c file-get-storage-info.c \
+ file-get-fs-options.c file-reparent.c
IOSRCS=io-async-icky.c io-async.c io-duplicate.c io-map.c io-modes-get.c \
io-modes-off.c io-modes-on.c io-modes-set.c io-owner-get.c \
- io-owner-mod.c io-pathconf.c io-read.c io-readable.c \
+ io-owner-mod.c io-pathconf.c io-read.c io-readable.c io-revoke.c \
io-reauthenticate.c io-restrict-auth.c io-seek.c io-select.c \
io-stat.c io-stubs.c io-write.c io-version.c io-identity.c
@@ -38,19 +39,25 @@ FSYSSRCS=fsys-getroot.c fsys-goaway.c fsys-stubs.c fsys-syncfs.c \
OTHERSRCS=demuxer.c protid-clean.c protid-dup.c cntl-create.c \
cntl-clean.c migsupport.c times.c startup.c open.c \
- runtime-argp.c set-options.c get-options.c
+ runtime-argp.c set-options.c append-args.c dyn-classes.c \
+ protid-classes.c cntl-classes.c
SRCS=$(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(OTHERSRCS)
MIGSTUBS=fsServer.o ioServer.o fsysServer.o fsys_replyUser.o
+libname = libtrivfs
+HURDLIBS = fshelp iohelp ports shouldbeinlibc
OBJS= $(sort $(subst .c,.o,$(SRCS)) $(MIGSTUBS))
LCLHDRS = trivfs.h fsmutations.h priv.h
MIGSFLAGS=-imacros $(srcdir)/fsmutations.h
MIGCOMSFLAGS = -prefix trivfs_
-libname = libtrivfs
-installhdrs = trivfs.h
+installhdrs := trivfs.h
+mig-sheader-prefix = trivfs_
+ifndef no_deps
+installhdrs += $(patsubst %,trivfs_%_S.h,fs io fsys)
+endif
include ../Makeconf
-libtrivfs.so: ../libports/libports.so
+$(MIGSTUBS:%Server.o=%.sdefsi): $(srcdir)/fsmutations.h
diff --git a/libtrivfs/get-options.c b/libtrivfs/append-args.c
index 370550da..d5c3d4a3 100644
--- a/libtrivfs/get-options.c
+++ b/libtrivfs/append-args.c
@@ -1,4 +1,4 @@
-/* Get runtime options
+/* Append current command line arguments
Copyright (C) 1996 Free Software Foundation
@@ -20,10 +20,11 @@
#include "priv.h"
-/* Return runtime options for FSYS in ARGZ & ARGZ_LEN. ARGZ should be
- allocated with malloc. */
+/* Append to the malloced string *ARGZ of length *ARGZ_LEN a NUL-separated
+ list of the arguments to this translator. */
error_t
-trivfs_get_options (struct trivfs_control *fsys, char **argz, size_t *argz_len)
+trivfs_append_args (struct trivfs_control *fsys,
+ char **argz, size_t *argz_len)
{
return EOPNOTSUPP;
}
diff --git a/libtrivfs/file-inv.c b/libtrivfs/cntl-classes.c
index 37f85660..356c9e92 100644
--- a/libtrivfs/file-inv.c
+++ b/libtrivfs/cntl-classes.c
@@ -1,5 +1,6 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/* Defaults for TRIVFS_CNTL_[N]PORTCLASSES
+
+ Copyright (C) 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -15,18 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-/* Unused stub */
-
-#include "priv.h"
-#include "fs_S.h"
+#include "trivfs.h"
-kern_return_t
-trivfs_S_file_invoke_translator (struct trivfs_protid *cred,
- int flags,
- retry_type *retry,
- char *retry_name,
- mach_port_t *retrypt,
- mach_msg_type_name_t *type)
-{
- return EOPNOTSUPP;
-}
+struct port_class *trivfs_cntl_portclasses[1];
+int trivfs_cntl_nportclasses;
diff --git a/libtrivfs/cntl-clean.c b/libtrivfs/cntl-clean.c
index 4b7a29cd..a010828f 100644
--- a/libtrivfs/cntl-clean.c
+++ b/libtrivfs/cntl-clean.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1996 Free Software Foundation
+ Copyright (C) 1994, 1996, 1997 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -27,4 +27,9 @@ trivfs_clean_cntl (void *arg)
mach_port_destroy (mach_task_self (), cntl->filesys_id);
mach_port_destroy (mach_task_self (), cntl->file_id);
mach_port_deallocate (mach_task_self (), cntl->underlying);
+
+ trivfs_remove_control_port_class (cntl->pi.class);
+ trivfs_remove_port_bucket (cntl->pi.bucket);
+ trivfs_remove_protid_port_class (cntl->protid_class);
+ trivfs_remove_port_bucket (cntl->protid_bucket);
}
diff --git a/libtrivfs/cntl-create.c b/libtrivfs/cntl-create.c
index dbe261b2..f103ed48 100644
--- a/libtrivfs/cntl-create.c
+++ b/libtrivfs/cntl-create.c
@@ -1,6 +1,6 @@
/* Create a new trivfs control port
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -33,9 +33,34 @@ trivfs_create_control (mach_port_t underlying,
struct port_bucket *protid_bucket,
struct trivfs_control **control)
{
- error_t err =
- ports_create_port (control_class, control_bucket,
- sizeof (struct trivfs_control), control);
+ error_t err;
+
+ /* Perhaps allocate, and perhaps add the specified port classes the ones
+ recognized by trivfs. */
+ err = trivfs_add_control_port_class (&control_class);
+ if (! err)
+ err = trivfs_add_protid_port_class (&protid_class);
+ else
+ protid_class = 0;
+
+ /* Perhaps allocate new port buckets. */
+ if (! err)
+ err = trivfs_add_port_bucket (&control_bucket);
+ else
+ control_bucket = 0;
+ if (! err)
+ {
+ if (! protid_bucket)
+ /* By default, use the same port bucket for both. */
+ protid_bucket = control_bucket;
+ err = trivfs_add_port_bucket (&protid_bucket);
+ }
+ else
+ protid_bucket = 0;
+
+ if (! err)
+ err = ports_create_port (control_class, control_bucket,
+ sizeof (struct trivfs_control), control);
if (! err)
{
@@ -47,7 +72,7 @@ trivfs_create_control (mach_port_t underlying,
if (err)
{
ports_port_deref (*control);
- return err;
+ goto out;
}
err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
@@ -56,12 +81,21 @@ trivfs_create_control (mach_port_t underlying,
{
mach_port_destroy (mach_task_self (), (*control)->filesys_id);
ports_port_deref (*control);
- return err;
+ goto out;
}
(*control)->hook = 0;
mutex_init (&(*control)->lock);
}
+out:
+ if (err)
+ {
+ trivfs_remove_control_port_class (control_class);
+ trivfs_remove_protid_port_class (protid_class);
+ trivfs_remove_port_bucket (control_bucket);
+ trivfs_remove_port_bucket (protid_bucket);
+ }
+
return err;
}
diff --git a/libtrivfs/dir-chg.c b/libtrivfs/dir-chg.c
index 6c9a9faf..d01abbbf 100644
--- a/libtrivfs/dir-chg.c
+++ b/libtrivfs/dir-chg.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_dir_notice_changes (struct trivfs_protid *cred,
diff --git a/libtrivfs/dir-link.c b/libtrivfs/dir-link.c
index 0f4833d0..f5a8c735 100644
--- a/libtrivfs/dir-link.c
+++ b/libtrivfs/dir-link.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1996 Free Software Foundation
+/*
+ Copyright (C) 1994,96,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,10 +16,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
-trivfs_S_dir_link (struct trivfs_protid *dir,
+trivfs_S_dir_link (struct trivfs_protid *dir,
mach_port_t reply, mach_msg_type_name_t reply_type,
struct trivfs_protid *file, char *name, int excl)
{
@@ -29,5 +28,3 @@ trivfs_S_dir_link (struct trivfs_protid *dir,
return EXDEV;
return ENOTDIR;
}
-
-
diff --git a/libtrivfs/dir-lookup.c b/libtrivfs/dir-lookup.c
index cdcfd4be..66afac1d 100644
--- a/libtrivfs/dir-lookup.c
+++ b/libtrivfs/dir-lookup.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,98,99,2001,02 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
#include <assert.h>
#include <fcntl.h>
#include <string.h>
@@ -32,8 +31,59 @@ trivfs_S_dir_lookup (struct trivfs_protid *cred,
mach_port_t *retrypt,
mach_msg_type_name_t *retrypt_type)
{
+ int perms;
+ error_t err;
+ struct trivfs_protid *newcred;
+
if (!cred)
return EOPNOTSUPP;
- return ENOTDIR;
+ if (filename[0])
+ return ENOTDIR;
+
+ /* This is a null-pathname "reopen" call; do the right thing. */
+
+ /* Burn off flags we don't actually implement */
+ flags &= O_HURD;
+ flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS);
+
+ /* Validate permissions */
+ if (! trivfs_check_access_hook)
+ file_check_access (cred->realnode, &perms);
+ else
+ (*trivfs_check_access_hook) (cred->po->cntl, cred->user,
+ cred->realnode, &perms);
+ if ((flags & (O_READ|O_WRITE|O_EXEC) & perms)
+ != (flags & (O_READ|O_WRITE|O_EXEC)))
+ return EACCES;
+
+ /* Execute the open */
+ err = 0;
+ if (trivfs_check_open_hook)
+ err = (*trivfs_check_open_hook) (cred->po->cntl, cred->user, flags);
+ if (!err)
+ {
+ struct iouser *user;
+
+ err = iohelp_dup_iouser (&user, cred->user);
+ if (err)
+ return err;
+
+ err = trivfs_open (cred->po->cntl, user, flags,
+ cred->realnode, &newcred);
+ if (err)
+ iohelp_free_iouser (user);
+ else
+ mach_port_mod_refs (mach_task_self (), cred->realnode,
+ MACH_PORT_RIGHT_SEND, +1);
+ }
+ if (err)
+ return err;
+
+ *retry_type = FS_RETRY_NORMAL;
+ *retry_name = '\0';
+ *retrypt = ports_get_right (newcred);
+ *retrypt_type = MACH_MSG_TYPE_MAKE_SEND;
+ ports_port_deref (newcred);
+ return 0;
}
diff --git a/libtrivfs/dir-mkdir.c b/libtrivfs/dir-mkdir.c
index f41dfdbe..d39bd3f8 100644
--- a/libtrivfs/dir-mkdir.c
+++ b/libtrivfs/dir-mkdir.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,02 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,10 +16,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
-trivfs_S_dir_mkdir (struct trivfs_protid *cred,
+trivfs_S_dir_mkdir (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
char *name, mode_t mode)
{
diff --git a/libtrivfs/dir-mkfile.c b/libtrivfs/dir-mkfile.c
index aaaa7ad9..048db244 100644
--- a/libtrivfs/dir-mkfile.c
+++ b/libtrivfs/dir-mkfile.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_dir_mkfile (struct trivfs_protid *file,
diff --git a/libtrivfs/dir-readdir.c b/libtrivfs/dir-readdir.c
index dbd0a054..f1176f07 100644
--- a/libtrivfs/dir-readdir.c
+++ b/libtrivfs/dir-readdir.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,99,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,13 +16,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_dir_readdir (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
char **data,
- u_int *datalen,
+ size_t *datalen,
+ boolean_t *data_dealloc,
int entry,
int nentries,
vm_size_t bufsiz,
diff --git a/libtrivfs/dir-rename.c b/libtrivfs/dir-rename.c
index 48fff625..d68233ec 100644
--- a/libtrivfs/dir-rename.c
+++ b/libtrivfs/dir-rename.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1996 Free Software Foundation
+/*
+ Copyright (C) 1994,96,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,10 +16,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
-trivfs_S_dir_rename (struct trivfs_protid *cred,
+trivfs_S_dir_rename (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
char *name,
struct trivfs_protid *cred2, char *name2, int excl)
diff --git a/libtrivfs/dir-rmdir.c b/libtrivfs/dir-rmdir.c
index ab9d8f41..a4d320c4 100644
--- a/libtrivfs/dir-rmdir.c
+++ b/libtrivfs/dir-rmdir.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,14 +16,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
-trivfs_S_dir_rmdir (struct trivfs_protid *cred,
+trivfs_S_dir_rmdir (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
char *name)
{
return cred ? ENOTDIR : EOPNOTSUPP;
}
-
-
diff --git a/libtrivfs/dir-unlink.c b/libtrivfs/dir-unlink.c
index d86ad324..a6ef9b0c 100644
--- a/libtrivfs/dir-unlink.c
+++ b/libtrivfs/dir-unlink.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,10 +16,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
-trivfs_S_dir_unlink (struct trivfs_protid *cred,
+trivfs_S_dir_unlink (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
char *name)
{
diff --git a/libtrivfs/dyn-classes.c b/libtrivfs/dyn-classes.c
new file mode 100644
index 00000000..5f73f8f3
--- /dev/null
+++ b/libtrivfs/dyn-classes.c
@@ -0,0 +1,269 @@
+/* Dynamically allocated port classes/buckets recognized by trivfs
+
+ Copyright (C) 1997 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 "priv.h"
+
+/* Auxiliary info for each vector element. */
+struct aux
+{
+ void (*free_el)();
+ unsigned refs;
+};
+
+/* Vectors of dynamically allocated port classes/buckets. */
+
+/* Protid port classes. */
+struct port_class **trivfs_dynamic_protid_port_classes = 0;
+size_t trivfs_num_dynamic_protid_port_classes = 0;
+static struct aux *dynamic_protid_port_classes_aux = 0;
+static size_t dynamic_protid_port_classes_sz = 0;
+
+/* Control port classes. */
+struct port_class **trivfs_dynamic_control_port_classes = 0;
+size_t trivfs_num_dynamic_control_port_classes = 0;
+static struct aux *dynamic_control_port_classes_aux = 0;
+static size_t dynamic_control_port_classes_sz = 0;
+
+/* Port buckets. */
+struct port_bucket **trivfs_dynamic_port_buckets = 0;
+size_t trivfs_num_dynamic_port_buckets = 0;
+static struct aux *dynamic_port_buckets_aux = 0;
+static size_t dynamic_port_buckets_sz = 0;
+
+/* Lock used to control access to all the above vectors. */
+static struct mutex dyn_lock = MUTEX_INITIALIZER;
+
+/* Add EL to the vector pointed to by VEC_V, which should point to a vector
+ of pointers of some type, and has a length stored in *SZ; If there's
+ already a pointer to EL in VEC_V, nothing will actually be added, but the
+ reference count for that element will be increased. *NUM is the actual
+ number of non-null elements in the vector, and will be incremented if
+ something is actually added. AUX_VEC is a pointer to a vector of struct
+ aux elements, that contains information parralleling VEC_V. FREE_EL, if
+ non-zero, should be a function that takes a single argument of the same
+ type as EL, and deallocates it; this function is called in the following
+ cases: (1) An error is encountered trying to grow one of the vectors, (2)
+ when the element is eventually freed by drop_el. */
+static error_t
+add_el (void *el, void (*free_el)(),
+ void *vec_v, struct aux **aux_vec,
+ size_t *sz, size_t *num)
+{
+ int i;
+ size_t new_sz;
+ void ***vec, **new_vec;
+ struct aux *new_aux_vec;
+
+ if (! el)
+ return ENOMEM;
+
+ mutex_lock (&dyn_lock);
+
+ vec = vec_v;
+
+ for (i = 0; i < *sz; i++)
+ if (! (*vec)[i])
+ {
+ (*vec)[i] = el;
+ (*aux_vec)[i].free_el = free_el;
+ (*aux_vec)[i].refs = 1;
+ (*num)++;
+ mutex_unlock (&dyn_lock);
+ return 0;
+ }
+ else if ((*vec)[i] == el)
+ {
+ (*aux_vec)[i].refs++;
+ mutex_unlock (&dyn_lock);
+ return 0;
+ }
+
+ new_sz = *sz + 4;
+ new_vec = realloc (*vec, new_sz * sizeof (void *));
+ new_aux_vec = realloc (*aux_vec, new_sz * sizeof (struct aux));
+
+ if (!new_vec || !new_aux_vec)
+ {
+ if (free_el)
+ (*free_el) (el);
+ /* One of the vectors might be the wrong size, but who cares. */
+ return ENOMEM;
+ }
+
+ for (i = *sz; i < new_sz; i++)
+ new_vec[i] = 0;
+
+ new_vec[*sz] = el;
+ new_aux_vec[*sz].free_el = free_el;
+ new_aux_vec[*sz].refs = 1;
+ (*num)++;
+
+ *vec = new_vec;
+ *aux_vec = new_aux_vec;
+ *sz = new_sz;
+
+ mutex_unlock (&dyn_lock);
+
+ return 0;
+}
+
+/* Scan VEC_V, which should be a vector of SZ pointers of the same type as
+ EL, for EL; if it is found, then decrement its reference count, and if
+ that goes to zero, decrement *NUM and free EL if it had an associated free
+ routine passed to add_el. */
+static void
+drop_el (void *el, void *vec_v, struct aux *aux_vec,
+ size_t sz, size_t *num)
+{
+ int i;
+ void **vec;
+
+ if (! el)
+ return;
+
+ mutex_lock (&dyn_lock);
+
+ vec = vec_v;
+
+ for (i = 0; i < sz; i++)
+ if (vec[i] == el)
+ {
+ if (aux_vec[i].refs == 1)
+ {
+ if (aux_vec[i].free_el)
+ (*aux_vec[i].free_el) (el);
+ vec[i] = 0;
+ (*num)--;
+ }
+ else
+ aux_vec[i].refs--;
+ break;
+ }
+
+ mutex_unlock (&dyn_lock);
+}
+
+/* Add the port class *CLASS to the list of control port classes recognized
+ by trivfs; if *CLASS is 0, an attempt is made to allocate a new port
+ class, which is stored in *CLASS. */
+error_t
+trivfs_add_control_port_class (struct port_class **class)
+{
+ /* XXX Gee, there *is no* way of freeing port classes or buckets! So we
+ actually never free anything! */
+
+ if (! *class)
+ {
+ *class = ports_create_class (trivfs_clean_cntl, 0);
+ if (! *class)
+ return ENOMEM;
+ }
+
+ return
+ add_el (*class, 0,
+ &trivfs_dynamic_control_port_classes,
+ &dynamic_control_port_classes_aux,
+ &dynamic_control_port_classes_sz,
+ &trivfs_num_dynamic_control_port_classes);
+}
+
+/* Remove the previously added dynamic control port class CLASS, freeing it
+ if it was allocated by trivfs_add_control_port_class. */
+void
+trivfs_remove_control_port_class (struct port_class *class)
+{
+ drop_el (class,
+ trivfs_dynamic_control_port_classes,
+ dynamic_control_port_classes_aux,
+ dynamic_control_port_classes_sz,
+ &trivfs_num_dynamic_control_port_classes);
+}
+
+/* Add the port class *CLASS to the list of protid port classes recognized by
+ trivfs; if *CLASS is 0, an attempt is made to allocate a new port class,
+ which is stored in *CLASS. */
+error_t
+trivfs_add_protid_port_class (struct port_class **class)
+{
+ /* XXX Gee, there *is no* way of freeing port classes or buckets! So we
+ actually never free anything! */
+
+ if (! *class)
+ {
+ *class = ports_create_class (trivfs_clean_protid, 0);
+ if (! *class)
+ return ENOMEM;
+ }
+
+ return
+ add_el (*class, 0,
+ &trivfs_dynamic_protid_port_classes,
+ &dynamic_protid_port_classes_aux,
+ &dynamic_protid_port_classes_sz,
+ &trivfs_num_dynamic_protid_port_classes);
+}
+
+/* Remove the previously added dynamic protid port class CLASS, freeing it
+ if it was allocated by trivfs_add_protid_port_class. */
+void
+trivfs_remove_protid_port_class (struct port_class *class)
+{
+ drop_el (class,
+ trivfs_dynamic_protid_port_classes,
+ dynamic_protid_port_classes_aux,
+ dynamic_protid_port_classes_sz,
+ &trivfs_num_dynamic_protid_port_classes);
+}
+
+/* Add the port bucket *BUCKET to the list of dynamically allocated port
+ buckets; if *bucket is 0, an attempt is made to allocate a new port
+ bucket, which is then stored in *bucket. */
+error_t
+trivfs_add_port_bucket (struct port_bucket **bucket)
+{
+ /* XXX Gee, there *is no* way of freeing port bucketes or buckets! So we
+ actually never free anything! */
+
+ if (! *bucket)
+ {
+ *bucket = ports_create_bucket ();
+ if (! *bucket)
+ return ENOMEM;
+ }
+
+ return
+ add_el (*bucket, 0,
+ &trivfs_dynamic_port_buckets,
+ &dynamic_port_buckets_aux,
+ &dynamic_port_buckets_sz,
+ &trivfs_num_dynamic_port_buckets);
+}
+
+/* Remove the previously added dynamic port bucket BUCKET, freeing it
+ if it was allocated by trivfs_add_port_bucket. */
+void
+trivfs_remove_port_bucket (struct port_bucket *bucket)
+{
+ drop_el (bucket,
+ trivfs_dynamic_port_buckets,
+ dynamic_port_buckets_aux,
+ dynamic_port_buckets_sz,
+ &trivfs_num_dynamic_port_buckets);
+}
diff --git a/libtrivfs/file-access.c b/libtrivfs/file-access.c
index d017b8e1..87029540 100644
--- a/libtrivfs/file-access.c
+++ b/libtrivfs/file-access.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,96,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,15 +16,20 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
-kern_return_t
+error_t
trivfs_S_file_check_access (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
int *allowed)
{
- if (!cred)
+ if (! cred)
return EOPNOTSUPP;
- *allowed = 0;
+
+ if (! trivfs_check_access_hook)
+ file_check_access (cred->realnode, allowed);
+ else
+ (*trivfs_check_access_hook) (cred->po->cntl, cred->user,
+ cred->realnode, allowed);
+
return 0;
}
diff --git a/libtrivfs/file-chauthor.c b/libtrivfs/file-chauthor.c
index 5f61743a..0460bfe1 100644
--- a/libtrivfs/file-chauthor.c
+++ b/libtrivfs/file-chauthor.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_chauthor (struct trivfs_protid *cred,
@@ -25,4 +24,3 @@ trivfs_S_file_chauthor (struct trivfs_protid *cred,
{
return cred ? file_chauthor (cred->realnode, auth) : EOPNOTSUPP;
}
-
diff --git a/libtrivfs/file-chflags.c b/libtrivfs/file-chflags.c
index 8d3d4577..c28f12f3 100644
--- a/libtrivfs/file-chflags.c
+++ b/libtrivfs/file-chflags.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,10 +16,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
-trivfs_S_file_chflags (struct trivfs_protid *cred,
+trivfs_S_file_chflags (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
int flags)
{
diff --git a/libtrivfs/file-chg.c b/libtrivfs/file-chg.c
index a7df7e1d..3af71b33 100644
--- a/libtrivfs/file-chg.c
+++ b/libtrivfs/file-chg.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_notice_changes (struct trivfs_protid *cred,
diff --git a/libtrivfs/file-chmod.c b/libtrivfs/file-chmod.c
index f4a8cdb3..f42a43c7 100644
--- a/libtrivfs/file-chmod.c
+++ b/libtrivfs/file-chmod.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_chmod (struct trivfs_protid *cred,
diff --git a/libtrivfs/file-chown.c b/libtrivfs/file-chown.c
index 4eb664c5..44f79203 100644
--- a/libtrivfs/file-chown.c
+++ b/libtrivfs/file-chown.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_chown (struct trivfs_protid *cred,
@@ -25,6 +24,3 @@ trivfs_S_file_chown (struct trivfs_protid *cred,
{
return cred ? file_chown (cred->realnode, uid, gid) : EOPNOTSUPP;
}
-
-
-
diff --git a/libtrivfs/file-exec.c b/libtrivfs/file-exec.c
index d39af5fd..a3ab048d 100644
--- a/libtrivfs/file-exec.c
+++ b/libtrivfs/file-exec.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -19,6 +19,8 @@
kern_return_t
trivfs_S_file_exec (trivfs_protid_t exec_file,
+ mach_port_t reply,
+ mach_msg_type_name_t replyPoly,
mach_port_t exec_task,
int flags,
data_t argv,
@@ -38,6 +40,3 @@ trivfs_S_file_exec (trivfs_protid_t exec_file,
{
return EOPNOTSUPP;
}
-
-
-
diff --git a/libtrivfs/file-get-fs-options.c b/libtrivfs/file-get-fs-options.c
index de887ca5..2e06c2d9 100644
--- a/libtrivfs/file-get-fs-options.c
+++ b/libtrivfs/file-get-fs-options.c
@@ -1,6 +1,6 @@
/* Get runtime options given a file handle
- Copyright (C) 1996 Free Software Foundation
+ Copyright (C) 1996,98,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -9,7 +9,7 @@
the Free Software Foundation; either version 2, or (at your option)
any later version.
- The GNU Hurd is distributed in the hope that it will be useful,
+ The GNU Hurd 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.
@@ -18,10 +18,10 @@
along with the GNU Hurd; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+#include <argz.h>
#include <hurd/fshelp.h>
#include "priv.h"
-#include "fsys_S.h"
error_t
trivfs_S_file_get_fs_options (struct trivfs_protid *cred,
@@ -30,16 +30,22 @@ trivfs_S_file_get_fs_options (struct trivfs_protid *cred,
char **data, mach_msg_type_number_t *len)
{
error_t err;
- char *argz;
- size_t argz_len;
+ char *argz = 0;
+ size_t argz_len = 0;
if (! cred)
return EOPNOTSUPP;
- err = trivfs_get_options (cred->po->cntl, &argz, &argz_len);
+ err = argz_add (&argz, &argz_len, program_invocation_name);
+ if (err)
+ return err;
+
+ err = trivfs_append_args (cred->po->cntl, &argz, &argz_len);
if (! err)
/* Put ARGZ into vm_alloced memory for the return trip. */
- err = fshelp_return_malloced_buffer (argz, argz_len, data, len);
+ err = iohelp_return_malloced_buffer (argz, argz_len, data, len);
+ else
+ free (argz);
return err;
}
diff --git a/libtrivfs/file-get-storage-info.c b/libtrivfs/file-get-storage-info.c
index 7e4073ad..58bdbc5c 100644
--- a/libtrivfs/file-get-storage-info.c
+++ b/libtrivfs/file-get-storage-info.c
@@ -1,5 +1,5 @@
/* Stub for the file_get_storage_info RPC as described in <hurd/fs.defs>.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
error_t
trivfs_S_file_get_storage_info (struct trivfs_protid *cred,
diff --git a/libtrivfs/file-get-trans.c b/libtrivfs/file-get-trans.c
index 15f5a003..687dc8cc 100644
--- a/libtrivfs/file-get-trans.c
+++ b/libtrivfs/file-get-trans.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,12 +16,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_get_translator (struct trivfs_protid *cred,
- mach_port_t reply, mach_msg_type_name_t reply_type,
- char **trans, u_int *translen)
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
+ char **trans, size_t *translen)
{
return EOPNOTSUPP;
}
diff --git a/libtrivfs/file-get-transcntl.c b/libtrivfs/file-get-transcntl.c
index 0367fff2..8af08fc8 100644
--- a/libtrivfs/file-get-transcntl.c
+++ b/libtrivfs/file-get-transcntl.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_get_translator_cntl (struct trivfs_protid *cred,
diff --git a/libtrivfs/file-getcontrol.c b/libtrivfs/file-getcontrol.c
index c75472ab..2a58016e 100644
--- a/libtrivfs/file-getcontrol.c
+++ b/libtrivfs/file-getcontrol.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_getcontrol (struct trivfs_protid *cred,
@@ -27,7 +26,7 @@ trivfs_S_file_getcontrol (struct trivfs_protid *cred,
return EOPNOTSUPP;
if (!cred->isroot)
return EPERM;
-
+
*cntl = ports_get_right (cred->po->cntl);
*cntltype = MACH_MSG_TYPE_MAKE_SEND;
return 0;
diff --git a/libtrivfs/file-getfh.c b/libtrivfs/file-getfh.c
index eeb9e3d1..35deb7d5 100644
--- a/libtrivfs/file-getfh.c
+++ b/libtrivfs/file-getfh.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,12 +16,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
-trivfs_S_file_getfh (struct trivfs_protid *cred,
+trivfs_S_file_getfh (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
- char **data, u_int *datalen)
+ char **data, size_t *datalen)
{
return EOPNOTSUPP;
}
diff --git a/libtrivfs/file-getlinknode.c b/libtrivfs/file-getlinknode.c
index 56ac3dff..078e5deb 100644
--- a/libtrivfs/file-getlinknode.c
+++ b/libtrivfs/file-getlinknode.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_getlinknode (struct trivfs_protid *cred,
diff --git a/libtrivfs/file-lock.c b/libtrivfs/file-lock.c
index 10d39736..993baff6 100644
--- a/libtrivfs/file-lock.c
+++ b/libtrivfs/file-lock.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_lock (struct trivfs_protid *cred,
@@ -33,4 +32,3 @@ trivfs_S_file_lock_stat (struct trivfs_protid *cred,
{
return EOPNOTSUPP;
}
-
diff --git a/libtrivfs/file-reparent.c b/libtrivfs/file-reparent.c
new file mode 100644
index 00000000..0682a912
--- /dev/null
+++ b/libtrivfs/file-reparent.c
@@ -0,0 +1,34 @@
+/* Reparent a directory
+
+ Copyright (C) 1997,2002,2010 Free Software Foundation, Inc.
+
+ This file is part of the GNU Hurd.
+
+ The GNU Hurd 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.
+
+ The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to
+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "priv.h"
+
+error_t
+trivfs_S_file_reparent (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ mach_port_t parent,
+ mach_port_t *new, mach_msg_type_name_t *new_type)
+{
+ /* This is not a directory, so we just duplicate it */
+ error_t ret = trivfs_S_io_duplicate (cred, reply, reply_type, new, new_type);
+ if (!ret)
+ mach_port_deallocate (mach_task_self (), parent);
+ return ret;
+}
diff --git a/libtrivfs/file-set-size.c b/libtrivfs/file-set-size.c
index eb174e46..287ed996 100644
--- a/libtrivfs/file-set-size.c
+++ b/libtrivfs/file-set-size.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
#include <assert.h>
kern_return_t
diff --git a/libtrivfs/file-set-trans.c b/libtrivfs/file-set-trans.c
index 36e9bd21..339bdb22 100644
--- a/libtrivfs/file-set-trans.c
+++ b/libtrivfs/file-set-trans.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,16 +16,16 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_set_translator (struct trivfs_protid *cred,
- mach_port_t reply, mach_msg_type_name_t reply_type,
+ mach_port_t reply,
+ mach_msg_type_name_t reply_type,
int actflags,
int passflags,
int oldtransflags,
char *trans,
- u_int translen,
+ size_t translen,
mach_port_t existing)
{
return EOPNOTSUPP;
diff --git a/libtrivfs/file-statfs.c b/libtrivfs/file-statfs.c
index 8b306623..648eef64 100644
--- a/libtrivfs/file-statfs.c
+++ b/libtrivfs/file-statfs.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1996 Free Software Foundation
+/*
+ Copyright (C) 1994,96,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
#include <string.h>
#include <unistd.h>
@@ -33,4 +32,4 @@ trivfs_S_file_statfs (struct trivfs_protid *cred,
stb->f_fsid = trivfs_fsid;
return 0;
-}
+}
diff --git a/libtrivfs/file-sync.c b/libtrivfs/file-sync.c
index 54076f67..cb0add3d 100644
--- a/libtrivfs/file-sync.c
+++ b/libtrivfs/file-sync.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1996 Free Software Foundation
+/*
+ Copyright (C) 1994,96,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_sync (struct trivfs_protid *cred,
diff --git a/libtrivfs/file-syncfs.c b/libtrivfs/file-syncfs.c
index 1f74e395..d356296e 100644
--- a/libtrivfs/file-syncfs.c
+++ b/libtrivfs/file-syncfs.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1996 Free Software Foundation
+/*
+ Copyright (C) 1994,96,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_syncfs (struct trivfs_protid *cred,
diff --git a/libtrivfs/file-utimes.c b/libtrivfs/file-utimes.c
index 916a8d8a..f9bedd7b 100644
--- a/libtrivfs/file-utimes.c
+++ b/libtrivfs/file-utimes.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fs_S.h"
kern_return_t
trivfs_S_file_utimes (struct trivfs_protid *cred,
diff --git a/libtrivfs/fsmutations.h b/libtrivfs/fsmutations.h
index cb716c8d..d81e5a87 100644
--- a/libtrivfs/fsmutations.h
+++ b/libtrivfs/fsmutations.h
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1995 Free Software Foundation
+/*
+ Copyright (C) 1994,95,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -28,6 +28,6 @@
#define FSYS_INTRAN trivfs_control_t trivfs_begin_using_control (fsys_t)
#define FSYS_DESTRUCTOR trivfs_end_using_control (trivfs_control_t)
-#define FILE_IMPORTS import "priv.h";
-#define IO_IMPORTS import "priv.h";
-#define FSYS_IMPORTS import "priv.h";
+#define FILE_IMPORTS import <hurd/trivfs.h>;
+#define IO_IMPORTS import <hurd/trivfs.h>;
+#define FSYS_IMPORTS import <hurd/trivfs.h>;
diff --git a/libtrivfs/fsys-forward.c b/libtrivfs/fsys-forward.c
index b7127a24..106360ea 100644
--- a/libtrivfs/fsys-forward.c
+++ b/libtrivfs/fsys-forward.c
@@ -1,8 +1,8 @@
/* fsys_forward
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995,2002 Free Software Foundation, Inc.
- Written by Miles Bader <miles@gnu.ai.mit.edu>
+ Written by Miles Bader <miles@gnu.org>
This file is part of the GNU Hurd.
@@ -11,7 +11,7 @@
the Free Software Foundation; either version 2, or (at your option)
any later version.
- The GNU Hurd is distributed in the hope that it will be useful,
+ The GNU Hurd 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.
@@ -21,7 +21,6 @@
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fsys_S.h"
/* Ask SERVER to provide fsys translation service for us. REQUESTOR is
the bootstrap port supplied to the original translator, and ARGV are
diff --git a/libtrivfs/fsys-get-options.c b/libtrivfs/fsys-get-options.c
index aa3b3374..4f2d602b 100644
--- a/libtrivfs/fsys-get-options.c
+++ b/libtrivfs/fsys-get-options.c
@@ -1,6 +1,6 @@
/* Get runtime options
- Copyright (C) 1996 Free Software Foundation
+ Copyright (C) 1996,98,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -9,7 +9,7 @@
the Free Software Foundation; either version 2, or (at your option)
any later version.
- The GNU Hurd is distributed in the hope that it will be useful,
+ The GNU Hurd 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.
@@ -18,10 +18,10 @@
along with the GNU Hurd; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+#include <argz.h>
#include <hurd/fshelp.h>
#include "priv.h"
-#include "fsys_S.h"
error_t
trivfs_S_fsys_get_options (struct trivfs_control *fsys,
@@ -29,16 +29,22 @@ trivfs_S_fsys_get_options (struct trivfs_control *fsys,
char **data, mach_msg_type_number_t *len)
{
error_t err;
- char *argz;
- size_t argz_len;
+ char *argz = 0;
+ size_t argz_len = 0;
if (! fsys)
return EOPNOTSUPP;
- err = trivfs_get_options (fsys, &argz, &argz_len);
+ err = argz_add (&argz, &argz_len, program_invocation_name);
+ if (err)
+ return err;
+
+ err = trivfs_append_args (fsys, &argz, &argz_len);
if (! err)
/* Put ARGZ into vm_alloced memory for the return trip. */
- err = fshelp_return_malloced_buffer (argz, argz_len, data, len);
+ err = iohelp_return_malloced_buffer (argz, argz_len, data, len);
+ else
+ free (argz);
return err;
}
diff --git a/libtrivfs/fsys-getroot.c b/libtrivfs/fsys-getroot.c
index 9eca01f5..60528d72 100644
--- a/libtrivfs/fsys-getroot.c
+++ b/libtrivfs/fsys-getroot.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994, 1995 Free Software Foundation
+ Copyright (C) 1993,94,95,97,99,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "fsys_S.h"
#include "fsys_reply_U.h"
#include <assert.h>
#include <fcntl.h>
@@ -31,8 +30,8 @@ trivfs_S_fsys_getroot (struct trivfs_control *cntl,
mach_port_t reply_port,
mach_msg_type_name_t reply_port_type,
mach_port_t dotdot,
- uid_t *uids, u_int nuids,
- uid_t *gids, u_int ngids,
+ uid_t *uids, size_t nuids,
+ uid_t *gids, size_t ngids,
int flags,
retry_type *do_retry,
char *retry_name,
@@ -43,16 +42,28 @@ trivfs_S_fsys_getroot (struct trivfs_control *cntl,
error_t err = 0;
mach_port_t new_realnode;
struct trivfs_protid *cred;
+ struct iouser *user;
if (!cntl)
return EOPNOTSUPP;
+ if (trivfs_getroot_hook)
+ {
+ err = (*trivfs_getroot_hook) (cntl, reply_port, reply_port_type, dotdot,
+ uids, nuids, gids, ngids, flags,
+ do_retry, retry_name, newpt, newpttype);
+ if (err != EAGAIN)
+ return err;
+ }
+
+ if ((flags & O_WRITE & trivfs_allow_open) != (flags & O_WRITE))
+ return EROFS;
if ((flags & (O_READ|O_WRITE|O_EXEC) & trivfs_allow_open)
!= (flags & (O_READ|O_WRITE|O_EXEC)))
- return EOPNOTSUPP;
+ return EACCES;
/* O_CREAT and O_EXCL are not meaningful here; O_NOLINK and O_NOTRANS
- will only be useful when trivfs supports translators (which it doesn't
+ will only be useful when trivfs supports translators (which it doesn't
now). */
flags &= O_HURD;
flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS);
@@ -62,27 +73,46 @@ trivfs_S_fsys_getroot (struct trivfs_control *cntl,
if (err)
return err;
- file_check_access (new_realnode, &perms);
+ err = iohelp_create_complex_iouser (&user, uids, nuids, gids, ngids);
+ if (err)
+ return err;
+
+ /* Validate permissions. */
+ if (! trivfs_check_access_hook)
+ file_check_access (new_realnode, &perms);
+ else
+ (*trivfs_check_access_hook) (cntl, user, new_realnode, &perms);
if ((flags & (O_READ|O_WRITE|O_EXEC) & perms)
!= (flags & (O_READ|O_WRITE|O_EXEC)))
err = EACCES;
if (!err && trivfs_check_open_hook)
- err = (*trivfs_check_open_hook) (cntl, uids, nuids, gids, ngids, flags);
+ err = (*trivfs_check_open_hook) (cntl, user, flags);
if (!err)
- err = trivfs_open (cntl, uids, nuids, gids, ngids, flags, new_realnode,
- &cred);
- if (err)
- mach_port_deallocate (mach_task_self (), new_realnode);
+ {
+ if (! trivfs_open_hook)
+ {
+ err = trivfs_open (cntl, user, flags, new_realnode, &cred);
+ if (!err)
+ mach_port_deallocate (mach_task_self (), dotdot);
+ }
+ else
+ err = (*trivfs_open_hook) (cntl, user, dotdot, flags, new_realnode,
+ &cred);
+ }
- if (!err)
+ if (err)
+ {
+ mach_port_deallocate (mach_task_self (), new_realnode);
+ iohelp_free_iouser (user);
+ }
+ else
{
*do_retry = FS_RETRY_NORMAL;
*retry_name = '\0';
*newpt = ports_get_right (cred);
*newpttype = MACH_MSG_TYPE_MAKE_SEND;
ports_port_deref (cred);
- mach_port_deallocate (mach_task_self (), dotdot);
}
return err;
diff --git a/libtrivfs/fsys-goaway.c b/libtrivfs/fsys-goaway.c
index 747e9f0e..1ad119b7 100644
--- a/libtrivfs/fsys-goaway.c
+++ b/libtrivfs/fsys-goaway.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995 Free Software Foundation
+ Copyright (C) 1994,95,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "fsys_S.h"
kern_return_t
trivfs_S_fsys_goaway (struct trivfs_control *cred,
diff --git a/libtrivfs/fsys-set-options.c b/libtrivfs/fsys-set-options.c
index 507bd442..43890df7 100644
--- a/libtrivfs/fsys-set-options.c
+++ b/libtrivfs/fsys-set-options.c
@@ -1,6 +1,6 @@
/* Set runtime options
- Copyright (C) 1996 Free Software Foundation
+ Copyright (C) 1996,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -9,7 +9,7 @@
the Free Software Foundation; either version 2, or (at your option)
any later version.
- The GNU Hurd is distributed in the hope that it will be useful,
+ The GNU Hurd 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.
@@ -21,7 +21,6 @@
#include <hurd/fshelp.h>
#include "priv.h"
-#include "fsys_S.h"
error_t
trivfs_S_fsys_set_options (struct trivfs_control *cntl,
diff --git a/libtrivfs/fsys-stubs.c b/libtrivfs/fsys-stubs.c
index 4457b231..28990759 100644
--- a/libtrivfs/fsys-stubs.c
+++ b/libtrivfs/fsys-stubs.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
+ Copyright (C) 1994,95,96,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "fsys_S.h"
kern_return_t
trivfs_S_fsys_startup (mach_port_t bootport,
@@ -29,7 +28,7 @@ trivfs_S_fsys_startup (mach_port_t bootport,
int flags,
mach_port_t cntl,
mach_port_t *realnode,
- mach_port_t *realnodetype)
+ mach_msg_type_name_t *realnodetype)
{
return EOPNOTSUPP;
}
@@ -60,11 +59,11 @@ trivfs_S_fsys_getfile (struct trivfs_control *cntl,
mach_port_t reply,
mach_msg_type_name_t replytype,
uid_t *genuids,
- u_int ngenuids,
+ size_t ngenuids,
uid_t *gengids,
- u_int ngengids,
+ size_t ngengids,
char *handle,
- u_int handlesize,
+ size_t handlesize,
mach_port_t *file,
mach_msg_type_name_t *filetype)
{
diff --git a/libtrivfs/fsys-syncfs.c b/libtrivfs/fsys-syncfs.c
index 6059adfd..e94fda38 100644
--- a/libtrivfs/fsys-syncfs.c
+++ b/libtrivfs/fsys-syncfs.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+/*
+ Copyright (C) 1994,96,2002 Free Software Foundation, Inc.
Written by Michael I. Bushnell.
This file is part of the GNU Hurd.
@@ -19,7 +19,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "fsys_S.h"
kern_return_t
trivfs_S_fsys_syncfs (struct trivfs_control *cntl,
diff --git a/libtrivfs/handle-port.c b/libtrivfs/handle-port.c
deleted file mode 100644
index 9568b88a..00000000
--- a/libtrivfs/handle-port.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
-
- 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 "priv.h"
-
-/* Backwards compatibility. Use trivfs_create_control. */
-mach_port_t
-trivfs_handle_port (mach_port_t realnode,
- struct port_class *control_class,
- struct port_bucket *control_bucket,
- struct port_class *protid_class,
- struct port_bucket *protid_bucket)
-{
- mach_port_t right;
- struct trivfs_control *control;
- error_t err =
- trivfs_create_control (realnode,
- control_class, control_bucket,
- protid_class, protid_bucket,
- &control);
-
- if (err)
- return MACH_PORT_NULL;
-
- right = ports_get_right (control);
- ports_port_deref (control);
-
- return right;
-}
-
-#if 0
-#include "linkwarn.h"
-obslete (trivfs_handle_port, trivfs_create_control)
-#endif
diff --git a/libtrivfs/interrupt.c b/libtrivfs/interrupt.c
deleted file mode 100644
index 3b3bd211..00000000
--- a/libtrivfs/interrupt.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Copyright (C) 1993, 1994 Free Software Foundation
-
-This file is part of the GNU Hurd.
-
-The GNU Hurd 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.
-
-The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Written by Michael I. Bushnell. */
-
-#include "priv.h"
-#include "interrupt_S.h"
-
-error_t
-trivfs_S_interrupt_operation (mach_port_t port)
-{
- struct port_info *pi = ports_lookup_port (0, port, 0);
- if (!pi)
- return EOPNOTSUPP;
- ports_interrupt_rpc (pi);
- ports_port_deref (pi);
- return 0;
-}
diff --git a/libtrivfs/io-async-icky.c b/libtrivfs/io-async-icky.c
index 0f0b99ea..bd9c5490 100644
--- a/libtrivfs/io-async-icky.c
+++ b/libtrivfs/io-async-icky.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,99,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
@@ -30,6 +29,5 @@ trivfs_S_io_get_icky_async_id (struct trivfs_protid *cred,
mach_port_t *id,
mach_msg_type_name_t *idtype)
{
- assert (!trivfs_support_read && !trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-async.c b/libtrivfs/io-async.c
index 0a2646a3..b02f57f6 100644
--- a/libtrivfs/io-async.c
+++ b/libtrivfs/io-async.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,99,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
@@ -31,6 +30,5 @@ trivfs_S_io_async (struct trivfs_protid *cred,
mach_port_t *id,
mach_msg_type_name_t *idtype)
{
- assert (!trivfs_support_read && !trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-duplicate.c b/libtrivfs/io-duplicate.c
index 4b20bb99..c1b7798d 100644
--- a/libtrivfs/io-duplicate.c
+++ b/libtrivfs/io-duplicate.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994, 1995 Free Software Foundation
+ Copyright (C) 1993,94,95,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <string.h>
kern_return_t
@@ -32,10 +31,10 @@ trivfs_S_io_duplicate (struct trivfs_protid *cred,
{
error_t err;
struct trivfs_protid *newcred;
-
+
if (!cred)
return EOPNOTSUPP;
-
+
err = trivfs_protid_dup (cred, &newcred);
if (!err)
{
@@ -46,4 +45,3 @@ trivfs_S_io_duplicate (struct trivfs_protid *cred,
return err;
}
-
diff --git a/libtrivfs/io-identity.c b/libtrivfs/io-identity.c
index 1232dcb4..44f60d38 100644
--- a/libtrivfs/io-identity.c
+++ b/libtrivfs/io-identity.c
@@ -1,5 +1,5 @@
-/* Fetching identity port
- Copyright (C) 1996 Free Software Foundation, Inc.
+/* Fetching identity port
+ Copyright (C) 1996,2002 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -19,7 +19,6 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "priv.h"
-#include "io_S.h"
error_t
trivfs_S_io_identity (struct trivfs_protid *cred,
@@ -29,14 +28,14 @@ trivfs_S_io_identity (struct trivfs_protid *cred,
mach_msg_type_name_t *idport_type,
mach_port_t *fsidport,
mach_msg_type_name_t *fsidport_type,
- int *fileno)
+ ino_t *fileno)
{
error_t err;
struct stat st;
-
+
if (!cred)
return EOPNOTSUPP;
-
+
err = io_stat (cred->realnode, &st);
if (err)
return err;
diff --git a/libtrivfs/io-map.c b/libtrivfs/io-map.c
index f94bf8a5..2959efba 100644
--- a/libtrivfs/io-map.c
+++ b/libtrivfs/io-map.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,2002 Free Software Foundation
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
@@ -32,6 +31,5 @@ trivfs_S_io_map (struct trivfs_protid *cred,
mach_port_t *wrobj,
mach_msg_type_name_t *wrtype)
{
- assert (!trivfs_support_read && !trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-modes-get.c b/libtrivfs/io-modes-get.c
index 025ed782..4d38d3a6 100644
--- a/libtrivfs/io-modes-get.c
+++ b/libtrivfs/io-modes-get.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,99,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
@@ -29,7 +28,6 @@ trivfs_S_io_get_openmodes (struct trivfs_protid *cred,
mach_msg_type_name_t replytype,
int *bits)
{
- assert (!trivfs_support_read && !trivfs_support_write);
if (!cred)
return EOPNOTSUPP;
else
@@ -38,5 +36,3 @@ trivfs_S_io_get_openmodes (struct trivfs_protid *cred,
return 0;
}
}
-
-
diff --git a/libtrivfs/io-modes-off.c b/libtrivfs/io-modes-off.c
index c78791e9..33b0a573 100644
--- a/libtrivfs/io-modes-off.c
+++ b/libtrivfs/io-modes-off.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
diff --git a/libtrivfs/io-modes-on.c b/libtrivfs/io-modes-on.c
index 8ca82bcf..7886dc50 100644
--- a/libtrivfs/io-modes-on.c
+++ b/libtrivfs/io-modes-on.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
diff --git a/libtrivfs/io-owner-get.c b/libtrivfs/io-owner-get.c
index d91cd4cc..f6c261c7 100644
--- a/libtrivfs/io-owner-get.c
+++ b/libtrivfs/io-owner-get.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
@@ -29,6 +28,5 @@ trivfs_S_io_get_owner (struct trivfs_protid *cred,
mach_msg_type_name_t replytype,
pid_t *owner)
{
- assert (!trivfs_support_read && !trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-owner-mod.c b/libtrivfs/io-owner-mod.c
index e499776e..4e96a245 100644
--- a/libtrivfs/io-owner-mod.c
+++ b/libtrivfs/io-owner-mod.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
@@ -29,6 +28,5 @@ trivfs_S_io_mod_owner (struct trivfs_protid *cred,
mach_msg_type_name_t replytype,
pid_t owner)
{
- assert (!trivfs_support_read && !trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-pathconf.c b/libtrivfs/io-pathconf.c
index 658e249c..51d4e094 100644
--- a/libtrivfs/io-pathconf.c
+++ b/libtrivfs/io-pathconf.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,96,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "io_S.h"
kern_return_t
trivfs_S_io_pathconf (struct trivfs_protid *cred,
@@ -24,10 +23,7 @@ trivfs_S_io_pathconf (struct trivfs_protid *cred,
int name, int *val)
{
if (cred)
- {
- *val = 0;
- return 0;
- }
+ return io_pathconf (cred->realnode, name, val);
else
return EOPNOTSUPP;
}
diff --git a/libtrivfs/io-read.c b/libtrivfs/io-read.c
index 24f3642a..dcba818b 100644
--- a/libtrivfs/io-read.c
+++ b/libtrivfs/io-read.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
@@ -30,4 +29,4 @@ trivfs_S_io_read (struct trivfs_protid *cred,
{
assert (!trivfs_support_read);
return EOPNOTSUPP;
-}
+}
diff --git a/libtrivfs/io-readable.c b/libtrivfs/io-readable.c
index 975ab44b..792bd1a7 100644
--- a/libtrivfs/io-readable.c
+++ b/libtrivfs/io-readable.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
diff --git a/libtrivfs/io-reauthenticate.c b/libtrivfs/io-reauthenticate.c
index e199642b..80ef31c1 100644
--- a/libtrivfs/io-reauthenticate.c
+++ b/libtrivfs/io-reauthenticate.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation
+ Copyright (C) 1993,94,95,96,2000,01,02 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
#include <string.h>
@@ -31,85 +30,49 @@ trivfs_S_io_reauthenticate (struct trivfs_protid *cred,
mach_port_t rendport)
{
struct trivfs_protid *newcred;
- uid_t gubuf[20], ggbuf[20], aubuf[20], agbuf[20];
- uid_t *gen_uids, *gen_gids, *aux_uids, *aux_gids;
- u_int genuidlen, gengidlen, auxuidlen, auxgidlen;
error_t err;
- int i;
auth_t auth;
mach_port_t newright;
if (cred == 0)
return EOPNOTSUPP;
- genuidlen = gengidlen = auxuidlen = auxgidlen = 20;
- gen_uids = gubuf;
- gen_gids = ggbuf;
- aux_uids = aubuf;
- aux_gids = agbuf;
-
do
err = ports_create_port_noinstall (cred->po->cntl->protid_class,
cred->po->cntl->protid_bucket,
- sizeof (struct trivfs_protid),
+ sizeof (struct trivfs_protid),
&newcred);
while (err == EINTR);
if (err)
return err;
auth = getauth ();
- newright = ports_get_right (newcred);
- err = mach_port_insert_right (mach_task_self (), newright, newright,
- MACH_MSG_TYPE_MAKE_SEND);
- assert_perror (err);
- do
- err = auth_server_authenticate (auth,
- rendport,
- MACH_MSG_TYPE_COPY_SEND,
- newright,
- MACH_MSG_TYPE_COPY_SEND,
- &gen_uids, &genuidlen,
- &aux_uids, &auxuidlen,
- &gen_gids, &gengidlen,
- &aux_gids, &auxgidlen);
- while (err == EINTR);
+ newright = ports_get_send_right (newcred);
+ assert (newright != MACH_PORT_NULL);
+
+ err = iohelp_reauth (&newcred->user, auth, rendport, newright, 1);
mach_port_deallocate (mach_task_self (), rendport);
- mach_port_deallocate (mach_task_self (), newright);
mach_port_deallocate (mach_task_self (), auth);
-
if (err)
- {
- newcred->isroot = 0;
- newcred->uids = malloc (1);
- newcred->gids = malloc (1);
- newcred->nuids = 0;
- newcred->ngids = 0;
- }
- else
- {
- newcred->isroot = 0;
- for (i = 0; i < genuidlen; i++)
- if (gen_uids[i] == 0)
- newcred->isroot = 1;
-
- newcred->uids = malloc (genuidlen * sizeof (uid_t));
- newcred->gids = malloc (gengidlen * sizeof (uid_t));
- bcopy (gen_uids, newcred->uids, genuidlen * sizeof (uid_t));
- bcopy (gen_gids, newcred->gids, gengidlen * sizeof (uid_t));
- newcred->nuids = genuidlen;
- newcred->ngids = gengidlen;
- }
-
+ return err;
+
+ mach_port_deallocate (mach_task_self (), newright);
+ if (idvec_contains (newcred->user->uids, 0))
+ newcred->isroot = 1;
+
newcred->hook = cred->hook;
-
+
mutex_lock (&cred->po->cntl->lock);
newcred->po = cred->po;
newcred->po->refcnt++;
mutex_unlock (&cred->po->cntl->lock);
-
+
do
err = io_restrict_auth (newcred->po->cntl->underlying, &newcred->realnode,
- gen_uids, genuidlen, gen_gids, gengidlen);
+ newcred->user->uids->ids,
+ newcred->user->uids->num,
+ newcred->user->gids->ids,
+ newcred->user->gids->num);
while (err == EINTR);
if (!err && trivfs_protid_create_hook)
{
@@ -127,19 +90,6 @@ trivfs_S_io_reauthenticate (struct trivfs_protid *cred,
mach_port_move_member (mach_task_self (), newcred->pi.port_right,
cred->po->cntl->protid_bucket->portset);
- if (gubuf != gen_uids)
- vm_deallocate (mach_task_self (), (u_int) gen_uids,
- genuidlen * sizeof (uid_t));
- if (ggbuf != gen_gids)
- vm_deallocate (mach_task_self (), (u_int) gen_gids,
- gengidlen * sizeof (uid_t));
- if (aubuf != aux_uids)
- vm_deallocate (mach_task_self (), (u_int) aux_uids,
- auxuidlen * sizeof (uid_t));
- if (agbuf != aux_gids)
- vm_deallocate (mach_task_self (), (u_int) aux_gids,
- auxgidlen * sizeof (uid_t));
-
ports_port_deref (newcred);
return err;
diff --git a/libtrivfs/io-restrict-auth.c b/libtrivfs/io-restrict-auth.c
index ac915896..98a80a13 100644
--- a/libtrivfs/io-restrict-auth.c
+++ b/libtrivfs/io-restrict-auth.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994, 1995 Free Software Foundation
+ Copyright (C) 1993,94,95,96,2001,02 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <string.h>
/* Tell if the array LIST (of size N) contains a member equal to QUERY. */
@@ -40,55 +39,88 @@ trivfs_S_io_restrict_auth (struct trivfs_protid *cred,
mach_msg_type_name_t replytype,
mach_port_t *newport,
mach_msg_type_name_t *newporttype,
- uid_t *uids, u_int nuids,
- uid_t *gids, u_int ngids)
+ uid_t *uids, size_t nuids,
+ uid_t *gids, size_t ngids)
{
int i;
- error_t err = 0;
+ error_t err;
struct trivfs_protid *newcred;
- uid_t *newuids, *newgids;
- int newnuids, newngids;
-
+ struct idvec *uvec, *gvec;
+ struct iouser *user;
+
if (!cred)
return EOPNOTSUPP;
-
- newuids = alloca (sizeof (uid_t) * cred->nuids);
- newgids = alloca (sizeof (uid_t) * cred->ngids);
- for (i = newnuids = 0; i < cred->nuids; i++)
- if (listmember (uids, cred->uids[i], nuids))
- newuids[newnuids++] = cred->uids[i];
- for (i = newngids = 0; i < cred->gids[i]; i++)
- if (listmember (gids, cred->gids[i], ngids))
- newgids[newngids++] = cred->gids[i];
+
+ if (cred->isroot)
+ /* CRED has root access, and so may use any ids. */
+ {
+ err = iohelp_create_complex_iouser (&user, uids, nuids, gids, ngids);
+ if (err)
+ return err;
+ }
+ else
+ {
+ uvec = make_idvec ();
+ if (! uvec)
+ return ENOMEM;
+
+ gvec = make_idvec ();
+ if (! gvec)
+ {
+ idvec_free (uvec);
+ return ENOMEM;
+ }
+
+ /* Otherwise, use any of the requested ids that CRED already has. */
+ for (i = 0; i < cred->user->uids->num; i++)
+ if (listmember (uids, cred->user->uids->ids[i], nuids))
+ {
+ err = idvec_add (uvec, cred->user->uids->ids[i]);
+ if (err)
+ goto out;
+ }
+
+ for (i = 0; i < cred->user->gids->num; i++)
+ if (listmember (gids, cred->user->gids->ids[i], ngids))
+ {
+ err = idvec_add (gvec, cred->user->gids->ids[i]);
+ if (err)
+ goto out;
+ }
+
+ err = iohelp_create_iouser (&user, uvec, gvec);
+ if (err)
+ {
+ out:
+ idvec_free (uvec);
+ idvec_free (gvec);
+ return err;
+ }
+ }
err = ports_create_port (cred->po->cntl->protid_class,
cred->po->cntl->protid_bucket,
- sizeof (struct trivfs_protid),
+ sizeof (struct trivfs_protid),
&newcred);
if (err)
- return err;
+ {
+ iohelp_free_iouser (user);
+ return err;
+ }
newcred->isroot = 0;
mutex_lock (&cred->po->cntl->lock);
newcred->po = cred->po;
newcred->po->refcnt++;
mutex_unlock (&cred->po->cntl->lock);
- if (cred->isroot)
- {
- for (i = 0; i < nuids; i++)
- if (uids[i] == 0)
- newcred->isroot = 1;
- }
- newcred->gids = malloc (newngids * sizeof (uid_t));
- newcred->uids = malloc (newnuids * sizeof (uid_t));
- bcopy (newuids, newcred->uids, newnuids * sizeof (uid_t));
- bcopy (newgids, newcred->gids, newngids * sizeof (uid_t));
- newcred->ngids = newngids;
- newcred->nuids = newnuids;
+ if (cred->isroot && idvec_contains (user->uids, 0))
+ newcred->isroot = 1;
+ newcred->user = user;
newcred->hook = cred->hook;
- err = io_restrict_auth (cred->realnode, &newcred->realnode,
- newuids, newnuids, newgids, newngids);
+ err = io_restrict_auth (cred->realnode, &newcred->realnode,
+ user->uids->ids, user->uids->num,
+ user->gids->ids, user->gids->num);
if (!err && trivfs_protid_create_hook)
{
err = (*trivfs_protid_create_hook) (newcred);
diff --git a/libtrivfs/notify-stubs.c b/libtrivfs/io-revoke.c
index 448984a4..901de4c6 100644
--- a/libtrivfs/notify-stubs.c
+++ b/libtrivfs/io-revoke.c
@@ -1,5 +1,6 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1999,2002 Free Software Foundation, Inc.
+ Written by Thomas Bushnell, BSG.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,38 +17,16 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "notify_S.h"
+/* Implement io_revoke as described in <hurd/io.defs>. */
kern_return_t
-trivfs_do_mach_notify_port_deleted (mach_port_t notify,
- mach_port_t name)
+trivfs_S_io_revoke (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type)
{
- return 0;
-}
-
-kern_return_t
-trivfs_do_mach_notify_msg_accepted (mach_port_t notify,
- mach_port_t name)
-{
- return 0;
-}
+ /* Revoke of the underlying node is actually generally right,
+ because that will cause actual calls to fail. In any case,
+ we don't have the ability to check permissions ourselves
+ correctly. */
-kern_return_t
-trivfs_do_mach_notify_port_destroyed (mach_port_t notify,
- mach_port_t name)
-{
- return 0;
-}
-
-kern_return_t
-trivfs_do_mach_notify_send_once (mach_port_t notify)
-{
- return 0;
-}
-
-kern_return_t
-trivfs_do_mach_notify_dead_name (mach_port_t notify,
- mach_port_t name)
-{
- return 0;
+ return cred ? io_revoke (cred->realnode) : EOPNOTSUPP;
}
diff --git a/libtrivfs/io-seek.c b/libtrivfs/io-seek.c
index 8d810786..8e794cf1 100644
--- a/libtrivfs/io-seek.c
+++ b/libtrivfs/io-seek.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
diff --git a/libtrivfs/io-select.c b/libtrivfs/io-select.c
index 7788da6e..9df24d61 100644
--- a/libtrivfs/io-select.c
+++ b/libtrivfs/io-select.c
@@ -1,5 +1,5 @@
/* Stub io_select RPC for trivfs library.
- Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1993,94,95,96,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
kern_return_t
diff --git a/libtrivfs/io-stat.c b/libtrivfs/io-stat.c
index aba8540a..6e430a22 100644
--- a/libtrivfs/io-stat.c
+++ b/libtrivfs/io-stat.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,96,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
#include <unistd.h>
kern_return_t
@@ -37,15 +36,15 @@ trivfs_S_io_stat (struct trivfs_protid *cred,
if (!err)
{
- if (!trivfs_fsid)
+ if (! trivfs_fsid)
trivfs_fsid = getpid();
st->st_fstype = trivfs_fstype;
st->st_fsid = trivfs_fsid;
+ st->st_mode = (st->st_mode & ~S_IFMT & ~S_ITRANS) | S_IFCHR | S_IROOT;
trivfs_modify_stat (cred, st);
}
return err;
}
-
diff --git a/libtrivfs/io-stubs.c b/libtrivfs/io-stubs.c
index 2c4f7330..a8cf3f57 100644
--- a/libtrivfs/io-stubs.c
+++ b/libtrivfs/io-stubs.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993,94,2002 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -8,7 +8,7 @@ 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.
-The GNU Hurd is distributed in the hope that it will be useful,
+The GNU Hurd 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.
@@ -20,7 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
#include "priv.h"
-#include "io_S.h"
kern_return_t
trivfs_S_io_map_cntl (struct trivfs_protid *cred,
@@ -48,7 +47,7 @@ trivfs_S_io_release_conch (struct trivfs_protid *cred,
return EOPNOTSUPP;
}
-kern_return_t
+kern_return_t
trivfs_S_io_eofnotify (struct trivfs_protid *cred,
mach_port_t reply,
mach_msg_type_name_t replytype)
@@ -57,20 +56,20 @@ trivfs_S_io_eofnotify (struct trivfs_protid *cred,
}
kern_return_t
-trivfs_S_io_prenotify (struct trivfs_protid *cred,
+trivfs_S_io_prenotify (struct trivfs_protid *cred,
mach_port_t reply,
mach_msg_type_name_t replytype,
- vm_offset_t start,
+ vm_offset_t start,
vm_offset_t end)
{
return EOPNOTSUPP;
}
kern_return_t
-trivfs_S_io_postnotify (struct trivfs_protid *cred,
+trivfs_S_io_postnotify (struct trivfs_protid *cred,
mach_port_t reply,
mach_msg_type_name_t replytype,
- vm_offset_t start,
+ vm_offset_t start,
vm_offset_t end)
{
return EOPNOTSUPP;
diff --git a/libtrivfs/io-version.c b/libtrivfs/io-version.c
index 3df9a0d3..ff820db9 100644
--- a/libtrivfs/io-version.c
+++ b/libtrivfs/io-version.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -17,8 +17,8 @@
#include "priv.h"
-kern_return_t
-trivfs_S_io_server_version (mach_port_t obj,
+kern_return_t
+trivfs_S_io_server_version (trivfs_protid_t obj,
mach_port_t reply,
mach_msg_type_name_t replytype,
char *name,
diff --git a/libtrivfs/io-write.c b/libtrivfs/io-write.c
index 05b57fde..106031dd 100644
--- a/libtrivfs/io-write.c
+++ b/libtrivfs/io-write.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994,99,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,8 +16,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
-#include "io_S.h"
#include <assert.h>
+#include <fcntl.h>
kern_return_t
trivfs_S_io_write (struct trivfs_protid *cred,
@@ -28,6 +28,9 @@ trivfs_S_io_write (struct trivfs_protid *cred,
off_t off,
mach_msg_type_number_t *amt)
{
+ if (!(trivfs_allow_open & O_WRITE))
+ return EBADF;
+
assert (!trivfs_support_write);
return EOPNOTSUPP;
}
diff --git a/libtrivfs/migsupport.c b/libtrivfs/migsupport.c
index 14e28231..b2d98e16 100644
--- a/libtrivfs/migsupport.c
+++ b/libtrivfs/migsupport.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995 Free Software Foundation
+ Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -20,45 +20,67 @@
struct trivfs_protid *
trivfs_begin_using_protid (mach_port_t port)
{
- if (trivfs_protid_nportclasses > 1)
+ if (trivfs_protid_nportclasses + trivfs_num_dynamic_protid_port_classes > 1)
{
struct port_info *pi = ports_lookup_port (0, port, 0);
int i;
- for (i = 0; i < trivfs_protid_nportclasses; i++)
- if (pi->class == trivfs_protid_portclasses[i])
- return (struct trivfs_protid *) pi;
- ports_port_deref ((void *)port);
+
+ if (pi)
+ {
+ for (i = 0; i < trivfs_protid_nportclasses; i++)
+ if (pi->class == trivfs_protid_portclasses[i])
+ return (struct trivfs_protid *) pi;
+ for (i = 0; i < trivfs_num_dynamic_protid_port_classes; i++)
+ if (pi->class == trivfs_dynamic_protid_port_classes[i])
+ return (struct trivfs_protid *) pi;
+ ports_port_deref (pi);
+ }
+
return 0;
}
- else
+ else if (trivfs_protid_nportclasses == 1)
return ports_lookup_port (0, port, trivfs_protid_portclasses[0]);
+ else
+ return ports_lookup_port (0, port, trivfs_dynamic_protid_port_classes[0]);
}
void
trivfs_end_using_protid (struct trivfs_protid *cred)
{
- ports_port_deref (cred);
+ if (cred)
+ ports_port_deref (cred);
}
struct trivfs_control *
trivfs_begin_using_control (mach_port_t port)
{
- if (trivfs_cntl_nportclasses > 1)
+ if (trivfs_cntl_nportclasses + trivfs_num_dynamic_control_port_classes > 1)
{
struct port_info *pi = ports_lookup_port (0, port, 0);
int i;
- for (i = 0; i < trivfs_cntl_nportclasses; i++)
- if (pi->class == trivfs_cntl_portclasses[i])
- return (struct trivfs_control *) pi;
- ports_port_deref ((void *)port);
+
+ if (pi)
+ {
+ for (i = 0; i < trivfs_cntl_nportclasses; i++)
+ if (pi->class == trivfs_cntl_portclasses[i])
+ return (struct trivfs_control *) pi;
+ for (i = 0; i < trivfs_num_dynamic_control_port_classes; i++)
+ if (pi->class == trivfs_dynamic_control_port_classes[i])
+ return (struct trivfs_control *) pi;
+ ports_port_deref (pi);
+ }
+
return 0;
}
- else
+ else if (trivfs_cntl_nportclasses == 1)
return ports_lookup_port (0, port, trivfs_cntl_portclasses[0]);
+ else
+ return ports_lookup_port (0, port, trivfs_dynamic_control_port_classes[0]);
}
void
trivfs_end_using_control (struct trivfs_control *cred)
{
- ports_port_deref (cred);
+ if (cred)
+ ports_port_deref (cred);
}
diff --git a/libtrivfs/nosenders.c b/libtrivfs/nosenders.c
deleted file mode 100644
index 2b4abef6..00000000
--- a/libtrivfs/nosenders.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- Copyright (C) 1993, 1994, 1995 Free Software Foundation
-
-This file is part of the GNU Hurd.
-
-The GNU Hurd 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.
-
-The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Written by Michael I. Bushnell. */
-
-#include "priv.h"
-#include "notify_S.h"
-
-/* Called by the kernel when a port has no more senders. We arrange
- to have this sent to the port which is out of senders (NOTIFY). MSCOUNT
- is the make-send count of the port when the notification was generated. */
-kern_return_t
-trivfs_do_mach_notify_no_senders (mach_port_t notify,
- mach_port_mscount_t mscount)
-{
- struct port_info *pt;
-
- pt = ports_lookup_port (0, notify, 0);
- if (!pt)
- return EOPNOTSUPP;
-
- ports_no_senders (pt, mscount);
-
- ports_port_deref (pt);
-
- return 0;
-}
diff --git a/libtrivfs/open.c b/libtrivfs/open.c
index 4303ca74..f64d2ffd 100644
--- a/libtrivfs/open.c
+++ b/libtrivfs/open.c
@@ -1,6 +1,6 @@
/* Make a new trivfs peropen/protid
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995, 1996, 1999 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -27,7 +27,7 @@
FLAGS. CNTL is the trivfs control object. */
error_t
trivfs_open (struct trivfs_control *cntl,
- uid_t *uids, unsigned num_uids, gid_t *gids, unsigned num_gids,
+ struct iouser *user,
unsigned flags,
mach_port_t realnode,
struct trivfs_protid **cred)
@@ -55,20 +55,8 @@ trivfs_open (struct trivfs_control *cntl,
sizeof (struct trivfs_protid), &new);
if (! err)
{
- int i;
-
- new->isroot = 0;
- for (i = 0; i < num_uids; i++)
- if (uids[i] == 0)
- new->isroot = 1;
-
- new->uids = malloc (num_uids * sizeof (uid_t));
- bcopy (uids, new->uids, num_uids * sizeof (uid_t));
- new->nuids = num_uids;
-
- new->gids = malloc (num_gids * sizeof (uid_t));
- bcopy (gids, new->gids, num_gids * sizeof (uid_t));
- new->ngids = num_gids;
+ new->user = user;
+ new->isroot = idvec_contains (user->uids, 0);
new->po = po;
new->hook = 0;
diff --git a/libtrivfs/priv.h b/libtrivfs/priv.h
index e75e3644..d92fe336 100644
--- a/libtrivfs/priv.h
+++ b/libtrivfs/priv.h
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994 Free Software Foundation
+/*
+ Copyright (C) 1994, 1997 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -16,21 +16,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef TRIVFS_PRIV_H_INCLUDED
+#define TRIVFS_PRIV_H_INCLUDED
#include <mach.h>
#include <hurd.h>
#include <hurd/ports.h>
#include "trivfs.h"
-/* For the sake of MiG. */
-typedef struct trivfs_protid *trivfs_protid_t;
-typedef struct trivfs_control *trivfs_control_t;
-
-struct trivfs_protid *_trivfs_begin_using_protid (mach_port_t);
-void _trivfs_end_using_protid (struct trivfs_protid *);
-struct trivfs_control *_trivfs_begin_using_control (mach_port_t);
-void _trivfs_end_using_control (struct trivfs_control *);
-
-#define TRIVFS_PRIV_H_INCLUDED
#endif
-
diff --git a/libtrivfs/protid-classes.c b/libtrivfs/protid-classes.c
new file mode 100644
index 00000000..204548d8
--- /dev/null
+++ b/libtrivfs/protid-classes.c
@@ -0,0 +1,22 @@
+/* Defaults for TRIVFS_PROTID_[N]PORTCLASSES
+
+ Copyright (C) 1997 Free Software Foundation, Inc.
+
+ 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 "trivfs.h"
+
+struct port_class *trivfs_protid_portclasses[1];
+int trivfs_protid_nportclasses;
diff --git a/libtrivfs/protid-clean.c b/libtrivfs/protid-clean.c
index b986fca0..b76b202e 100644
--- a/libtrivfs/protid-clean.c
+++ b/libtrivfs/protid-clean.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995 Free Software Foundation
+ Copyright (C) 1994, 1995, 1996 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -44,8 +44,7 @@ trivfs_clean_protid (void *arg)
}
mutex_unlock (&cred->po->cntl->lock);
- free (cred->uids);
- free (cred->gids);
+ iohelp_free_iouser (cred->user);
if (cred->realnode != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), cred->realnode);
diff --git a/libtrivfs/protid-dup.c b/libtrivfs/protid-dup.c
index 0aa62dbf..855cd062 100644
--- a/libtrivfs/protid-dup.c
+++ b/libtrivfs/protid-dup.c
@@ -1,6 +1,6 @@
/* Duplicate a protid
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1993,94,95,96,2001 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -42,13 +42,12 @@ trivfs_protid_dup (struct trivfs_protid *cred, struct trivfs_protid **dup)
new->isroot = cred->isroot;
- new->uids = malloc (cred->nuids * sizeof (uid_t));
- bcopy (cred->uids, new->uids, cred->nuids * sizeof (uid_t));
- new->nuids = cred->nuids;
-
- new->gids = malloc (cred->ngids * sizeof (gid_t));
- bcopy (cred->gids, new->gids, cred->ngids * sizeof (uid_t));
- new->ngids = cred->ngids;
+ err = iohelp_dup_iouser (&new->user, cred->user);
+ if (err)
+ {
+ ports_port_deref (new);
+ return err;
+ }
new->realnode = cred->realnode;
mach_port_mod_refs (mach_task_self (), new->realnode,
diff --git a/libtrivfs/startup.c b/libtrivfs/startup.c
index 3783efc2..86b0f827 100644
--- a/libtrivfs/startup.c
+++ b/libtrivfs/startup.c
@@ -1,6 +1,6 @@
/* Contact parent filesystem and establish ourselves as the translator.
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2000 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -49,11 +49,12 @@ trivfs_startup(mach_port_t bootstrap, int flags,
if (err)
return err;
- right = ports_get_right (fsys);
+ right = ports_get_send_right (fsys);
/* Contact whoever started us. */
- err = fsys_startup (bootstrap, flags, right, MACH_MSG_TYPE_MAKE_SEND,
+ err = fsys_startup (bootstrap, flags, right, MACH_MSG_TYPE_COPY_SEND,
&underlying);
+ mach_port_deallocate (mach_task_self (), right);
if (! err)
fsys->underlying = underlying;
diff --git a/libtrivfs/times.c b/libtrivfs/times.c
index 2c527612..d2fcc589 100644
--- a/libtrivfs/times.c
+++ b/libtrivfs/times.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994 Free Software Foundation
+ Copyright (C) 1994, 1999, 2007 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -25,9 +25,9 @@ trivfs_set_atime (struct trivfs_control *cntl)
time_value_t mtime;
io_stat (cntl->underlying, &st);
- mtime.seconds = st.st_mtime;
- mtime.microseconds = st.st_mtime_usec;
- host_get_time (mach_host_self (), &atime);
+ mtime.seconds = st.st_mtim.tv_sec;
+ mtime.microseconds = st.st_mtim.tv_nsec / 1000;
+ atime.microseconds = -1;
file_utimes (cntl->underlying, atime, mtime);
return 0;
}
@@ -40,9 +40,9 @@ trivfs_set_mtime (struct trivfs_control *cntl)
time_value_t mtime;
io_stat (cntl->underlying, &st);
- atime.seconds = st.st_atime;
- atime.microseconds = st.st_atime_usec;
- host_get_time (mach_host_self (), &mtime);
+ atime.seconds = st.st_atim.tv_sec;
+ atime.microseconds = st.st_atim.tv_nsec / 1000;
+ mtime.microseconds = -1;
file_utimes (cntl->underlying, atime, mtime);
return 0;
}
diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h
index 4274226f..798e0b38 100644
--- a/libtrivfs/trivfs.h
+++ b/libtrivfs/trivfs.h
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
+/*
+ Copyright (C) 1994,95,96,97,99,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -23,12 +23,12 @@
#include <sys/types.h> /* for uid_t &c */
#include <mach/mach.h>
#include <hurd/ports.h>
+#include <hurd/iohelp.h>
struct trivfs_protid
{
struct port_info pi;
- uid_t *uids, *gids;
- int nuids, ngids;
+ struct iouser *user;
int isroot;
/* REALNODE will be null if this protid wasn't fully created (currently
only in the case where trivfs_protid_create_hook returns an error). */
@@ -72,7 +72,7 @@ void trivfs_end_using_control (struct trivfs_control *);
extern int trivfs_fstype;
extern int trivfs_fsid;
-/* Set these if trivfs should allow read, write,
+/* Set these if trivfs should allow read, write,
or execute of file. */
extern int trivfs_support_read;
extern int trivfs_support_write;
@@ -84,27 +84,47 @@ extern int trivfs_support_exec;
operations.) */
extern int trivfs_allow_open;
+/* If the user defines these, they should be vectors (and the associated
+ sizes) of port classes that will be translated into control & protid
+ pointers for passing to rpcs, in addition to those passed to or created by
+ trivfs_create_control (or trivfs_startup) will automatically be
+ recognized. */
extern struct port_class *trivfs_protid_portclasses[];
extern int trivfs_protid_nportclasses;
extern struct port_class *trivfs_cntl_portclasses[];
extern int trivfs_cntl_nportclasses;
-/* The user must define this function. This should modify a struct
+/* The user must define this function. This should modify a struct
stat (as returned from the underlying node) for presentation to
- callers of io_stat. It is permissable for this function to do
+ callers of io_stat. It is permissible for this function to do
nothing. */
-void trivfs_modify_stat (struct trivfs_protid *cred, struct stat *);
+void trivfs_modify_stat (struct trivfs_protid *cred, io_statbuf_t *);
+
+/* If this variable is set, it is called to find out what access this
+ file permits to USER instead of checking the underlying node.
+ REALNODE is the underlying node, and CNTL is the trivfs control
+ object. The access permissions are returned in ALLOWED. */
+error_t (*trivfs_check_access_hook) (struct trivfs_control *cntl,
+ struct iouser *user,
+ mach_port_t realnode,
+ int *allowed);
/* If this variable is set, it is called every time an open happens.
- UIDS, GIDS, and FLAGS are from the open; CNTL identifies the
+ USER and FLAGS are from the open; CNTL identifies the
node being opened. This call need not check permissions on the underlying
node. This call can block as necessary, unless O_NONBLOCK is set
in FLAGS. Any desired error can be returned, which will be reflected
to the user and prevent the open from succeeding. */
error_t (*trivfs_check_open_hook) (struct trivfs_control *cntl,
- uid_t *uids, u_int nuids,
- gid_t *gids, u_int ngids,
- int flags);
+ struct iouser *user, int flags);
+
+/* If this variable is set, it is called in place of `trivfs_open' (below). */
+error_t (*trivfs_open_hook) (struct trivfs_control *fsys,
+ struct iouser *user,
+ mach_port_t dotdot,
+ int flags,
+ mach_port_t realnode,
+ struct trivfs_protid **cred);
/* If this variable is set, it is called every time a new protid
structure is created and initialized. */
@@ -122,13 +142,27 @@ void (*trivfs_protid_destroy_hook) (struct trivfs_protid *);
is about to be destroyed. */
void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *);
+/* If this variable is set, it is called by trivfs_S_fsys_getroot before any
+ other processing takes place; if the return value is EAGAIN, normal trivfs
+ getroot processing continues, otherwise the rpc returns with that return
+ value. */
+error_t (*trivfs_getroot_hook) (struct trivfs_control *cntl,
+ mach_port_t reply_port,
+ mach_msg_type_name_t reply_port_type,
+ mach_port_t dotdot,
+ uid_t *uids, u_int nuids, uid_t *gids, u_int ngids,
+ int flags,
+ retry_type *do_retry, char *retry_name,
+ mach_port_t *node, mach_msg_type_name_t *node_type);
+
/* Creates a control port for this filesystem and sends it to BOOTSTRAP with
fsys_startup. CONTROL_CLASS & CONTROL_BUCKET are passed to the ports
library to create the control port, and PROTID_CLASS & PROTID_BUCKET are
- used when creating ports representing opens of this node. If CONTROL
- isn't NULL, the trivfs control port is return in it. If any error occurs
- sending fsys_startup, it is returned, otherwise 0. FLAGS specifies how to
- open the underlying node (O_*). */
+ used when creating ports representing opens of this node; any of these may
+ be zero, in which case an appropriate port class/bucket is created. If
+ CONTROL isn't NULL, the trivfs control port is return in it. If any error
+ occurs sending fsys_startup, it is returned, otherwise 0. FLAGS specifies
+ how to open the underlying node (O_*). */
error_t trivfs_startup (mach_port_t bootstrap, int flags,
struct port_class *control_class,
struct port_bucket *control_bucket,
@@ -140,7 +174,8 @@ error_t trivfs_startup (mach_port_t bootstrap, int flags,
return it in CONTROL. CONTROL_CLASS & CONTROL_BUCKET are passed to
the ports library to create the control port, and PROTID_CLASS &
PROTID_BUCKET are used when creating ports representing opens of this
- node. */
+ node; any of these may be zero, in which case an appropriate port
+ class/bucket is created. */
error_t
trivfs_create_control (mach_port_t underlying,
struct port_class *control_class,
@@ -161,8 +196,7 @@ int trivfs_demuxer (mach_msg_header_t *, mach_msg_header_t *);
the underlying node reference, with the given identity, and open flags in
FLAGS. CNTL is the trivfs control object. */
error_t trivfs_open (struct trivfs_control *fsys,
- uid_t *uids, unsigned num_uids,
- gid_t *gids, unsigned num_gids,
+ struct iouser *user,
unsigned flags,
mach_port_t realnode,
struct trivfs_protid **cred);
@@ -194,10 +228,73 @@ extern struct argp *trivfs_runtime_argp;
error_t trivfs_set_options (struct trivfs_control *fsys,
char *argz, size_t argz_len);
-/* Return runtime options for FSYS in ARGZ & ARGZ_LEN. ARGZ should be
- allocated with malloc. The default definition for this routine returns
- EOPNOTSUPP. */
-error_t trivfs_get_options (struct trivfs_control *fsys,
+/* Append to the malloced string *ARGZ of length *ARGZ_LEN a NUL-separated
+ list of the arguments to this translator. The default definition of this
+ routine simply calls diskfs_append_std_options. */
+error_t trivfs_append_args (struct trivfs_control *fsys,
char **argz, size_t *argz_len);
+
+/* Add the port class *CLASS to the list of control port classes recognized
+ by trivfs; if *CLASS is 0, an attempt is made to allocate a new port
+ class, which is stored in *CLASS. */
+error_t trivfs_add_control_port_class (struct port_class **class);
+
+/* Remove the previously added dynamic control port class CLASS, freeing it
+ if it was allocated by trivfs_add_control_port_class. */
+void trivfs_remove_control_port_class (struct port_class *class);
+
+/* Add the port class *CLASS to the list of protid port classes recognized by
+ trivfs; if *CLASS is 0, an attempt is made to allocate a new port class,
+ which is stored in *CLASS. */
+error_t trivfs_add_protid_port_class (struct port_class **class);
+
+/* Remove the previously added dynamic protid port class CLASS, freeing it
+ if it was allocated by trivfs_add_protid_port_class. */
+void trivfs_remove_protid_port_class (struct port_class *class);
+
+/* Add the port bucket *BUCKET to the list of dynamically allocated port
+ buckets; if *bucket is 0, an attempt is made to allocate a new port
+ bucket, which is then stored in *bucket. */
+error_t trivfs_add_port_bucket (struct port_bucket **bucket);
+
+/* Remove the previously added dynamic port bucket BUCKET, freeing it
+ if it was allocated by trivfs_add_port_bucket. */
+void trivfs_remove_port_bucket (struct port_bucket *bucket);
+
+
+/* This stuff is for the sake of MiG stubs and could be in a private
+ header. But it might be handy for users that override parts of the
+ library. Moreover, since the stub headers will use all the imports we
+ need for the stubs, we couldn't make the stub headers public without
+ making this public too. */
+
+typedef struct trivfs_protid *trivfs_protid_t;
+typedef struct trivfs_control *trivfs_control_t;
+
+struct trivfs_protid *_trivfs_begin_using_protid (mach_port_t);
+void _trivfs_end_using_protid (struct trivfs_protid *);
+struct trivfs_control *_trivfs_begin_using_control (mach_port_t);
+void _trivfs_end_using_control (struct trivfs_control *);
+
+/* Vectors of dynamically allocated port classes/buckets. */
+
+/* Protid port classes. */
+extern struct port_class **trivfs_dynamic_protid_port_classes;
+extern size_t trivfs_num_dynamic_protid_port_classes;
+
+/* Control port classes. */
+extern struct port_class **trivfs_dynamic_control_port_classes;
+extern size_t trivfs_num_dynamic_control_port_classes;
+
+/* Port buckets. */
+extern struct port_bucket **trivfs_dynamic_port_buckets;
+extern size_t trivfs_num_dynamic_port_buckets;
+
+/* These are the MiG-generated headers that declare prototypes
+ for the server functions. */
+#include <hurd/trivfs_fs_S.h>
+#include <hurd/trivfs_io_S.h>
+#include <hurd/trivfs_fsys_S.h>
+
#endif /* __TRIVFS_H__ */