summaryrefslogtreecommitdiff
path: root/libdiskfs
AgeCommit message (Collapse)Author
2020-06-01libdiskfs: Add missing node lock around fshelp_rlock_drop_peropen callSamuel Thibault
fshelp_rlock_drop_peropen actually needs the node to be locked for proper waiting atomicity.
2020-06-01libdiskfs: Drop spurious mutex acquisitionSamuel Thibault
diskfs_make_peropen does not need node to be locked. Worse, it could try to lock it. * libdiskfs/file-reparent.c (diskfs_S_file_reparent): Do not lock node around diskfs_make_peropen.
2020-05-28libdiskfs,libnetfs: add missing io_pathconf casesSamuel Thibault
* libdiskfs/io-pathconf.c (diskfs_S_io_pathconf): For _PC_REC_MAX_XFER_SIZE, _PC_REC_INCR_XFER_SIZE, _PC_SYMLINK_MAX, return undefined. For _PC_2_SYMLINKS, return 1. For _PC_REC_MIN_XFER_SIZE, _PC_REC_XFER_ALIGN, _PC_ALLOC_SIZE_MIN, return page size. * libnetfs/io-pathconf.c (netfs_S_io_pathconf): Likewise.
2020-03-31Fix build with -fno-commonSamuel Thibault
which will be the default in gcc-10. * acpi/acpifs.h (fs, acpifs_maptime): Add extern qualifier. * boot/private.h (verbose): Likewise. * eth-multiplexer/netfs_impl.h (multiplexer_maptime): Likewise. * eth-multiplexer/vdev.h (port_bucket, vdev_portclass): Likewise. * exec/priv.h (port_bucket, execboot_portclass): Likewise. * ext2fs/ext2fs.h (sblock, sblock_dirty, block_size, log2_block_size, log2_dev_blocks_per_fs_block, log2_stat_blocks_per_fs_block, zeroblock, frag_size, frags_per_block, inodes_per_block, itb_per_group, db_per_group, desc_per_block, addr_per_block, groups_count, node_to_page_lock, generation_lock, next_generation, group_desc_image, global_pokel, modified_global_blocks, use_xattr_translator_records): Likewise. * hostmux/hostmux.h (hostmux_maptime): Likewise. * isofs/isofs.h (host_name, mounted_on, disk_image, disk_image_len, logical_block_size, sblock): Likewise. * libdiskfs/diskfs.h (diskfs_shortcut_symlink, diskfs_shortcut_chrdev, diskfs_shortcut_blkdev, diskfs_shortcut_fifo, diskfs_shortcut_ifsock, diskfs_create_symlink_hook, diskfs_read_symlink_hook): Likewise. * libnetfs/callbacks.h (_netfs_translator_callback1, _netfs_translator_callback2): Likewise. * libnetfs/priv.h (netfs_mtime): Likewise. * libpager/priv.h (_pager_class): Likewise. * libtrivfs/trivfs.h (trivfs_check_access_hook, trivfs_check_open_hook, trivfs_open_hook, trivfs_protid_create_hook, trivfs_peropen_create_hook, trivfs_protid_destroy_hook, trivfs_peropen_destroy_hook, trivfs_getroot_hook): Likewise. * lwip/lwip-hurd.h (lwip_bucket, socketport_class, addrport_class, shutdown_notify_class, lwip_protid_portclasses, lwip_cntl_portclasses, lwip_bootstrap_portclass, fsys_identity, lwipcntl, lwip_owner, lwip_group): Likewise. * lwip/port/include/netif/hurdtunif.h (tunnel_cntlclass, tunnel_class): Likewise. * nfs/nfs.h (main_udp_socket, hostname, mapped_time): Likewise. * nfsd/nfsd.h (mapped_time, authserver): Likewise. * pci-arbiter/pcifs.h (fs, pcifs_maptime): Likewise. * pci-arbiter/startup.h (pci_shutdown_notify_class, arrange_shutdown_notification): Likewise. * pfinet/pfinet.h (pfinet_bucket, addrport_class, socketport_class, fsys_identity, pfinetctl, pfinet_owner, pfinet_group): Likewise. * pflocal/sserver.h (sock_port_bucket): Likewise. * proc/proc.h (authserver, self_proc, init_proc, startup_proc, proc_bucket, proc_class, generic_port_class, exc_class, generic_port, kernel_proc, global_lock): Likewise. * term/term.h (termstate, termflags, global_lock, carrier_alert, select_alert, pty_select_alert, term_bucket, tty_cntl_class, tty_class, cttyid_class, pty_class, pty_cntl_class, termctl, ptyctl, inputq, rawq, outputq, remote_input_mode, external_processing, term_owner, term_group, term_mode, bottom): Likewise. * usermux/usermux.h (usermux_maptime): Likewise. * utils/msgids.h (msgid_argp): Likewise. * libdiskfs/priv.h (_diskfs_mtime): Remove definition. * lwip/options.h (lwip_argp): Add prototype. * mach-defpager/priv.h (partitions): Name structure. (all_partitions): Add extern qualifier. * acpi/main.c (acpifs_maptime, fs): New variables. * exec/main.c (port_bucket, execboot_portclass): Likewise. * ext2fs/ext2fs.c (sblock, sblock_dirty, block_size, log2_block_size, log2_dev_blocks_per_fs_block, log2_stat_blocks_per_fs_block, frag_size, frags_per_block, inodes_per_block, itb_per_group, db_per_group, desc_per_block, addr_per_block, groups_count, next_generation, group_desc_image, global_pokel, use_xattr_translator_records): Likewise. * isofs/main.c (host_name, mounted_on, logical_block_size, sblock): Likewise. * libpager/pager-create.c (_pager_class): Likewise. * lwip/port/netif/hurdtunif.c (tunnel_cntlclass, tunnel_class): Likewise. * mach-defpager/default_pager.c (all_partitions): Likewise. * nfs/main.c (main_udp_socket, hostname, mapped_time): Likewise. * nfsd/main.c (mapped_time, authserver): Likewise. * pci-arbiter/main.c (fs, pcifs_maptime): Likewise. * pci-arbiter/startup.c (*pci_shutdown_notify_class): Likewise. * pfinet/main.c (pfinetctl, pfinet_owner, pfinet_group, pfinet_bucket, addrport_class, socketport_class, fsys_identity): Likewise. * proc/main.c (authserver, self_proc, init_proc, startup_proc, proc_bucket, proc_class, generic_port_class, exc_class, generic_port, kernel_proc, global_lock): Likewise. * term/main.c (termstate, termflags, global_lock, carrier_alert, select_alert, pty_select_alert, term_bucket, tty_cntl_class, tty_class, cttyid_class, pty_class, pty_cntl_class, termctl, ptyctl, outputq, remote_input_mode, external_processing, term_owner, term_group, term_mode, bottom): Likewise. * usermux/usermux.c (usermux_mapped_time): Rename to usermux_maptime. * lwip/main.c: Include "options.h". (lwip_argp, netif_list): Remove declarations. (lwip_bucket, socketport_class, addrport_class, shutdown_notify_class, lwip_cntl_portclasses, lwip_bootstrap_portclass, lwip_owner, lwip_group, fsys_identity, lwipcntl): New variables. * eth-multiplexer/multiplexer.c (multiplexer_maptime): Add variable. * hostmux/hostmux.c (hostmux_mapped_time): Rename variable to hostmux_maptime * libdiskfs/extra-version.c: Rename file to... * libdiskfs/priv.c: ... new file. (diskfs_shortcut_symlink, diskfs_shortcut_chrdev, diskfs_shortcut_blkdev, diskfs_shortcut_fifo, diskfs_shortcut_ifsock, diskfs_create_symlink_hook, diskfs_read_symlink_hook): Add weak variables. * libdiskfs/Makefile (OTHERSRCS): Replace extra-version.c with priv.c. * libtrivfs/priv.c: New file. * libtrivfs/Makefile (OTHERSRCS): Add priv.c * libcons/extra-version.c: Rename file to... * libcons/priv.c: ... new file. * libcons/Makefile (SRCS): Replace extra-version.c with priv.c. Fix build with #
2019-11-10libfshelp: Fix memleakSamuel Thibault
* libfshelp/fshelp.h (fshelp_rlock_po_fini): New inline function. * libdiskfs/peropen-rele.c (diskfs_release_peropen): Call fshelp_rlock_po_fini. * libnetfs/release-peropen.c (netfs_release_peropen): Likewise.
2019-10-30libdiskfs: Support for file record lockingNeal H Walfield
2019-03-04 Svante Signell <svante.signell@gmail.com> * file-lock.c: Make flock work regardless of the mode in which the file was opened. 2019-02-12 Svante Signell <svante.signell@gmail.com> * file-lock.c: Comment out "Make flock work without R or W mode" 2019-02-01 Svante Signell <svante.signell@gmail.com> * Update copyright years. * file-record-lock.c(diskfs_S_file_record_lock): Don't set rendezvous to MACH_PORT_NULL. 2018-12-07 Svante Signell <svante.signell@gmail.com> * Update copyright years. * dir-lookup.c(diskfs_S_dir_lookup): Call fshelp_rlock_tweak() with new last argument rendezvous = MACH_PORT_NULL. * file-lock.c(diskfs_S_file_lock): Likewise. * file-record-lock.c(diskfs_S_file_record_lock): Likewise. (diskfs_S_file_record_lock): Add new argument mach_port_t rendezvous. 2017-01-05 Svante Signell <svante.signell@gmail.com> * Update copyright years and headers. 2016-05-23 Svante Signell <svante.signell@gmail.com> * file-lock-stat.c: Port from cthreads to libpthread. * file-lock.c: Likewise. * file-record-lock: Likewise. 2001-04-11 Neal H Walfield <neal@cs.uml.edu> * Makefile (FSSRCS): Add file-record-lock.c. * diskfs.h (struct peropen): Change the type of lock_status from an int to a struct rlock_peropen. (struct node): Change the type of userbox from a struct lock_box to a struct rlock_box. * dir-lookup.c (diskfs_S_dir_lookup): Use fshelp_rlock_tweak as fshelp_acquire_lock is now depreciated. * file-lock-stat.c (diskfs_S_file_lock_stat): Total rewrite around the new record locking functions. * file-lock.c (diskfs_S_file_lock): Total rewrite around the new record locking functions. * file-record-lock.c: New file. Implement diskfs_S_file_record_lock. * node-make.c (diskfs_make_node): Initialize userbox with fshelp_rlock_init. * peropen-make.c (diskfs_make_peropen): Initialize lock_status using fshelp_rlock_po_init. * peropen-rele.c (diskfs_release_peropen): Release lock_status using fshelp_rlock_drop_peropen.
2019-10-27libdiskfs: Fix buildSamuel Thibault
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Remove duplicate variable.
2019-10-27libdiskfs: Do not register active translator if it failed to startSamuel Thibault
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Do not call fshelp_set_active_translator if fshelp_fetch_root returned an error which is not ENOENT.
2019-09-01Use the data_t type defined in hurd_types.h.Flavio Cruz
* boot/boot.c: Replace char* with data_t. * console-client/trans.c: Likewise. * exec/exec.c: Likewise. * ext2fs/storeinfo.c: Likewise. * fatfs/inode.c: Likewise. * fatfs/main.c: Likewise. * isofs/inode.c: Likewise. * libdiskfs/boot-start.c: Likewise. * libdiskfs/dir-readdir.c: Likewise. * libdiskfs/file-exec.c: Likewise. * libdiskfs/file-get-fs-opts.c: Likewise. * libdiskfs/file-get-trans.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-set-trans.c: Likewise. * libdiskfs/fsys-forward.c: Likewise. * libdiskfs/fsys-getfile.c: Likewise. * libdiskfs/fsys-options.c: Likewise. * libdiskfs/io-read.c: Likewise. * libdiskfs/io-write.c: Likewise. * libnetfs/dir-readdir.c: Likewise. * libnetfs/file-exec.c: Likewise. * libnetfs/file-get-fs-options.c: Likewise. * libnetfs/file-get-storage-info.c: Likewise. * libnetfs/file-get-translator.c: Likewise. * libnetfs/file-set-translator.c: Likewise. * libnetfs/fsstubs.c: Likewise. * libnetfs/fsys-get-options.c: Likewise. * libnetfs/fsys-set-options.c: Likewise. * libnetfs/fsysstubs.c: Likewise. * libnetfs/io-read.c: Likewise. * libnetfs/io-write.c: Likewise. * libtrivfs/dir-readdir.c: Likewise. * libtrivfs/file-get-fs-options.c: Likewise. * libtrivfs/file-get-storage-info.c: Likewise. * libtrivfs/file-get-trans.c: Likewise. * libtrivfs/file-getfh.c: Likewise. * libtrivfs/file-set-trans.c: Likewise. * libtrivfs/fsys-forward.c: Likewise. * libtrivfs/fsys-get-options.c: Likewise. * libtrivfs/fsys-set-options.c: Likewise. * libtrivfs/fsys-stubs.c: Likewise. * libtrivfs/io-read.c: Likewise. * libtrivfs/io-write.c: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/pfinet-ops.c: Likewise. * pfinet/socket-ops.c: Likewise. * pfinet/tunnel.c: Likewise. * pflocal/io.c: Likewise. * pflocal/pf.c: Likewise. * pflocal/socket.c: Likewise. * proc/info.c: Likewise. * startup/startup.c: Likewise. * storeio/io.c: Likewise. * term/users.c: Likewise. * tmpfs/node.c: Likewise. * trans/crash.c: Likewise. * trans/fakeroot.c: Likewise. * trans/fifo.c: Likewise. * trans/firmlink.c: Likewise. * trans/hello-mt.c: Likewise. * trans/hello.c: Likewise. * trans/mtab.c: Likewise. * trans/new-fifo.c: Likewise. * trans/null.c: Likewise. * trans/proxy-defpager.c: Likewise. * trans/streamio.c: Likewise.
2019-07-27Catch LFS64 inconsistencies in RPC server stubsSamuel Thibault
* libdiskfs/diskfs.h (protid_t): New type (diskfs_S_io_write, diskfs_S_io_read, diskfs_S_io_seek, diskfs_S_io_stat, diskfs_S_file_set_size, diskfs_S_file_get_storage_info, diskfs_S_file_statfs): New prototypes. * libnetfs/netfs.h (netfs_S_io_write, netfs_S_io_read, netfs_S_io_seek, netfs_S_io_stat, netfs_S_file_set_size, netfs_S_file_get_storage_info, netfs_S_file_statfs): New prototypes. * libtrivfs/trivfs.h (trivfs_S_io_write, trivfs_S_io_read, trivfs_S_io_seek, trivfs_S_io_stat, trivfs_S_file_set_size, trivfs_S_file_get_storage_info, trivfs_S_file_statfs): New prototypes.
2019-07-27Fix missing gnu_dev_* prototypesSamuel Thibault
* isofs/rr.c: Include <sys/sysmacros.h>. * libdiskfs/file-set-trans.c: Likewise. * libfshelp/fetch-root.c: Likewise. * libnetfs/file-get-translator.c: Likewise. * libnetfs/file-set-translator.c: Likewise. * nfs/nfs.c: Likewise. * nfs/ops.c: Likewise. * storeio/storeio.c: Likewise. * trans/fakeroot.c: Likewise.
2019-07-27diskfs.h: Expose 64bit typesSamuel Thibault
We build hurd with LFS64, so we should always expose LFS64 types, so callers do not have to build with -D_FILE_OFFSET_BITS=64. * libdiskfs/diskfs.h (struct peropen): Make `filepointer' field type `loff_t' instead of `off_t'. (diskfs_cached_ifind): Make `inum' parameter `ino64_t' instead of `ino_t'. (diskfs_cached_lookup_context): Likewise. * hurd/shared.h (strcut shared_io): Make `read_size', `prenotify_size', `postnotify_size', `readnotify_size', `rd_file_pointer', `wr_file_pointer', `xx_file_pointer', `file_size' fields type `loff_t' instead of `off_t'.
2019-04-28diskfs: Fix rename_dir(excl=1) for source directoriesSamuel Thibault
Starting from coreutils 8.30 which uses renameat2(flag=RENAME_NOREPLACE), we need to have excl=1 to behave correctly, notably in this case: $ mkdir a $ mkdir b $ touch b/t $ mv b a diskfs_rename("b", "a", excl=1) called by mv shall return EEXIST. * libdiskfs/diskfs.h (diskfs_rename_dir): Add `excl' parameter. * doc/hurd.texi (diskfs_rename_dir): Document `excl' parameter. * libdiskfs/dir-renamed.c (diskfs_rename_dir): Add `excl' parameter. Return EEXIST when target exists and `excl' is not 0. * libdiskfs/dir-rename.c (diskfs_S_dir_rename): Pass `excl' to diskfs_rename_dir.
2019-01-05hurd: fix error on opening symlink with O_NOFOLLOW|O_WRITESamuel Thibault
POSIX requires ELOOP in that case. * libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Return ELOOP instead of EACCES when the result is a symlink and O_WRITE|O_EXEC was requested
2018-06-13Hurd patches (fix compilation)Luca Weiss
* isofs/rr.c (rrip_work): Use gnu_dev_makedev instead of makedev. * libdiskfs/file-set-trans.c (diskfs_S_file_set_translator): Likewise. * libnetfs/file-set-translator.c (netfs_S_file_set_translator): Likeiwse. * nfs/nfs.c (xdr_decode_fattr): Likewise. * storeio/storeio.c (parse_opt): Likewise. * libfshelp/fetch-root.c (fshelp_short_circuited_callback1): Use gnu_dev_major and gnu_dev_minor instead of major and minor. * libnetfs/file-get-translator.c (netfs_S_file_get_translator): Likewise. * nfs/ops.c (netfs_attempt_link): Likewise. * storeio/storeio.c (trivfs_append_args): Likewise. * trans/fakeroot.c (netfs_attempt_mkdev): Likewise. * pfinet/glue-include/linux/mm.h: Include <mach/vm_param.h>. * term/users.c: Include <signal.h>
2018-03-05Add file_utimens RPC to use a struct timespecFlávio Cruz
and update the servers to use UTIME_NOW and UTIME_OMIT. * console-client/trans.c (netfs_attempt_utimes): Do not set current time ourself. * console/console.c (netfs_attempt_utimes): Likewise. * ftpfs/netfs.c (netfs_attempt_utimes): Likewise. * hostmux/node.c (netfs_attempt_utimes): Likewise. * usermux/node.c (netfs_attempt_utimes): Likewise. * nfs/ops.c (netfs_attempt_utimes): Likewise. * doc/hurd.texi (file_utimens): Add documentation. * hurd/fs.defs (file_utimens): Add RPC. * libdiskfs/file-utimes.c (diskfs_S_file_utimes): Move implementation and replace with translation layer with... (diskfs_S_file_utimens): ... new function. * libnetfs/file-utimes.c (netfs_S_file_utimes): Likewise with... (netfs_S_file_utimens): ... new function. * libnetfs/init-init.c: Include <error.h>. (netfs_mtime): New variable. (netfs_init): New function. * libnetfs/netfs.h (netfs_attempt_utimes): Update documentation. * libnetfs/priv.h (netfs_mtime): Declare variable. * libtreefs/s-file.c (treefs_S_file_utimes): Convert time values and call treefs_s_file_utimens instead of treefs_s_file_utimes. * libtreefs/treefs-hooks.h: Replace TREEFS_HOOK_S_FILE_UTIMES with TREEFS_HOOK_S_FILE_UTIMENS. * libtreefs/treefs-s-hooks.h: Replace s_file_utimes with s_file_utimens. * libtrivfs/file-utimes.c (trivfs_S_file_utimens): New function. * libtrivfs/times.c (trivfs_set_atime): Try to use file_utimens before using file_utimes. (trivfs_set_mtime): Likewise. * nfsd/ops.c (complete_setattr): Likewise. * trans/fakeroot.c (netfs_attempt_utimes): Likewise. * nfs/nfs.c (xdr_encode_sattr_times): Do not set atime or mtime when they are NULL. * configure.ac: Look for file_futimens, and define UTIME_NOW/OMIT, for compatibility with old glibcs.
2018-03-05Fix warningsSamuel Thibault
* libdiskfs/boot-start.c (diskfs_start_bootstrap): Fix printf format. * libfshelp/delegate.c: Include <alloca.h> and <stdlib.h>. * libfshelp/start-translator-long.c: Include <stdlib.h>. * libshouldbeinlibc/ugids-verify-auth.c (server_verify_make_auth): Fix prototypes for password_check_group and password_check_user. * libstore/argp.c: Include <stdlib.h>. * libstore/task.c: Include <stdlib.h>. * exec/exec.c: Include <mach/vm_param.h>. * libbpf/bpf_impl.c: Include <stdlib.h>. * proc/info.c (S_proc_getloginpids): Remove local variables leader_task and leader_sub. * proc/main.c (main): Remove local variable original_argv. * boot/boot.c (task_died, S_mach_notify_new_task): Fix printf format. * exec/elfcore.c: Include <alloca.h> and <mach/vm_param.h>. * trans/crash.c: Include <hurd/msg.h>. * trans/random.c: Include <signal.h>. * utils/login.c: Include <signal.h>. * utils/id.c: Include <hurd/msg.h>. * utils/devprobe.c: Include <stdlib.h>. * utils/addauth.c: Include <hurd/msg.h>. * utils/frobauth-mod.c: Include <hurd/msg.h>. * utils/storeread.c: Include <stdlib.h>. * utils/msgport.c: Include <hurd/msg.h>. * sutils/clookup.c (file_name_lookup_carefully): Fix lookup function prototype, make head and tail const. * utils/rpcscan.c: Include <stdlib.h>. * sutils/bless.c: Include <stdlib.h>. * fstests/fstests.c: Include <stdlib.h>. * startup/startup.c (argz_task_insert_right): Fix printf format. * init/init.c: Include <stdlib.h>.
2018-01-15Revert "libdiskfs: Shutdown pagers on startup_dosync."Samuel Thibault
This reverts commit 89a49ec8b3a847f3b770cff6a4a80b98b94ad7bf. There was a typo in diskfs_shutdown (FSYS_GOAWAY_FORCE || FSYS_GOAWAY_RECURSE) which was making it FSYS_GOAWAY_NOWAIT, and thus not actually syncing if there happens to be clients (it was then returning EBUSY). Fixing this into FSYS_GOAWAY_FORCE | FSYS_GOAWAY_RECURSE then makes it wait for clients (and NOWAIT is not supported), and there are very often some left, thus not syncing either.
2018-01-08Add a file_exec_file_name RPCEmilio Pozuelo Monfort
* hurd/fs.defs (file_exec): Deprecate in favor of... (file_exec_paths): ...this new RPC. * TODO: Update. * doc/hurd.texi: Update RPC name. * hurd/hurd_types.h: Update RPC name. * libdiskfs/boot-start.c: Update RPC name. * configure.ac: Check for presence of RPC stubs file_exec_paths exec_exec_paths. * exec/hashexec.c (check_hashbang): When file_exec_paths is available, use it instead of file_exec. * startup/startup.c (run, run_for_real, start_child): Likewise. * utils/login.c (main): Likewise. * libfshelp/start-translator-long.c (fshelp_start_translator_long): Likewise. * libdiskfs/file-exec.c (diskfs_S_file_exec): Move code to new function diskfs_S_file_exec_paths and call it. (diskfs_S_file_exec_paths): New function, use exec_exec_paths when available instead of exec_exec * libnetfs/file-exec.c (netfs_S_file_exec, netfs_S_file_exec_paths): Likewise. * trans/fakeroot.c (netfs_S_file_exec, netfs_S_file_exec_paths): Likewise. * libtrivfs/file-exec.c (trivfs_S_file_exec_paths): New function.
2017-09-25libdiskfs: Improve error message.Justus Winter
* libdiskfs/init-main.c (diskfs_init_main): Use name of the function that failed as error message.
2017-09-12libdiskfs: Shutdown pagers on startup_dosync.Justus Winter
* libdiskfs/init-startup.c (diskfs_S_startup_dosync): Simplify the code by just using 'diskfs_shutdown' with the force flag. This also shuts down pagers, which potentially affects other tasks, but getting rid of the pagers allows us to commit a clean and consistent state to the disk before shutting down. Crashing other tasks just before the system powers down seems like a small price to pay.
2017-09-12Traverse translator hierarchies using the fsys protocol.Justus Winter
Previously, we used the fs protocol to traverse the translator hierarchies. This, however, is conceptually flawed, because translators are bound to nodes, and a node can have zero or more links in the file system. Therefore, the previous method of returning a list of paths to the client and expecting them to be able to follow these to reach the child translators was always unreliable. Fix this by using the fsys protocol to traverse the hierarchy, and returning the control ports of all children. This is more robust, and also conceptually cleaner, because the fsys protocol is about translator linkage, hence this is the point to implement traversal. Also move the get source routine over. A per-node source really does not fit the reality of most translators, while a per-translator source makes sense in many cases. * hurd/fs.defs (file_get_children): Drop routine. (file_get_source): Likewise. * hurd/fsys.defs (fsys_get_children): New routine. (fsys_get_source): Likewise. * libdiskfs/Makefile (FSYSSRCS): Remove files, add files. * libdiskfs/file-get-children.c: Remove file. * libdiskfs/fsys-get-children.c: New file. * libdiskfs/file-get-source.c: Remove file. * libdiskfs/fsys-get-source.c: New file. * libfshelp/fshelp.h (fshelp_filter): Remove type. (fshelp_get_active_translators): Remove filter and prefix argument, return list of control ports. * libfshelp/translator-list.c (fshelp_get_active_translators): Likewise. * libnetfs/Makefile (FSSRCS): Move 'get-source.c' too OTHERSRCS. (FSYSSRCS): Remove files, add files. * libnetfs/file-get-children.c: Remove file. * libnetfs/fsys-get-children.c: New file. * libnetfs/file-get-source.c: Remove file. * libnetfs/fsys-get-source.c: New file. * libtrivfs/Makefile: Move 'get-source.c' too OTHERSRCS. (FSYSSRCS): Remove files, add files. * libtrivfs/file-get-children.c: Remove file. * libtrivfs/fsys-get-children.c: New file. * libtrivfs/file-get-source.c: Remove file. * libtrivfs/fsys-get-source.c: Add file. * trans/Makefile (mtab): Build client stubs until the libc has caught on. * trans/mtab.c (target_control): New variable. (insecure): Drop variable. (all_translators): Likewise. (MAX_DEPTH): New macro. (max_depth): New variable. (options): Remove '--insecure' and '--all-translators', add '--depth'. (parse_opt): Adapt accordingly. (trivsfs_append_args): Likewise. (main): Get the control port of the target translator, then drop privileges. (is_filesystem_translator): Remove function. (mtab_mark_as_seen): Simplify. Just check if the control port is known. (mtab_populate): Limit depth of recursion, adapt to traversing over the control ports, simplify. (open_hook): Remove scary comment, it is not applicable anymore because we no longer dir_lookup child translators.
2017-09-12libfshelp: Use node instead of name as key.Justus Winter
Previously, libfshelp used the name of an translator as key in the hash table. This however is flawed, because a translator is bound to a node, and a node can have zero or more links in the file system. Use the nodes address (or rather, the address of the transbox embedded in the node) as key instead. * libfshelp/fshelp.h (fshelp_set_active_translator): Instead of the control port, hand the whole transbox to the function. * libfshelp/translator-list.c (struct translator): New field 'locp'. (hash): Hash pointer. (compare): Compare pointer. (translator_ihash): Use an location pointer. (fshelp_set_active_translator): Use the address of the transbox as key. (fshelp_remove_active_translator): Remove using the location pointer. * libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Fix callsite. * libdiskfs/file-set-trans.c (diskfs_S_file_set_translator): Likewise. * libnetfs/dir-lookup.c (netfs_S_dir_lookup): Likewise. * libnetfs/file-set-translator.c (netfs_S_file_set_translator): Likewise.
2017-09-12Normalize path of translators.Justus Winter
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Strip trailing slashes. * libnetfs/dir-lookup.c (netfs_S_dir_lookup): Likewise.
2017-09-12libfshelp: Add function to map over all active translators.Justus Winter
* libdiskfs/file-syncfs.c (diskfs_S_file_syncfs): Use the new function. * libdiskfs/fsys-options.c (diskfs_S_fsys_set_options): Likewise. * libdiskfs/fsys-syncfs.c (diskfs_S_fsys_syncfs): Likewise. * libdiskfs/shutdown.c (diskfs_shutdown): Likewise. * libfshelp/fshelp.h (fshelp_map_active_translators): New declaration. * libfshelp/translator-list.c (fshelp_map_active_translators): New function. * libnetfs/file-syncfs.c (netfs_S_file_syncfs): Use the new function. * libnetfs/fsys-set-options.c (netfs_S_fsys_set_options): Likewise. * libnetfs/fsys-syncfs.c (netfs_S_fsys_syncfs): Likewise. * libnetfs/shutdown.c (netfs_shutdown): Likewise.
2017-09-12Fix active translator registration.Justus Winter
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Unconditionally register translators. Previously, we missed translators because 'transbox.active' is not in fact reset if the translator dies. * libnetfs/dir-lookup.c (netfs_S_dir_lookup): Likewise.
2017-09-01Remove unused parameter from the 'get_source' machinery.Justus Winter
* libdiskfs/diskfs.h (diskfs_get_source): Remove first parameter. * libdiskfs/file-get-source.c (diskfs_S_file_get_source): Adapt callsite. * libdiskfs/get-source.c (diskfs_get_source): Adapt default implementation. * libnetfs/netfs.h (netfs_get_source): Remove first parameter. * libnetfs/file-get-source.c (netfs_S_file_get_source): Adapt callsite. * libnetfs/get-source.c (netfs_get_source): Adapt default implementation. * libtrivfs/trivfs.h (trivfs_get_source): Remove first parameter. * libtrivfs/file-get-source.c (trivfs_S_file_get_source): Adapt callsite. * libtrivfs/get-source.c (trivfs_get_source): Adapt default implementation. * nfs/main.c (netfs_get_source): Adapt implementation. * procfs/main.c (netfs_get_source): Likewise. * trans/firmlink.c (trivfs_get_source): Likewise.
2017-08-24libdiskfs: Simplify type checks.Justus Winter
* libdiskfs/diskfs.h (diskfs_begin_using_control_port): Check port class. * libdiskfs/fsys-getfile.c (diskfs_S_fsys_getfile): Drop check. * libdiskfs/fsys-getroot.c (diskfs_S_fsys_getroot): Likewise. * libdiskfs/fsys-goaway.c (diskfs_S_fsys_goaway): Likewise. * libdiskfs/fsys-options.c (diskfs_S_fsys_{s,g}et_options): Likewise. * libdiskfs/fsys-syncfs.c (diskfs_S_fsys_syncfs): Likewise.
2017-08-24libdiskfs: Use control class for the singleton 'bootinfo'.Justus Winter
* libdiskfs/boot-start.c (bootinfo): New variable. (diskfs_start_bootstrap): Create 'bootinfo' as an instance of 'diskfs_control_class'. (diskfs_S_fsys_getpriv): Only allow operation on 'bootinfo'. (diskfs_S_fsys_init): Allow operation on any control object, but only once. * libdiskfs/diskfs.h (diskfs_initboot_class): Drop declaration. * libdiskfs/init-init.c (diskfs_initboot_class): Drop variable. (diskfs_init_diskfs): Adapt.
2017-08-06libdiskfs: Make mapping the time device more robust.Justus Winter
* libdiskfs/init-init.c (diskfs_init_diskfs): First try /dev/time, then fall back to the Mach device.
2017-08-05Use our own variant of 'assert' and 'assert_perror'.Justus Winter
Our variants print stack traces on failures. This will make locating errors much easier.
2017-03-12Pass the kernel's task port to proc.Justus Winter
Previously, the early server bootstrap relied upon a specific task layout to determine the kernels task port. Explicitly pass it from the kernel instead. * boot/boot.c (default_boot_script): Add '--kernel-task' parameter to ext2fs. (main): New bootscript variable 'kernel-task'. * libdiskfs/boot-start.c (diskfs_kernel_task): Declaration variable. (diskfs_start_bootstrap): If '--kernel-task' was given to us, pass it along to startup. * libdiskfs/opts-std-startup.c (diskfs_kernel_task): New variable. (startup_options): Add '--kernel-task' option. (parse_startup_opt): Handle option. * proc/main.c (kernel_task): New variable. (OPT_KERNEL_TASK): New macro. (options): New variable. (parse_opt): New function. (main): Parse options. Use 'kernel_task' if provided. * release/servers.boot: Add '--kernel-task' parameter to ext2fs. * startup/startup.c (OPT_KERNEL_TASK): New macro. (options): Add '--kernel-task' option. (kernel_task): New variable. (insert_ports_fnc_t): New declaration. (run): Add argument for a function that inserts rights into the newly created task and adds arguments to the argument vector. (argz_task_insert_right): New function. (proc_insert_ports): Likewise. (parse_opt): New function. (main): Pass the kernel's task port to proc. (frob_kernel_process): Use the kernel's task port.
2016-10-31libdiskfs: Factorize code for last hard reference being releasedSamuel Thibault
* libdiskfs/node-lastref.c: New file * libdiskfs/Makefile (OTHERSRCS): Add node-lastref.c * libdiskfs/libdiskfs/node-nput.c (diskfs_nput): Replace last hard reference code with a call to _diskfs_lastref. * libdiskfs/node-nrele.c (diskfs_nrele): Likewise.
2016-10-31libdiskfs: fix removal of socket nodesSamuel Thibault
Follow-up on 5ab5d98fa515cd19a64e8d5868fcbae85eec9dc5 ('libdiskfs: fix removal of socket nodes'), for diskfs_nrele. * libdiskfs/node-nrele.c (diskfs_nrele): Deallocate right to socket address when cleaning light references.
2016-10-30Mark library stubs as weakSamuel Thibault
So that static linking of e.g. console.static can work. * libdiskfs/io-stubs.c (diskfs_S_io_readsleep, diskfs_S_io_eofnotify, diskfs_S_io_postnotify, diskfs_S_io_readnotify): Mark weak. * libnetfs/fsstubs.c (netfs_S_file_notice_changes, netfs_S_file_getfh, netfs_S_ifsock_getsockaddr): Likewise. * libnetfs/fsysstubs.c (netfs_S_fsys_getfile: netfs_S_fsys_getpriv, netfs_S_fsys_init, netfs_S_fsys_forward, netfs_S_fsys_startup): Likewise. * libpager/stubs.c (_pager_S_memory_object_copy, _pager_S_memory_object_data_write, _pager_S_memory_object_supply_completed): Likewise. * libtrivfs/fsys-stubs.c (trivfs_S_fsys_startup, trivfs_S_fsys_getpriv, trivfs_S_fsys_init, trivfs_S_fsys_getfile): Likewise. * libtrivfs/io-stubs.c (trivfs_S_io_map_cntl, trivfs_S_io_get_conch, trivfs_S_io_release_conch, trivfs_S_io_eofnotify, trivfs_S_io_prenotify, trivfs_S_io_postnotify, trivfs_S_io_readsleep, trivfs_S_io_sigio, trivfs_S_io_readnotify): Likewise.
2016-10-27libdiskfs: Make utimes RPC flush pending timestamp updatesSamuel Thibault
Thanks Kalle Olavi Niemitalo for the notice. * libdiskfs/file-utimes.c (diskfs_S_file_utimes): Call diskfs_set_node_times before setting node timestamps.
2016-10-27libdiskfs: Fix timestamp update on file closeSamuel Thibault
* libdiskfs/node-nrele.c (diskfs_nrele): Call diskfs_set_node_times when there are no hard refs any more, like diskfs_nput does.
2016-10-03libdiskfs: Fix short-circuiting translators.Justus Winter
* libdiskfs/file-set-trans.c (diskfs_S_file_set_translator): When setting a short-circuited translator, clear the translator record first. Improve error handling. This notably fixes a crash in ext2fs when setting a symlink on a node with an existing translator record.
2016-08-30Fix message about not being able to request shutdown notificationSamuel Thibault
It is just a warning, not a fatal error. * libdiskfs/init-startup.c (_diskfs_init_completed): Prefix warning about requesting shutdown nofication with "warning:". * random/random.c (main): Likewise.
2016-05-22libdiskfs: fix error handlingJustus Winter
* libdiskfs/dir-rmdir.c (diskfs_S_dir_rmdir): Initialize 'np'.
2016-05-19Avoid superfluous locking of nodeJustus Winter
* libdiskfs/io-restrict-auth.c (diskfs_S_io_restrict_auth): Do not lock the associated node. No operation here needs synchronization. * libnetfs/io-restrict-auth.c (netfs_S_io_restrict_auth): Likewise.
2016-05-19Unify the short-circuit translator logicJustus Winter
* libdiskfs/dir-lookup.c (short_circuited_callback1): Move function to libfshelp. (diskfs_S_dir_lookup): Use the function from libfshelp instead. * libdiskfs/fsys-getroot.c (diskfs_S_fsys_getroot): Adapt accordingly. * libdiskfs/trans-callback.c (_diskfs_translator_callback2_fn): Likewise. * libfshelp/fetch-root.c (fshelp_short_circuited_callback1): New function. * libfshelp/fshelp.h (struct fshelp_stat_cookie): New definition. (fshelp_short_circuited_callback1): New prototype. * libnetfs/dir-lookup.c (short_circuited_callback1): Drop function. (netfs_S_dir_lookup): Use the function from libfshelp instead. * libnetfs/fsys-getroot.c (netfs_S_fsys_getroot): Adapt accordingly. * libnetfs/trans-callback.c (_netfs_translator_callback2_fn): Likewise.
2016-05-19libdiskfs: cosmetic changesJustus Winter
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Rename identifiers to be more idiomatic and closer to libnetfs and the interface specification. Massage the code so that it aligns closer with the dir_lookup server function in libnetfs. It should not change the behavior.
2016-04-26libdiskfs: Reject LFS seeks and read/writesSamuel Thibault
vm_offset_t (used by pager_memcpy) is not 64bit-ready yet. Reject requests which go further than this. * libdiskfs/io-seek.c (diskfs_S_io_seek): Return EFBIG when requested offset is beyond limits of vm_offset_t. * libdiskfs/rdwr-internal.c (_diskfs_rdwr_internal): Return EFBIG when request goes beyond limits of vm_offset_t.
2016-04-26libdiskfs: improve error handlingJustus Winter
* libdiskfs/boot-start.c (diskfs_start_bootstrap): Improve error handling.
2016-02-28Fix mustbedir mechanism for symlinksSamuel Thibault
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): When following a symlink, if mustbedir is true, always append a slash to the symlink target, not only when the target is absolute. Reset mustbedir to 0 before continuing the lookup loop. * libnetfs/dir-lookup.c (netfs_S_dir_lookup): When following a symlink, if mustbedir is true, append a slash to the symlink target. Reset mustbedir to 0 before continuing the lookup loop. * libtreefs/dir-lookup.c (_treefs_s_dir_lookup): Likewise.
2016-02-15libdiskfs: fix and improve locking in nrefs/nput.Flavio Cruz
* libnetfs/node-nput.c: Do not unlock the node since it will be unlocked later. * libnetfs/node-nrele.c: Do not lock the node twice if not needed.
2016-01-13Fix O_DIRECTORY lookup on trivial translatorsFlavio Cruz
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): If mustbedir, make sure entry is a directory by retrying "/", or starting the translator and retrying "/". * libnetfs/dir-lookup.c (netfs_S_dir_lookup): Likewise.
2015-12-29fix compiler warnings in hurd/libdiskfsFlavio Cruz
2015-12-01libdiskfs: use ihash for the node cacheJustus Winter
Replace the hand-written hash table in the node cache with libihash. Libihash is a self-tuning hash table, whereas the previous code used a fixed number of buckets. * libdiskfs/Makefile (HURDLIBS): Link to `ihash'. * libdiskfs/diskfs.h (struct node): Remove bucket list, add slot pointer. * libdiskfs/node-cache.c (nodecache): New ihash table replacing the old `nodehash'. (lookup): Drop function. (diskfs_cached_lookup_context): Adapt accordingly. (diskfs_cached_ifind): Likewise. (diskfs_try_dropping_softrefs): Likewise. (diskfs_node_iterate): Likewise.