History log of /haiku/headers/private/kernel/vfs.h
Revision Date Author Comments
# c6fe3673 18-Jun-2021 Jérôme Duval <jerome.duval@gmail.com>

POSIX: introduce ppoll

will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: I38014ad910881df260f0ec762831491e143328c4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4099
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# fe357eb9 05-Nov-2020 Jérôme Duval <jerome.duval@gmail.com>

POSIX: add posix_fallocate and a preallocate syscall

the preallocate syscall will call the preallocate filesystem hook, if available.

fix #6285

Change-Id: Ifff4595548610c8e009d4e5ffb64c37e0884e62d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3382
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# a9be0efb 31-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/fs: Add support for setting custom VMCaches in vnodes.

This adds one (private) VFS function, and checks in all usages of
the vnode->cache as a VMVnodeCache that it really is one. (Generic
usages, for the moment just the ReleaseRef() calls in vnode
destruction, are intentionally not touched.)

This will be used by ramfs to set the cache from its own,
so that map_file() calls on a ramfs can work.


# 8bca37d6 14-Jan-2018 Adrien Destugues <pulkomandy@pulkomandy.tk>

vfs: Bind flock locks to file descriptors

* File locks created by flock should only apply for the file descriptor
that was used to lock the file. Another fd on the same file should then
be denied access (calling flock should fail).
* fcntl based locks, however, are in a separate namespace and are global
to a team.
* This issue was found when running webkitpy test suite, and should close
ticket #13795.
* Don't use session or team as comparison in release_advisory_lock(), as
that information might not be available anymore (e.g. when called from
Team::~Team()). This fixes #14121.

Change-Id: I9efb96cfcefe7e72b0060220c635a665e7e643cc
Co-authored-by: Axel Dörfler <axeld@pinc-software.de>


# 67988f50 21-Mar-2016 Axel Dörfler <axeld@pinc-software.de>

NodeMonitor: Resolve mount points for B_WATCH_CHILDREN.

* When a watched directory contains a mount point, we need to resolve
the actual parent directory of the mount point in the file system to
serve the monitor.


# 6adf7a0c 11-Sep-2015 Axel Dörfler <axeld@pinc-software.de>

VFS: prevent FD inheritance for the kernel completely.

* Each io_context now has a "inherit_fds" member that decides whether
or not this context allows to inherit FDs to its children.
* This replaces the former O_CLOEXEC mechanism.


# 6bbd25f0 29-Oct-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Make vfs_resize_fd_table() accessible in the kernel

Also update some types from int to uint32.


# 237127fb 22-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix _user_entry_ref_to_path() in chroot

* Add "bool kernel" parameter to vfs_entry_ref_to_path(), so it can be
specified for which I/O context the entry ref shall be translated.
* _user_entry_ref_to_path(): Use the calling team's I/O context instead
of the kernel's. Fixes the bug that in a chroot the syscall would
return a path for outside the chroot.


# 195a0f35 21-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Changed argument type of fcntl syscall from uint32 to size_t.

Since this argument may be used to pass pointers, uint32 is not
correct for 64-bit. Effectively no change on 32-bit targets, both
size_t and uint32 are unsigned long there.


# 54e721af 21-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add support for bind-mounting directories

* Add support function vfs_get_mount_point(), so a file system can get
its own mount point (i.e. the node it covers). Re-added
fs_mount::covers_vnode for that purpose -- the root node isn't know to
the VFS before the mount() hook returns.
* Add function vfs_bind_mount_directory() which bind-mounts a directory
to another. The Vnode::covers/covered_by mechanism is used, so this
isn't true bind-mounting, but sufficient for what we need ATM and
cheaper as well. The vnodes connected thus aren't tracked yet, which
is needed for undoing the connection when unmounting.
* get_vnode_name(): Don't use dir_read() to read the directory. Since we
have already resolved vnode to the covered vnode, we don't want the
dirents to be "fixed" to refer to the covering nodes. Such a vnode
simply wouldn't be found.


# f4a1387c 21-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add vfs_ prefix to resolve_vnode_to_covering_vnode()


# 47ea54c5 20-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Generalize use of Vnode::covered_by/covers

* Introduce Vnode flags for covered and covering. Can be used as a quick
check when one doesn't already hold sVnodeLock.
* Rename resolve_mount_point_to_volume_root() to
resolve_vnode_to_covering_vnode().
* Adjust all code that deals with transitions between mount points and
volume root vnodes to generally support covered/covering vnodes.


# d5e36fb5 10-Aug-2011 Axel Dörfler <axeld@pinc-software.de>

* Introduced new fs_lopen_attr_dir() function that opens the attribute
directory of a file without traversing leaf links (just like lstat()).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42620 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d61a8548 21-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add support for bind-mounting directories

* Add support function vfs_get_mount_point(), so a file system can get
its own mount point (i.e. the node it covers). Re-added
fs_mount::covers_vnode for that purpose -- the root node isn't know to
the VFS before the mount() hook returns.
* Add function vfs_bind_mount_directory() which bind-mounts a directory
to another. The Vnode::covers/covered_by mechanism is used, so this
isn't true bind-mounting, but sufficient for what we need ATM and
cheaper as well. The vnodes connected thus aren't tracked yet, which
is needed for undoing the connection when unmounting.
* get_vnode_name(): Don't use dir_read() to read the directory. Since we
have already resolved vnode to the covered vnode, we don't want the
dirents to be "fixed" to refer to the covering nodes. Such a vnode
simply wouldn't be found.


# 313e1e37 21-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add vfs_ prefix to resolve_vnode_to_covering_vnode()


# 2e21fc54 20-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Generalize use of Vnode::covered_by/covers

* Introduce Vnode flags for covered and covering. Can be used as a quick
check when one doesn't already hold sVnodeLock.
* Rename resolve_mount_point_to_volume_root() to
resolve_vnode_to_covering_vnode().
* Adjust all code that deals with transitions between mount points and
volume root vnodes to generally support covered/covering vnodes.


# 137c5fe2 16-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

* add implementation of bindfs, which can be used to bind-mount
a folder to some other place in the filesystem hierarchy
* add helper function to VFS that encapsulates the "conversion" of a
vnode-pointer to a fs_vnode-pointer (used by bindfs)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40238 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 435c43f5 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced type generic_io_vec, which is similar to iovec, but uses types
that are wide enough for both virtual and physical addresses.
* DMABuffer, IORequest, IOScheduler,... and code using them: Use
generic_io_vec and generic_{addr,size}_t where necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36997 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9d570af7 24-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed the type of the "op" parameter of the fs_vnode_ops::ioctl() hook and
the _kern_ioctl() syscall from ulong to uint32.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36927 a95241bf-73f2-0310-859d-f6bbb57e9c96


# deee8524 26-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced {malloc,memalign,free}_etc() which take an additional "flags"
argument. They replace the previous special-purpose allocation functions
(malloc_nogrow(), vip_io_request_malloc()).
* Moved the I/O VIP heap to heap.cpp accordingly.
* Added quite a bit of passing around of allocation flags in the VM,
particularly in the VM*AddressSpace classes.
* Fixed IOBuffer::GetNextVirtualVec(): It was ignoring the VIP flag and always
allocated on the normal heap.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35316 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 486fffda 26-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Forgot to add linkat(), this really closes #4928 now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34289 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fb2500da 26-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Added missing AT_EACCESS.
* Implemented renameat(), faccessat(), fchownat(), fchmodat(), and mkfifoat().
* Added stub for mknodat().
* The kernel backend for faccessat() does not yet differentiate between
effective and real user/group IDs, though.
* Removed B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT, as we now support everything
(more or less). This also closes ticket #4928.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1ba04177 25-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* load_image() now has exec() semantics wrt file descriptors; before each team
would always inherit them all, causing quite a number of open files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34247 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9689e84 30-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* VFS:
- Fixed vfs_get_vnode_from_fd() return type.
- Added vfs_open_vnode().
- Added a "bool traverseLeafLink" parameter to vfs_get_fs_node_from_path().
It was always resolving symlinks.
* device manager/devfs:
- devfs: get_node_for_path() no longer resolves leaf symlinks. That still
doesn't help with file disk devices, as creating partition wouldn't work
anyway.
- Pulled the module-related implementation part of BaseDevice into new class
AbstractModuleDevice and made all methods of BaseDevice virtual. Small
adjustments to devfs to be happy with the new BaseDevice interface.
- Added BaseDevice subclass FileDevice, which maps the interface to a file's
file descriptor. Still got a few TODOs, but should basically work.
- Use FileDevice for publishing file disk devices in devfs. Now those do
actually work, though there's some BFS trouble with one of the images I
tested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33385 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8ae594ff 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Introduced dedicated syscalls for the deprecated BeOS fs_attr API. Before,
each attribute access needed 3 syscalls, now only one as it should.
* Renamed the new Haiku call fs_open_attr() to fs_fopen_attr(), and added a new
function fs_open_attr() that takes a path (same semantics as the
fs_[f]open_attr_dir() functions already present in BeOS).
* Merged former _kern_open_attr(), and _kern_create_attr() into one syscall.
* Cleaned up vfs.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31881 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eb2bd0e8 27-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

axeld:
* Implemented a way to do asynchronous pre-fetching when mapping files.
* There are slight code duplications in some places that could benefit
from cleaning up, but nothing too bad.
* Implementing smarter ways to trigger prefetching and more analysis of
the situations in the kernel would be nice. Currently up to 10 MB
of every mapped file are pre-fetched without further analysis.
* The speed improvement is nice for certain operations. On our test
system (real hardware), Firefox took 9 seconds from being launched
to display a window. Now it takes 5 seconds. Both measurements
right after booting. The same system took 35 seconds from launching
Haiku in the GRUB menu to displaying the Tracker desktop background
image. Now it takes 27 seconds.
* We didn't have the chance to check out the effects of this on the
CD boot, but potentially, they could speed it up a lot.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30465 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ecc4b37 01-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced ref-counting for the I/O contexts.
* The I/O context related vfs_*() functions have io_context* instead of void*
parameters/return values, now.
* vfs_new_io_context(): Lock the parent I/O context before getting its table
size. Otherwise the table size could change until we do.
* vfs_resize_fd_table(): Fixed use of MutexLocker. We created only a temporary
object, not one with function scope.
* Renamed load_image_etc() to load_image_internal() and added a parameter for
specifying the parent team of the one to create.
* Introduced a kernel private load_image_etc() with a few more arguments than
load_image().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29375 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e8d3eff9 26-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* vfs_normalize_path() and _user_normalize_path() use a common helper
function (normalize_path()), now. There was some code duplication
before.
* Added "bool traverseLink" parameter to vfs_normalize_path(). When
true and the leaf component is a symlink, it will be resolved.
* KPath:
- Added similar leaf link traversal parameter to SetTo() and
SetPath().
- Added Normalize().
- Added DetachBuffer(), which returns the object's current buffer and
unsets itself.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27751 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 66394896 18-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added method vfs_asynchronous_write_pages(), which, unsurprisingly,
writes the given page iovecs asynchronously. The new class
AsyncIOCallback is used to inform the caller when the request has been
finished.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27055 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f12cc54 30-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
classes have grown new methods and attributes to deal with that. The
"finished" callbacks have got additional parameters to indicate
whether the transfer was only partial and how much has been
transferred. Other callbacks and functions have a size_t* in/out
parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
of the underlying FS's {read,write}_pages() hooks (those should be
unused now). Furthermore they've got an additional "flags" parameter,
which is passed to IORequest::Init(), i.e. it allows to specify that
the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
driver I/O requests are passed all the way from the VFS/VM to the
driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
methods.
* Disabled some debug output by default. Added new optional debug
output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26692 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cfae07b6 28-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added kernel private vfs_vnode_io() which performs an io_request on a
vnode (falling back to synchronous I/O if the io() is not supported).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26672 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ec598fe4 27-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added FS interface hooks io() and cancel_io(). The former is supposed
to provide asynchrounous (or only synchronous, if asynchronous is not
supported) I/O request support. It will eventually replace
{read,write}_pages(). None of the FS implementations implement them
yet.
* Implemented some support functions for request-based I/O. File system
implementations can use do_fd_io() which passes an I/O request to the
layer responsible for a given FD, and do_iterative_fd_io(), which
translates a request for a file to subrequests for the underlying
device and passes them on. Both fall back to synchrounous processing
when the io() hook is not supported.
Furthermore added vfs_synchronous_io() which should be handy for the
devfs to perform io_requests synchronously for devices that don't
support the io() hook.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26655 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e6bd90c5 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* bfs_fsync() was the only place which could cause the
fs_vnode_ops::write_pages() to be called with fsReenter = true. Since
this is no longer the case, the argument has become superfluous. For
read_pages() it always was. Removed the argument from the functions
and all functions that propagated it.
* Some whitespace at the end of lines was removed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26579 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c99d639 22-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged branch haiku/branches/developer/bonefish/vm into trunk. This
introduces the following relevant changes:
* VMCache:
- Renamed vm_cache to VMCache, merged it with vm_store and made it a
C++ class with virtual methods (replacing the store operations).
Turned the different store implementations into subclasses.
- Introduced MergeStore() callback, changed semantics of Commit().
- Changed locking and referencing semantics. A reference can only be
acquired/released with the cache locked. An unreferenced cache is
deleted and a mergeable cache merged when it is unlocked. This
removes the "busy" state of a cache and simplifies the page fault
code.
* Added VMAnonymousCache, which will implement swap support (work by
Zhao Shuai). It is not integrated and used yet, though.
* Enabled the mutex/recursive lock holder asserts.
* Fixed DoublyLinkedList::Swap().
* Generalized the low memory handler to a low resource handler. And made
semaphores and reserved memory handled resources. Made
vm_try_resource_memory() optionally wait (with timeout), and used that
feature to reserve memory for areas.
...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26572 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6b202f4e 13-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced new header directory headers/private/system which is supposed
to contain headers shared by kernel and userland (mainly libroot).
* Moved quite a few private kernel headers to the new location. Split
several kernel headers into a shared part and one that is still kernel
private. Adjusted all affected Jamfiles and source in the standard x86
build accordingly. The build for other architectures and for test code
may be broken.
* Quite a bit of userland code still includes private kernel headers.
Mostly those are <util/*> headers. The ones that aren't strictly
kernel-only should be moved to some other place (maybe
headers/private/shared/util).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25486 a95241bf-73f2-0310-859d-f6bbb57e9c96


# df50f7a9 10-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the way the socket functions work:
- The net_stack driver is no longer used. Instead we have a kernel
module which is directly used by syscall implementations in the
kernel. I.e. we no longer tunnel those functions through ioctls, but
have normal syscalls.
- Removed the superfluous net starter module.
- Implemented the FDTYPE_SOCKET type file_descriptors, that is sockets
are no longer vnode based.
- Adjusted libnetwork (the socket function implementations)
accordingly.
- Adjusted netstat accordingly.
* Socket module:
- Implemented socketpair().
- Added "kernel" parameter to the control hook. Quite a few more hooks
would actually need the parameter, but I didn't change those yet,
since that would probably also require changes to the protocol
module interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f8b4d83f 09-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

New service function vfs_create_special_node() to create special nodes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24883 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc380199 06-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Rename vfs_stat_entry_ref() to vfs_stat_node_ref() as that's what a dev_t and
ino_t combination really is.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24825 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e36a49e 05-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added _kern_create_pipe() syscall, creating a pipe as an entryless
FIFO. Reimplemented pipe() to use it.
* pipefs is no longer mounted. Will remove the superfluous code soon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24823 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7ffafac8 05-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reorganized the FS interface a little:
- Moved most file_system_module_info hooks into separate structures.
Those that operate on mounted volumes to fs_volume_ops, those
operating on a vnode to fs_vnode_ops.
- Got rid of the fs_volume, fs_cookie, fs_vnode typedefs. We use void*
again.
- Instead of a void* volume and node cookie hooks are passed a
fs_volume and fs_vnode structure pointer, which contain the cookie
and an ops pointer (fs_volume a few more things).
- The VFS {new,publish,get,...}_vnode() functions take a fs_volume*
instead of the volume ID. So does vfs_get_fs_node_from_path().
- Added type and flags arguments to publish_vnode() and the
get_vnode() hook and removed the type argument from lookup() hook.
Added vnode::type using formerly unused bits to store the node type.
Simplified a few things in the VFS due to the now always available
node type.
- Added fs_volume_ops::{create,delete}_sub_vnode() and
fs_vnode_ops::get_super_vnode() hooks. They are used to support file
system layers, e.g. allowing to extend an FS not supporting BeOS
attribute with attribute support. Needs some more work in the VFS.
- Added fs_vnode_ops::create_special_node() hook for creating special
nodes (e.g. FIFOs).
* Adjusted the built-in file systems and BFS according to the interface
changes. Removed all other FSs from the image for the time being.
We'll see whether further API changes are necessary before porting
them.
* Adjusted the bfs_shell accordingly.
* Implemented create_special_node() in rootfs to support special nodes.
* Added support for FIFOs:
- Added syscall _kern_create_fifo() (used by mkfifo()), which creates
a special node (type S_IFIFO) in the respective file system.
- When a special node is published the VFS creates a respective sub
node. Currently only FIFOs are supported.
- Added a little support for FIFO subnodes by using functionality from
the pipefs.
- Added mkfifo to the image. It can create FIFOs in the rootfs, but
the FIFOs aren't really usable ATM, since they still work like
pipes, i.e. readers and writers need to have them open at the same
time.
* Some smaller changes in the VFS:
- Made the *_CALL macros nicer to use (vargs).
- Refactored FS entry lookup into new function lookup_dir_entry().
- create_vnode() no longer just calls the FS create() hook. First it
looks up the entry and uses open_vnode(), if it already exists. This
is necessary for two reasons: 1) The FS might not support create()
while still allowing to open() entries. 2) When the FS has other
layers on to of it (or the respective node) it might not be
responsible for opening the node.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24816 a95241bf-73f2-0310-859d-f6bbb57e9c96


# efb965d5 05-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Introduce vfs_stat_entry_ref() that allows to stat a vnode based on a dev_t
and ino_t instead of a path. Supposed to work with node monitoring messages.
Took the name from vfs_entry_ref_to_path() that takes the same arguments, but
suggestions for a better name are welcome.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24813 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 360be1fc 29-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented support for chroot:
- Added a "root" vnode to the io_context. It is used for resolving
paths and converting nodes to paths instead of sRoot. Some more
passing around of io_context structures was necessary.
- Introduced a new lock sIOContextRootLock to protect
io_context::root. The current uses of io_context::io_mutex
(put_vnode(), remove_vnode() while holding it) looked too suspicious
to use that mutex in vnode_path_to_vnode().
- Added _kern_change_root() syscall and chroot() libroot function.
- Added chroot coreutils program to the image. Funnily it seems to be
much easier to set up a little jail than under Linux (just copy
bash and libroot.so into respective subdirs; mount another pipefs
if you want pipe support).
With Haiku allowing direct access to directories via inode IDs
jailing is obviously not very secure at the moment.
- Added /var/empty to the image. It will be the chroot target for ssh.
* Changed vfs.cpp:get_cwd() so that the io_context::io_mutex is no
longer held when calling dir_vnode_to_path().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24673 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c117a6d 29-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added function vfs_read_stat() that also allows for stat()ing files in
the user IO context from within the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24667 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4f26630d 27-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Factored a vfs_entry_ref_to_path() out of _user_entry_ref_to_path()
and made it public (within the kernel).
* _user_entry_ref_to_path() is now using that function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24151 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c986936 07-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added new syscall _kern_normalize_path() to normalize a path.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23929 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a32a4683 03-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Implemented flock() semantics to the advisory locking backend. Not tested
(must also compare to BSD; I've looked at their sources, but I might have
missed something).
* Added sys/file.h and the flock() system call.
* common_fcntl() could forget to put back the file descriptor on some error
conditions (I guess we should introduce and use a DescriptorGetter class).
* Cleaned up fcntl.h, moved the BSD extensions S_IREAD and S_IWRITE to
sys/stat.h where they belong, and added the missing S_IEXEC to them.
* Added some more comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23836 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e122bd9 12-Nov-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld + bonefish: Missed those changes in the previous commit:
* Added vfs_unmount(), which allows unmounting by dev_t (used by the DDM).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22910 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3d268eda 10-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* Extracted file_map API out of the file cache - it's now an optional service
that can be used by file systems.
* Changed the way the file cache works: instead of reading/writing to the
underlying device directly, it can now be used for any data source, ie.
also network file systems.
* As a result, the former pages_io() moved to the VFS layer, and can now be
called by a file system via {read|write}_file_io_vec_pages() (naming
suggestions are always welcomed :-)). It now gets an FD, and uses that to
communicate with the device (via its fs_{read|write}_pages() hooks).
* The file_cache_{read|write}() functions must now be called without holding
an I/O relevant file system lock. That allows the file cache to prepare the
pages without colliding with the page writer, IOW the "mayBlock" flag can
go into the attic again (yay!).
* This also results in a much better performance when the system does I/O and
is low on memory, as the page writer can now finally write back some pages,
and that even without maxing out the CPU :)
* The API changes put slightly more burden on the fs_{read|write}_pages()
hooks, but in combination with the file_map it's still pretty straight
forward. It just will have to dispatch the call to the underlying device
directly, usually it will just call its fs_{read|write}_pages() hooks
via the above mentioned calls.
* Ported BFS and FAT to the new API, the latter has not been tested, though.
* Also ported the API changes to the fs_shell. I also completely removed its
file cache level page handling - the downside is that device access is no
longer cached (ie. depends on the host OS now), the upside is that the code
is greatly simplified.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22886 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0710d59c 08-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a "canWait" argument to vfs_get_vnode() - you can use this to ignore
busy vnodes.
* dir_create_entry_ref() used get_vnode() incorrectly (and could therefore
potentially prevent a file system from doing proper locking when called
from the kernel).
* The vnode_store now uses this for its acquire_unreferenced_ref()
implementation (and therefore for the page writer).
* read_into_cache() and write_to_cache() were still marked inline.
* The system will now wait 10 secs for a busy vnode before returning an error.
* It will also no longer panic in that case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22485 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 80f54692 06-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* struct vnode is an opaque type now, removed void* where it was used incorrectly.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22461 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3e9513aa 03-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* fs_{write|read}_pages() now has an additional argument "mayBlock".
* the page writer don't allow to block, while all other writers do. This fixes
bug #1509. The reason the page writer needs this is because it marks several
pages from different caches as busy.
* Fixed a warning about ASSERT being defined already in BFS, since
util/DoublyLinkedList.h now includes debug.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22434 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 66c03dc3 30-Sep-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* fd.c -> fd.cpp
* Reworked the select support:
- The io_context additionally stores a table of lists of select_infos,
which enables it to deselect events of a pending select() when
closing a FD. This prevents a race condition potentially causing a
write to stale memory.
- The opaque selectsync* passed to FSs is now actually a select_info*.
This was necessary, since the FDs deselect() hook (unlike the
select() hook) doesn't take a "ref" argument and deselecting a
single info (e.g. caused by a premature close()) was not possible.
The select() hook's "ref" argument has become superfluous.
- It should now be relatively easy to implement a poll_on_steroids()
that can also wait for objects other than FDs (e.g. semaphores,
ports, threads etc.).
* Set/reset the signal mask in common_select(). This makes pselect()
work as required.
* Reorganized vfs_resize_fd_table().



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22391 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6d4aea47 25-Sep-2007 Axel Dörfler <axeld@pinc-software.de>

bonefish+axeld:
* Removed the vm_cache/vm_store ref_count duality that besides being a bit ugly
also created the page dameon cache retrieval problem: now, only areas (and
cache consumers) retrieve a reference to the store (and therefore, the vnode).
The page daemon doesn't need to care about this at all anymore, and the pseudo
references of the vm_cache could be removed again.
* Rearranged deletion of vnodes such that its ID can be reused directly after
fs_remove_vnode() has been called.
* vm_page_allocate_page() no longer panics when it runs out of pages, but just
waits for new pages to become available using the new sFreeCondition condition
variable - to make sure this happens in an acceptable time frame, it'll
trigger a run of the low memory handlers.
* Implemented a page_thief() that steals inactive pages from caches and puts
them into the free queue. It runs as a low memory handler.
* The file cache now sets the usage count on the pages it inserts into the
cache (needs some rework though, cache_io() doesn't do it yet).
* Instead of panicking, the kernel will currently dead lock in low memory
situations, since BFS does a bit too much in bfs_release_vnode().
* Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22315 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 58f6e8e5 17-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Merged vm_cache_ref and vm_cache to a single structure (Axel & Ingo).
* Renamed vm_cache.c to vm_cache.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21642 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 245aecda 21-Jun-2007 Axel Dörfler <axeld@pinc-software.de>

Got rid of vnode_id and mount_id, replaced with ino_t and dev_t.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21485 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2dedc014 19-Feb-2007 François Revol <revol@free.fr>

Use same figures as BeOS for soft and ahrd maximums on fd and mon tables (even though we don't use a table for mons).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20164 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f5fa54f7 12-Jan-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

Improved error reporting when a failure to find/mount the root device occurs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19774 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8265e121 02-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented mandatory file locking, BeOS style. BNode::Lock() and BNode::Unlock()
are now working as expected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17697 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 97e06971 12-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Added a "reenter" parameter to the {read|write}_pages() functions to give file
systems a chance to know if they have locked already.
This fixes a locking problem in BFS where one thread tried to acquire two read
locks (where someone else trying to acquire a write lock would have caused a
dead lock).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17108 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 606e0d36 27-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Factored out the vnode disconnection code from fs_unmount() to a separate
function, and added a vfs_disconnect_vnode() for other kernel components.
* devfs_unpublish_device() can now optionally make use of this call.
* Fixed the type check of devfs' unpublish_node().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16907 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9f6376a0 06-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* get_vnode() did not decrease the sUnusedVnodes counter when taking one node
of that list.
* Added a vfs_free_unused_vnodes() function that calls the low memory handler
directly.
* create_sem_etc() now calls the above function in case there are no semaphores
available anymore; this usually frees up to 2 semaphores per node (one from
the cache if there is a file cache attached, and eventually one from the
file system).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16610 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5a2ad00c 20-Feb-2006 Jérôme Duval <korli@users.berlios.de>

fix a TODO in _user_mount : added an argsLength parameter


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16480 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 979aeaf7 25-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed bug #97:
* BEntry::Remove() now uses _kern_remove_dir() for directories.
* Added fd parameter to _kern_remove_dir().
* Fixed LibBeAdapter's _kern_unlink() to only work on files, and
added _kern_remove_dir() for directories.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16078 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0e382a46 16-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented a syscall to get information about the open file descriptors of all teams.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15991 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2db3fced 17-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Moved vfs_bootstrap_file_systems() and vfs_mount_boot_file_system() out of vfs.cpp
and into its own file vfs_boot.cpp.

Added basic support for booting from CD - it doesn't give CDs a higher priority,
so you could end up booting from HD when you didn't explicetly select "CD-ROM"
in the boot loader. Eventually, it should only boot from HD in this case, if
booting from CD failed (because of a missing boot partition or whatever).

fs_mount(), _kern_mount(), and _user_mount() will now return the dev_t of the
mounted device, and not just B_OK. Maybe we should have fs_unmount() work on
a dev_t instead of a path as well...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14403 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a63d903 06-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Added kernel private VFS functions vfs_entry_ref_to_vnode() and vfs_vnode_to_node_ref().
Minor cleanup of vfs.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14314 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 681779f1 06-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Our close-on-exec flag handling was broken: it's supposed to be specified per slot, not
per file descriptor (a descriptor can be shared among several slots). There is now a
second table in the io_context structure that contains that information in a bitmap.
There are now two new (private) functions to control the close-on-exec flag, fd_close_on_exec(),
and fd_set_close_on_exec().
F_DUPFD, dup(), and dup2() are supposed to clear the close-on-exec flag on the duplicated
slot - this fixes bug #57 (no output after a redirect of a shell builtin).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14313 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7964c56d 09-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Added vfs_get_cwd() call to get the mount_id and vnode_id of the current
working directory (instead of the full path).
Cleanup of some remaining "int" status variables (where it should have
been a "status_t").


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13924 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eab435cd 05-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

vfs_get_vnode_cache() now only allocates a new cache if requested: this
prevents the system to allocate caches for files that don't use or have
a file cache (ie. only those can be mmap()ed!).
Therefore, cache_prefetch() no longer crashes when trying to prefetch
files without a file cache.
read_into_cache() no longer does anything if the requested size is 0.
Fixed a bug in cache_prefetch_vnode(): if the cache couldn't be retrieved,
it put the vnode, but didn't own it (the caller does).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13904 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b72cf260 01-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed vfs_vnode_acquire_ref() to vnode_acquire_vnode().
Removed vfs_vnode_release_ref(), as vfs_put_vnode() already does the same thing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13867 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b7d8ef5a 01-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

The term vnode_ptr is not used anywhere else; renamed vfs_put_vnode_ptr() to vfs_put_vnode().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13865 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 219dacab 06-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Changed our read link syscall and FS interface call to make it easily possible to be POSIX compliant.
Also changed readlink() to be POSIX compliant with those changes.
"ls -l" does now resolve links properly again (the new coreutils version outlined the problems).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12263 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74b043d9 17-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Removed execute property that was set accidently (since CVS days).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11896 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9391dd21 17-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed broken handling of the new file_descriptor::open_count across
team boundaries; if you didn't actually call close() from within the
application, the close-hook of the file system was never called.
Also, you could close files of other teams (ie. invoke close on a
shared file descriptor).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11892 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d12de920 01-Feb-2005 Axel Dörfler <axeld@pinc-software.de>

Added some more convenience VFS calls (vfs_stat_vnode(), and vfs_get_vnode_name()).
Removed *_create() and *_create_entry_ref() syscalls - they are now handled by
*_open() and *_open_entry_ref() calls which get another parameter for the permissions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11204 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 244f03dc 30-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the autolocking code for recursive lockers to <util/AutoLock.h>.
* Added resolve_mount_point_to_volume_root() version for external use
(by the node monitor).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11159 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d786bd13 13-Dec-2004 Axel Dörfler <axeld@pinc-software.de>

Renamed vfs_get_vnode() to vfs_lookup_vnode() as it doesn't grab a ref to the node.
Added new vfs_get_vnode() that actually grabs such a ref.
vfs_get_vnode_cache() now fills a vm_cache_ref instead of a void pointer.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10430 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dfb71e04 12-Dec-2004 Axel Dörfler <axeld@pinc-software.de>

Added a query length parameter to _kern_open_query() - it's much easier to
do these things in userland.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10397 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4c8e8f2f 29-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Added "flags" parameter to unmount.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 06db2509 15-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

vfs_mount_boot_file_system() now also gets the kernel_args.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9964 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 424f90af 03-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for readv/writev() syscalls.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9766 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eef5d24c 31-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Changed the last argument of _kern_mount() to be a string rather than a void pointer.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9691 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7fb2963a 28-Oct-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added vfs_normalize_path() service call.
* Added resolve_mount_point_to_volume_root() which does what
resolve_volume_root_to_mount_point() did. IOW the latter one didn't
do what it advertised.
* Fixed dir_vnode_to_path(). Basically broken due to the broken
resolve_volume_root_to_mount_point(), but also compared potentially
unrelated vnode IDs (belonging to different volumes).
* Fixed get_dir_path_and_leaf(). It didn't deal correctly with paths
ending in '/' (including the root dir).
* fs_mount() does now accept a NULL fsName, getting the FS name from
the DDM in this case.
* fs_mount() now also supports mounting file images; it lets the DDM
create a file device for them.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9629 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d5b7e0b 27-Oct-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_mount() now has a flags parameter, too.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9544 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7b5e243a 27-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototype for the new vfs_get_fs_node_from_path() function. It's
currently only used in devfs for the publication of partitions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9533 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 76dede71 07-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added exec() support function vfs_exec_io_context().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9241 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6acb6724 05-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

New syscall for fcntl().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9200 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 57549ff4 30-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Removed vfs_types.h - it's no longer needed.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9143 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4a02ef9f 30-Sep-2004 François Revol <revol@free.fr>

notify_select_event moved to headers/os/drivers/Drivers.h where it belong


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9138 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cfd8ea78 06-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Added a "cookie" parameter to the vfs_read|write|has_page[s]().
Also added a prototype for the fs_get_file_map() fs call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8867 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1b4746c2 04-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Changed the VM store and VFS functions a bit to better match the corresponding driver hooks.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8844 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8b3bd22a 03-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Added vfs_get_vnode() prototype.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8826 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 36ce5c01 03-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Changed the way the vnode cache is set - it's now cleaner and can no longer
allocate a cache twice.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8815 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9955b99a 28-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Several VFS related syscalls have been changed, added or removed.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8701 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c28c0592 07-Jul-2004 Axel Dörfler <axeld@pinc-software.de>

Added all syscalls needed for the next_dev() call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8346 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 63e846d5 02-Jul-2004 Axel Dörfler <axeld@pinc-software.de>

Added a syscall to get a path for a directory node_ref.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8278 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 645e1388 01-Jul-2004 Axel Dörfler <axeld@pinc-software.de>

Moved vfs/fd _kern_*() calls to syscalls.h.
Removed some includes from syscalls.h where possible, minor style changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8256 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 734893f6 15-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Renamed all VFS syscalls to the new style.
Improved returned types.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7963 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2defe47a 07-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Removed no longer used system call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7814 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aad3f70c 07-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Moved the public fs functions to fs_interface.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7800 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ac15401 10-May-2004 Axel Dörfler <axeld@pinc-software.de>

Changed the "stat" related syscalls to have an additional parameter that specified
the size of the stat structure to allow extensions of that structure.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7493 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cdbef380 05-May-2004 Axel Dörfler <axeld@pinc-software.de>

Changed some return codes to status_t where appropriate.
Renamed vfs_bootstrap_all_filesystems() to vfs_bootstrap_file_systems().
Renamed vfs_register_filesystem() to vfs_register_file_system().
Added new call vfs_mount_boot_file_system().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7421 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7d5be143 22-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

We have status_t.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6692 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c7a03dad 08-Sep-2003 Axel Dörfler <axeld@pinc-software.de>

list.h is now in util/.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4594 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5306fba3 07-Sep-2003 Axel Dörfler <axeld@pinc-software.de>

Added the new vfs_get_module_path() call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4558 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 318ea28b 03-Sep-2003 Axel Dörfler <axeld@pinc-software.de>

Added internal syscalls (_user/_kern) for fs_read_info() and fs_write_info().
Not yet accessible from the outside.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4493 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 564cba31 03-May-2003 Axel Dörfler <axeld@pinc-software.de>

Some header work: removed unnecessary dependencies to stage2.h, fixed
some broken C++ export definitions, added missing licenses etc.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3152 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 896aefa8 21-Feb-2003 Axel Dörfler <axeld@pinc-software.de>

Added a new call vfs_new_vnode(), replaced "int" return type to status_t
for the VFS vnode functions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2785 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f9bdcca5 18-Jan-2003 Axel Dörfler <axeld@pinc-software.de>

Added kernel private node_monitor.h header.
Moved definition of "struct io_context" from fd.h to vfs.h.
Introduced new fs/ directory; some cleanups to come.
Added node monitor syscalls.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2479 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ef7716d 02-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added a missing const to the (sys|user)_select() call.
Broke binary compatibility for the notify_select_event(), since it obviously
hasn't been used on R5 at all.
The new API/implementation is much nicer to use.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1830 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a2cbc788 28-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Adds support for select(), and poll() in the kernel - both are realized
using the current BeOS device API.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1745 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 146a3000 17-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added syscalls for the index functions.
Corrected the prototype for fs_rewind_index_dir() (don't copy and paste...)
Also checked in the syscall definitions for the signal stuff to save Angelo
some work.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1562 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e5ca65b 16-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added a new write_stat() call to the file descriptor operations.
Renamed sys_read_stat() to sys_read_path_stat() - sys_read_stat() is now
the fd operation.
Removed the sys_write_attr_stat() call because it is no longer needed.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1554 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 11fe0cb8 07-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for the sys_/user_ attribute calls.
Changed the file_descriptor structure (more status_t, name removed).
Changed "extern inline" to "static inline" in thread.h/arch_thread.h as those
also work with -O0 -g.
Added prototypes for [arch_cpu_]user_strlcpy().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1454 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3c6bf0c8 25-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Renamed "calls" to "ops".
Removed unused prototype.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1179 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4dc5ecd3 25-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Renamed fs_id to mount_id.
Moved typedefs for mount_id and vnode_id to fs_interface.h.
Removed some unused stuff in ktypes.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1173 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4c405cbd 13-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

The fs interface functions should now return a "status_t" rather than an "int".
Added syscalls for, and implemented sys_create_link(), sys_remove_dir().
Implemented link(), unlink(), rmdir().
Fixed the inconsistent path buffer handling in the user|sys vfs functions; the
path buffer is now exactly SYS_MAX_PATH_LEN from userland (incl. terminating
null byte).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@748 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 854fc92a 13-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Implemented some more calls in unistd.h.
Replaced the unused syscall for getdtablesize() with one for access().
Implemented sys_access() and added it to the file system interface.
Removed the fs function interface from vfs.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@738 a95241bf-73f2-0310-859d-f6bbb57e9c96


# beddff0f 09-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Replaced opendir.c with directory.c, implemented chdir(), fchdir(), and
getcwd().
Introduced new xyz(int fd, char *path, ...) style of functions for
sys_setcwd(), and sys_write_stat().
Added missing sys_fstat(). Removed duplicated prototypes in syscalls.h
Fixed some minor bugs.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@669 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d7dd1c2a 09-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Changed argument order for sys_read/write() to be more intuitive.
Removed unistd.h (new BeOS-like unistd.h will be in posix/ shortly)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@664 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dc74f4ac 05-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Added a comment in memheap.h
Added sys|user_write_link() to vfs.h


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@595 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dfa8e8ef 04-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Added a sys_write_link() function.
Added a "mode" parameter to the sys_create_symlink() function.
Added an open_mode to the file_descriptor struct.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@591 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ae372703 02-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Big commit: Added symlink support to the kernel.
- added needed syscalls to access symlink support from userland
- implemented lstat(), symlink(), and readlink()
- added dev_t to ktypes.h (for now - should be in a public header anyway)
- added symlink support to the "ls" command (now calls lstat() and shows the
link target with the -l option)
- changed the sys_read_stat() call to support symlinks, and updated files
using that function (it gets an extra argument: bool traverseLink)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@560 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3aaee8e5 28-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Beginnings of the symbolic link support, though it's not yet working.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@507 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 973b9ee6 23-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Added the syscalls for sys_open_entry_ref(), sys_create_entry_ref(),
sys_open_dir_entry_ref(), sys_open_dir_node_ref(), sys_create_dir_entry_ref().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@394 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 071f62bc 19-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Major code cleanup and reorganisation.
Fixed many bugs.
Now, the vfs_ prefix is for functions that are called by other parts of the
kernel. file_ is for file related stuff, dir_ for directory related, and
common_ for both, fs_ for general file system stuff.
Put all prefixed functions together in the source.
Implemented (currently without a user/sys call) opening/creating of entry_refs,
and node_refs (the latter for opening directories only).
Moved vfs_dup(), and vfs_dup2() to fd.c, fd_dup(), and fd_dup2().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@351 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ba948746 18-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Added a fs_get_vnode_name() call for the file systems.
Fixed a header dependency in sem.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@314 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b79d207d 17-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

user|sys_seek() now returns an off_t.
Changed the fd_close() call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@267 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eba8b6cf 13-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Next update of the VFS: more posix like open/create; divided create in
sys_create(), and sys_create_dir(), open in sys_open(), and sys_open_dir().
Small cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@207 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f8d76107 10-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Added the syscalls for sys_read_dir(), and sys_rewind_dir().
sys_read_dir() now has a parameter for the maximum number of dirents that
are handled by the upper layer - which is currently 1.
Added a comment in fd.h to ease the location of the sys|user prototypes
of the corresponding functions in fd.c.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@58 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6adf7a0c75beebd9a9bd48602f50ac7c7ae8056e 11-Sep-2015 Axel Dörfler <axeld@pinc-software.de>

VFS: prevent FD inheritance for the kernel completely.

* Each io_context now has a "inherit_fds" member that decides whether
or not this context allows to inherit FDs to its children.
* This replaces the former O_CLOEXEC mechanism.


# 6bbd25f071e5981c15444c8ba28a92b145b77566 29-Oct-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Make vfs_resize_fd_table() accessible in the kernel

Also update some types from int to uint32.


# 237127fbe4071abea20f3e5005f5a1e549f12788 22-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix _user_entry_ref_to_path() in chroot

* Add "bool kernel" parameter to vfs_entry_ref_to_path(), so it can be
specified for which I/O context the entry ref shall be translated.
* _user_entry_ref_to_path(): Use the calling team's I/O context instead
of the kernel's. Fixes the bug that in a chroot the syscall would
return a path for outside the chroot.


# 195a0f350e3acd76856016f673c8a871ed687a07 21-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Changed argument type of fcntl syscall from uint32 to size_t.

Since this argument may be used to pass pointers, uint32 is not
correct for 64-bit. Effectively no change on 32-bit targets, both
size_t and uint32 are unsigned long there.


# 54e721afeb11349677b5b9e39c61312753a33cef 21-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add support for bind-mounting directories

* Add support function vfs_get_mount_point(), so a file system can get
its own mount point (i.e. the node it covers). Re-added
fs_mount::covers_vnode for that purpose -- the root node isn't know to
the VFS before the mount() hook returns.
* Add function vfs_bind_mount_directory() which bind-mounts a directory
to another. The Vnode::covers/covered_by mechanism is used, so this
isn't true bind-mounting, but sufficient for what we need ATM and
cheaper as well. The vnodes connected thus aren't tracked yet, which
is needed for undoing the connection when unmounting.
* get_vnode_name(): Don't use dir_read() to read the directory. Since we
have already resolved vnode to the covered vnode, we don't want the
dirents to be "fixed" to refer to the covering nodes. Such a vnode
simply wouldn't be found.


# f4a1387cea3b8a441bc1d952bc562ae34af6647c 21-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add vfs_ prefix to resolve_vnode_to_covering_vnode()


# 47ea54c55bed272f7c506b23d1ff8216e6a57a96 20-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Generalize use of Vnode::covered_by/covers

* Introduce Vnode flags for covered and covering. Can be used as a quick
check when one doesn't already hold sVnodeLock.
* Rename resolve_mount_point_to_volume_root() to
resolve_vnode_to_covering_vnode().
* Adjust all code that deals with transitions between mount points and
volume root vnodes to generally support covered/covering vnodes.


# d5e36fb599b43a6a9dfb3cf8e95018fe15780219 10-Aug-2011 Axel Dörfler <axeld@pinc-software.de>

* Introduced new fs_lopen_attr_dir() function that opens the attribute
directory of a file without traversing leaf links (just like lstat()).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42620 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d61a8548f9d5efd322004bfd62c57e5a3891cdbf 21-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add support for bind-mounting directories

* Add support function vfs_get_mount_point(), so a file system can get
its own mount point (i.e. the node it covers). Re-added
fs_mount::covers_vnode for that purpose -- the root node isn't know to
the VFS before the mount() hook returns.
* Add function vfs_bind_mount_directory() which bind-mounts a directory
to another. The Vnode::covers/covered_by mechanism is used, so this
isn't true bind-mounting, but sufficient for what we need ATM and
cheaper as well. The vnodes connected thus aren't tracked yet, which
is needed for undoing the connection when unmounting.
* get_vnode_name(): Don't use dir_read() to read the directory. Since we
have already resolved vnode to the covered vnode, we don't want the
dirents to be "fixed" to refer to the covering nodes. Such a vnode
simply wouldn't be found.


# 313e1e37f229242df626cb34f466d388590d62d9 21-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add vfs_ prefix to resolve_vnode_to_covering_vnode()


# 2e21fc543649e665507240f0803de9dddc26f152 20-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Generalize use of Vnode::covered_by/covers

* Introduce Vnode flags for covered and covering. Can be used as a quick
check when one doesn't already hold sVnodeLock.
* Rename resolve_mount_point_to_volume_root() to
resolve_vnode_to_covering_vnode().
* Adjust all code that deals with transitions between mount points and
volume root vnodes to generally support covered/covering vnodes.


# 137c5fe2ba9706736db4af57584b663b1b282f6c 16-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

* add implementation of bindfs, which can be used to bind-mount
a folder to some other place in the filesystem hierarchy
* add helper function to VFS that encapsulates the "conversion" of a
vnode-pointer to a fs_vnode-pointer (used by bindfs)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40238 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 435c43f5912b109e7d5cf682865d2061e62fad8c 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced type generic_io_vec, which is similar to iovec, but uses types
that are wide enough for both virtual and physical addresses.
* DMABuffer, IORequest, IOScheduler,... and code using them: Use
generic_io_vec and generic_{addr,size}_t where necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36997 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9d570af7c878ba30043b23e6dce5f3ae5578aa7c 24-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed the type of the "op" parameter of the fs_vnode_ops::ioctl() hook and
the _kern_ioctl() syscall from ulong to uint32.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36927 a95241bf-73f2-0310-859d-f6bbb57e9c96


# deee8524b7534d9b586cbcbf366d0660c9769a8e 26-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced {malloc,memalign,free}_etc() which take an additional "flags"
argument. They replace the previous special-purpose allocation functions
(malloc_nogrow(), vip_io_request_malloc()).
* Moved the I/O VIP heap to heap.cpp accordingly.
* Added quite a bit of passing around of allocation flags in the VM,
particularly in the VM*AddressSpace classes.
* Fixed IOBuffer::GetNextVirtualVec(): It was ignoring the VIP flag and always
allocated on the normal heap.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35316 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 486fffdaaf7f16e65bea9f4fde7d5d3c3726ece8 26-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Forgot to add linkat(), this really closes #4928 now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34289 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fb2500da15e8c574cbb343b8fc536d7094357f54 26-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Added missing AT_EACCESS.
* Implemented renameat(), faccessat(), fchownat(), fchmodat(), and mkfifoat().
* Added stub for mknodat().
* The kernel backend for faccessat() does not yet differentiate between
effective and real user/group IDs, though.
* Removed B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT, as we now support everything
(more or less). This also closes ticket #4928.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1ba04177d3f10173d03433e9a7d37e46c2161428 25-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* load_image() now has exec() semantics wrt file descriptors; before each team
would always inherit them all, causing quite a number of open files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34247 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9689e8492e520d532410c762bb3d5e3a5ac4819 30-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* VFS:
- Fixed vfs_get_vnode_from_fd() return type.
- Added vfs_open_vnode().
- Added a "bool traverseLeafLink" parameter to vfs_get_fs_node_from_path().
It was always resolving symlinks.
* device manager/devfs:
- devfs: get_node_for_path() no longer resolves leaf symlinks. That still
doesn't help with file disk devices, as creating partition wouldn't work
anyway.
- Pulled the module-related implementation part of BaseDevice into new class
AbstractModuleDevice and made all methods of BaseDevice virtual. Small
adjustments to devfs to be happy with the new BaseDevice interface.
- Added BaseDevice subclass FileDevice, which maps the interface to a file's
file descriptor. Still got a few TODOs, but should basically work.
- Use FileDevice for publishing file disk devices in devfs. Now those do
actually work, though there's some BFS trouble with one of the images I
tested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33385 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8ae594ffd47d73edb1c9b9e1240a1ee667197472 28-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Introduced dedicated syscalls for the deprecated BeOS fs_attr API. Before,
each attribute access needed 3 syscalls, now only one as it should.
* Renamed the new Haiku call fs_open_attr() to fs_fopen_attr(), and added a new
function fs_open_attr() that takes a path (same semantics as the
fs_[f]open_attr_dir() functions already present in BeOS).
* Merged former _kern_open_attr(), and _kern_create_attr() into one syscall.
* Cleaned up vfs.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31881 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eb2bd0e8e3689998717f91d8b9023296e3f32e78 27-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

axeld:
* Implemented a way to do asynchronous pre-fetching when mapping files.
* There are slight code duplications in some places that could benefit
from cleaning up, but nothing too bad.
* Implementing smarter ways to trigger prefetching and more analysis of
the situations in the kernel would be nice. Currently up to 10 MB
of every mapped file are pre-fetched without further analysis.
* The speed improvement is nice for certain operations. On our test
system (real hardware), Firefox took 9 seconds from being launched
to display a window. Now it takes 5 seconds. Both measurements
right after booting. The same system took 35 seconds from launching
Haiku in the GRUB menu to displaying the Tracker desktop background
image. Now it takes 27 seconds.
* We didn't have the chance to check out the effects of this on the
CD boot, but potentially, they could speed it up a lot.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30465 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ecc4b37752beba35afeb7ef446f07c3c6d01971 01-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced ref-counting for the I/O contexts.
* The I/O context related vfs_*() functions have io_context* instead of void*
parameters/return values, now.
* vfs_new_io_context(): Lock the parent I/O context before getting its table
size. Otherwise the table size could change until we do.
* vfs_resize_fd_table(): Fixed use of MutexLocker. We created only a temporary
object, not one with function scope.
* Renamed load_image_etc() to load_image_internal() and added a parameter for
specifying the parent team of the one to create.
* Introduced a kernel private load_image_etc() with a few more arguments than
load_image().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29375 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e8d3eff9689f3436efa2863b9bf4afc84f79e0a3 26-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* vfs_normalize_path() and _user_normalize_path() use a common helper
function (normalize_path()), now. There was some code duplication
before.
* Added "bool traverseLink" parameter to vfs_normalize_path(). When
true and the leaf component is a symlink, it will be resolved.
* KPath:
- Added similar leaf link traversal parameter to SetTo() and
SetPath().
- Added Normalize().
- Added DetachBuffer(), which returns the object's current buffer and
unsets itself.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27751 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 663948966c47fdc1ef9df7a4592cfe0d40b91c0a 18-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added method vfs_asynchronous_write_pages(), which, unsurprisingly,
writes the given page iovecs asynchronously. The new class
AsyncIOCallback is used to inform the caller when the request has been
finished.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27055 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f12cc54a729622cd04940ee9400958413d99b21 30-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
classes have grown new methods and attributes to deal with that. The
"finished" callbacks have got additional parameters to indicate
whether the transfer was only partial and how much has been
transferred. Other callbacks and functions have a size_t* in/out
parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
of the underlying FS's {read,write}_pages() hooks (those should be
unused now). Furthermore they've got an additional "flags" parameter,
which is passed to IORequest::Init(), i.e. it allows to specify that
the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
driver I/O requests are passed all the way from the VFS/VM to the
driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
methods.
* Disabled some debug output by default. Added new optional debug
output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26692 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cfae07b6ac5571cdca26e35281cfd05c4edd7a52 28-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added kernel private vfs_vnode_io() which performs an io_request on a
vnode (falling back to synchronous I/O if the io() is not supported).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26672 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ec598fe493579e3d522453cb407ca3c6b57d715a 27-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added FS interface hooks io() and cancel_io(). The former is supposed
to provide asynchrounous (or only synchronous, if asynchronous is not
supported) I/O request support. It will eventually replace
{read,write}_pages(). None of the FS implementations implement them
yet.
* Implemented some support functions for request-based I/O. File system
implementations can use do_fd_io() which passes an I/O request to the
layer responsible for a given FD, and do_iterative_fd_io(), which
translates a request for a file to subrequests for the underlying
device and passes them on. Both fall back to synchrounous processing
when the io() hook is not supported.
Furthermore added vfs_synchronous_io() which should be handy for the
devfs to perform io_requests synchronously for devices that don't
support the io() hook.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26655 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e6bd90c58dbae64f3b464edcff90dcb06e63a716 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* bfs_fsync() was the only place which could cause the
fs_vnode_ops::write_pages() to be called with fsReenter = true. Since
this is no longer the case, the argument has become superfluous. For
read_pages() it always was. Removed the argument from the functions
and all functions that propagated it.
* Some whitespace at the end of lines was removed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26579 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c99d639708df9b4e2cc847b38d510149d19ec78 22-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged branch haiku/branches/developer/bonefish/vm into trunk. This
introduces the following relevant changes:
* VMCache:
- Renamed vm_cache to VMCache, merged it with vm_store and made it a
C++ class with virtual methods (replacing the store operations).
Turned the different store implementations into subclasses.
- Introduced MergeStore() callback, changed semantics of Commit().
- Changed locking and referencing semantics. A reference can only be
acquired/released with the cache locked. An unreferenced cache is
deleted and a mergeable cache merged when it is unlocked. This
removes the "busy" state of a cache and simplifies the page fault
code.
* Added VMAnonymousCache, which will implement swap support (work by
Zhao Shuai). It is not integrated and used yet, though.
* Enabled the mutex/recursive lock holder asserts.
* Fixed DoublyLinkedList::Swap().
* Generalized the low memory handler to a low resource handler. And made
semaphores and reserved memory handled resources. Made
vm_try_resource_memory() optionally wait (with timeout), and used that
feature to reserve memory for areas.
...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26572 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6b202f4e3da73d4c131355fcd82b792d153f84f6 13-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced new header directory headers/private/system which is supposed
to contain headers shared by kernel and userland (mainly libroot).
* Moved quite a few private kernel headers to the new location. Split
several kernel headers into a shared part and one that is still kernel
private. Adjusted all affected Jamfiles and source in the standard x86
build accordingly. The build for other architectures and for test code
may be broken.
* Quite a bit of userland code still includes private kernel headers.
Mostly those are <util/*> headers. The ones that aren't strictly
kernel-only should be moved to some other place (maybe
headers/private/shared/util).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25486 a95241bf-73f2-0310-859d-f6bbb57e9c96


# df50f7a9b4b0bbe77413d722875b0a346c61d527 10-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the way the socket functions work:
- The net_stack driver is no longer used. Instead we have a kernel
module which is directly used by syscall implementations in the
kernel. I.e. we no longer tunnel those functions through ioctls, but
have normal syscalls.
- Removed the superfluous net starter module.
- Implemented the FDTYPE_SOCKET type file_descriptors, that is sockets
are no longer vnode based.
- Adjusted libnetwork (the socket function implementations)
accordingly.
- Adjusted netstat accordingly.
* Socket module:
- Implemented socketpair().
- Added "kernel" parameter to the control hook. Quite a few more hooks
would actually need the parameter, but I didn't change those yet,
since that would probably also require changes to the protocol
module interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f8b4d83f2f310c288d3ba32c6371fb00ae2b4824 09-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

New service function vfs_create_special_node() to create special nodes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24883 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc380199455ea67c8ed9b65b34e20b91133cfbb9 06-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Rename vfs_stat_entry_ref() to vfs_stat_node_ref() as that's what a dev_t and
ino_t combination really is.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24825 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e36a49e62cbad57eb5c88dd1a16ca39be3f4e3f 05-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added _kern_create_pipe() syscall, creating a pipe as an entryless
FIFO. Reimplemented pipe() to use it.
* pipefs is no longer mounted. Will remove the superfluous code soon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24823 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7ffafac8d76aa50ea68667e61038022220a90256 05-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reorganized the FS interface a little:
- Moved most file_system_module_info hooks into separate structures.
Those that operate on mounted volumes to fs_volume_ops, those
operating on a vnode to fs_vnode_ops.
- Got rid of the fs_volume, fs_cookie, fs_vnode typedefs. We use void*
again.
- Instead of a void* volume and node cookie hooks are passed a
fs_volume and fs_vnode structure pointer, which contain the cookie
and an ops pointer (fs_volume a few more things).
- The VFS {new,publish,get,...}_vnode() functions take a fs_volume*
instead of the volume ID. So does vfs_get_fs_node_from_path().
- Added type and flags arguments to publish_vnode() and the
get_vnode() hook and removed the type argument from lookup() hook.
Added vnode::type using formerly unused bits to store the node type.
Simplified a few things in the VFS due to the now always available
node type.
- Added fs_volume_ops::{create,delete}_sub_vnode() and
fs_vnode_ops::get_super_vnode() hooks. They are used to support file
system layers, e.g. allowing to extend an FS not supporting BeOS
attribute with attribute support. Needs some more work in the VFS.
- Added fs_vnode_ops::create_special_node() hook for creating special
nodes (e.g. FIFOs).
* Adjusted the built-in file systems and BFS according to the interface
changes. Removed all other FSs from the image for the time being.
We'll see whether further API changes are necessary before porting
them.
* Adjusted the bfs_shell accordingly.
* Implemented create_special_node() in rootfs to support special nodes.
* Added support for FIFOs:
- Added syscall _kern_create_fifo() (used by mkfifo()), which creates
a special node (type S_IFIFO) in the respective file system.
- When a special node is published the VFS creates a respective sub
node. Currently only FIFOs are supported.
- Added a little support for FIFO subnodes by using functionality from
the pipefs.
- Added mkfifo to the image. It can create FIFOs in the rootfs, but
the FIFOs aren't really usable ATM, since they still work like
pipes, i.e. readers and writers need to have them open at the same
time.
* Some smaller changes in the VFS:
- Made the *_CALL macros nicer to use (vargs).
- Refactored FS entry lookup into new function lookup_dir_entry().
- create_vnode() no longer just calls the FS create() hook. First it
looks up the entry and uses open_vnode(), if it already exists. This
is necessary for two reasons: 1) The FS might not support create()
while still allowing to open() entries. 2) When the FS has other
layers on to of it (or the respective node) it might not be
responsible for opening the node.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24816 a95241bf-73f2-0310-859d-f6bbb57e9c96


# efb965d5596e99bc2d3bd0cb6c7ee6c4a81a2637 05-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Introduce vfs_stat_entry_ref() that allows to stat a vnode based on a dev_t
and ino_t instead of a path. Supposed to work with node monitoring messages.
Took the name from vfs_entry_ref_to_path() that takes the same arguments, but
suggestions for a better name are welcome.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24813 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 360be1fc45416df27312c38d2268b466621bbae7 29-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented support for chroot:
- Added a "root" vnode to the io_context. It is used for resolving
paths and converting nodes to paths instead of sRoot. Some more
passing around of io_context structures was necessary.
- Introduced a new lock sIOContextRootLock to protect
io_context::root. The current uses of io_context::io_mutex
(put_vnode(), remove_vnode() while holding it) looked too suspicious
to use that mutex in vnode_path_to_vnode().
- Added _kern_change_root() syscall and chroot() libroot function.
- Added chroot coreutils program to the image. Funnily it seems to be
much easier to set up a little jail than under Linux (just copy
bash and libroot.so into respective subdirs; mount another pipefs
if you want pipe support).
With Haiku allowing direct access to directories via inode IDs
jailing is obviously not very secure at the moment.
- Added /var/empty to the image. It will be the chroot target for ssh.
* Changed vfs.cpp:get_cwd() so that the io_context::io_mutex is no
longer held when calling dir_vnode_to_path().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24673 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c117a6d887caefe7aacdddb08bb6557d100f106 29-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added function vfs_read_stat() that also allows for stat()ing files in
the user IO context from within the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24667 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4f26630d823fe7367a7ba80563779546204de671 27-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Factored a vfs_entry_ref_to_path() out of _user_entry_ref_to_path()
and made it public (within the kernel).
* _user_entry_ref_to_path() is now using that function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24151 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c986936dfb7ff4f5723641b100d280a44dda479 07-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added new syscall _kern_normalize_path() to normalize a path.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23929 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a32a4683ff8eb994524d5ab8eba13d93fe90c0ff 03-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Implemented flock() semantics to the advisory locking backend. Not tested
(must also compare to BSD; I've looked at their sources, but I might have
missed something).
* Added sys/file.h and the flock() system call.
* common_fcntl() could forget to put back the file descriptor on some error
conditions (I guess we should introduce and use a DescriptorGetter class).
* Cleaned up fcntl.h, moved the BSD extensions S_IREAD and S_IWRITE to
sys/stat.h where they belong, and added the missing S_IEXEC to them.
* Added some more comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23836 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e122bd99ec62ea5bf4adbcfebb4a28f8b604e28 12-Nov-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld + bonefish: Missed those changes in the previous commit:
* Added vfs_unmount(), which allows unmounting by dev_t (used by the DDM).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22910 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3d268eda3d0ca504c865533347decf27b54025b6 10-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* Extracted file_map API out of the file cache - it's now an optional service
that can be used by file systems.
* Changed the way the file cache works: instead of reading/writing to the
underlying device directly, it can now be used for any data source, ie.
also network file systems.
* As a result, the former pages_io() moved to the VFS layer, and can now be
called by a file system via {read|write}_file_io_vec_pages() (naming
suggestions are always welcomed :-)). It now gets an FD, and uses that to
communicate with the device (via its fs_{read|write}_pages() hooks).
* The file_cache_{read|write}() functions must now be called without holding
an I/O relevant file system lock. That allows the file cache to prepare the
pages without colliding with the page writer, IOW the "mayBlock" flag can
go into the attic again (yay!).
* This also results in a much better performance when the system does I/O and
is low on memory, as the page writer can now finally write back some pages,
and that even without maxing out the CPU :)
* The API changes put slightly more burden on the fs_{read|write}_pages()
hooks, but in combination with the file_map it's still pretty straight
forward. It just will have to dispatch the call to the underlying device
directly, usually it will just call its fs_{read|write}_pages() hooks
via the above mentioned calls.
* Ported BFS and FAT to the new API, the latter has not been tested, though.
* Also ported the API changes to the fs_shell. I also completely removed its
file cache level page handling - the downside is that device access is no
longer cached (ie. depends on the host OS now), the upside is that the code
is greatly simplified.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22886 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0710d59c1c6edace8ad333b1e3e86f9931e4e3f0 08-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a "canWait" argument to vfs_get_vnode() - you can use this to ignore
busy vnodes.
* dir_create_entry_ref() used get_vnode() incorrectly (and could therefore
potentially prevent a file system from doing proper locking when called
from the kernel).
* The vnode_store now uses this for its acquire_unreferenced_ref()
implementation (and therefore for the page writer).
* read_into_cache() and write_to_cache() were still marked inline.
* The system will now wait 10 secs for a busy vnode before returning an error.
* It will also no longer panic in that case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22485 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 80f54692912d728f5780e9d78d7643828edaaa2a 06-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* struct vnode is an opaque type now, removed void* where it was used incorrectly.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22461 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3e9513aa4a8bf5f2fb2b86a767ffe46f6e626acc 03-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* fs_{write|read}_pages() now has an additional argument "mayBlock".
* the page writer don't allow to block, while all other writers do. This fixes
bug #1509. The reason the page writer needs this is because it marks several
pages from different caches as busy.
* Fixed a warning about ASSERT being defined already in BFS, since
util/DoublyLinkedList.h now includes debug.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22434 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 66c03dc3a92b84f0320b1c350238396cdf203cc7 30-Sep-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* fd.c -> fd.cpp
* Reworked the select support:
- The io_context additionally stores a table of lists of select_infos,
which enables it to deselect events of a pending select() when
closing a FD. This prevents a race condition potentially causing a
write to stale memory.
- The opaque selectsync* passed to FSs is now actually a select_info*.
This was necessary, since the FDs deselect() hook (unlike the
select() hook) doesn't take a "ref" argument and deselecting a
single info (e.g. caused by a premature close()) was not possible.
The select() hook's "ref" argument has become superfluous.
- It should now be relatively easy to implement a poll_on_steroids()
that can also wait for objects other than FDs (e.g. semaphores,
ports, threads etc.).
* Set/reset the signal mask in common_select(). This makes pselect()
work as required.
* Reorganized vfs_resize_fd_table().



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22391 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6d4aea47962e0ea08b81327fbbf93b32ae821177 25-Sep-2007 Axel Dörfler <axeld@pinc-software.de>

bonefish+axeld:
* Removed the vm_cache/vm_store ref_count duality that besides being a bit ugly
also created the page dameon cache retrieval problem: now, only areas (and
cache consumers) retrieve a reference to the store (and therefore, the vnode).
The page daemon doesn't need to care about this at all anymore, and the pseudo
references of the vm_cache could be removed again.
* Rearranged deletion of vnodes such that its ID can be reused directly after
fs_remove_vnode() has been called.
* vm_page_allocate_page() no longer panics when it runs out of pages, but just
waits for new pages to become available using the new sFreeCondition condition
variable - to make sure this happens in an acceptable time frame, it'll
trigger a run of the low memory handlers.
* Implemented a page_thief() that steals inactive pages from caches and puts
them into the free queue. It runs as a low memory handler.
* The file cache now sets the usage count on the pages it inserts into the
cache (needs some rework though, cache_io() doesn't do it yet).
* Instead of panicking, the kernel will currently dead lock in low memory
situations, since BFS does a bit too much in bfs_release_vnode().
* Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22315 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 58f6e8e5e4aeee797ecd3bb7bed17d5a3a2029c0 17-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Merged vm_cache_ref and vm_cache to a single structure (Axel & Ingo).
* Renamed vm_cache.c to vm_cache.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21642 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 245aecda8ac43fc2c0c0bac6a7e4016efa9b71e1 21-Jun-2007 Axel Dörfler <axeld@pinc-software.de>

Got rid of vnode_id and mount_id, replaced with ino_t and dev_t.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21485 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2dedc014e37939d1ea914b9ea1d9a5584f6e297a 19-Feb-2007 François Revol <revol@free.fr>

Use same figures as BeOS for soft and ahrd maximums on fd and mon tables (even though we don't use a table for mons).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20164 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f5fa54f79828b9fdf292f3c4c67db108e9f1c420 12-Jan-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

Improved error reporting when a failure to find/mount the root device occurs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19774 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8265e1210cefdff2a0553dc2a0696bb3cb2396bf 02-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented mandatory file locking, BeOS style. BNode::Lock() and BNode::Unlock()
are now working as expected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17697 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 97e069713b80839b9dd5441b9f4d37d891b452d8 12-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Added a "reenter" parameter to the {read|write}_pages() functions to give file
systems a chance to know if they have locked already.
This fixes a locking problem in BFS where one thread tried to acquire two read
locks (where someone else trying to acquire a write lock would have caused a
dead lock).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17108 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 606e0d364e0c814450efb2ba37bd216d6a1241fc 27-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Factored out the vnode disconnection code from fs_unmount() to a separate
function, and added a vfs_disconnect_vnode() for other kernel components.
* devfs_unpublish_device() can now optionally make use of this call.
* Fixed the type check of devfs' unpublish_node().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16907 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9f6376a0c752eb965d97c400eb3bb27dbc102775 06-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* get_vnode() did not decrease the sUnusedVnodes counter when taking one node
of that list.
* Added a vfs_free_unused_vnodes() function that calls the low memory handler
directly.
* create_sem_etc() now calls the above function in case there are no semaphores
available anymore; this usually frees up to 2 semaphores per node (one from
the cache if there is a file cache attached, and eventually one from the
file system).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16610 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5a2ad00cab1adde7fe59540ca5ef692c7e83b3a3 20-Feb-2006 Jérôme Duval <korli@users.berlios.de>

fix a TODO in _user_mount : added an argsLength parameter


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16480 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 979aeaf71cf0c238793ee9a49d91997342ce5fdb 25-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed bug #97:
* BEntry::Remove() now uses _kern_remove_dir() for directories.
* Added fd parameter to _kern_remove_dir().
* Fixed LibBeAdapter's _kern_unlink() to only work on files, and
added _kern_remove_dir() for directories.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16078 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0e382a46670b2bfa5317d2c6a350c1cb6f99aa42 16-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented a syscall to get information about the open file descriptors of all teams.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15991 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2db3fced5f119bb3f7c8b8a3ac3fe60190f76e6c 17-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Moved vfs_bootstrap_file_systems() and vfs_mount_boot_file_system() out of vfs.cpp
and into its own file vfs_boot.cpp.

Added basic support for booting from CD - it doesn't give CDs a higher priority,
so you could end up booting from HD when you didn't explicetly select "CD-ROM"
in the boot loader. Eventually, it should only boot from HD in this case, if
booting from CD failed (because of a missing boot partition or whatever).

fs_mount(), _kern_mount(), and _user_mount() will now return the dev_t of the
mounted device, and not just B_OK. Maybe we should have fs_unmount() work on
a dev_t instead of a path as well...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14403 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a63d903970648f924ab2a70bc92761d2ea31a03 06-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Added kernel private VFS functions vfs_entry_ref_to_vnode() and vfs_vnode_to_node_ref().
Minor cleanup of vfs.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14314 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 681779f1c8f009c46030c12878e588bc2443d353 06-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Our close-on-exec flag handling was broken: it's supposed to be specified per slot, not
per file descriptor (a descriptor can be shared among several slots). There is now a
second table in the io_context structure that contains that information in a bitmap.
There are now two new (private) functions to control the close-on-exec flag, fd_close_on_exec(),
and fd_set_close_on_exec().
F_DUPFD, dup(), and dup2() are supposed to clear the close-on-exec flag on the duplicated
slot - this fixes bug #57 (no output after a redirect of a shell builtin).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14313 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7964c56d67bb6283a76db7f540f1a807173556ec 09-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Added vfs_get_cwd() call to get the mount_id and vnode_id of the current
working directory (instead of the full path).
Cleanup of some remaining "int" status variables (where it should have
been a "status_t").


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13924 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eab435cd59a30d144ecc077fbdbc1bb37b3eb5a6 05-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

vfs_get_vnode_cache() now only allocates a new cache if requested: this
prevents the system to allocate caches for files that don't use or have
a file cache (ie. only those can be mmap()ed!).
Therefore, cache_prefetch() no longer crashes when trying to prefetch
files without a file cache.
read_into_cache() no longer does anything if the requested size is 0.
Fixed a bug in cache_prefetch_vnode(): if the cache couldn't be retrieved,
it put the vnode, but didn't own it (the caller does).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13904 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b72cf2601fbc931d2b3224e285eb26d09b20ea5e 01-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed vfs_vnode_acquire_ref() to vnode_acquire_vnode().
Removed vfs_vnode_release_ref(), as vfs_put_vnode() already does the same thing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13867 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b7d8ef5a0d83bbf8f8d642e00d36db65f3407b3f 01-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

The term vnode_ptr is not used anywhere else; renamed vfs_put_vnode_ptr() to vfs_put_vnode().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13865 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 219dacab3cbce36004f4fe91f6c0ef2dbff1feb9 06-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Changed our read link syscall and FS interface call to make it easily possible to be POSIX compliant.
Also changed readlink() to be POSIX compliant with those changes.
"ls -l" does now resolve links properly again (the new coreutils version outlined the problems).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12263 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74b043d98d35652a6892fc430537a02f5f9d9f76 17-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Removed execute property that was set accidently (since CVS days).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11896 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9391dd214dd0aadcc0360c83839c24185d2c8967 17-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed broken handling of the new file_descriptor::open_count across
team boundaries; if you didn't actually call close() from within the
application, the close-hook of the file system was never called.
Also, you could close files of other teams (ie. invoke close on a
shared file descriptor).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11892 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d12de9209a35dd2b2894f99e8c3466a19ca28dd6 01-Feb-2005 Axel Dörfler <axeld@pinc-software.de>

Added some more convenience VFS calls (vfs_stat_vnode(), and vfs_get_vnode_name()).
Removed *_create() and *_create_entry_ref() syscalls - they are now handled by
*_open() and *_open_entry_ref() calls which get another parameter for the permissions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11204 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 244f03dc1ce49b0820786863861d292889dbbc54 30-Jan-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the autolocking code for recursive lockers to <util/AutoLock.h>.
* Added resolve_mount_point_to_volume_root() version for external use
(by the node monitor).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11159 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d786bd1324c8bec66c86da73001e47f7f015c52e 13-Dec-2004 Axel Dörfler <axeld@pinc-software.de>

Renamed vfs_get_vnode() to vfs_lookup_vnode() as it doesn't grab a ref to the node.
Added new vfs_get_vnode() that actually grabs such a ref.
vfs_get_vnode_cache() now fills a vm_cache_ref instead of a void pointer.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10430 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dfb71e0444a5e5cc3bce5de3355e20a65f9055e7 12-Dec-2004 Axel Dörfler <axeld@pinc-software.de>

Added a query length parameter to _kern_open_query() - it's much easier to
do these things in userland.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10397 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4c8e8f2f196b79675f6349ee04952dc941c7a111 29-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Added "flags" parameter to unmount.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 06db2509162693845b31ed2e93940543445e4c2b 15-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

vfs_mount_boot_file_system() now also gets the kernel_args.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9964 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 424f90aff9146b1af2791bef69ac4b3613f2169b 03-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for readv/writev() syscalls.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9766 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eef5d24c90d99d5ae6f882cc6209e672d3d681e9 31-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Changed the last argument of _kern_mount() to be a string rather than a void pointer.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9691 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7fb2963ae41010e397838f095b8b7b71332d36ff 28-Oct-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added vfs_normalize_path() service call.
* Added resolve_mount_point_to_volume_root() which does what
resolve_volume_root_to_mount_point() did. IOW the latter one didn't
do what it advertised.
* Fixed dir_vnode_to_path(). Basically broken due to the broken
resolve_volume_root_to_mount_point(), but also compared potentially
unrelated vnode IDs (belonging to different volumes).
* Fixed get_dir_path_and_leaf(). It didn't deal correctly with paths
ending in '/' (including the root dir).
* fs_mount() does now accept a NULL fsName, getting the FS name from
the DDM in this case.
* fs_mount() now also supports mounting file images; it lets the DDM
create a file device for them.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9629 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d5b7e0b23210c806fd1ba4e1777bb12602031c0 27-Oct-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_mount() now has a flags parameter, too.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9544 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7b5e243a4d1376b8ddb063074d10f6dcc30e5b28 27-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototype for the new vfs_get_fs_node_from_path() function. It's
currently only used in devfs for the publication of partitions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9533 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 76dede71c7471e1487cf4bbf024e613895c3d0d2 07-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added exec() support function vfs_exec_io_context().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9241 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6acb67243170d742eb1a572ccd1f98131d2f7053 05-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

New syscall for fcntl().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9200 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 57549ff41e51b3b0d1069a24cabea8233b89fe44 30-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Removed vfs_types.h - it's no longer needed.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9143 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4a02ef9f5530edfa69d3ed5f9e10288170a79003 30-Sep-2004 François Revol <revol@free.fr>

notify_select_event moved to headers/os/drivers/Drivers.h where it belong


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9138 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cfd8ea7832743b95d2ee5952cd539098504056b9 06-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Added a "cookie" parameter to the vfs_read|write|has_page[s]().
Also added a prototype for the fs_get_file_map() fs call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8867 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1b4746c27006ac8c57d081a54e5af086099fb1db 04-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Changed the VM store and VFS functions a bit to better match the corresponding driver hooks.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8844 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8b3bd22a1db864e3d306c53273e1289cc39e7605 03-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Added vfs_get_vnode() prototype.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8826 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 36ce5c0164579bd1cd6483c493480b39829b4313 03-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Changed the way the vnode cache is set - it's now cleaner and can no longer
allocate a cache twice.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8815 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9955b99a86b8f3b232f738d206ec63207fe09539 28-Aug-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Several VFS related syscalls have been changed, added or removed.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8701 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c28c0592921ef90cd5bdab9e6ac6642dbf37ece9 07-Jul-2004 Axel Dörfler <axeld@pinc-software.de>

Added all syscalls needed for the next_dev() call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8346 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 63e846d50d65212728f18636ffbb17336315a37d 02-Jul-2004 Axel Dörfler <axeld@pinc-software.de>

Added a syscall to get a path for a directory node_ref.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8278 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 645e138890cdf1586c42a98a2d7c09f6581302a6 01-Jul-2004 Axel Dörfler <axeld@pinc-software.de>

Moved vfs/fd _kern_*() calls to syscalls.h.
Removed some includes from syscalls.h where possible, minor style changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8256 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 734893f6d2fc9044f5034b414d20b11eea49142a 15-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Renamed all VFS syscalls to the new style.
Improved returned types.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7963 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2defe47a24999fb649f10b034984d5dfb7c7ef11 07-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Removed no longer used system call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7814 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aad3f70c8640eabcc730f43630c02adab84a1fc3 07-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Moved the public fs functions to fs_interface.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7800 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ac154012173a2a81c0959cf73e9e5996bf26369 10-May-2004 Axel Dörfler <axeld@pinc-software.de>

Changed the "stat" related syscalls to have an additional parameter that specified
the size of the stat structure to allow extensions of that structure.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7493 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cdbef38048fc2b6b419c5f32dd4c7fa9aa32d51f 05-May-2004 Axel Dörfler <axeld@pinc-software.de>

Changed some return codes to status_t where appropriate.
Renamed vfs_bootstrap_all_filesystems() to vfs_bootstrap_file_systems().
Renamed vfs_register_filesystem() to vfs_register_file_system().
Added new call vfs_mount_boot_file_system().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7421 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7d5be143e8165e64145d58d1e35817c583e78156 22-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

We have status_t.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6692 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c7a03dadeaf42e5341b34ebd53e798d7053461e1 08-Sep-2003 Axel Dörfler <axeld@pinc-software.de>

list.h is now in util/.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4594 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5306fba3a10f0d38e8214b4342efadea4ce8d54c 07-Sep-2003 Axel Dörfler <axeld@pinc-software.de>

Added the new vfs_get_module_path() call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4558 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 318ea28bebe3f0ff51b75818cca14d487a56d1ba 03-Sep-2003 Axel Dörfler <axeld@pinc-software.de>

Added internal syscalls (_user/_kern) for fs_read_info() and fs_write_info().
Not yet accessible from the outside.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4493 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 564cba312ebe49860fbb8416737c4de3e6ccd5f2 03-May-2003 Axel Dörfler <axeld@pinc-software.de>

Some header work: removed unnecessary dependencies to stage2.h, fixed
some broken C++ export definitions, added missing licenses etc.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3152 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 896aefa8ece7d3b2415b3280c4040c3d595618a6 21-Feb-2003 Axel Dörfler <axeld@pinc-software.de>

Added a new call vfs_new_vnode(), replaced "int" return type to status_t
for the VFS vnode functions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2785 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f9bdcca59cbf81bf938cf10a6a1d5b6f050d6eee 18-Jan-2003 Axel Dörfler <axeld@pinc-software.de>

Added kernel private node_monitor.h header.
Moved definition of "struct io_context" from fd.h to vfs.h.
Introduced new fs/ directory; some cleanups to come.
Added node monitor syscalls.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2479 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ef7716d48096f1ffbf55359e42b766508b28b23 02-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added a missing const to the (sys|user)_select() call.
Broke binary compatibility for the notify_select_event(), since it obviously
hasn't been used on R5 at all.
The new API/implementation is much nicer to use.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1830 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a2cbc788e0320a065e7e592dfb78fb1547a6f0fe 28-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Adds support for select(), and poll() in the kernel - both are realized
using the current BeOS device API.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1745 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 146a3000ee509a0c225deb1aa01aa50ad88b5cca 17-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added syscalls for the index functions.
Corrected the prototype for fs_rewind_index_dir() (don't copy and paste...)
Also checked in the syscall definitions for the signal stuff to save Angelo
some work.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1562 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e5ca65bc98f599f4cb9eb85c9d66d04f9205a13 16-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added a new write_stat() call to the file descriptor operations.
Renamed sys_read_stat() to sys_read_path_stat() - sys_read_stat() is now
the fd operation.
Removed the sys_write_attr_stat() call because it is no longer needed.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1554 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 11fe0cb8de932243324b119e4567e7d5d69c4540 07-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for the sys_/user_ attribute calls.
Changed the file_descriptor structure (more status_t, name removed).
Changed "extern inline" to "static inline" in thread.h/arch_thread.h as those
also work with -O0 -g.
Added prototypes for [arch_cpu_]user_strlcpy().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1454 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3c6bf0c8c115c68b7cda915d44ed546ed7b3fc8f 25-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Renamed "calls" to "ops".
Removed unused prototype.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1179 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4dc5ecd3cb444ebc26809a781c03b34d70c8b2cd 25-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Renamed fs_id to mount_id.
Moved typedefs for mount_id and vnode_id to fs_interface.h.
Removed some unused stuff in ktypes.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1173 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4c405cbdd43a20546d1d0a71b75f7ede417fe5fc 13-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

The fs interface functions should now return a "status_t" rather than an "int".
Added syscalls for, and implemented sys_create_link(), sys_remove_dir().
Implemented link(), unlink(), rmdir().
Fixed the inconsistent path buffer handling in the user|sys vfs functions; the
path buffer is now exactly SYS_MAX_PATH_LEN from userland (incl. terminating
null byte).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@748 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 854fc92a7ccbf27a2b9bcf80e7a2ca9a0a355243 13-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Implemented some more calls in unistd.h.
Replaced the unused syscall for getdtablesize() with one for access().
Implemented sys_access() and added it to the file system interface.
Removed the fs function interface from vfs.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@738 a95241bf-73f2-0310-859d-f6bbb57e9c96


# beddff0f569d79109e45afd1cde91c4b254234de 09-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Replaced opendir.c with directory.c, implemented chdir(), fchdir(), and
getcwd().
Introduced new xyz(int fd, char *path, ...) style of functions for
sys_setcwd(), and sys_write_stat().
Added missing sys_fstat(). Removed duplicated prototypes in syscalls.h
Fixed some minor bugs.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@669 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d7dd1c2ac240343aa44737b57bcf6c6c2e5e935a 09-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Changed argument order for sys_read/write() to be more intuitive.
Removed unistd.h (new BeOS-like unistd.h will be in posix/ shortly)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@664 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dc74f4ac1539f1eb973361da895770bad45b164c 05-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Added a comment in memheap.h
Added sys|user_write_link() to vfs.h


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@595 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dfa8e8ef78982a360b73c0f77a8389494b543745 04-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Added a sys_write_link() function.
Added a "mode" parameter to the sys_create_symlink() function.
Added an open_mode to the file_descriptor struct.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@591 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ae372703ce511d5bf7e2034e44241908b012b1ee 02-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Big commit: Added symlink support to the kernel.
- added needed syscalls to access symlink support from userland
- implemented lstat(), symlink(), and readlink()
- added dev_t to ktypes.h (for now - should be in a public header anyway)
- added symlink support to the "ls" command (now calls lstat() and shows the
link target with the -l option)
- changed the sys_read_stat() call to support symlinks, and updated files
using that function (it gets an extra argument: bool traverseLink)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@560 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3aaee8e5b0ae2e637f3ca8bf251501274550b46a 28-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Beginnings of the symbolic link support, though it's not yet working.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@507 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 973b9ee6b70f6a8506cea31c5a0cc5d961326ce7 23-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Added the syscalls for sys_open_entry_ref(), sys_create_entry_ref(),
sys_open_dir_entry_ref(), sys_open_dir_node_ref(), sys_create_dir_entry_ref().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@394 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 071f62bc368ffcbc82a5fcd7931455679098014d 19-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Major code cleanup and reorganisation.
Fixed many bugs.
Now, the vfs_ prefix is for functions that are called by other parts of the
kernel. file_ is for file related stuff, dir_ for directory related, and
common_ for both, fs_ for general file system stuff.
Put all prefixed functions together in the source.
Implemented (currently without a user/sys call) opening/creating of entry_refs,
and node_refs (the latter for opening directories only).
Moved vfs_dup(), and vfs_dup2() to fd.c, fd_dup(), and fd_dup2().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@351 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ba94874630ad8aae849913f5246b24d41890bf37 18-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Added a fs_get_vnode_name() call for the file systems.
Fixed a header dependency in sem.h.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@314 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b79d207dc224843baeb7b752519a749002837cec 17-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

user|sys_seek() now returns an off_t.
Changed the fd_close() call.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@267 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eba8b6cfb916c71aa0fd2aca63faedd2093e3b29 13-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Next update of the VFS: more posix like open/create; divided create in
sys_create(), and sys_create_dir(), open in sys_open(), and sys_open_dir().
Small cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@207 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f8d76107147f6371649c7ab2f8dd7a0cf8146c64 10-Jul-2002 Axel Dörfler <axeld@pinc-software.de>

Added the syscalls for sys_read_dir(), and sys_rewind_dir().
sys_read_dir() now has a parameter for the maximum number of dirents that
are handled by the upper layer - which is currently 1.
Added a comment in fd.h to ease the location of the sys|user prototypes
of the corresponding functions in fd.c.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@58 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96