History log of /haiku/src/tools/fs_shell/vfs.cpp
Revision Date Author Comments
# 44e09f07 01-Apr-2024 InfiniteVerma <vermainfinite@gmail.com>

fs_shell: Fix cat on symlink file

Changes mirror those in kernel VFS.

Change-Id: I47edf548d460d3932857254ac9730fb2161f3250
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7584
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# f42b1cb1 02-Mar-2024 InfiniteVerma <vermainfinite@gmail.com>

fs_shell: Fix error message of cat command.

The fd was passed to strerror instead of the error code.

Also add CALLED() macro to trace function calls in the btrfs code and in
fs_shell (disabled by default but enabled by TRACE defines as usual).

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


# b8fbb723 24-Oct-2023 Augustin Cavalier <waddlesplash@gmail.com>

fs_shell: Use UINTPTR_MAX not LONG_MAX.

Fixes the build after the previous commit.


# 4b3e80f6 24-Oct-2023 JackBurton79 <stefano.ceccherini@gmail.com>

Fix build on arm64 (and other 64 bit non x86 platforms, probably)

Change-Id: I0b09ab8925244746eded66de924d9dbf36693c22
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7064
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 425ac1b6 20-Jun-2023 Alexander von Gluck IV <kallisti5@unixzen.com>

refactor: Swap %Ld for %lld in all format usages

* %Ld is an undocumented alias for %lld in glibc.
* muslc doesn't implement it for this reason.
* While we will likely never drop %Ld support,
lets clean house and set a better example.

Change-Id: Id46dad3104abae483e80cc5c05d1464d3ecd8030
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6636
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 3f06b49a 16-Apr-2023 mbrumbelow <mbrumbelow@mac.com>

fs_shell: cleaned up of a few unused variables

Change-Id: I58e91b634d8d32247c2f37a2518d4234397e8a6f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6378
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 92030a4a 22-Mar-2022 Augustin Cavalier <waddlesplash@gmail.com>

Revert "vfs: functions to change a vnode busy status and ID"

This reverts commit 8497a2cc289f6d991147995507e4efc0ae189147.

The VFS layer is not at all ready for this. Many places in the
code implicitly assume ino_t values will never change. This
functionality is only necessary for live shrinking of partitions,
which is a feature niche enough we do not need to worry about
implementing it in the first round of resizing (if ever.)


# 822ee124 27-Aug-2021 Augustin Cavalier <waddlesplash@gmail.com>

fs_shell: Detect 64-bit by comparing LONG_MAX and INT_MAX.

This is how we do it within the kernel itself. Should fix build of fs_shell
on 64-bit platforms that are not x86.


# 8497a2cc 12-Jul-2012 ahenriksson <sausageboy@gmail.com>

vfs: functions to change a vnode busy status and ID

The kernel version is only partially tested.

Change-Id: I9a2f6c78087154ab137eadbced99062a8a2dd688
Reviewed-on: https://review.haiku-os.org/c/918
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# efb0a3a8 17-Aug-2015 Michael Lotz <mmlr@mlotz.ch>

EntryCache: Add entry_cache_add_missing() for negative caching.

It provides a way for filesystems to cache a lookup failure and
therefore prevents repeated lookups of missing entries. This is a
common scenario for example in command lookup and compiling, where
each directory in PATH or each include directory is searched for the
given entry.


# 50d274f7 25-Oct-2014 Axel Dörfler <axeld@pinc-software.de>

fs_shell: Added missing new permission check function.

* Fixes the build.


# c4684f1e 28-Jun-2012 Andreas Henriksson <sausageboy@gmail.com>

Change missed fs_mount::cookie access in fs_shell:vfs.cpp

See commit 7ffafac8d76aa50ea68667e61038022220a90256
This change was made in the kernel version, but missed in fs_shell.


# 077c84eb 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: atomic_*() functions rework

* No need for the atomically changed variables to be declared as
volatile.
* Drop support for atomically getting and setting unaligned data.
* Introduce atomic_get_and_set[64]() which works the same as
atomic_set[64]() used to. atomic_set[64]() does not return the
previous value anymore.


# 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.


# 846b2f90 06-Jul-2012 Axel Dörfler <axeld@ibm.kiwi>

Changed the kernel's file_map.cpp to be usable from the fs_shell as well.

* This should reduce our maintenance burden a tiny bit :-)
* It also fixes a bug in the fs_shell, see hrev43395.


# 8175a2c3 01-Apr-2012 Axel Dörfler <axeld@pinc-software.de>

Fixed warning.


# 026d2028 18-Mar-2012 Jérôme Duval <jerome.duval@gmail.com>

fs_shell: fix trace build for vfs.cpp


# 386be45a 24-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed 64 bit warnings.


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


# cf844822 24-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added B_PRIdTIME and B_PRIiTIME macros (for time_t).
* Added FSSH_[S]SIZE_MAX to headers/private/fs_shell/fssh_types.h.
* Fixed various 64 bit compiler warnings. Nothing too serious, though.


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


# 4ab3fa3b 12-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Added real_time_clock(), and real_time_clock_usecs().
* Added support for timespec stat times.


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


# 3cf43c26 25-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed the fs_vnode_ops::create_dir() parameter for returning the ID of the
newly created dir. The VFS really doesn't need it and for some file systems
it might not be easy to get by. Several file systems (e.g. rootfs and fat)
were ignoring the parameter anyway.


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


# 49004dc7 19-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

Remove the additional fs_vnode_ops arugment from get_vnode() again as it's not
needed at all when used as intended. Thanks Ingo for the explanation on how this
is intended to work. Adjusted the overlay fs accordingly and updated/reverted
the changes to the other filesystems.


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


# 00405f22 09-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Add an additional argument to get_vnode() that gets the fs_vnode_ops of the
node. That is needed for a layered filesystem to be able to construct a full
fs_vnode out of a volume/inode pair.
* Adapt places where get_vnode is used. Sadly this is a C API and we can't just
use a default NULL for that argument.
* Introduce a flag B_VNODE_WANTS_OVERLAY_SUB_NODE that can be returned in the
flags field of a fs get_vnode call. A filesystem can use this flag to indicate
that it doesn't support the full set of fs features (attributes, write support)
and it'd like to have unsupported calls emulated by an overlay sub node.
* Add a perliminary overlay filesystem that emulates file attributes using files
on a filesystem where attributes aren't supported. It does currently only
support reading attributes/attribute directories though. All other calls are
just passed through to the super filesystem.
* Adjust places where a HAS_FS_CALL() is taken as a guarantee that the operation
is supported. For the overlay filesystem we may later return a B_UNSUPPORTED,
so make sure that in that case proper fallback options are taken.
* Make the iso9660 filesystem request overlay sub nodes. This can be fine tuned
later to only trigger where there are features on a CD that need emulation
at all.

If you happened to know the attribute file format and location you could build
an iso with read-only attribute support now. Note that this won't be enough to
get a bootable iso-only image as the query and index support is yet missing.


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


# ee1a1571 07-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented a simple directory entry cache to speed up path resolution.


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


# 9f6ae76f 01-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added acquire_vnode() call that you can use to get another reference to an
inode - unlike get_vnode() the busy flag won't prevent you from getting that
reference.
* Changed put_vnode() to return an error in case the vnode couldn't be found.


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


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

Added fssh_volume_for_vnode() and fssh_do[_iterative]_fd_io() to the
FS shell. The latter two lack an implementation yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26670 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


# 589f1a91 07-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Made the private kernel locking primitives available to file systems as well.
* Applied Korli's mutex_unlock() fix to block_cache.cpp.
* Removed block_cache_priv.h, as it's no longer needed (moved its definitions
into block_cache.cpp, as in the kernel file).


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


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

Might help gcc 2.95.3 to resolve its perceived overloading of the
function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24824 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


# 45eb999e 09-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added "query" and "chmod" (octal, non-recursive only) commands.


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


# fa28330b 09-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Explained under which circumstances vnode_path_to_vnode() will clobber the
buffer of the provided "path" argument.
* Applied patch by Vasilis to fix some warnings when build on Linux (missing
const on certain functions). We should probably fix the original
{add|remove}_debugger_command() functions in Haiku as well.


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


# 4accd841 06-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed a big bug in common_file_io_vec_pages(): vecOffset was not correctly
set when the first chunk of the file could be read in directly, causing it
to read data to a wrong place in the buffer.
* Reading in the first chunk directly would have also only worked if vecIndex
and vecOffset was 0 when calling the function.
* Applied the fs_shell changes in file_map to the kernel version as well (the
constructor already worked correctly, though).


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


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

This might help with the build on Linux.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22888 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


# db5c68ca 04-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added the partition size as parameter to the file and partitioning
system initialize() hooks. It's often the only info about the
partition one needs and thus locking the partition just to get it is
no longer necessary.
* intel partitioning system:
- Removed passing around block sizes. We require 512 byte sectors
anyway. In fact using the parent partition's block size was even
wrong.
- Simplified writing the partition map sector.
- Simplified and corrected the partition map initialization.
- We don't fail identifying a partition anymore, if the partition map
contains no partitions. We would never identify a freshly
initialized partition map before.
- Made pm_identify() more intelligent: It determines the priority to
return depending on whether the partition is the device itself and
whether we have recognized child partitions.


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


# 32bf31b3 19-Sep-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Stricter limit for the number of unused vnodes. The fs_shell doesn't
really manage memory, so one could easily run out of memory when copying
large files.


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


# 9e12e9a7 01-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added mapping of dup() in the FS shell.
* Adjusted the FS initialize() hook to have FD and partition_id
parameters like the other hooks instead of the partition path.
* Adjusted initialization in BFS accordingly.
* Implemented the FS initialization method in KFileSystem.


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


# 308771ff 17-Jun-2007 Jérôme Duval <korli@users.berlios.de>

reverted to use __x86_64__ as it seems BeOSHostCompatibility header is not included for fs_shell


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


# 913f680e 17-Jun-2007 Jérôme Duval <korli@users.berlios.de>

followed Ingo's suggestion and introduced HAIKU_HOST_PLATFORM_64_BIT macro


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


# a3ca7ebc 17-Jun-2007 Jérôme Duval <korli@users.berlios.de>

x86_64 changes :
added atomic*64() functions
use int32 instead of long


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


# e23824d7 07-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Surprising how much gcc 4 compilers on Linux differ. Another attempt to
make both gcc 2.95.3 and the plethora of gcc 4s happy: Typedefed
struct fssh_stat to fssh_struct_stat, thus hopefully avoiding spurious
errors concerning clashes with the function or regarding namespacing.


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


# 19d7a2a1 02-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the syscalls into the FSShell namespace, so that they don't
collide with the functions defined in libroot_build.so.
* On BeOS incompatible platforms fssh_open() and fssh_close() use the
libroot_build.so _kern_open() and _kern_close() respectively, so that the
attribute support works also when using the generic attribute
emulation.
* Use fssh_open()/fssh_close() instead of open()/close() for the cp
command, so that we get attribute support on BeOS incompatible
platforms when the generic attribute emulation is used.


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


# cc70cbe2 02-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Reduced number of unused vnodes the VFS keeps around. We were hitting
the maximal number of (emulated) semphores on Linux before.


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


# 4b32170e 30-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Work-around for an obscure gcc 2.95.3 bug: It complained about ambiguity
of fssh_stat struct and function.


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


# dac7faad 29-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added volume initialization support.


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


# 90c08768 27-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

FS shell changes:
* Added basic built-in module support.
* Added rootfs.
* Added "kernel" initialization.
* Exposed the FS syscalls.
* Mounting/unmounting the FS works now.


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


# a38a92c9 26-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Beginnings of a new, better portable FS shell with Haiku FS interface.
Doesn't do anything ATM, but already provides the required system
interface (VFS, caches, POSIX functions).


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


# efb0a3a853557e69ecf2bc88adc9a69ed08d1514 17-Aug-2015 Michael Lotz <mmlr@mlotz.ch>

EntryCache: Add entry_cache_add_missing() for negative caching.

It provides a way for filesystems to cache a lookup failure and
therefore prevents repeated lookups of missing entries. This is a
common scenario for example in command lookup and compiling, where
each directory in PATH or each include directory is searched for the
given entry.


# 50d274f7f9e714a0fd8a51192a37fd90cb6fbb2d 25-Oct-2014 Axel Dörfler <axeld@pinc-software.de>

fs_shell: Added missing new permission check function.

* Fixes the build.


# c4684f1e0bcf29a78ef2884f54905f264284e308 28-Jun-2012 Andreas Henriksson <sausageboy@gmail.com>

Change missed fs_mount::cookie access in fs_shell:vfs.cpp

See commit 7ffafac8d76aa50ea68667e61038022220a90256
This change was made in the kernel version, but missed in fs_shell.


# 077c84eb27b25430428d356f3d13afabc0cc0d13 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: atomic_*() functions rework

* No need for the atomically changed variables to be declared as
volatile.
* Drop support for atomically getting and setting unaligned data.
* Introduce atomic_get_and_set[64]() which works the same as
atomic_set[64]() used to. atomic_set[64]() does not return the
previous value anymore.


# 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.


# 846b2f90f670827f5ddc6b22772ffb0038c70745 06-Jul-2012 Axel Dörfler <axeld@ibm.kiwi>

Changed the kernel's file_map.cpp to be usable from the fs_shell as well.

* This should reduce our maintenance burden a tiny bit :-)
* It also fixes a bug in the fs_shell, see hrev43395.


# 8175a2c342e4d0ac9e8390ce083b94d961d6440c 01-Apr-2012 Axel Dörfler <axeld@pinc-software.de>

Fixed warning.


# 026d20288d8d38677a56f436feff949efae70305 18-Mar-2012 Jérôme Duval <jerome.duval@gmail.com>

fs_shell: fix trace build for vfs.cpp


# 386be45abcfda37fcb4f30a664150430dac19aac 24-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed 64 bit warnings.


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


# cf844822db58eed3db11f93243e38503eb1a4b91 24-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added B_PRIdTIME and B_PRIiTIME macros (for time_t).
* Added FSSH_[S]SIZE_MAX to headers/private/fs_shell/fssh_types.h.
* Fixed various 64 bit compiler warnings. Nothing too serious, though.


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


# 4ab3fa3b5a45a509c954d8183f9c37770515dd31 12-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Added real_time_clock(), and real_time_clock_usecs().
* Added support for timespec stat times.


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


# 3cf43c26516b695e35b7433196a530f7541c4ca8 25-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed the fs_vnode_ops::create_dir() parameter for returning the ID of the
newly created dir. The VFS really doesn't need it and for some file systems
it might not be easy to get by. Several file systems (e.g. rootfs and fat)
were ignoring the parameter anyway.


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


# 49004dc730f842ea3c162b56dee63696c51d17c7 19-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

Remove the additional fs_vnode_ops arugment from get_vnode() again as it's not
needed at all when used as intended. Thanks Ingo for the explanation on how this
is intended to work. Adjusted the overlay fs accordingly and updated/reverted
the changes to the other filesystems.


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


# 00405f2286fd370a0bd264d0bbac0cfa120e7646 09-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Add an additional argument to get_vnode() that gets the fs_vnode_ops of the
node. That is needed for a layered filesystem to be able to construct a full
fs_vnode out of a volume/inode pair.
* Adapt places where get_vnode is used. Sadly this is a C API and we can't just
use a default NULL for that argument.
* Introduce a flag B_VNODE_WANTS_OVERLAY_SUB_NODE that can be returned in the
flags field of a fs get_vnode call. A filesystem can use this flag to indicate
that it doesn't support the full set of fs features (attributes, write support)
and it'd like to have unsupported calls emulated by an overlay sub node.
* Add a perliminary overlay filesystem that emulates file attributes using files
on a filesystem where attributes aren't supported. It does currently only
support reading attributes/attribute directories though. All other calls are
just passed through to the super filesystem.
* Adjust places where a HAS_FS_CALL() is taken as a guarantee that the operation
is supported. For the overlay filesystem we may later return a B_UNSUPPORTED,
so make sure that in that case proper fallback options are taken.
* Make the iso9660 filesystem request overlay sub nodes. This can be fine tuned
later to only trigger where there are features on a CD that need emulation
at all.

If you happened to know the attribute file format and location you could build
an iso with read-only attribute support now. Note that this won't be enough to
get a bootable iso-only image as the query and index support is yet missing.


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


# ee1a1571a21825526da904634316649f06647268 07-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented a simple directory entry cache to speed up path resolution.


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


# 9f6ae76f020cd6cf1fca7a3ae21ee7819581307d 01-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added acquire_vnode() call that you can use to get another reference to an
inode - unlike get_vnode() the busy flag won't prevent you from getting that
reference.
* Changed put_vnode() to return an error in case the vnode couldn't be found.


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


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

Added fssh_volume_for_vnode() and fssh_do[_iterative]_fd_io() to the
FS shell. The latter two lack an implementation yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26670 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


# 589f1a9133081a871738156ebc2c95e757581aac 07-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Made the private kernel locking primitives available to file systems as well.
* Applied Korli's mutex_unlock() fix to block_cache.cpp.
* Removed block_cache_priv.h, as it's no longer needed (moved its definitions
into block_cache.cpp, as in the kernel file).


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


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

Might help gcc 2.95.3 to resolve its perceived overloading of the
function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24824 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


# 45eb999ec8f4d9bf86648ab94cfa96accadde3d8 09-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added "query" and "chmod" (octal, non-recursive only) commands.


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


# fa28330bbf9d39c01ad3016a777bedaa5960eedb 09-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Explained under which circumstances vnode_path_to_vnode() will clobber the
buffer of the provided "path" argument.
* Applied patch by Vasilis to fix some warnings when build on Linux (missing
const on certain functions). We should probably fix the original
{add|remove}_debugger_command() functions in Haiku as well.


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


# 4accd841c7331a6674a4c5db4d9b2686d7eb8bac 06-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed a big bug in common_file_io_vec_pages(): vecOffset was not correctly
set when the first chunk of the file could be read in directly, causing it
to read data to a wrong place in the buffer.
* Reading in the first chunk directly would have also only worked if vecIndex
and vecOffset was 0 when calling the function.
* Applied the fs_shell changes in file_map to the kernel version as well (the
constructor already worked correctly, though).


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


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

This might help with the build on Linux.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22888 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


# db5c68ca46ce6f291fa5c047035418f6ccc89817 04-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added the partition size as parameter to the file and partitioning
system initialize() hooks. It's often the only info about the
partition one needs and thus locking the partition just to get it is
no longer necessary.
* intel partitioning system:
- Removed passing around block sizes. We require 512 byte sectors
anyway. In fact using the parent partition's block size was even
wrong.
- Simplified writing the partition map sector.
- Simplified and corrected the partition map initialization.
- We don't fail identifying a partition anymore, if the partition map
contains no partitions. We would never identify a freshly
initialized partition map before.
- Made pm_identify() more intelligent: It determines the priority to
return depending on whether the partition is the device itself and
whether we have recognized child partitions.


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


# 32bf31b3eec8a0b42a260bbce4c6f263aab682c0 19-Sep-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Stricter limit for the number of unused vnodes. The fs_shell doesn't
really manage memory, so one could easily run out of memory when copying
large files.


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


# 9e12e9a72e7fde25482302f2d9a6a680fd2c0e6a 01-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added mapping of dup() in the FS shell.
* Adjusted the FS initialize() hook to have FD and partition_id
parameters like the other hooks instead of the partition path.
* Adjusted initialization in BFS accordingly.
* Implemented the FS initialization method in KFileSystem.


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


# 308771ff5d884090f4a3e3cc8251585d351d26b7 17-Jun-2007 Jérôme Duval <korli@users.berlios.de>

reverted to use __x86_64__ as it seems BeOSHostCompatibility header is not included for fs_shell


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


# 913f680ea231a0a8d89bb7e49296a22d162e1eaf 17-Jun-2007 Jérôme Duval <korli@users.berlios.de>

followed Ingo's suggestion and introduced HAIKU_HOST_PLATFORM_64_BIT macro


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


# a3ca7ebc40de58e0d8fdcca01bdf976896739d9a 17-Jun-2007 Jérôme Duval <korli@users.berlios.de>

x86_64 changes :
added atomic*64() functions
use int32 instead of long


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


# e23824d781d789eb9844a0fe3701a203c33b8586 07-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Surprising how much gcc 4 compilers on Linux differ. Another attempt to
make both gcc 2.95.3 and the plethora of gcc 4s happy: Typedefed
struct fssh_stat to fssh_struct_stat, thus hopefully avoiding spurious
errors concerning clashes with the function or regarding namespacing.


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


# 19d7a2a162c1adc9775fdbc3c89c22327386354e 02-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the syscalls into the FSShell namespace, so that they don't
collide with the functions defined in libroot_build.so.
* On BeOS incompatible platforms fssh_open() and fssh_close() use the
libroot_build.so _kern_open() and _kern_close() respectively, so that the
attribute support works also when using the generic attribute
emulation.
* Use fssh_open()/fssh_close() instead of open()/close() for the cp
command, so that we get attribute support on BeOS incompatible
platforms when the generic attribute emulation is used.


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


# cc70cbe297d87feca922b758e6458bc36abd8d80 02-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Reduced number of unused vnodes the VFS keeps around. We were hitting
the maximal number of (emulated) semphores on Linux before.


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


# 4b32170efd350a328dbf325fee54ff70e25006eb 30-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Work-around for an obscure gcc 2.95.3 bug: It complained about ambiguity
of fssh_stat struct and function.


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


# dac7faad8db7a251838599f8a18b87e03db6ddad 29-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added volume initialization support.


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


# 90c0876839198399555aa95d15f8dbd0ffc3cbf1 27-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

FS shell changes:
* Added basic built-in module support.
* Added rootfs.
* Added "kernel" initialization.
* Exposed the FS syscalls.
* Mounting/unmounting the FS works now.


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


# a38a92c955f46ea3dbd3929ad1398c2b418e80cb 26-Apr-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Beginnings of a new, better portable FS shell with Haiku FS interface.
Doesn't do anything ATM, but already provides the required system
interface (VFS, caches, POSIX functions).


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