History log of /haiku/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp
Revision Date Author Comments
# 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>


# b5ff580a 06-Apr-2023 vaibhavg20comp <vaibhavg20.comp@coep.ac.in>

btrfs: btrfs_shell build errors fixed

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


# cf5f513b 27-Apr-2022 Jérôme Duval <jerome.duval@gmail.com>

file_systems: add entry_cache_(add/missing) in btrfs,ext2,exfat lookup methods.

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


# 711e2dc0 01-Dec-2021 Augustin Cavalier <waddlesplash@gmail.com>

Adjust all struct dirent creations (again), this time to use offsetof().

The dirent struct is not packed, so offsetof(dirent, d_name) != sizeof(dirent).
Thus in order not to waste the alignment bytes (which are significant,
on x86_64 at least, sizeof(dirent)==32, but offsetof(...)=26.)

This is also the most portable way to handle things, and should
work just fine in cross-platform code that has a non-zero-sized d_name.


# 9d242fb9 18-Nov-2021 Augustin Cavalier <waddlesplash@gmail.com>

file_systems & Tracker: Do not assume sizeof(dirent) contains 1 byte for the name.

At present, it does, but that is an oddity we have preserved from BeOS
that the next commit is going to remove. (This commit thus wastes 1 byte
without the following one.)

Most changes are pretty straightforward: only a +1 is needed,
and a few removed from sizing calculations. Some filesystems like UDF
originally passed back the length with the \0 included, so they have
been adjusted further. UFS2 had some other sizing problems which are also
corrected in this commit.


# ab1a16de 19-Sep-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

btrfs: build fix


# 1519703a 03-Jul-2019 brjhaiku <brjhaiku@gmail.com>

btrfs: implement btrfs_write_fs_info

Change-Id: I507fc4154f8a11235b6b6f8812c3b38924f533f7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1560
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# ba6665a3 25-Jun-2019 brjhaiku <brjhaiku@gmail.com>

btrfs: add stub write function

Only does the parameter error checking.

Change-Id: Idee4a8e8e183d45c4a14236c32ff40e52ccb2555
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1534
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# f79386ad 10-Jul-2019 brjhaiku <brjhaiku@gmail.com>

btrfs: partially implemented btrfs_write_stat

Change-Id: Ib17ef1467a320af6edc3739555ebfb3f46bcc98b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1640
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 43160669 21-Jul-2020 waddlesplash <waddlesplash@gmail.com>

Revert "btrfs: partially implemented btrfs_write_stat"

This reverts commit f16979003a9740ca3fa54ebe0b64aa627b6f69f1.

Reason for revert: Broke the build.

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


# f1697900 10-Jul-2019 brjhaiku <brjhaiku@gmail.com>

btrfs: partially implemented btrfs_write_stat

Change-Id: Ib17ef1467a320af6edc3739555ebfb3f46bcc98b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1640
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# e1b7c1c7 19-Apr-2020 Kyle Ambroff-Kao <kyle@ambroffkao.com>

storage/SymLink: Fix Be API regression in ReadLink

After this patch, "UnitTester BSymLink" passes.

BSymLink::ReadLink() in BeOS would always return the length of the
link unless an error occurred. Before this patch, Haiku instead seemed
to emulate posix readlink() behavior, returning the number of bytes
copied into the output buffer.

BeOS also did not guarantee that the string written into the output
buffer is NULL terminated if the output buffer cannot contain the
entire link contents, but the Haiku implementation does since it is is
a basic safety issue.

This patch fixes this and updates the Haiku API docs to describe the
behavior explicitly.

Fixing this required changing behavior in bfs_read_link, which
required changes in many more places.

docs/user/storage/SymLink.dox:
src/kits/storage/SymLink.cpp:
* Don't return B_BUFFER_OVERFLOW if the provided buffer is not large
enough to hold the link contents.
* Update documentation to clearly describe behavior.

src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp:
* Change bfs_read_link() to always return the link length. This is
called by common_read_link in the VFS, which is called by
_kern_read_link().

src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp:
src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp:
src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp:
src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp:
src/add-ons/kernel/file_systems/netfs/client/netfs.cpp:
src/add-ons/kernel/file_systems/nfs/nfs_add_on.c:
src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp:
src/add-ons/kernel/file_systems/reiserfs/Iterators.cpp:
src/add-ons/kernel/file_systems/reiserfs/Iterators.h:
src/add-ons/kernel/file_systems/reiserfs/Volume.cpp:
src/add-ons/kernel/file_systems/reiserfs/Volume.h:
* Update the implementation of read_link for these filesystems. Some
of them were incorrect, and some had just copied the posix behavior of
bfs from before this patch.
* Use user_memcpy in ext2_read_link()
* Use user_memcpy in nfs fs_read_link()
* Use user_memcpy in reiserfs StreamReader::_ReadIndirectItem and
StreamReader::_ReadDirectItem
* Remove unused method Volume::ReadObject in reiserfs.

src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingLeafNode.cpp:
src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp:
* Update UnpackingLeafNode::ReadSymlink and
PackageSymLink::ReadSymLink() to set the bufferSize out parameter to
the symlink length. Both of these are called by
packagefs_read_symlink.
* Use user_memcpy

src/add-ons/kernel/file_systems/netfs/client/netfs.cpp:
* netfs seems mostly unimplemented. Added a FIXME note for future
implementers so that they know to implement the correct behavior.

src/system/libroot/posix/unistd/link.c:
* readlinkat() was just wrapping _kern_read_link() because before this
patch it had expected posix behavior. But now it does not, so we
need to return the number of bytes written to the output
buffer.

src/build/libroot/fs.cpp:
* Update _kern_read_link() in the compatibility code to emulate the
Haiku behavior on the host system. This is done by using an
intermediate buffer that is guaranteed to fit the link contents and
returning its length. The intermediate buffer is copied into the
output buffer until there is no more room.

src/tests/kits/storage/SymLinkTest.cpp:
* This patch also resolves some test failures similar to those
resolved in ee8cf35f0 which fixed tests for BNode. The tests were
failing because Haiku's error checking is just better.

BeOS allowed constructing a BSymLink with BSymLink(BDirectory*,
const char*) with the entry name of "". The same is true of the
equivilant SetTo() method. The BSymLink object will appear valid
until you attempt to use it by, for example, calling the ReadLink
method, which will return B_BAD_VALUE.

Haiku does a more appropriate thing and returns B_ENTRY_NOT_FOUND,
for this constructor and the equivilant SetTo(BDirectory*, const
char*) method. This patch fixes these test assertions to match Haiku
behavior.

docs/develop/file_systems/overview.txt:
* Add notes for future filesystem driver implementers to call this
mistake when implementing fs_vnode_ops::read_symlink.

docs/user/drivers/fs_interface.dox:
* Fix documentation for fs_vnode_ops::read_symlink

Change-Id: I8bcb8b2a0c9333059c84ace15844c32d4efeed9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2502
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# c5e9dd9b 10-Jan-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Fix btrfs_shell build

The hacks to still use actual system headers for zlib didn't quite work.

- Define Z_SOLO, which makes zlib build without any system include
- Remove use of std::max and #include <algorithm> from AVLTree
- Do not include DebugSupport.h because it uses system headers
- Do not include uuid.h and define just what we need

Now it's possible to compile the btrfs_shell on Linux.

Change-Id: I74a14b5f6804db45ab5a9f582ab493d696376fd3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2098
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 175e599a 08-Oct-2019 Adrien Destugues <pulkomandy@pulkomandy.tk>

btrfs: document that we don't need get_vnode_name

Change-Id: Iffea088f7234ab7d458ed0cabc4ded0aa50009c2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1617
Reviewed-by: Chế Vũ Gia Hy <ugen@cinnamon.is>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 9a84f57b 10-Jul-2019 brjhaiku <brjhaiku@gmail.com>

btrfs: implemented btrfs_unlink

Change-Id: I3ccb6be54ba3e42136fa7093f35e16aaecc5a540
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1589
Reviewed-by: Chế Vũ Gia Hy <cvghy116@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# aa08671d 08-Apr-2019 Les De Ridder <les@lesderid.net>

btrfs: partially implement filesystem initialization

Change-Id: I7fb3340dc39b3331d30e5113b5860d936efab253
Reviewed-on: https://review.haiku-os.org/c/1395
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# e982a0b2 08-Apr-2019 Les De Ridder <les@lesderid.net>

btrfs: make file system name consistent

Change-Id: I5276be636875809f78201cb6274d64499252de73
Reviewed-on: https://review.haiku-os.org/c/1394
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>


# f10ebdb1 13-Mar-2019 brjhaiku <brjhaiku@gmail.com>

btrfs

* Fixed coding style for all files under /src/add-ons/kernel/file_systems/btrfs
* rewrote crc_table.cpp to generate CRCTable.cpp that conforms to coding style.

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


# 99768086 29-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Add author and license.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 4896a373 28-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Implement btrfs_remove_dir that can remove directories in most case.

We need to handle a case when node size is small reasonably it can be merged with another node or push data from other node to this node.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 166917c9 28-Aug-2017 hyche <cvghy116@gmail.com>

BTRFS: Implement btrfs_create_dir that can create directories in most case.

We need to handle a case when node is full, the solution should be split or push data to another node.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# b24d4c8a 18-May-2017 hyche <cvghy116@gmail.com>

Fixed: Code style (again)

* Pointer/Reference should be next to type
* else if -> if
* Remove trailing spaces

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# bf5d0ce3 19-May-2017 hyche <cvghy116@gmail.com>

btrfs_shell for testing btrfs code.

* Adding Jamfile in src/tools/btrfs_shell and include the subdir in src/tools/Jamfile
* Adding system_dependencies.h in btrfs source to include all the system headers
* fs_shell wrapping for btrfs source. If FS_SHELL is defined, compile with fs_shell headers instead.
* Change macro BTRFS_SHELL to FS_SHELL
* Adding btrfs_std_ops function: fs_shell now can recognize and load module


# 8864a6cb 18-May-2017 hyche <cvghy116@gmail.com>

btrfs: Code style

* Using tab instead of spaces
* Pointer/Reference should be next to type
* etc


# 6f7fc220 07-Mar-2016 Axel Dörfler <axeld@pinc-software.de>

NodeMonitor: Added B_WATCH_CHILDREN flag.

* Added a directory argument for notify_{stat/attribute}_changed().
* This allows to watch only a directory, and get the notifications for
all of its files, not just add/remove entry notifications.


# 267a780a 06-May-2013 Jérôme Duval <jerome.duval@gmail.com>

btrfs: fixes 64 bit warnings


# 795f13d6 02-May-2013 Jerome Duval <jerome.duval@gmail.com>

btrfs: Return more than a single dirent at a time in btrfs_read_dir().

* similar to what mmlr did in hrev45575 for bfs.


# f53ec236 02-Mar-2011 Jérôme Duval <korli@users.berlios.de>

changed ioctl hook return code when the opcode isn't supported.


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


# d40b4e0f 01-Feb-2011 Jérôme Duval <korli@users.berlios.de>

the object to be rewinded is actually a AttributeIterator instance. Thanks to Stephan for pointing out!


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


# 886d6531 31-Jan-2011 Jérôme Duval <korli@users.berlios.de>

forgot to add B_FS_HAS_ATTR when adding attribute support


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


# 956f541d 31-Jan-2011 Jérôme Duval <korli@users.berlios.de>

added read only attribute support for btrfs.


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


# 6f4c36e2 24-Jan-2011 Jérôme Duval <korli@users.berlios.de>

* Implemented a read-only btrfs file system, tested with a 400MB image.
* Inline extent data isn't read with the file_cache yet as the data is not block aligned.


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


# 267a780ab5ba7e7774dc6b4a6d391ab3cfbb9f78 06-May-2013 Jérôme Duval <jerome.duval@gmail.com>

btrfs: fixes 64 bit warnings


# 795f13d6f2ef70799c89ae999e2b4ea9c170faed 02-May-2013 Jerome Duval <jerome.duval@gmail.com>

btrfs: Return more than a single dirent at a time in btrfs_read_dir().

* similar to what mmlr did in hrev45575 for bfs.


# f53ec236e22695929663822b4050b3cfe9a10c09 02-Mar-2011 Jérôme Duval <korli@users.berlios.de>

changed ioctl hook return code when the opcode isn't supported.


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


# d40b4e0f3ba176b04e1619d84ff9e94c959150a9 01-Feb-2011 Jérôme Duval <korli@users.berlios.de>

the object to be rewinded is actually a AttributeIterator instance. Thanks to Stephan for pointing out!


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


# 886d6531a6aac8b135930367a0037069d6e5d7f2 31-Jan-2011 Jérôme Duval <korli@users.berlios.de>

forgot to add B_FS_HAS_ATTR when adding attribute support


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


# 956f541d967013c2be8563b7b1ee9af79eb50532 31-Jan-2011 Jérôme Duval <korli@users.berlios.de>

added read only attribute support for btrfs.


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


# 6f4c36e2979b9684a65e6d73b872d4628f3e452a 24-Jan-2011 Jérôme Duval <korli@users.berlios.de>

* Implemented a read-only btrfs file system, tested with a 400MB image.
* Inline extent data isn't read with the file_cache yet as the data is not block aligned.


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