History log of /haiku/headers/private/kernel/fs/KPath.h
Revision Date Author Comments
# 42e3c6f9 10-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

KPath: Use an object_cache for the path buffers in the normal case.

This was (following the packagefs changes) the number-one (by call
count) consumer of malloc() during the boot -- 52866 calls, and 100%
of them either 1024 or 1025 bytes!

Virtually all of these are ephemeral (indeed, the object_cache
stats after a boot with this patch shows there is only a single slab
of 64 buffers allocated, and most of them unused), so this is
probably a significant performance boost.

Change-Id: I659f5707510cbfeafa735d35eea7b92732ead666


# e9843da3 30-Apr-2017 Axel Dörfler <axeld@pinc-software.de>

KPath: Added LAZY_ALLOC flag.

* This allows KPath to not allocate a buffer when initialized
without path.
* Added test cases for this.
* Added test for LockBuffer().
* Enhanced tests to allow building them in debug mode.
* Moved calling vfs_normalize_path() into own private method.
* Improved error codes; B_NO_MEMORY is now only returned if the
allocation actually failed.
* If used with LAZY_ALLOC, Path() and LockBuffer() are now allowed
to return a NULL path.


# eac83fb3 30-Apr-2017 Axel Dörfler <axeld@pinc-software.de>

KPath: Replaced booleans with flags field.

* No functional change intended; I chose the flags in a way that it
should still work even if I missed a reference.


# 3582d4fe 29-Apr-2017 Axel Dörfler <axeld@pinc-software.de>

Minor style cleanup.


# 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


# 56bbbbc9 08-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Added Adopt() method that steals the other path's buffer.
* Fixed operator=(): the second argument of SetTo() is a boolean (normalize),
not the length of the buffer.


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


# 3532662e 14-Jul-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added RemoveLeaf() leaf method. Very handy for recursive directory
iteration code using a single KPath object.


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


# 0d4c16e0 05-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Reduced the stack usage of most of the I/O paths - there were several places
that put one or more full paths on the stack before, which could cause some
problems under certain conditions.
* Cleaned up KPath, ie. use size_t instead of int32 where appropriate, added
license.


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


# b38248e1 04-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Fixed a warning in GCC 3.


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


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

Added support for path normalization.


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


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

Extended Append() to also allow adding parts of path components. Added leaf component manipulation. Now always chop trailing slashes off the path.


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


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

Added class KPath. Convenient wrapper for a fixed-sized path buffer.


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


# 56bbbbc9ca07e097c948cd59d3f70d4bb363f19c 08-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Added Adopt() method that steals the other path's buffer.
* Fixed operator=(): the second argument of SetTo() is a boolean (normalize),
not the length of the buffer.


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


# 3532662e0c5f385a64db401663b9a136c323a6a9 14-Jul-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Added RemoveLeaf() leaf method. Very handy for recursive directory
iteration code using a single KPath object.


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


# 0d4c16e0c08ba45ee32177fae63fdeb5b71b52a1 05-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

* Reduced the stack usage of most of the I/O paths - there were several places
that put one or more full paths on the stack before, which could cause some
problems under certain conditions.
* Cleaned up KPath, ie. use size_t instead of int32 where appropriate, added
license.


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


# b38248e1084ac5c855ba313f4454ec0c0a2e087d 04-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Fixed a warning in GCC 3.


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


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

Added support for path normalization.


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


# 0402530222cb6116c9af92f1948277e56728ab53 28-Oct-2004 Ingo Weinhold <ingo_weinhold@gmx.de>

Extended Append() to also allow adding parts of path components. Added leaf component manipulation. Now always chop trailing slashes off the path.


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


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

Added class KPath. Convenient wrapper for a fixed-sized path buffer.


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