History log of /haiku/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp
Revision Date Author Comments
# 354311b5 30-Aug-2019 Adrien Destugues <pulkomandy@pulkomandy.tk>

filesystems: bump priority of BFS over others

If multipole filesystems think they can handle a volume, it makes sense
to assume the native one is to be used.

Makes my partitions with a BFS superblock and a leftover ext2 superblock
on them mountable again without manually specifying the filesystem type.

Fixes #15045.

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


# aa775038 05-Jul-2012 ahenriksson <sausageboy@gmail.com>

bfs: split checkfs code into FileSystemVisitor and CheckVisitor

Another FileSystemVisitor implementation will be used for resizing

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


# 5d558f27 26-Oct-2018 François Revol <revol@free.fr>

BFS: Use separate name & pretty name for big-endian

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


# 44c76b26 09-Jan-2017 Axel Dörfler <axeld@pinc-software.de>

bfs: Made updating the boot block more secure.

* It now also checks the length/offset indepdently from each other,
so that they cannot benefit from integer overflow.
* This fixes bug #12943.


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


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

bfs: Use negative caching on directory lookup failures.


# de9c0613 03-Jul-2014 Axel Dörfler <axeld@pinc-software.de>

bfs: Use the QueryParserUtils instead of its own copy.

* Ingo copied the methods into a shared location, and then obviously
"forgot" to let BFS use them. As a side note for Ingo: the complete
error GCC reported was "std::fssh_size_t" not defined with the macro
wrapper as code location. The actual problem was a "using std::size_t"
in some C++ header that accidentally got included after the wrapper.
* The shared Query code is not yet used. That'll be done another time.
* Renamed BFS_SHELL define to FS_SHELL, such that QueryParserUtils can be
used in any file system shell, not just the bfs_shell.


# 547cd462 02-Nov-2013 Axel Dörfler <axeld@pinc-software.de>

trim: Added is_called_via_syscall() function.

* And use it in get_trim_data_from_user(), formerly known as copy_*().
* This fixes differentiating between user and kernel buffers.


# 99086aa3 14-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

trim: Target SCSI UNMAP command instead of WRITE SAME.

* The UNMAP command is theoretically much faster, as it can get many block
ranges instead of just a single range.
* Furthermore, the ATA TRIM command resembles it much better.
* Therefore, fs_trim_data now gets an array of ranges, and we use SCSI UNMAP
to trim.
* Updated BFS code to collect array ranges to fully support the new
fs_trim_data possibilities.


# 0a0ba4b5 04-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

Added B_TRIM_DEVICE support to BFS.

* It currently ignores the offset/size, though, and always trims everything.
* Now only SCSI support is missing.


# a01dd963 28-Apr-2013 Michael Lotz <mmlr@mlotz.ch>

Return more than a single dirent at a time in bfs_read_dir().

Return as many dirents as fit into the provided buffer. The readdir()
implementation in libroot tries to get many dirents and caches them to
reduce the amount of syscalls and the associated overhead.

This reduces the syscall count dramatically for use cases where a lot
of directories are enumerated. A "git status" on a Haiku repository for
example goes from over 50k read dir syscalls down to just under 7k.
The performance gain is only around a moderate 5% in that use case
though.


# caa1e8b7 31-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fix CID 712419, 712420, 712421, 712422: Unintentional sign extension to 64 bits.


# 3cd66dda 31-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fix CID 712419, 712420, 712421, 712422: Unintentional sign extension to 64 bits.


# eb5f3639 12-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

Fixes some occurrences of 'variable set but not used', disables Werror for problematic items.


# a735bdeb 31-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

Align all filesystem relevant places to use B_UNSUPPORTED for unsupported
instead of a mix of B_NOT_SUPPORTED and B_UNSUPPORTED. This allows checking for
a specific error code. Probably one of those should be phased out...


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


# 90ade5e2 12-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added file_system_module_info::uninitialize() analogously to
partition_module_info::uninitialize().
* Implemented the hook for BFS.
* Implemented KFileSystem::Uninitialize().

Fixes failure to initialize a BFS initialized device with an intel partition
map.


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


# 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


# 48ec4fbb 09-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Rohit Yadav that fixes #6750, thanks a lot!
* This changes Inode::CheckPermissions(), and bfs_write_stat() based on Ingo's
solution in his file corruption test file system.


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


# d63f4274 18-Oct-2010 Jérôme Duval <korli@users.berlios.de>

added a file system call preallocate() as described in #6285, currently unused


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


# 950f37b2 13-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* renamed bfs_inode::ToUsecs() to bfs_inode::ToNsecs, as it really converts to nanoseconds.
* added a comment explaining the nanoseconds conversion


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


# 75148e01 14-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Janito that fixes broken reverting when a rename operation
failed on last chance. Thanks!


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


# 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


# 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


# 1a1a8f33 10-Apr-2010 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Janito that solves a TODO and utilizes the actual device
block size to align the file map.
* This closes ticket #5707, thanks!


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


# d501707d 03-Mar-2010 Axel Dörfler <axeld@pinc-software.de>

* Removed the cookie field of the check_control structure; that really was
a stupid idea. Instead, the already existing fCheckCookie member is used.
* bfs_ioctl() now accesses all userland buffers safely, this should help with
#3264, and move the crash where it belongs.
* Changes not yet tested; they only affect checkfs.


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


# b2397539 05-Jan-2010 Axel Dörfler <axeld@pinc-software.de>

* BFS now correctly reports the B_FS_HAS_QUERY flag (ie. if you disable the
indices it will no longer be set).


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


# 4ea6fb8b 27-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Changed the query code again to send B_ENTRY_REMOVED/B_ENTRY_CREATED
notifications if an inode in a query result was moved/renamed - this time all
the information is correct, though.
* While I did not introduce B_ENTRY_MOVED for queries yet, this should make
adding it very simple (left as an excercise for the reader ;-))


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


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

* Implemented O_DIRECTORY in BFS.


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


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

Replaced "%Ld" and "%lld" in printf()s by the new B_PRI* macros to avoid
warnings when building with a 64 bit compiler.


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


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

* Only remove the inode from the Volume::RemovedNodes() list when it has gone
through the VFS.
* This fixes bug #4942.


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


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

* common_rename() now checks the name for validity before passing it on to the
file systems, so those checks don't have to be duplicated there, anymore.
* Minor cleanup, mostly automatic whitespace.


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


# 1b944eec 29-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Improved the status_change time check to actually filter out invalid times,
before, st_ctim was never updated; since you cannot change st_ctim via an API,
'0' cannot ever be set, either.
* Inode::WriteAttribute(), and Attribute::Write() now return whether they
created an attribute or not, and thus B_ATTR_CREATED is now correctly set.
* Moved status_change update from bfs_write_attr() into Inode::WriteAttribute()
where it can be handled more efficiently.
* Likewise, Inode::RemoveAttribute() now updates the status_change time as well,
I simply forgot this before.
* Minor cleanup.


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


# b43e064e 29-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Attribute changes now also change the status change time.
* While Ingo already convinced me to use the modified time for this instead
(see People files, for example), I did not do so for two reasons:
1) The file modification date is important to the user; more or less hidden
attribute changes shouldn't have an effect on this.
2) Efficiency: the last_modified field is indexed whereas status_change is
not. Speed would suffer noticeably else.
* We might want to think about a new "stat::st_attrtim" field, though, instead.


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


# aeb099b3 19-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a very simple way to fragment your disk.


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


# 425cb3d7 09-Sep-2009 Oliver Tappe <zooey@hirschkaefer.de>

* revert r32999 and adjusted each filesystem to return B_NOT_A_DIRECTORY in
its open_dir() implementation instead (as suggested by Ingo).
-alphabranch (it's only a cleanup)


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


# 1a60fd72 06-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Replaced the Inode::GetTree() method with a simple getter - the tree is
always created for directories since quite some time now.


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


# 134e1b04 06-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Somehow I forgot to update the parent directory's time stamps on file
creation, removal, and name changes...


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


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

bonefish + axeld:
* Reverted r31809 as it introduced a race condition; if the I/O request had been
notified, it could already been deleted at that point.
* Instead, we need to notify the request in each file system/driver that uses
it. Added new notify_io_request() function that does that exactly.
* Added a TODO comment to the userlandfs where the request notification needs
a bit more thought.


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


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

* Almost all Transaction::Done() return values are now honoured.


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


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

* Journal::_WriteTransactionToLog()'s return value was ignored previously,
leading BFS to report success on actually failed transactions. Those
transactions were even kept open, leading to a panic when starting the next
transaction.
* Transaction::Done() now returns a status - currently, this is only handled
correctly where this is likely to happen without a disk fault, ie. if the
transaction was too large to be written back safely.
* Improved "bfs_journal" command output.


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


# e4944941 15-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup of how the time is converted between bfs_inode and the outside world:
there is now a couple of conversion functions, and I changed the type from
bigtime_t to int64, as it's not what a bigtime_t would usually contain, but
some shift magic in order to make duplicate index entries less likely.
* We now correctly fill in the timespec in struct stat as good as possible; the
12 of the 16 possible bits are used for the nano second value. The lower 8
bits are used to avoid the duplicate index entries. Only if the nano second
time is 0, the lower 12 bits are used to achieve that.


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


# 33203f67 25-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

* added support for ctime to BFS by grabbing two of the pad-fields
* added TODO about a sanity check that should perhaps be dropped
I checked this change with both a haiku-BFS partition and one from R5

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


# a786c139 08-May-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed the work-around that allowed to open directories read/write.
See ticket #3875.


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


# 24b822d8 17-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* No longer hold the write lock when calling Inode::FillGapWithZeros(), as this
potentially deadlocks as described in bug #3768. The system is still
completely unresponsive, but gets back to a working state after some time now.
* Since the rw_lock is public, Transaction and InodeReadLocker no longer need to
be friends with Inode.


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


# 992fba36 16-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* There is now a list of removed vnodes in Volume - while asking the VFS for
this seemed to be a good idea, there is one race condition that cannot be
solved otherwise (the vnode must be added/removed to that list while holding
the transaction lock, and we cannot guarantee that in the VFS).
* We are using an unused area of the in-memory bfs_inode to store the list
links (bfs_inode::pad - this will also work on 64 bit platforms).
* Inode no longer adds a singly linked list link - the transaction list now
shares the doubly linked list with the removed vnodes list.
* Added an in-memory flag INODE_IN_TRANSACTION to avoid searching an inode
to be added in the list.
* Removing an attribute directory did not hold its write lock.
* If removing an attribute failed for some reason, the INODE_DELETED flag
was not removed (the transaction would not have failed because of that).


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


# 973032b8 29-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added TODO for Axel or whoever is interested. :-)


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


# aa4ba93e 08-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed src/system/kernel/device_manager/io_requests.{h,cpp} to
IORequest.{h,cpp}.
* Introduced public <io_requests.h> header. Currently it only declares the
single function BFS uses.


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


# b6b002b8 23-Jan-2009 Jérôme Duval <korli@users.berlios.de>

when renaming, check first with the newDirectory instead of starting at its parent. this should fix #3355


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


# e677f5aa 10-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed two possible crashing bugs in the file system check code: the checker
was attached to the inode instead of the file descriptor, causing it to call
BlockAllocator::StopChecking() whenever anyone closed the device's root node
during the check. The other bug was that it tried to fix errors even if the
device was read-only.
* Added TODO that ioctl() accesses userland buffers unsafely.
* Removed no longer valid or superfluous comments.


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


# 64e0d084 02-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Inodes are no longer trimmed from the checking thread. This should fix bug
#3190.


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


# 243680e8 26-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* Forgot to cast before the shift; this fixes the problem seen by Bruno.


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


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

* In bfs_write_stat() B_STAT_UID, B_STAT_GID, and B_STAT_MODE now also trigger
an update of st_mtime. This is a work-around for the unmaintained st_ctime,
and this also fixes bug #3143.


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


# 2bb83490 17-Oct-2008 Michael Lotz <mmlr@mlotz.ch>

Fix two bugs related to the use of the entry cache for parent entries in BFS:
* The parent entry ("..") of a directory was not removed from the cache when its
directory was removed.
* When moving a directory to a new parent, it's cached parent entry wasn't
updated.

Those would lead to stale cache entries for directory parents. If a certain inode
would be reused to create a new directory after removing another, this would lead
to an invalid inode being returned when looking up the parent of the new
directory. This was easily reproducible by unzipping some directory structure,
deleting it and unzipping it again. You would end up with many "inode already
deleted" messages.


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


# 218f8c86 17-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Give a more detailed error message in case someone just tried to access a
deleted inode (which might always happen when accessing an inode by ID),
for example by using the BDirectory(node_ref&) constructor.


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


# 057f999d 13-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a flag B_DISK_SYSTEM_SUPPORTS_WRITING to determine whether or not a
file system can write to files before mounting.
* Set the flag for all file systems that actually can write.


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


# cfa4660b 13-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the way the BFS_IOCTL_UPDATE_BOOT_BLOCK ioctl works; it's a bit
more flexible to use now.


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


# 9fc81c53 11-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Use a block size of 512 - since there is no standard, we're just following
the masses (whatever stupidity created this misery).


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


# b2ec044c 30-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Added stat::st_blocks field as required by POSIX. This also closes ticket
#2261.
* Made at least BFS report it more or less correctly (the attributes are
ignored, though).


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


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

Removed debug output.


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


# dea4ee19 14-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the error return by bfs_link() to B_NOT_SUPPORTED.


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


# 57b9debf 13-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Some index updating functions did not take into account that not all nodes
are put into all indices. For example, symlinks aren't part of the size
index. This fixes bug #2704.
* Also, Inode::NeedsTrimming() now ignores symlinks that have no data stream,
it's const now, too.
* Added helper methods Inode::In{Name|Size|LastModified}Index(), and use it
where appropriate.
* Clarified Inode::Create() description with regards to name vs. parent.


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


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

Use the new entry cache.


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


# 46124337 30-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added parameter "size_t align" to file_map_translate(). If > 1, the
vector at the end of the file will be aligned to the given value.
* BFS uses an alignment of 512 bytes (should be block size of the
underlying device or BFS block size, whatever is less), which should
be fine, since file data are only stored in BFS blocks. This totally
avoids any partial operations at the I/O scheduler level, thus saving
disk operations. Not that I could measure any performance difference.
Theoretically it should help a lot though, particularly when dealing
with lots of small files, since we avoid using bounce buffers, which
are (a) limited in number and (b) require copying of the data.


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


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

The return value of the identify_partition() hook is not error code
compatible. Small floats have to be returned.


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


# 7f57b05f 13-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Temporarily use the private I/O request API to decide whether or not the
request is a write request.
* This closes bug #2579, thanks BGA for the investigation!


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


# bbc9703c 10-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

As suggested by Rene and Andreas: Use '%lld' instead of the non-standard
'%Ld'. This solves build problems in Solaris.


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


# 3656dc0d 09-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed debug tracing that obviously slipped in in a former commit.


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


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

* We must call file_cache_disable() with O_NOCACHE also in bfs_create().


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


# 88a25656 03-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for O_NOCACHE/O_DIRECT.
* bfs_open() was leaking the already allocated cookie in several error
conditions.


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


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

* Coding style cleanups, no functional changes.


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


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

* Replaced Chain with the new SinglyLinkedList.
* Renamed openModeToAccess() to open_mode_to_access().
* Cleanup.


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


# 2e3477e3 31-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the inode write locking to be held as long as the transaction is
running - this fixes several cases where someone could see outdated data
when a transaction had to be reverted (the time between unlocking the inode
and actually reverting the blocks). For that, Inodes can now be put into a
singly linked list.
* Added a TODO in Inode::WriteAt() which explains why it cannot use the above
method: seems that our VFS/VM locking model isn't really that good.
* Fixed a possible deadlock in Attribute::_Truncate() where the inode write
lock was held before starting the transaction.
* Added an InodeReadLocker convenience class, that should be used instead
of ReadLocker - Inode::Lock() only still exists because of the needs of
bfs_io().
* Moved the bfs_io() callback hooks out of the exported module API region,
and removed their bfs_ prefix.
* Added a Volume::IsInitializing() method that should be used rather than
checking if Volume::ID() is >= 0.
* Removed the MultiInodeLocker again, as it's pretty much superfluous now.
* Moved openModeToAccess() to the Utility.h header.
* Minor cleanup.


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


# 274e684a 31-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* bfs_rename() did not write lock the moved inode, but only its former and
new parent directories. This would only be necessary in case it's a directory,
but we do it always now.
* This fixes bug #2556.


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


# b99521f2 30-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

First round of locking fixes:
* Moved locking the data stream out of the BPlusTree methods; this fixes at
least two locations where another thread could have seen outdated/incorrect
data.
* Removed some superfluous code in bfs_rename(): we don't have to revert to the
previous situation, the transaction does this for us automatically.
* Added a simple MultiWriteLocker, even though it's not really necessary anymore
(since we always hold the transaction lock first when we lock more than one
inode at a time).
* Inode::Create() called InodeAllocator::Keep() a bit too early, the file cache
and map wasn't created and assigned yet.
* InodeAllocator now keeps the inode write locked.


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


# e9c954c3 29-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Use file_map_translate() instead of bfs_get_file_map().


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


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

Implemented the io() hook.


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


# fe08828a 23-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* The identify_cookie was allocated unchecked, spotted by Stippi.


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


# 082bae1a 23-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* bfs_fsync() no longer grabs the Inode's read lock - instead, Inode::Sync()
will take care of the locking.
* Use new(std::nothrow) over new, and malloc (only in kernel_interface.cpp);
the kernel_cpp.h header isn't really necessary anymore, so there is no reason
BFS should continue to use it.
* Removed superfluous NULL checks.


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


# 9083840f 20-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

bonefish + mmlr + axeld:
* Fixed a bug that could easily corrupt your disks (yeah, one of those
again): bfs_get_file_map() truncated the last vec incorrectly and
would potentially return a too large file size -- which was later
happily overwritten with file data, but could have belonged to
anything but that file (like inodes, B+trees, etc.).
* Renamed previous round_up() function to key_align().
* Added round_up() template function, and used it where appropriate.
* The latter actually fixed two bugs where the and mask was computed in
32 bit where it should have been in 64 bit.
* Inode::FindBlockRun() should have checked the max indirect size
instead of the direct size - this didn't cause any problems, though.
* White space cleanup.


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


# 8c121d2c 14-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed the bug described by Salvatore: since we let BFS open directories with
read/write access, we shouldn't let it truncate the directory B+tree...
* Also fixed allowing truncation in read-only mode.


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


# 1bde8b03 08-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced BFS's ReadWriteLock implementation with the kernel's rw_lock.
* The BlockAllocator now uses the new mutex_transfer_lock() function instead
of clobbering the mutex directly.
* Removed Lock.h - it's no longer needed.
* Minor white space cleanup.


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


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

* Removed the home-brewn locking classes in BFS besides the read/write lock
(for now).
* Inode::fSmallDataLock is now a recursive_lock, Journal::fLock is now
a recursive_lock, too, Journal::fEntriesLock is now a mutex, as is
BPlusTree::fIteratorLock.


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


# 0c48c437 01-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed the bfs_write() error code for directories as suggested by Jerome.
* Removed a few superfluous checks.


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


# fdf3fa9f 30-Jun-2008 Jérôme Duval <korli@users.berlios.de>

read() expects B_IS_A_DIRECTORY on directories that can't be read.
This fixes grep misbehavior with directories.


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


# bcd30708 28-Jun-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed a deadlock found by Salvatore; the volume lock is now only used to
protect the bfs_read_fs_stat() and bfs_write_fs_stat() functions.


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


# ef098c90 28-Jun-2008 Axel Dörfler <axeld@pinc-software.de>

* Removed volume lock from bfs_get_vnode() - it's not necessary on Haiku.
* Minor cleanup.


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


# 1da9f5ce 10-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Added BDiskSystem::ShortName() and everything needed to get it there.
* Added BDiskDeviceRoster::GetDiskSystem() method, that can get a disk system
by short/pretty/module name - since they should all be unique, I put them
in a single namespace, please complain if you don't like that :-)
* Cleaned up DiskSystem.h and DiskDeviceRoster.h according to the updated
header guidelines.
* Renamed ntfs pretty name from "ntfs File System" to "Windows NT File System".


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


# fd4a010b 24-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

rename() is supposed to fail when the target exists and is not a
directory only if the source is a directory.


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


# d11e733f 24-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Allow passing sub vnode ops and publish flags to Inode::Create().
* Implemented create_special_node() hook.
* Fixed Inode::IsContainer()/IsDirectory().


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


# 3daf03d3 08-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

I broke the index dir access when changing the FS interface.


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


# 0e4edbea 04-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Added checks to (hopefully) all write/create functions to bail out early
if the volume is read-only. This should help with #2028.
* Removed unused bfs_[de]select() functions.
* Removed most paranoia checks - now that we control both sides of code,
this would just hide eventual problems in the VFS code.
* Cleanup.


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


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

* Inode::OldSize() is the size of the file before the last index update
- this might be a bit older, so we cannot use it for the previous size
in the call to Inode::FillGapWithZeros() in bfs_write_stat().
* This fixes the perl problem Ingo ran into after r24555.


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


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

* Added a new flag for write stat: B_STAT_SIZE_INSECURE that allows a
file system to not fill newly created space with zeros.
BFile::SetSize() now uses this, while [f]truncate() does not. This
is only a temporary work-around until BFS supports sparse files.
* Apps that want to reserve space to fill up later should use
BFile::SetSize() for now, as this will be a lot faster than
[f]truncate().
* cache_io() and the functions below now use a special mode when you
pass in a NULL buffer: for read access, the cache is only populated
(useful for prefetching), for write access, the file is filled with
zeros.
* Implemented BFS's Inode::FillGapWithZeros() using this method now.
* Removed extraneous white space.


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


# 1b32947d 17-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Aligned the semantics of the read_symlink() FS module hook with the
readlink() function. It is no longer required to null-terminate the
string, shall not fail, if the buffer is too small, and shall return
the length of the string actually written into the buffer.
* Adjusted rootfs, devfs, and bfs accordingly. Also adjusted their
read_stat() hooks to return the correct symlink length in st_size.
* Our readlink() does now comply to the standard (and BeOS).
Additionally if the buffer is big enough it is nice to non-conforming
apps and null-terminates it.
* BSymLink::ReadLink() explicitly null-terminates the string now.


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


# 6cc58858 15-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Improved error reporting when mounting a volume failed, especially when
the log couldn't be replayed.
* Minor cleanup.


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


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

Corrected patch to fix warnings when compiled with GCC 4, thanks Vasilis!


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


# 351b7a2d 25-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Added B_WATCH_INTERIM_STAT, and B_STAT_INTERIM_UPDATE definitions to
NodeMonitor.h.
* The latter will be set in "statFields" for interim updates when you have
asked to get them via the former.
* BFS now uses the B_STAT_INTERIM_UPDATE flag for sending updates to actively
written files.
* This makes us more compatible with BeOS again; if you only asked for
B_WATCH_STAT, you will now only receive a notification if the file in
question has been closed.
* Tracker now uses B_WATCH_INTERIM_STAT to always get all updates (ie.
downloading a file will update its size and modification time in Tracker
periodically during the download).
* Wether "needsTrimming" was true or not has no influence on wether or not
the size index needs to be updated in BFS - only the actual file size is
stored there, not the on-disk size.
* Added a TODO comment in Inode::WriteAt() that it would actually need to
update the size index when changing the file size, not when the file has
been closed (but that's probably too slow).


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


# 4f045f9c 14-Feb-2008 Michael Lotz <mmlr@mlotz.ch>

Turns out the only thing we didn't do in bfs_free_cookie was - actually
free the cookie. One memory leak less...

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


# d7477802 12-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Made the additions of the KDL debugger commands independant from the
DEBUG macro; they are now added only if BFS_DEBUGGER_COMMANDS is
defined (which is now done by default in the Jamfile).
* Added "bfs" KDL command which dumps volume information and the super
block.
* Made use of the new tracing API to trace block and inode actions
(and the new AbstractTraceEntry class I forgot to mention in the last
commit). Is compiled in only when BFS_TRACING is enabled (defaults to
off in the standard builds).


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


# 21885de2 08-Dec-2007 Axel Dörfler <axeld@pinc-software.de>

* BFS now always writes back the whole block when it writes the super block.
* Therefore, I've added an I/O control that let's it update the boot block
part of this block, so that makebootable can use it on a mounted volume
(this will probably be moved into a disk system API later).
* Added user_memcpy() to the fs_shell.
* Minor cleanup.


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


# 4afaeabb 02-Dec-2007 Axel Dörfler <axeld@pinc-software.de>

* bfs_free_cookie() accidently reverted a transaction after having updated
the inode's internal last modified and size copies, causing in inconsistent
data. This fixes #1643.
* The block being replayed are now dumped to the debug output.


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


# 4a31d30e 13-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* The file map needs to know the actual file size to be able to know if it has
the complete extent info or not.
* file_map_translate() now cuts down the request to the file bounds.
* Adjusted BFS and FAT to the API changes.


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


# 364759e0 11-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* The "bytes" as passed to {read|write}_file_io_vec_pages() was never
initialized, causing those functions to read|write a random amount.
* This fixes bug #1614 - amazing how well the system worked with those randomly
sized requests...


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


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

* The previous locking order "inode write" -> "journal" was not only not
honoured (in the Inode attribute code), it also couldn't be honoured there.
Therefore, the locking order is now reversed, that is "journal" comes first,
then the Inode write lock. This should also help with the lock ups that
appeared after r22886.
* Got rid of INODE_NO_TRANSACTION; it doesn't make any sense to use.
* When Inode::WriteAttribute() changed the type, the type field was actually
never written back within the current transaction.
* If the attribute data fit into the inode again, the attribute's write lock
was never released.
* Since r22886, Inode::ReadAt() does its own locking, so we must no longer lock
the inode before calling it.


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


# 57225f03 10-Nov-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved helper function to check initialization parameters to separate
source file. Added function to check the volume name.
* Removed bfs_validate_initialize(). This functionality is to be implemented
in a userland add-on.


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


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

* Implemented bfs_validate_initialize(). It should probably do more
checks (e.g. if the partition is big enough), though.
* bfs_initialize():
- Report job progress.
- Rescan the partition after it has been initialized, so that all
partition_data fields are properly initialized.



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


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

Forgot to replace the error code with the new "mayBlock" logic, thanks Ingo!


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


# ab88b095 29-Sep-2007 Axel Dörfler <axeld@pinc-software.de>

* bfs_{read|write}_pages() now only try to lock - this fixes a possible
deadlock whenever someone without a lock (like the page_writer()) is calling
this function.
* Added a new ReadWriteLock::TryLock() method.
* Renamed bfs_read_vnode() and bfs_release_vnode() to bfs_get_vnode() and
bfs_put_vnode() just like those functions are called in fs_interface.h.
* Fixed a warning in BPlusTree::_SplitNode().


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


# 76a8ec23 22-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added disk system flags for whether a partition name and partition
content name are supported.
* Added file_system_module_info::flags (analogously to
partition_module_info::flags) which indicate which disk device
features the FS supports.
* Replaced the
file_system_module_info/partition_module_info::supports_*()
hooks by a get_supported_operations() hook and for partitioning
systems additionally a get_supported_child_operations() hook.
* Updated file and partitioning systems accordingly.
* Updated fs_shell accordingly.
* Updated the DDM accordingly. The syscall interface remains unchanged,
though.
* _user_supports_initializing_partition() also checks whether the parent
partitioning system is content now.


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


# 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


# 68fd0cb9 24-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Driver settings support is now available in the FS shell.


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


# 065e3184 22-May-2007 Axel Dörfler <axeld@pinc-software.de>

* Inode::Create() now has a "_created" parameter that will be set to true in case a
node has been created - this is now used in bfs_create() to suppress the new entry
notification in case the file already existed.
* Implemented parameter parsing in bfs_initialize() - does not work in the new bfs_shell
though, as it currently misses driver_settings functionality.
* Attribute::Create() and Attribute::Open() will now honour O_TRUNC correctly.
* Note: Inode::WriteAttribute() still follows R5 semantics for small_data attributes
in this regard and must be fixed (I've opened ticket #1242 for this).
* Some cleanup.


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


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

Added very basic volume initialization support.


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


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

* Prepared the BFS sources to be used with the new FS shell:
- Moved all inclusions of system headers into a new
system_dependencies.h header, which conditionally either includes
these or the FS shell headers.
- Fixed compiler warnings related to printf-like functions (int32 is
int, not long on non-BeOS platforms).
* Build a new bfs_shell. Compiles and links, but does nothing ATM.


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


# 4bf052db 07-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed dummy strtod().

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


# 12d359b8 04-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed write_link from the FS module interface. Adjusted all FS
add-ons accordingly and removed the syscall.
* Removed send_notification().
* Reimplemented notify_listener(). It used the unimplemented
send_notification(). Now it has a chance to work. Note that
notify_listener() is obsolete. I would already have removed it, if
there weren't lots of FS implementations still using it (Hint!).


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


# 230a0989 06-Feb-2007 Axel Dörfler <axeld@pinc-software.de>

bfs_free_cookie() now always write locks the inode - before it only hold a read lock
which wasn't enough when tampering with the inode's data, and it also acquired that
lock too late.
Thanks to Stefano for pointing this out.


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


# fc317af2 23-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Writing to attributes was deadlock prone; the BFS volume lock was acquired with
the BFS Journal lock held.
Since our get_vnode() is no longer unsafe (unlike Be's version of it), we can
get rid of the UNSAFE_GET_VNODE stuff, which also solves this bug.


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


# 1411be77 25-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* Fixed a crashing bug when creating a long symlink - there was no file cache
created in this case but used later on.
* The length of a long symlink was one too short, and was thus always losing
the last character.


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


# 297f8934 25-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* write_stat() should not add/update the last modification time of directories.
Reported by Robert Szeleney.
* Fixed an endian problem in write_stat() in the R5 version of BFS.


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


# 03a29852 30-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* When releasing a vnode, it tried to trim down the allocation even if the file
system was mounted read-only.
* bfs_rename() did not check the access privileges of the directories involved.


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


# a4237b2a 10-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* bfs_fsync() now locks the inode as it must do.
* added a IsLocked() method to ReadLocked.


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


# b61fdf78 28-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

* The inode block wasn't written back when it was opened with O_TRUNC/B_ERASE_FILE
which could cause inconsistency of on-disk structures.
* Fixed copy&paste bug introduced by Ingo when he did the GCC 4 work-around: when
shrinking the direct range, the new size was written to the indirect range.
* Some cleanup, renamed private Inode methods to have a leading '_' symbol.


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


# 6106f57e 26-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* Didn't allow to write back attributes outside the inode block (they don't
have a user accessable stream, but they do have a file cache).
* removed superfluous dump_inode() version; the "bfsinfo" debugger
command is now a bit more useful as well.
* Inode::fAttributes was not initialized when it wasn't used.

(coded by axeld)



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


# 15612acb 25-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

bfs_read_vnode() no longer tries to load a block when there can't be an inode
(since it knows that it doesn't place any inodes before the end of the log area).


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


# 65af8c83 12-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

bfs_get_file_map() no longer returns the preallocation area as part of the
file data - it checks if the current run goes beyond the file size and cuts
it off after the block containing that last few bytes.


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


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

Added missing safety check when reading in a node.


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


# 1c12a6a3 08-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Inode::ShrinkStream() now evaluates the return values from some functions - dunno
if that's a good idea (it may still be a good idea to succeed for shrinking the
stream, even if not everything worked), but it looks better :-)
Improved debug output in case TrimPreallocation() fails.
Journal::FlushLogAndBlocks() no longer ends the current transaction if called
from within an ongoing transaction.


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


# 2dbdc141 30-May-2005 Axel Dörfler <axeld@pinc-software.de>

Transactions can now be nested (bfs_release_vnode() actually did that before,
but that was not working correctly):
only the owning transaction (the one that came first) can now end a transaction.
To do: if the owning transaction fails, it should actually not abort the
transaction in case there were sub transactions, but does so right now
(should do no harm, eventually file data is not freed as it should).


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


# bae7c12d 25-May-2005 Axel Dörfler <axeld@pinc-software.de>

bfs_read_link() did not report the correct link size (it did not take the
terminating null byte into account) - thanks to Korli for reporting this.
Inode::Create() will no longer publish symlink vnodes; instead, bfs_create_symlink()
will publish the link when it is complete (ie. the actual link data had been
written).


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


# 47f39c93 23-May-2005 Axel Dörfler <axeld@pinc-software.de>

Merged the disk device manager module interface for file systems with the
VFS's interface, so that a file system only has to implement one interface.
As a side effect, the automatic file system detection may now work (not yet
tested, though).


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


# cbc6d404 17-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Added missing select()/deselect() Hooks to the file system interface
and made sure they are called by the VFS, if existent.


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


# fa4244bf 13-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Simplifications due to the solved get_vnode()/new_vnode() mess; bfs_read_vnode()
can now just do what it's supposed to do, even the bfs_inode::etc pointer is
no longer used.


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


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

Ported over to the new notification API.


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


# a4480535 19-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

No longer tries to update indices from deleted files. Added new method
Inode::IsDeleted().


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


# 381c5247 10-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed compilation in debug mode.


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


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

Implemented bfs_get_vnode_name().


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


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

Reenabled query support for the Haiku kernel.
Implemented bfs_rewind_query().


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


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

Enabled full attribute support under the Haiku kernel.
It's not as clean as it could, but it works for now.


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


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

Fixed a big allocation leak: preallocation was done for all streams, but
only regular files were stripped back when bfs_close() was called.
Now, we don't preallocate any blocks for attributes, attribute directories,
and symbolic links (which do have a stream when longer than 144 bytes).
Also, bfs_release_vnode() now trims back all streams that need to be
trimmed - this catches standard directories, which could also slip through
before.
Removed the remaining blocks of INODE_NO_CACHE support as this is not
needed for Haiku.
Added method Inode::NeedsTrimming() that determines if its data stream
can be trimmed (indices are never trimmed to reduce fragmentation).


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


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

Yeah, sure, don't compile stuff before checking it in.
bfs_open_dir() now checks for read access.
bfs_lookup() now checks for execute access and not read access anymore
(as reported by Ingo as well).


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


# 41cf3876 27-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

bfs_create() now only checks for write access in the parent directory if a
file really has to be created, thanks to Ingo for reporting this.
Inode::Create() now checks for write access to the inode when O_TRUNC is set.


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


# 8c6a62c6 22-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Now implements bfs_write_pages().
Changed some debug stuff.


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


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

Big update while moving over completely to the Haiku kernel:
- Ported over BFS to the new cache API
- Inode no longer inherits from CachedBlock, and therefore, no longer
keeps the whole inode block in memory. It now has a copy of the bfs_inode
structure in memory instead. This has a number of advantages but also some
disadvantages, so it might be reverted later, even if it's unlikely.
- Added a NodeGetter class that can be used whenever the real block needs
to be accessed (ie. for attributes)
- Changed *transaction to &transaction where possible
- Removed support for KEEP_WRONG_DIRENT_RECLEN
- Removed support for uncached file access since that's no longer needed
- Fixed some endian issues in bfs_write_stat()
- Removed the install BFS rules, since they don't make any sense anymore
(unless you are running Haiku ;-))

Note, logged streams are not supported anymore right now. Also, the
transaction code is pretty simple and slow - it will be improved later
on. Attribute code is pretty much untested in the new environment.


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


# fac367f2 15-Nov-2004 Jérôme Duval <korli@users.berlios.de>

fix to conform to the API


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


# 755901d8 29-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

bfs_read_stat() now correctly reports the size of a link for symbolic links
that are short enough to be placed in the short symlink region.
bfs_read_link() now makes sure that the link read is always null terminated.


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


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

Implemented the Disk Device Manager Scanning API. It's currently exported
as a separate module, but might be merged with the standard FS API.


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


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

Enabled the bfs_set_flags() call.


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


# 40f2ce7d 14-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Activated the index functions and ported it to the the new VFS API.


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


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

The fs_readlink() function must work a bit differently in the new VFS API
(ie. it needs to add the terminating null byte).
It now also properly fails if the link is too long for the provided buffer.
This allows us to resolve links on BFS volumes using Haiku again :)


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


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

Added a "cookie" parameter to the fs_read|write|has_page[s]().
Implemented bfs_get_file_map().
Now uses the brand new file cache for the file data streams.


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


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

The VM fs interface has changed to better match the one of the device interface.
Added an fs call for the file cache.


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


# 15190e07 10-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

The current kernel version needs these functions to be there (it will crash
if not).


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


# 83d95695 08-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Missing name index update with a late failed rename operation fixed (the
same as in kernel_interface_r5.cpp).
{add|remove}_debugger_commands() are now called in B_MODULE_[UN]INIT, no
longer in bfs_[un]mount().
Removed empty cache implementation as it's in the kernel itself for now.


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


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

First try at a working BFS for the new kernel - does compile but not much more.


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


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

It's now <util/kernel_cpp.h> rather than <kernel_cpp.h>.
Forgot to commit that...


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


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

Moved the logic from bfs_close() to bfs_free_cookie() - apparently, doing
anything in bfs_close() does not really makes sense. Thanks to Ingo for
pointing this out.


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


# e4758ac3 03-May-2004 Bruno G. Albuquerque <bga@bug-br.org.br>

Added BFS_REPLACEMENT define that will enable compiling OpenBFS as as full
BFS replacement (will report itself as "bfs" instead of "obfs". Is there a
way to change the add-on name based on the same define?


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


# 5b25332a 01-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

This should fix the recently introduced locking problems:
- locking policy is now: 1) the volume lock, 2) the inode lock, 3) start
the transaction (the journal lock) - you don't need all locks, but you
have to follow this order when you need more than one of them.
- in many cases, this makes our inode read/write lock useless. I am really
looking forward to the OpenBeOS VFS layer where we can remove many of
these locks again.


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


# b39a7a0e 29-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Fixed the "inode is not becoming unbusy" problem.


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


# 01338285 29-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Some minor style changes.


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


# a49b150f 27-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Removed the fOwningThread functionality from the Journal class; it now
just uses a RecursiveLock instead.
Changed Journal::CurrentTransaction() so that it returns the current
transaction only if it's valid for the thread asking for it.
That doesn't fix the bug, but changed its timing a bit.


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


# aac1dff9 25-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Updated the comment in bfs_initialize() - which we don't need for R5 (as it's
never called).


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


# aef00d7b 25-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Cleaned up the debug mess mmu_man has created (thanks anyway!).
Fixed a bug where the debug commands would be added in bfs_mount(), but
not removed (since bfs_unmount() is only called if bfs_mount() doesn't
fail).
Switched to kernel_cpp.h/cpp.


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


# 91e6897c 24-Jan-2004 François Revol <revol@free.fr>

Added obfsinode kernel debugger command.


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


# 6503b7c3 05-Nov-2003 Axel Dörfler <axeld@pinc-software.de>

Added missing statics; static functions doesn't need to be extern "C".


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


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

The file system is now almost endian-aware.
Used lazy unreadable conversion: ==, !=, == 0, != 0 are endian-safe
and don't need byte swapping.
If the platform endian differs from the one selected at compile time,
it will mount all volumes read-only for now.
Uncomment BFS_BIG_ENDIAN_ONLY in the Jamfile to build the big endian
version under x86.
No matter on what platform, the compilation defaults to build BFS as
little endian file system (see bfs_endian.h for details).


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


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

Only send notifications if writing was successful.


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


# 4a9d9dfa 18-Jun-2003 Axel Dörfler <axeld@pinc-software.de>

Added new RecursiveLock and RecursiveLocker classes.
Added file system global locking around creating, deleting, and renaming
inodes - that's not nice, but since we have only sequential journal access,
it won't hurt concurrency much. The locks are needed to prevent certain
things from happening like two threads could theoretically create the same
file twice (one of them would have failed, but relatively late in the process).
Anyway, a better locking scheme will be implemented at a later date, but maybe
not for R1.
Small cleanup.


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


# 4a5e9fec 15-Jun-2003 Axel Dörfler <axeld@pinc-software.de>

Updated some comments.


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


# 8ea8d0c2 31-May-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed queries a bit more (maybe even completely...). In several situations,
the old attribute value wasn't evaluated at all.
Also, Index::Update() got a type code of zero, instead of the real value
in situations where this didn't make any sense.
Minor cleanup in kernel_interface.cpp.
New method Volume::CheckForLiveQuery() that checks if there is a live query
depending on the specified attribute - not yet implemented, but already used;
always returns "true" right now, which doesn't cause any harm but reducing
the speed lightly.


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


# f2024b11 28-May-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed debug output in bfs_setflags().


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


# a9aa5ee1 27-May-2003 Axel Dörfler <axeld@pinc-software.de>

Implemented bfs_setflags().


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


# ae587160 27-May-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed another bad bug caused by calling get_vnode() on a node currently
being constructed: bfs_read_node() created an Inode object independent from
the one set in new_vnode().
As a work-around (the new VFS layer will introduce some better methods here)
we are now using the bfs_inode.etc field as a pointer to our object - just
like BFS has thought to use this field. If bfs_read_vnode() has to wait for
the inode (because it is being constructed), it will use the "etc" pointer
and don't create it's own Inode object.
Almost all changes made change the API to take this case into account:
- new Inode constructor to be able to be created from a CachedBlock
- CachedBlock now has a Keep() method which suppresses the release_block()
call when the object is destructed.
- a CachedBlock can now be constructed from the contents of another one (by
calling the source's Keep() method).
- Inode::InitCheck() no longer checks the integrity of the bfs_inode - this
is now done by bfs_inode::InitCheck() which is optionally called by the
former (default).
- moved the inline CachedBlock methods out of the class definition (was
too crowded to be readable).
- new Inode::Initialize() which is called by all Inode constructors
- an Inode object now sets a better name for its read/write lock.


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


# a476bfc5 26-May-2003 Axel Dörfler <axeld@pinc-software.de>

Now waits for a whole second on the inode to become unbusy - just in case
there is a slow drive. Note, if the system is heavily used and the thread
waiting for the inode to become unbusy is a real time thread, that time
might be not enough - don't have a better solution at hand though (other
than waiting even longer).


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


# 98b972c9 25-Feb-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed all warnings that appeared with DEBUG=1 set.
Also fixed missing return codes in BufferPool::ReleaseBuffer() and Journal::WriteLogEntry().


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


# 2fee336b 29-Jan-2003 Axel Dörfler <axeld@pinc-software.de>

Removed the load_driver_symbols() call, since it doesn't seem to have any
effect anyway.
Now passes the flags parameter on to the Query.


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


# 3b7911f1 10-Jan-2003 Axel Dörfler <axeld@pinc-software.de>

We now check in bfs_rename() if the new name is the same as the old name
in the same directory - in this case, we will return B_OK (as nothing has
to be done to fulfill the request), instead of B_BAD_VALUE which would
be thrown later in the process.


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


# af9ba303 29-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

bfs_walk() now prints the file name if it couldn't locate a file with debug
output turned on.
bfs_open_dir() now accepts again all containers, because bfs_open_index_dir()
is using it, too (too bad when you forgot about your own code).


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


# 98138634 25-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added the private ioctl calls to get the 64-bit create and modified time.
Most probably these are used by the kernel to identify changes in a shared
library or something like this.


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


# 97d569f0 25-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Now uses strlcpy() rather than strcpy() where appropriate.
The inode is now locked in bfs_close() (when the indices are updated).
Moved the special cases for INODE_NO_CACHE and INODE_CHKBFS_RUNNING into
bfs_free_cookie() - should probably do that with the index update as well.
Updated some comments.


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


# f512ce42 21-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added a new inode flag INODE_CHKBFS_RUNNING to detect aborted chkbfs processes.
bfs_read_vnode() will now wait for half a second at maximum until it returns
the B_BUSY error (so that live queries will like it better).


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


# 5254026b 21-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Removed the logic for freeing the inode's space from bfs_remove_vnode(); now
instead calls Inode::Free().
If INODE_DONT_FREE_SPACE was set, bfs_remove_vnode() forgot to delete the
inode before returning B_OK.
bfs_read_vnode() will now return the exact error Inode::InitCheck() returned.


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


# b24d7c8b 19-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Many style changes.
The only functional change is that bfs_rename() now checks for '/' in the
target name (the VFS should do those things, but you never know as long
you haven't written it yourself :).


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


# 27fe0a4b 17-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Adds support for INODE_DONT_FREE_SPACE, and all private BFS ioctls defined
in bfs_control.h.
Some minor cleanups.


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


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

Added some comments, made bfs_create() a bit nicer (no functional change, though).


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


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

Fixed a dead-lock that could happen if an attribute was changed and you
had some running live queries.
SimpleLock now allows nesting; added some missing atomic operations to
make its implementation as easy as possible.


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


# bbdc29a0 28-Oct-2002 Bruno G. Albuquerque <bga@bug-br.org.br>

bfs_walk() should check for read permissions for iterating through directories, not execute permission.


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


# 7ab95d9d 21-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Made it easier to switch from R5 compilation to the test "obfs" compilation.
$ COMPILE_FOR_R5=1 jam
will compile the "bfs" version, otherwise the "obfs" version is created.
Note: the final executable will always be called obfs (for now).


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


# 2b5451f1 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Added private non-implemented copy constructor and assignment operators
for many classes for the sake of completeness.
Added a Transaction::IsStarted() method to not let it look like as if the
transaction is started more than once.
Changes made after suggestions from Mike Nordell, again :-)


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


# 6829a19b 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Now bfs_write() also don't trigger any notifications during write access
on uncached files (might be needed for the VM file).


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


# a00ac4bc 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

bfs_write() called Volume::WriteCachedBlocksIfNecessary() also on uncached
files which might cause troubles with the VM file.


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


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

Added power management functions to support Dano (needed to boot Dano using
our file system):
- added bfs_wake_vnode(), and bfs_suspend_vnode()
- bumped B_CUR_FS_API_VERSION to 3 as needed for Dano

It should now be able to boot Dano with our BFS, although I haven't tested
it. The information was gained using some degree of reverse engineering...
It won't be part of the BFS implementation for OpenBeOS (that won't run on R5
anymore) :-)


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


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

Inode::SetFileSize() now doesn't allow changing the file size of uncached
files anymore (only Inode::WriteAt() denied it before).
Introduced a BFS_NAME define to be able to switch easier between "obfs",
and "bfs".
bfs_write_stat() didn't return the error code if Inode::SetFileSize() failed;
instead, it always reported success.


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


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

Fixed the dirent.d_reclen calculation - define KEEP_WRONG_DIRENT_RECLEN to
enable the old and compatible behaviour (on BeOS R5, all available file
systems seem to do that wrong).


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


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

Fixed a bug that could lead to the wrong last_modified time in an inode;
bfs_close() updated the last_modified time & index, but it didn't write
the inode back to disk.
Furthermore, bfs_write() should have already updated the last_modified
time, not bfs_close.


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


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

BufferPool::ReleaseBuffers() didn't set fFirstFree correctly.
Setting uncached access to a file no longer returns an error (if it succeeds).


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


# 6a2e0710 11-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Fixed compilation (stupid me :-).


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


# 40f7fd6c 07-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Implemented the basics to allow uncached file access under BeOS.
This is needed for the VM swap file and if you want to mount disk images
located on the BFS volume.
There is now a BufferPool class that manages a pool of buffers, so that
Inode::ReadAt()/Inode::WriteAt() can access a file without having to use
the cache or malloc()/free().
The real uncached file access is not yet implemented, though.


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


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

Initial revision


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


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

bfs: Use negative caching on directory lookup failures.


# de9c0613398645390b8d450089051b2888e2e15b 03-Jul-2014 Axel Dörfler <axeld@pinc-software.de>

bfs: Use the QueryParserUtils instead of its own copy.

* Ingo copied the methods into a shared location, and then obviously
"forgot" to let BFS use them. As a side note for Ingo: the complete
error GCC reported was "std::fssh_size_t" not defined with the macro
wrapper as code location. The actual problem was a "using std::size_t"
in some C++ header that accidentally got included after the wrapper.
* The shared Query code is not yet used. That'll be done another time.
* Renamed BFS_SHELL define to FS_SHELL, such that QueryParserUtils can be
used in any file system shell, not just the bfs_shell.


# 547cd462f843df15db02ed0dd7a35528221b66bc 02-Nov-2013 Axel Dörfler <axeld@pinc-software.de>

trim: Added is_called_via_syscall() function.

* And use it in get_trim_data_from_user(), formerly known as copy_*().
* This fixes differentiating between user and kernel buffers.


# 99086aa32333be5792b0f059ccbbe3c90be05ea6 14-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

trim: Target SCSI UNMAP command instead of WRITE SAME.

* The UNMAP command is theoretically much faster, as it can get many block
ranges instead of just a single range.
* Furthermore, the ATA TRIM command resembles it much better.
* Therefore, fs_trim_data now gets an array of ranges, and we use SCSI UNMAP
to trim.
* Updated BFS code to collect array ranges to fully support the new
fs_trim_data possibilities.


# 0a0ba4b5f09da93410943578b6c5aa1f3aa60cb0 04-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

Added B_TRIM_DEVICE support to BFS.

* It currently ignores the offset/size, though, and always trims everything.
* Now only SCSI support is missing.


# a01dd963464e7a1dd3e4f7fa1db77307f701b123 28-Apr-2013 Michael Lotz <mmlr@mlotz.ch>

Return more than a single dirent at a time in bfs_read_dir().

Return as many dirents as fit into the provided buffer. The readdir()
implementation in libroot tries to get many dirents and caches them to
reduce the amount of syscalls and the associated overhead.

This reduces the syscall count dramatically for use cases where a lot
of directories are enumerated. A "git status" on a Haiku repository for
example goes from over 50k read dir syscalls down to just under 7k.
The performance gain is only around a moderate 5% in that use case
though.


# caa1e8b74245bd1602bd9d6ae642e34beb583a00 31-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fix CID 712419, 712420, 712421, 712422: Unintentional sign extension to 64 bits.


# 3cd66dda5e623130a5ef7560da6851d421fd591e 31-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fix CID 712419, 712420, 712421, 712422: Unintentional sign extension to 64 bits.


# eb5f36397841abfc740031fde56ca5e4dee9fdd3 12-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

Fixes some occurrences of 'variable set but not used', disables Werror for problematic items.


# a735bdebb94ce14c72f56204f022038de7a49e2f 31-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

Align all filesystem relevant places to use B_UNSUPPORTED for unsupported
instead of a mix of B_NOT_SUPPORTED and B_UNSUPPORTED. This allows checking for
a specific error code. Probably one of those should be phased out...


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


# 90ade5e2987f2b3fa617d09630c1398bf238d955 12-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added file_system_module_info::uninitialize() analogously to
partition_module_info::uninitialize().
* Implemented the hook for BFS.
* Implemented KFileSystem::Uninitialize().

Fixes failure to initialize a BFS initialized device with an intel partition
map.


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


# 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


# 48ec4fbb40a9ac5327e0351486946403d0b533b8 09-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Rohit Yadav that fixes #6750, thanks a lot!
* This changes Inode::CheckPermissions(), and bfs_write_stat() based on Ingo's
solution in his file corruption test file system.


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


# d63f4274b665d32065f24a7a01a025578c8a43c9 18-Oct-2010 Jérôme Duval <korli@users.berlios.de>

added a file system call preallocate() as described in #6285, currently unused


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


# 950f37b2069f10d297d7192726f70be915a49e80 13-Oct-2010 Jérôme Duval <korli@users.berlios.de>

* renamed bfs_inode::ToUsecs() to bfs_inode::ToNsecs, as it really converts to nanoseconds.
* added a comment explaining the nanoseconds conversion


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


# 75148e0193474578fcd6771f0c45d5f24de12f8a 14-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Janito that fixes broken reverting when a rename operation
failed on last chance. Thanks!


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


# 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


# 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


# 1a1a8f33d14eaedeb0847d5cf4f07d5b948cc2d2 10-Apr-2010 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Janito that solves a TODO and utilizes the actual device
block size to align the file map.
* This closes ticket #5707, thanks!


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


# d501707d8abd1f3648bed3a4f975e3a984a5e6f1 03-Mar-2010 Axel Dörfler <axeld@pinc-software.de>

* Removed the cookie field of the check_control structure; that really was
a stupid idea. Instead, the already existing fCheckCookie member is used.
* bfs_ioctl() now accesses all userland buffers safely, this should help with
#3264, and move the crash where it belongs.
* Changes not yet tested; they only affect checkfs.


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


# b2397539da89844a78dff31d53970c82d56d7395 05-Jan-2010 Axel Dörfler <axeld@pinc-software.de>

* BFS now correctly reports the B_FS_HAS_QUERY flag (ie. if you disable the
indices it will no longer be set).


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


# 4ea6fb8bd4961cdd6177dcfa90a14ec09c94c3e4 27-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Changed the query code again to send B_ENTRY_REMOVED/B_ENTRY_CREATED
notifications if an inode in a query result was moved/renamed - this time all
the information is correct, though.
* While I did not introduce B_ENTRY_MOVED for queries yet, this should make
adding it very simple (left as an excercise for the reader ;-))


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


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

* Implemented O_DIRECTORY in BFS.


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


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

Replaced "%Ld" and "%lld" in printf()s by the new B_PRI* macros to avoid
warnings when building with a 64 bit compiler.


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


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

* Only remove the inode from the Volume::RemovedNodes() list when it has gone
through the VFS.
* This fixes bug #4942.


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


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

* common_rename() now checks the name for validity before passing it on to the
file systems, so those checks don't have to be duplicated there, anymore.
* Minor cleanup, mostly automatic whitespace.


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


# 1b944eec20dd1b26dd3b7878acc90b3acda1151d 29-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Improved the status_change time check to actually filter out invalid times,
before, st_ctim was never updated; since you cannot change st_ctim via an API,
'0' cannot ever be set, either.
* Inode::WriteAttribute(), and Attribute::Write() now return whether they
created an attribute or not, and thus B_ATTR_CREATED is now correctly set.
* Moved status_change update from bfs_write_attr() into Inode::WriteAttribute()
where it can be handled more efficiently.
* Likewise, Inode::RemoveAttribute() now updates the status_change time as well,
I simply forgot this before.
* Minor cleanup.


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


# b43e064ecc0bdfa425f9fde9652dd4bf147a410b 29-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Attribute changes now also change the status change time.
* While Ingo already convinced me to use the modified time for this instead
(see People files, for example), I did not do so for two reasons:
1) The file modification date is important to the user; more or less hidden
attribute changes shouldn't have an effect on this.
2) Efficiency: the last_modified field is indexed whereas status_change is
not. Speed would suffer noticeably else.
* We might want to think about a new "stat::st_attrtim" field, though, instead.


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


# aeb099b317eda4eb3c4b3318222e0a7d3ed2867f 19-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a very simple way to fragment your disk.


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


# 425cb3d71644c19d925f97846964a32475b09b95 09-Sep-2009 Oliver Tappe <zooey@hirschkaefer.de>

* revert r32999 and adjusted each filesystem to return B_NOT_A_DIRECTORY in
its open_dir() implementation instead (as suggested by Ingo).
-alphabranch (it's only a cleanup)


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


# 1a60fd72cf588ed0d25028da354261b4d8409c08 06-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Replaced the Inode::GetTree() method with a simple getter - the tree is
always created for directories since quite some time now.


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


# 134e1b04d4256ec2958a6e2454318c46aea0acd3 06-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Somehow I forgot to update the parent directory's time stamps on file
creation, removal, and name changes...


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


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

bonefish + axeld:
* Reverted r31809 as it introduced a race condition; if the I/O request had been
notified, it could already been deleted at that point.
* Instead, we need to notify the request in each file system/driver that uses
it. Added new notify_io_request() function that does that exactly.
* Added a TODO comment to the userlandfs where the request notification needs
a bit more thought.


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


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

* Almost all Transaction::Done() return values are now honoured.


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


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

* Journal::_WriteTransactionToLog()'s return value was ignored previously,
leading BFS to report success on actually failed transactions. Those
transactions were even kept open, leading to a panic when starting the next
transaction.
* Transaction::Done() now returns a status - currently, this is only handled
correctly where this is likely to happen without a disk fault, ie. if the
transaction was too large to be written back safely.
* Improved "bfs_journal" command output.


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


# e49449412249a5175d2e69da8a3830121379b46c 15-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup of how the time is converted between bfs_inode and the outside world:
there is now a couple of conversion functions, and I changed the type from
bigtime_t to int64, as it's not what a bigtime_t would usually contain, but
some shift magic in order to make duplicate index entries less likely.
* We now correctly fill in the timespec in struct stat as good as possible; the
12 of the 16 possible bits are used for the nano second value. The lower 8
bits are used to avoid the duplicate index entries. Only if the nano second
time is 0, the lower 12 bits are used to achieve that.


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


# 33203f677e24af9885c58e4407faa4cd44f130df 25-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

* added support for ctime to BFS by grabbing two of the pad-fields
* added TODO about a sanity check that should perhaps be dropped
I checked this change with both a haiku-BFS partition and one from R5

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


# a786c139ef3ebe2ac00e4de9231b1e666260a2b0 08-May-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed the work-around that allowed to open directories read/write.
See ticket #3875.


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


# 24b822d843be9b891e7e9ebba99741b65e89647d 17-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* No longer hold the write lock when calling Inode::FillGapWithZeros(), as this
potentially deadlocks as described in bug #3768. The system is still
completely unresponsive, but gets back to a working state after some time now.
* Since the rw_lock is public, Transaction and InodeReadLocker no longer need to
be friends with Inode.


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


# 992fba36eef8b17808a06d483f2fdad90173b01d 16-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* There is now a list of removed vnodes in Volume - while asking the VFS for
this seemed to be a good idea, there is one race condition that cannot be
solved otherwise (the vnode must be added/removed to that list while holding
the transaction lock, and we cannot guarantee that in the VFS).
* We are using an unused area of the in-memory bfs_inode to store the list
links (bfs_inode::pad - this will also work on 64 bit platforms).
* Inode no longer adds a singly linked list link - the transaction list now
shares the doubly linked list with the removed vnodes list.
* Added an in-memory flag INODE_IN_TRANSACTION to avoid searching an inode
to be added in the list.
* Removing an attribute directory did not hold its write lock.
* If removing an attribute failed for some reason, the INODE_DELETED flag
was not removed (the transaction would not have failed because of that).


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


# 973032b8d79f6cd6f7ba68b6dd318e25b669db0e 29-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added TODO for Axel or whoever is interested. :-)


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


# aa4ba93e25c1c63730ba69e04d3d96c3253924fd 08-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed src/system/kernel/device_manager/io_requests.{h,cpp} to
IORequest.{h,cpp}.
* Introduced public <io_requests.h> header. Currently it only declares the
single function BFS uses.


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


# b6b002b81ecc76f0aafa8388e003a97634e8139b 23-Jan-2009 Jérôme Duval <korli@users.berlios.de>

when renaming, check first with the newDirectory instead of starting at its parent. this should fix #3355


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


# e677f5aa675fce95e7558cf58fee40afd6df554d 10-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed two possible crashing bugs in the file system check code: the checker
was attached to the inode instead of the file descriptor, causing it to call
BlockAllocator::StopChecking() whenever anyone closed the device's root node
during the check. The other bug was that it tried to fix errors even if the
device was read-only.
* Added TODO that ioctl() accesses userland buffers unsafely.
* Removed no longer valid or superfluous comments.


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


# 64e0d0841b2276f67a953dd09e900743b7cb5a2b 02-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Inodes are no longer trimmed from the checking thread. This should fix bug
#3190.


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


# 243680e81945d4a4845f7e4b79608b3e3dd4159a 26-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* Forgot to cast before the shift; this fixes the problem seen by Bruno.


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


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

* In bfs_write_stat() B_STAT_UID, B_STAT_GID, and B_STAT_MODE now also trigger
an update of st_mtime. This is a work-around for the unmaintained st_ctime,
and this also fixes bug #3143.


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


# 2bb834901cbb71569579fe4a0b48d5b85ad1e54e 17-Oct-2008 Michael Lotz <mmlr@mlotz.ch>

Fix two bugs related to the use of the entry cache for parent entries in BFS:
* The parent entry ("..") of a directory was not removed from the cache when its
directory was removed.
* When moving a directory to a new parent, it's cached parent entry wasn't
updated.

Those would lead to stale cache entries for directory parents. If a certain inode
would be reused to create a new directory after removing another, this would lead
to an invalid inode being returned when looking up the parent of the new
directory. This was easily reproducible by unzipping some directory structure,
deleting it and unzipping it again. You would end up with many "inode already
deleted" messages.


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


# 218f8c8632338544bca52685c8a8b78f7ee42b6a 17-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Give a more detailed error message in case someone just tried to access a
deleted inode (which might always happen when accessing an inode by ID),
for example by using the BDirectory(node_ref&) constructor.


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


# 057f999da63f5d006591b41a284c0cd50ccbb042 13-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a flag B_DISK_SYSTEM_SUPPORTS_WRITING to determine whether or not a
file system can write to files before mounting.
* Set the flag for all file systems that actually can write.


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


# cfa4660b4781a22a25f43bb71561450fc30ecf4e 13-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the way the BFS_IOCTL_UPDATE_BOOT_BLOCK ioctl works; it's a bit
more flexible to use now.


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


# 9fc81c5394e80ee0be60037cd8c98b526420b44c 11-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Use a block size of 512 - since there is no standard, we're just following
the masses (whatever stupidity created this misery).


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


# b2ec044cb8a930fe55b3a3d899f2e854d955f1d5 30-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Added stat::st_blocks field as required by POSIX. This also closes ticket
#2261.
* Made at least BFS report it more or less correctly (the attributes are
ignored, though).


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


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

Removed debug output.


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


# dea4ee198060670d577fa73e36d8b6784ddc74a1 14-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the error return by bfs_link() to B_NOT_SUPPORTED.


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


# 57b9debf766c370dff725412c27ab09701f1d05f 13-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Some index updating functions did not take into account that not all nodes
are put into all indices. For example, symlinks aren't part of the size
index. This fixes bug #2704.
* Also, Inode::NeedsTrimming() now ignores symlinks that have no data stream,
it's const now, too.
* Added helper methods Inode::In{Name|Size|LastModified}Index(), and use it
where appropriate.
* Clarified Inode::Create() description with regards to name vs. parent.


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


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

Use the new entry cache.


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


# 4612433715fc0477740693682ec4a642c1a4c6e1 30-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added parameter "size_t align" to file_map_translate(). If > 1, the
vector at the end of the file will be aligned to the given value.
* BFS uses an alignment of 512 bytes (should be block size of the
underlying device or BFS block size, whatever is less), which should
be fine, since file data are only stored in BFS blocks. This totally
avoids any partial operations at the I/O scheduler level, thus saving
disk operations. Not that I could measure any performance difference.
Theoretically it should help a lot though, particularly when dealing
with lots of small files, since we avoid using bounce buffers, which
are (a) limited in number and (b) require copying of the data.


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


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

The return value of the identify_partition() hook is not error code
compatible. Small floats have to be returned.


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


# 7f57b05f1dc4c8f355a72d9315ec0dba6e065a41 13-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Temporarily use the private I/O request API to decide whether or not the
request is a write request.
* This closes bug #2579, thanks BGA for the investigation!


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


# bbc9703cc32db565b85a30ba2d6bd8996769a045 10-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

As suggested by Rene and Andreas: Use '%lld' instead of the non-standard
'%Ld'. This solves build problems in Solaris.


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


# 3656dc0d61577b521720cefecca511aed97c0d50 09-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed debug tracing that obviously slipped in in a former commit.


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


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

* We must call file_cache_disable() with O_NOCACHE also in bfs_create().


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


# 88a2565650749a2ee9436f0e5f2a2077d21bf03e 03-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for O_NOCACHE/O_DIRECT.
* bfs_open() was leaking the already allocated cookie in several error
conditions.


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


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

* Coding style cleanups, no functional changes.


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


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

* Replaced Chain with the new SinglyLinkedList.
* Renamed openModeToAccess() to open_mode_to_access().
* Cleanup.


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


# 2e3477e3d851cc46fa682712c3f73dbb82d64fd9 31-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the inode write locking to be held as long as the transaction is
running - this fixes several cases where someone could see outdated data
when a transaction had to be reverted (the time between unlocking the inode
and actually reverting the blocks). For that, Inodes can now be put into a
singly linked list.
* Added a TODO in Inode::WriteAt() which explains why it cannot use the above
method: seems that our VFS/VM locking model isn't really that good.
* Fixed a possible deadlock in Attribute::_Truncate() where the inode write
lock was held before starting the transaction.
* Added an InodeReadLocker convenience class, that should be used instead
of ReadLocker - Inode::Lock() only still exists because of the needs of
bfs_io().
* Moved the bfs_io() callback hooks out of the exported module API region,
and removed their bfs_ prefix.
* Added a Volume::IsInitializing() method that should be used rather than
checking if Volume::ID() is >= 0.
* Removed the MultiInodeLocker again, as it's pretty much superfluous now.
* Moved openModeToAccess() to the Utility.h header.
* Minor cleanup.


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


# 274e684a8e5c7b8bf60551ca760ecfb34680b7e4 31-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* bfs_rename() did not write lock the moved inode, but only its former and
new parent directories. This would only be necessary in case it's a directory,
but we do it always now.
* This fixes bug #2556.


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


# b99521f213e60f88b3d7700f395fb0c4bf99f63a 30-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

First round of locking fixes:
* Moved locking the data stream out of the BPlusTree methods; this fixes at
least two locations where another thread could have seen outdated/incorrect
data.
* Removed some superfluous code in bfs_rename(): we don't have to revert to the
previous situation, the transaction does this for us automatically.
* Added a simple MultiWriteLocker, even though it's not really necessary anymore
(since we always hold the transaction lock first when we lock more than one
inode at a time).
* Inode::Create() called InodeAllocator::Keep() a bit too early, the file cache
and map wasn't created and assigned yet.
* InodeAllocator now keeps the inode write locked.


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


# e9c954c387d674831c04b40863cb9ca92082c08a 29-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Use file_map_translate() instead of bfs_get_file_map().


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


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

Implemented the io() hook.


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


# fe08828a3cc59838a91f70b469043419437e705e 23-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* The identify_cookie was allocated unchecked, spotted by Stippi.


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


# 082bae1aa58dd0021d69aaa2dc05de7b33b75854 23-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* bfs_fsync() no longer grabs the Inode's read lock - instead, Inode::Sync()
will take care of the locking.
* Use new(std::nothrow) over new, and malloc (only in kernel_interface.cpp);
the kernel_cpp.h header isn't really necessary anymore, so there is no reason
BFS should continue to use it.
* Removed superfluous NULL checks.


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


# 9083840f3462752eeba06158182a11a1e86c7aac 20-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

bonefish + mmlr + axeld:
* Fixed a bug that could easily corrupt your disks (yeah, one of those
again): bfs_get_file_map() truncated the last vec incorrectly and
would potentially return a too large file size -- which was later
happily overwritten with file data, but could have belonged to
anything but that file (like inodes, B+trees, etc.).
* Renamed previous round_up() function to key_align().
* Added round_up() template function, and used it where appropriate.
* The latter actually fixed two bugs where the and mask was computed in
32 bit where it should have been in 64 bit.
* Inode::FindBlockRun() should have checked the max indirect size
instead of the direct size - this didn't cause any problems, though.
* White space cleanup.


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


# 8c121d2ca1bf7777b61b78a56cc9f053d01aa0bc 14-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed the bug described by Salvatore: since we let BFS open directories with
read/write access, we shouldn't let it truncate the directory B+tree...
* Also fixed allowing truncation in read-only mode.


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


# 1bde8b03e7789d10cdc063a8a4b23ce3cba6f2e1 08-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced BFS's ReadWriteLock implementation with the kernel's rw_lock.
* The BlockAllocator now uses the new mutex_transfer_lock() function instead
of clobbering the mutex directly.
* Removed Lock.h - it's no longer needed.
* Minor white space cleanup.


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


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

* Removed the home-brewn locking classes in BFS besides the read/write lock
(for now).
* Inode::fSmallDataLock is now a recursive_lock, Journal::fLock is now
a recursive_lock, too, Journal::fEntriesLock is now a mutex, as is
BPlusTree::fIteratorLock.


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


# 0c48c43777589ae350081733ce20eb3d8cc4beea 01-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed the bfs_write() error code for directories as suggested by Jerome.
* Removed a few superfluous checks.


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


# fdf3fa9fe13ad76512bea8d28e5ccb09e23d5d5b 30-Jun-2008 Jérôme Duval <korli@users.berlios.de>

read() expects B_IS_A_DIRECTORY on directories that can't be read.
This fixes grep misbehavior with directories.


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


# bcd307089b56ff8b0df050a4747a1405ff26ad80 28-Jun-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed a deadlock found by Salvatore; the volume lock is now only used to
protect the bfs_read_fs_stat() and bfs_write_fs_stat() functions.


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


# ef098c9099eb6fbd035db1b28706b10ede24cea5 28-Jun-2008 Axel Dörfler <axeld@pinc-software.de>

* Removed volume lock from bfs_get_vnode() - it's not necessary on Haiku.
* Minor cleanup.


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


# 1da9f5cea5ea4d32c539a01cd94a7b605e941beb 10-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Added BDiskSystem::ShortName() and everything needed to get it there.
* Added BDiskDeviceRoster::GetDiskSystem() method, that can get a disk system
by short/pretty/module name - since they should all be unique, I put them
in a single namespace, please complain if you don't like that :-)
* Cleaned up DiskSystem.h and DiskDeviceRoster.h according to the updated
header guidelines.
* Renamed ntfs pretty name from "ntfs File System" to "Windows NT File System".


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


# fd4a010b054bb45d5d1feac80ccb5f7b5058a480 24-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

rename() is supposed to fail when the target exists and is not a
directory only if the source is a directory.


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


# d11e733fee81b682160c03a5d1cacb77b3a2faff 24-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Allow passing sub vnode ops and publish flags to Inode::Create().
* Implemented create_special_node() hook.
* Fixed Inode::IsContainer()/IsDirectory().


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


# 3daf03d3abcdec867fcc4682dd3106b2ba3c9f72 08-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

I broke the index dir access when changing the FS interface.


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


# 0e4edbeafa2c780bf873c1cdc8839cf0fb461300 04-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Added checks to (hopefully) all write/create functions to bail out early
if the volume is read-only. This should help with #2028.
* Removed unused bfs_[de]select() functions.
* Removed most paranoia checks - now that we control both sides of code,
this would just hide eventual problems in the VFS code.
* Cleanup.


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


# 48931654004f0561f45c55f430e64150fa87cc79 25-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Inode::OldSize() is the size of the file before the last index update
- this might be a bit older, so we cannot use it for the previous size
in the call to Inode::FillGapWithZeros() in bfs_write_stat().
* This fixes the perl problem Ingo ran into after r24555.


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


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

* Added a new flag for write stat: B_STAT_SIZE_INSECURE that allows a
file system to not fill newly created space with zeros.
BFile::SetSize() now uses this, while [f]truncate() does not. This
is only a temporary work-around until BFS supports sparse files.
* Apps that want to reserve space to fill up later should use
BFile::SetSize() for now, as this will be a lot faster than
[f]truncate().
* cache_io() and the functions below now use a special mode when you
pass in a NULL buffer: for read access, the cache is only populated
(useful for prefetching), for write access, the file is filled with
zeros.
* Implemented BFS's Inode::FillGapWithZeros() using this method now.
* Removed extraneous white space.


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


# 1b32947d3f6c19dc1716a27d50361dcf59c27882 17-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Aligned the semantics of the read_symlink() FS module hook with the
readlink() function. It is no longer required to null-terminate the
string, shall not fail, if the buffer is too small, and shall return
the length of the string actually written into the buffer.
* Adjusted rootfs, devfs, and bfs accordingly. Also adjusted their
read_stat() hooks to return the correct symlink length in st_size.
* Our readlink() does now comply to the standard (and BeOS).
Additionally if the buffer is big enough it is nice to non-conforming
apps and null-terminates it.
* BSymLink::ReadLink() explicitly null-terminates the string now.


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


# 6cc5885822b9b22095b35f02c6856ac73ce21e88 15-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Improved error reporting when mounting a volume failed, especially when
the log couldn't be replayed.
* Minor cleanup.


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


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

Corrected patch to fix warnings when compiled with GCC 4, thanks Vasilis!


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


# 351b7a2d2499a7c9929452009158a92ba9d66091 25-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Added B_WATCH_INTERIM_STAT, and B_STAT_INTERIM_UPDATE definitions to
NodeMonitor.h.
* The latter will be set in "statFields" for interim updates when you have
asked to get them via the former.
* BFS now uses the B_STAT_INTERIM_UPDATE flag for sending updates to actively
written files.
* This makes us more compatible with BeOS again; if you only asked for
B_WATCH_STAT, you will now only receive a notification if the file in
question has been closed.
* Tracker now uses B_WATCH_INTERIM_STAT to always get all updates (ie.
downloading a file will update its size and modification time in Tracker
periodically during the download).
* Wether "needsTrimming" was true or not has no influence on wether or not
the size index needs to be updated in BFS - only the actual file size is
stored there, not the on-disk size.
* Added a TODO comment in Inode::WriteAt() that it would actually need to
update the size index when changing the file size, not when the file has
been closed (but that's probably too slow).


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


# 4f045f9cba93358a7f890bc727e780796caf64fd 14-Feb-2008 Michael Lotz <mmlr@mlotz.ch>

Turns out the only thing we didn't do in bfs_free_cookie was - actually
free the cookie. One memory leak less...

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


# d7477802b8a5451ce525646fd2d4b13ef449c455 12-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Made the additions of the KDL debugger commands independant from the
DEBUG macro; they are now added only if BFS_DEBUGGER_COMMANDS is
defined (which is now done by default in the Jamfile).
* Added "bfs" KDL command which dumps volume information and the super
block.
* Made use of the new tracing API to trace block and inode actions
(and the new AbstractTraceEntry class I forgot to mention in the last
commit). Is compiled in only when BFS_TRACING is enabled (defaults to
off in the standard builds).


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


# 21885de266a154a66d4027ba78b8c9ed8f12ac3b 08-Dec-2007 Axel Dörfler <axeld@pinc-software.de>

* BFS now always writes back the whole block when it writes the super block.
* Therefore, I've added an I/O control that let's it update the boot block
part of this block, so that makebootable can use it on a mounted volume
(this will probably be moved into a disk system API later).
* Added user_memcpy() to the fs_shell.
* Minor cleanup.


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


# 4afaeabbd858d959a57593f0ad52e4c481709495 02-Dec-2007 Axel Dörfler <axeld@pinc-software.de>

* bfs_free_cookie() accidently reverted a transaction after having updated
the inode's internal last modified and size copies, causing in inconsistent
data. This fixes #1643.
* The block being replayed are now dumped to the debug output.


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


# 4a31d30e84d78b7d06b9efa6c1dd96c292262e4a 13-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* The file map needs to know the actual file size to be able to know if it has
the complete extent info or not.
* file_map_translate() now cuts down the request to the file bounds.
* Adjusted BFS and FAT to the API changes.


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


# 364759e0d2beec229c1cbf54a6e73feb1079112a 11-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* The "bytes" as passed to {read|write}_file_io_vec_pages() was never
initialized, causing those functions to read|write a random amount.
* This fixes bug #1614 - amazing how well the system worked with those randomly
sized requests...


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


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

* The previous locking order "inode write" -> "journal" was not only not
honoured (in the Inode attribute code), it also couldn't be honoured there.
Therefore, the locking order is now reversed, that is "journal" comes first,
then the Inode write lock. This should also help with the lock ups that
appeared after r22886.
* Got rid of INODE_NO_TRANSACTION; it doesn't make any sense to use.
* When Inode::WriteAttribute() changed the type, the type field was actually
never written back within the current transaction.
* If the attribute data fit into the inode again, the attribute's write lock
was never released.
* Since r22886, Inode::ReadAt() does its own locking, so we must no longer lock
the inode before calling it.


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


# 57225f0367dd88447cb87714cae045e76b9ec9c0 10-Nov-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved helper function to check initialization parameters to separate
source file. Added function to check the volume name.
* Removed bfs_validate_initialize(). This functionality is to be implemented
in a userland add-on.


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


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

* Implemented bfs_validate_initialize(). It should probably do more
checks (e.g. if the partition is big enough), though.
* bfs_initialize():
- Report job progress.
- Rescan the partition after it has been initialized, so that all
partition_data fields are properly initialized.



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


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

Forgot to replace the error code with the new "mayBlock" logic, thanks Ingo!


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


# ab88b095f209c11a9d1d97fdbc7aa45f69639040 29-Sep-2007 Axel Dörfler <axeld@pinc-software.de>

* bfs_{read|write}_pages() now only try to lock - this fixes a possible
deadlock whenever someone without a lock (like the page_writer()) is calling
this function.
* Added a new ReadWriteLock::TryLock() method.
* Renamed bfs_read_vnode() and bfs_release_vnode() to bfs_get_vnode() and
bfs_put_vnode() just like those functions are called in fs_interface.h.
* Fixed a warning in BPlusTree::_SplitNode().


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


# 76a8ec23db391176bac91f33c5f1fc6e8e41866c 22-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added disk system flags for whether a partition name and partition
content name are supported.
* Added file_system_module_info::flags (analogously to
partition_module_info::flags) which indicate which disk device
features the FS supports.
* Replaced the
file_system_module_info/partition_module_info::supports_*()
hooks by a get_supported_operations() hook and for partitioning
systems additionally a get_supported_child_operations() hook.
* Updated file and partitioning systems accordingly.
* Updated fs_shell accordingly.
* Updated the DDM accordingly. The syscall interface remains unchanged,
though.
* _user_supports_initializing_partition() also checks whether the parent
partitioning system is content now.


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


# 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


# 68fd0cb9642045681c43fac9c69096d3d1947f6a 24-May-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Driver settings support is now available in the FS shell.


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


# 065e31842971a008888c578c2c1f1a35c75de40e 22-May-2007 Axel Dörfler <axeld@pinc-software.de>

* Inode::Create() now has a "_created" parameter that will be set to true in case a
node has been created - this is now used in bfs_create() to suppress the new entry
notification in case the file already existed.
* Implemented parameter parsing in bfs_initialize() - does not work in the new bfs_shell
though, as it currently misses driver_settings functionality.
* Attribute::Create() and Attribute::Open() will now honour O_TRUNC correctly.
* Note: Inode::WriteAttribute() still follows R5 semantics for small_data attributes
in this regard and must be fixed (I've opened ticket #1242 for this).
* Some cleanup.


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


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

Added very basic volume initialization support.


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


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

* Prepared the BFS sources to be used with the new FS shell:
- Moved all inclusions of system headers into a new
system_dependencies.h header, which conditionally either includes
these or the FS shell headers.
- Fixed compiler warnings related to printf-like functions (int32 is
int, not long on non-BeOS platforms).
* Build a new bfs_shell. Compiles and links, but does nothing ATM.


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


# 4bf052db56bcd889690abd2afaca5f8bc70ed10f 07-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed dummy strtod().

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


# 12d359b85a22246a568569b09b6587534e98aacc 04-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed write_link from the FS module interface. Adjusted all FS
add-ons accordingly and removed the syscall.
* Removed send_notification().
* Reimplemented notify_listener(). It used the unimplemented
send_notification(). Now it has a chance to work. Note that
notify_listener() is obsolete. I would already have removed it, if
there weren't lots of FS implementations still using it (Hint!).


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


# 230a0989fdcea9e7519990db11f4d15cbdfd39cc 06-Feb-2007 Axel Dörfler <axeld@pinc-software.de>

bfs_free_cookie() now always write locks the inode - before it only hold a read lock
which wasn't enough when tampering with the inode's data, and it also acquired that
lock too late.
Thanks to Stefano for pointing this out.


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


# fc317af25e51b2c96c416b3d1fc01e3f0b168595 23-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Writing to attributes was deadlock prone; the BFS volume lock was acquired with
the BFS Journal lock held.
Since our get_vnode() is no longer unsafe (unlike Be's version of it), we can
get rid of the UNSAFE_GET_VNODE stuff, which also solves this bug.


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


# 1411be7744ceed9ae92e5ef360b09f4e8f99db79 25-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* Fixed a crashing bug when creating a long symlink - there was no file cache
created in this case but used later on.
* The length of a long symlink was one too short, and was thus always losing
the last character.


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


# 297f89345fa915545dcb669dcccd185ebd7b913e 25-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* write_stat() should not add/update the last modification time of directories.
Reported by Robert Szeleney.
* Fixed an endian problem in write_stat() in the R5 version of BFS.


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


# 03a2985277308cd876dec79d8850edbb95f941b4 30-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* When releasing a vnode, it tried to trim down the allocation even if the file
system was mounted read-only.
* bfs_rename() did not check the access privileges of the directories involved.


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


# a4237b2a8e182d5d48b77294ce4b1f736ae85475 10-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* bfs_fsync() now locks the inode as it must do.
* added a IsLocked() method to ReadLocked.


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


# b61fdf78c6e0da8638a91542ef457ee9ca8e6ca8 28-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

* The inode block wasn't written back when it was opened with O_TRUNC/B_ERASE_FILE
which could cause inconsistency of on-disk structures.
* Fixed copy&paste bug introduced by Ingo when he did the GCC 4 work-around: when
shrinking the direct range, the new size was written to the indirect range.
* Some cleanup, renamed private Inode methods to have a leading '_' symbol.


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


# 6106f57e218cbdc72d0de30b71ddd9973bbbc9d6 26-Feb-2006 Stephan Aßmus <superstippi@gmx.de>

* Didn't allow to write back attributes outside the inode block (they don't
have a user accessable stream, but they do have a file cache).
* removed superfluous dump_inode() version; the "bfsinfo" debugger
command is now a bit more useful as well.
* Inode::fAttributes was not initialized when it wasn't used.

(coded by axeld)



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


# 15612acb76aa1384dfe5749a9808f1e431f13f2b 25-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

bfs_read_vnode() no longer tries to load a block when there can't be an inode
(since it knows that it doesn't place any inodes before the end of the log area).


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


# 65af8c83274b18217281fcd0435e96dd8b484339 12-Aug-2005 Axel Dörfler <axeld@pinc-software.de>

bfs_get_file_map() no longer returns the preallocation area as part of the
file data - it checks if the current run goes beyond the file size and cuts
it off after the block containing that last few bytes.


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


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

Added missing safety check when reading in a node.


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


# 1c12a6a33f1af79130b6b2da2ca7bf4d78610ab4 08-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Inode::ShrinkStream() now evaluates the return values from some functions - dunno
if that's a good idea (it may still be a good idea to succeed for shrinking the
stream, even if not everything worked), but it looks better :-)
Improved debug output in case TrimPreallocation() fails.
Journal::FlushLogAndBlocks() no longer ends the current transaction if called
from within an ongoing transaction.


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


# 2dbdc141cf0ea22fa3fb8425a4d74b74b1736b11 30-May-2005 Axel Dörfler <axeld@pinc-software.de>

Transactions can now be nested (bfs_release_vnode() actually did that before,
but that was not working correctly):
only the owning transaction (the one that came first) can now end a transaction.
To do: if the owning transaction fails, it should actually not abort the
transaction in case there were sub transactions, but does so right now
(should do no harm, eventually file data is not freed as it should).


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


# bae7c12dba9651705d21c73470da51bdc16f016d 25-May-2005 Axel Dörfler <axeld@pinc-software.de>

bfs_read_link() did not report the correct link size (it did not take the
terminating null byte into account) - thanks to Korli for reporting this.
Inode::Create() will no longer publish symlink vnodes; instead, bfs_create_symlink()
will publish the link when it is complete (ie. the actual link data had been
written).


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


# 47f39c93cbd7db06e72642b047f1fc327852684c 23-May-2005 Axel Dörfler <axeld@pinc-software.de>

Merged the disk device manager module interface for file systems with the
VFS's interface, so that a file system only has to implement one interface.
As a side effect, the automatic file system detection may now work (not yet
tested, though).


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


# cbc6d404f9cf85f3b5c63217b514744413564fd4 17-Mar-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Added missing select()/deselect() Hooks to the file system interface
and made sure they are called by the VFS, if existent.


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


# fa4244bffcbaadfadbd7cc12590ed2bc9046ccb3 13-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Simplifications due to the solved get_vnode()/new_vnode() mess; bfs_read_vnode()
can now just do what it's supposed to do, even the bfs_inode::etc pointer is
no longer used.


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


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

Ported over to the new notification API.


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


# a4480535ade318237fb8382cb0545bb2c2d6323f 19-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

No longer tries to update indices from deleted files. Added new method
Inode::IsDeleted().


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


# 381c5247e0555bd114924f97c6142594a04dd436 10-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed compilation in debug mode.


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


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

Implemented bfs_get_vnode_name().


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


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

Reenabled query support for the Haiku kernel.
Implemented bfs_rewind_query().


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


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

Enabled full attribute support under the Haiku kernel.
It's not as clean as it could, but it works for now.


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


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

Fixed a big allocation leak: preallocation was done for all streams, but
only regular files were stripped back when bfs_close() was called.
Now, we don't preallocate any blocks for attributes, attribute directories,
and symbolic links (which do have a stream when longer than 144 bytes).
Also, bfs_release_vnode() now trims back all streams that need to be
trimmed - this catches standard directories, which could also slip through
before.
Removed the remaining blocks of INODE_NO_CACHE support as this is not
needed for Haiku.
Added method Inode::NeedsTrimming() that determines if its data stream
can be trimmed (indices are never trimmed to reduce fragmentation).


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


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

Yeah, sure, don't compile stuff before checking it in.
bfs_open_dir() now checks for read access.
bfs_lookup() now checks for execute access and not read access anymore
(as reported by Ingo as well).


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


# 41cf3876974fa4f855fed199a3839868c4fde86f 27-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

bfs_create() now only checks for write access in the parent directory if a
file really has to be created, thanks to Ingo for reporting this.
Inode::Create() now checks for write access to the inode when O_TRUNC is set.


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


# 8c6a62c60c366e302e9198bcf5187f317d4e866b 22-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Now implements bfs_write_pages().
Changed some debug stuff.


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


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

Big update while moving over completely to the Haiku kernel:
- Ported over BFS to the new cache API
- Inode no longer inherits from CachedBlock, and therefore, no longer
keeps the whole inode block in memory. It now has a copy of the bfs_inode
structure in memory instead. This has a number of advantages but also some
disadvantages, so it might be reverted later, even if it's unlikely.
- Added a NodeGetter class that can be used whenever the real block needs
to be accessed (ie. for attributes)
- Changed *transaction to &transaction where possible
- Removed support for KEEP_WRONG_DIRENT_RECLEN
- Removed support for uncached file access since that's no longer needed
- Fixed some endian issues in bfs_write_stat()
- Removed the install BFS rules, since they don't make any sense anymore
(unless you are running Haiku ;-))

Note, logged streams are not supported anymore right now. Also, the
transaction code is pretty simple and slow - it will be improved later
on. Attribute code is pretty much untested in the new environment.


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


# fac367f27df2549634007f026260f25ce3556a94 15-Nov-2004 Jérôme Duval <korli@users.berlios.de>

fix to conform to the API


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


# 755901d8350088aefd03c769f8c75865bf3d5a8a 29-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

bfs_read_stat() now correctly reports the size of a link for symbolic links
that are short enough to be placed in the short symlink region.
bfs_read_link() now makes sure that the link read is always null terminated.


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


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

Implemented the Disk Device Manager Scanning API. It's currently exported
as a separate module, but might be merged with the standard FS API.


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


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

Enabled the bfs_set_flags() call.


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


# 40f2ce7d205230e65f8cfa44cfc71fd9b7ddf90b 14-Sep-2004 Axel Dörfler <axeld@pinc-software.de>

Activated the index functions and ported it to the the new VFS API.


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


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

The fs_readlink() function must work a bit differently in the new VFS API
(ie. it needs to add the terminating null byte).
It now also properly fails if the link is too long for the provided buffer.
This allows us to resolve links on BFS volumes using Haiku again :)


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


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

Added a "cookie" parameter to the fs_read|write|has_page[s]().
Implemented bfs_get_file_map().
Now uses the brand new file cache for the file data streams.


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


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

The VM fs interface has changed to better match the one of the device interface.
Added an fs call for the file cache.


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


# 15190e07b33fe9763e1116a6328b503aa8cce98a 10-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

The current kernel version needs these functions to be there (it will crash
if not).


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


# 83d956957084e6f5f0f51dc51a2359de446ce698 08-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Missing name index update with a late failed rename operation fixed (the
same as in kernel_interface_r5.cpp).
{add|remove}_debugger_commands() are now called in B_MODULE_[UN]INIT, no
longer in bfs_[un]mount().
Removed empty cache implementation as it's in the kernel itself for now.


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


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

First try at a working BFS for the new kernel - does compile but not much more.


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


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

It's now <util/kernel_cpp.h> rather than <kernel_cpp.h>.
Forgot to commit that...


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


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

Moved the logic from bfs_close() to bfs_free_cookie() - apparently, doing
anything in bfs_close() does not really makes sense. Thanks to Ingo for
pointing this out.


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


# e4758ac3824ebcac1e9862668512762f8a879dde 03-May-2004 Bruno G. Albuquerque <bga@bug-br.org.br>

Added BFS_REPLACEMENT define that will enable compiling OpenBFS as as full
BFS replacement (will report itself as "bfs" instead of "obfs". Is there a
way to change the add-on name based on the same define?


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


# 5b25332a790992e509503f09c206a0c38d3c17ef 01-Feb-2004 Axel Dörfler <axeld@pinc-software.de>

This should fix the recently introduced locking problems:
- locking policy is now: 1) the volume lock, 2) the inode lock, 3) start
the transaction (the journal lock) - you don't need all locks, but you
have to follow this order when you need more than one of them.
- in many cases, this makes our inode read/write lock useless. I am really
looking forward to the OpenBeOS VFS layer where we can remove many of
these locks again.


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


# b39a7a0edd6417fe5b7e4e04f5e01afe623672e7 29-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Fixed the "inode is not becoming unbusy" problem.


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


# 01338285a9dd86dc5d0353598d6615016890cd0d 29-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Some minor style changes.


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


# a49b150fff1fec5e4d3f0f6c774617111304e916 27-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Removed the fOwningThread functionality from the Journal class; it now
just uses a RecursiveLock instead.
Changed Journal::CurrentTransaction() so that it returns the current
transaction only if it's valid for the thread asking for it.
That doesn't fix the bug, but changed its timing a bit.


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


# aac1dff95114f7675e700de990f6eebdcc4c6cc9 25-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Updated the comment in bfs_initialize() - which we don't need for R5 (as it's
never called).


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


# aef00d7b03f89c7d8af36bdb3e202d410ad5a911 25-Jan-2004 Axel Dörfler <axeld@pinc-software.de>

Cleaned up the debug mess mmu_man has created (thanks anyway!).
Fixed a bug where the debug commands would be added in bfs_mount(), but
not removed (since bfs_unmount() is only called if bfs_mount() doesn't
fail).
Switched to kernel_cpp.h/cpp.


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


# 91e6897c6321262a91daed30b1b5be7420c53679 24-Jan-2004 François Revol <revol@free.fr>

Added obfsinode kernel debugger command.


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


# 6503b7c3bed1f6349fb2e1349565de461421de17 05-Nov-2003 Axel Dörfler <axeld@pinc-software.de>

Added missing statics; static functions doesn't need to be extern "C".


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


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

The file system is now almost endian-aware.
Used lazy unreadable conversion: ==, !=, == 0, != 0 are endian-safe
and don't need byte swapping.
If the platform endian differs from the one selected at compile time,
it will mount all volumes read-only for now.
Uncomment BFS_BIG_ENDIAN_ONLY in the Jamfile to build the big endian
version under x86.
No matter on what platform, the compilation defaults to build BFS as
little endian file system (see bfs_endian.h for details).


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


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

Only send notifications if writing was successful.


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


# 4a9d9dfa146df5d8a5b0c118501e3662dcd02239 18-Jun-2003 Axel Dörfler <axeld@pinc-software.de>

Added new RecursiveLock and RecursiveLocker classes.
Added file system global locking around creating, deleting, and renaming
inodes - that's not nice, but since we have only sequential journal access,
it won't hurt concurrency much. The locks are needed to prevent certain
things from happening like two threads could theoretically create the same
file twice (one of them would have failed, but relatively late in the process).
Anyway, a better locking scheme will be implemented at a later date, but maybe
not for R1.
Small cleanup.


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


# 4a5e9fec88ea506295b027c46987061c7ee1f949 15-Jun-2003 Axel Dörfler <axeld@pinc-software.de>

Updated some comments.


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


# 8ea8d0c2bb1270149813f29b7cda0fba06f2210a 31-May-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed queries a bit more (maybe even completely...). In several situations,
the old attribute value wasn't evaluated at all.
Also, Index::Update() got a type code of zero, instead of the real value
in situations where this didn't make any sense.
Minor cleanup in kernel_interface.cpp.
New method Volume::CheckForLiveQuery() that checks if there is a live query
depending on the specified attribute - not yet implemented, but already used;
always returns "true" right now, which doesn't cause any harm but reducing
the speed lightly.


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


# f2024b115800d701366508abaad876eba52376b4 28-May-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed debug output in bfs_setflags().


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


# a9aa5ee181fca87633fd02f5b966eaf9e01d7aca 27-May-2003 Axel Dörfler <axeld@pinc-software.de>

Implemented bfs_setflags().


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


# ae587160243f792a18663e03b0c77c93058fb24f 27-May-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed another bad bug caused by calling get_vnode() on a node currently
being constructed: bfs_read_node() created an Inode object independent from
the one set in new_vnode().
As a work-around (the new VFS layer will introduce some better methods here)
we are now using the bfs_inode.etc field as a pointer to our object - just
like BFS has thought to use this field. If bfs_read_vnode() has to wait for
the inode (because it is being constructed), it will use the "etc" pointer
and don't create it's own Inode object.
Almost all changes made change the API to take this case into account:
- new Inode constructor to be able to be created from a CachedBlock
- CachedBlock now has a Keep() method which suppresses the release_block()
call when the object is destructed.
- a CachedBlock can now be constructed from the contents of another one (by
calling the source's Keep() method).
- Inode::InitCheck() no longer checks the integrity of the bfs_inode - this
is now done by bfs_inode::InitCheck() which is optionally called by the
former (default).
- moved the inline CachedBlock methods out of the class definition (was
too crowded to be readable).
- new Inode::Initialize() which is called by all Inode constructors
- an Inode object now sets a better name for its read/write lock.


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


# a476bfc5b146a08af87ff292aa5b954753f8cc1b 26-May-2003 Axel Dörfler <axeld@pinc-software.de>

Now waits for a whole second on the inode to become unbusy - just in case
there is a slow drive. Note, if the system is heavily used and the thread
waiting for the inode to become unbusy is a real time thread, that time
might be not enough - don't have a better solution at hand though (other
than waiting even longer).


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


# 98b972c906051113e46d46cfe8c02f5adebdd599 25-Feb-2003 Axel Dörfler <axeld@pinc-software.de>

Fixed all warnings that appeared with DEBUG=1 set.
Also fixed missing return codes in BufferPool::ReleaseBuffer() and Journal::WriteLogEntry().


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


# 2fee336b52cb217e8b2bf0973229cd50bf06aeee 29-Jan-2003 Axel Dörfler <axeld@pinc-software.de>

Removed the load_driver_symbols() call, since it doesn't seem to have any
effect anyway.
Now passes the flags parameter on to the Query.


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


# 3b7911f105339ba9bc073bf4f26b5c90a3b19b3b 10-Jan-2003 Axel Dörfler <axeld@pinc-software.de>

We now check in bfs_rename() if the new name is the same as the old name
in the same directory - in this case, we will return B_OK (as nothing has
to be done to fulfill the request), instead of B_BAD_VALUE which would
be thrown later in the process.


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


# af9ba303e44ced9e752f680bf5192f244972f587 29-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

bfs_walk() now prints the file name if it couldn't locate a file with debug
output turned on.
bfs_open_dir() now accepts again all containers, because bfs_open_index_dir()
is using it, too (too bad when you forgot about your own code).


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


# 98138634aafb9c5fdd246ef243f7f5ca9485c8a2 25-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added the private ioctl calls to get the 64-bit create and modified time.
Most probably these are used by the kernel to identify changes in a shared
library or something like this.


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


# 97d569f0de473250ae5c6a3d4ace6546e0250c91 25-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Now uses strlcpy() rather than strcpy() where appropriate.
The inode is now locked in bfs_close() (when the indices are updated).
Moved the special cases for INODE_NO_CACHE and INODE_CHKBFS_RUNNING into
bfs_free_cookie() - should probably do that with the index update as well.
Updated some comments.


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


# f512ce4233082b1fd9583c64fbd4459ad7a54e30 21-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Added a new inode flag INODE_CHKBFS_RUNNING to detect aborted chkbfs processes.
bfs_read_vnode() will now wait for half a second at maximum until it returns
the B_BUSY error (so that live queries will like it better).


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


# 5254026ba2a0c9700b28e8d1f0f9f4b22beae241 21-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Removed the logic for freeing the inode's space from bfs_remove_vnode(); now
instead calls Inode::Free().
If INODE_DONT_FREE_SPACE was set, bfs_remove_vnode() forgot to delete the
inode before returning B_OK.
bfs_read_vnode() will now return the exact error Inode::InitCheck() returned.


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


# b24d7c8bf700f073d855fa22b46c3de974a1cc9e 19-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Many style changes.
The only functional change is that bfs_rename() now checks for '/' in the
target name (the VFS should do those things, but you never know as long
you haven't written it yourself :).


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


# 27fe0a4b4be365a085ef142b1e5a5e1926cfe61b 17-Nov-2002 Axel Dörfler <axeld@pinc-software.de>

Adds support for INODE_DONT_FREE_SPACE, and all private BFS ioctls defined
in bfs_control.h.
Some minor cleanups.


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


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

Added some comments, made bfs_create() a bit nicer (no functional change, though).


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


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

Fixed a dead-lock that could happen if an attribute was changed and you
had some running live queries.
SimpleLock now allows nesting; added some missing atomic operations to
make its implementation as easy as possible.


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


# bbdc29a05d5944932c92f6133506cb0cfa7cec79 28-Oct-2002 Bruno G. Albuquerque <bga@bug-br.org.br>

bfs_walk() should check for read permissions for iterating through directories, not execute permission.


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


# 7ab95d9da94ccc3df95e8b2d97e1c2f71b100b97 21-Oct-2002 Axel Dörfler <axeld@pinc-software.de>

Made it easier to switch from R5 compilation to the test "obfs" compilation.
$ COMPILE_FOR_R5=1 jam
will compile the "bfs" version, otherwise the "obfs" version is created.
Note: the final executable will always be called obfs (for now).


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


# 2b5451f1642e72a8bd34ccabac5c0b670f09f664 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Added private non-implemented copy constructor and assignment operators
for many classes for the sake of completeness.
Added a Transaction::IsStarted() method to not let it look like as if the
transaction is started more than once.
Changes made after suggestions from Mike Nordell, again :-)


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


# 6829a19b3fc4c8fd42dd6d131f03dfc8404999d6 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

Now bfs_write() also don't trigger any notifications during write access
on uncached files (might be needed for the VM file).


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


# a00ac4bc29ebc7d18dcacd38d3cdc47e5cb3ade0 16-Sep-2002 Axel Dörfler <axeld@pinc-software.de>

bfs_write() called Volume::WriteCachedBlocksIfNecessary() also on uncached
files which might cause troubles with the VM file.


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


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

Added power management functions to support Dano (needed to boot Dano using
our file system):
- added bfs_wake_vnode(), and bfs_suspend_vnode()
- bumped B_CUR_FS_API_VERSION to 3 as needed for Dano

It should now be able to boot Dano with our BFS, although I haven't tested
it. The information was gained using some degree of reverse engineering...
It won't be part of the BFS implementation for OpenBeOS (that won't run on R5
anymore) :-)


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


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

Inode::SetFileSize() now doesn't allow changing the file size of uncached
files anymore (only Inode::WriteAt() denied it before).
Introduced a BFS_NAME define to be able to switch easier between "obfs",
and "bfs".
bfs_write_stat() didn't return the error code if Inode::SetFileSize() failed;
instead, it always reported success.


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


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

Fixed the dirent.d_reclen calculation - define KEEP_WRONG_DIRENT_RECLEN to
enable the old and compatible behaviour (on BeOS R5, all available file
systems seem to do that wrong).


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


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

Fixed a bug that could lead to the wrong last_modified time in an inode;
bfs_close() updated the last_modified time & index, but it didn't write
the inode back to disk.
Furthermore, bfs_write() should have already updated the last_modified
time, not bfs_close.


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


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

BufferPool::ReleaseBuffers() didn't set fFirstFree correctly.
Setting uncached access to a file no longer returns an error (if it succeeds).


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


# 6a2e071075cb0e334f1b9001e9f96fd9d8b1d3fb 11-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Fixed compilation (stupid me :-).


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


# 40f7fd6cf3371d69b9d78ca406058a93648cf18c 07-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Implemented the basics to allow uncached file access under BeOS.
This is needed for the VM swap file and if you want to mount disk images
located on the BFS volume.
There is now a BufferPool class that manages a pool of buffers, so that
Inode::ReadAt()/Inode::WriteAt() can access a file without having to use
the cache or malloc()/free().
The real uncached file access is not yet implemented, though.


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


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

Initial revision


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