Commit Graph

275 Commits

Author SHA1 Message Date
Axel Dörfler
697df4613d Style clean-ups *and* Index::Update() now correctly converts B_MIME_STRING_TYPE
to B_STRING_TYPE for the lower layers - should probably find a better solution
to handle this.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2166 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-06 04:32:05 +00:00
Axel Dörfler
d3ca8eec8d The new block bitmap is now written using through the log for chkbfs.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2163 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-05 20:30:18 +00:00
Axel Dörfler
af9ba303e4 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
2002-11-29 20:03:49 +00:00
Axel Dörfler
006928f81b Fixed the bug in the query code: B_MIME_STRING_TYPE was not correctly
translated into B_STRING_TYPE for the key comparison (it was translated
but not saved under the new type).
compareKeys() will now return -1 if it didn't know the type to compare.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2121 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-29 19:22:52 +00:00
Axel Dörfler
c78d05895c Removed some debug output I accidently added to the repository.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2107 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-28 15:13:08 +00:00
Axel Dörfler
363999a1eb Thanks to Bruno, we fixed a bug in Inode::Create() that happened with newly
created files that already existed.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2098 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-27 22:40:04 +00:00
Michael Pfeiffer
367265f7f0 Added shared source code for print kit.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2092 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-26 23:12:19 +00:00
Axel Dörfler
98138634aa 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
2002-11-25 23:51:03 +00:00
Axel Dörfler
cb0a9fe094 Fixed a stupid bug, used Inode::Name() without locking.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2087 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-25 23:30:54 +00:00
Axel Dörfler
2ad0108fbe Now uses Inode::GetName() and strlcpy().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2086 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-25 18:43:11 +00:00
Axel Dörfler
c0f2928e7d Now uses Inode::GetName() where appropriate.
Fixed a bigger race condition when matching against the name index.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2085 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-25 18:42:40 +00:00
Axel Dörfler
97d569f0de 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
2002-11-25 18:07:35 +00:00
Axel Dörfler
0606e6e197 Added a new method Inode::GetName() which safely copies the inode's name
to the provided buffer.
Inode::Name() no longer locks the small_data region anymore.
Added ASSERTs that the small_data region is locked for the methods requiring
that.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2083 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-25 17:38:19 +00:00
Axel Dörfler
d88937ace2 Added a SimpleLock.IsLocked() method.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2082 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-25 17:36:53 +00:00
Axel Dörfler
0f374ebc88 Added a strlcpy() call for usage in BeOS (OpenBeOS has it built-in already).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2081 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-25 17:35:21 +00:00
Axel Dörfler
d369893781 Removed the usage of Inode::Name() in the debug output.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2080 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-25 17:33:43 +00:00
Axel Dörfler
fea5713c6d Added a comment about live-queries in Inode::Create().
Some style cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2060 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-22 03:45:01 +00:00
Axel Dörfler
b5a0c65c19 Added support for aborted "chkbfs" runs (so that they won't do any harm).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-22 03:32:53 +00:00
Axel Dörfler
f512ce4233 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
2002-11-22 03:31:34 +00:00
Axel Dörfler
5254026ba2 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
2002-11-21 20:45:52 +00:00
Axel Dörfler
11a8dbc63a Completely worked over the inode creation mechanism. Now more work is delegated
to the InodeAllocator class (initialization of the inode, tree creation for
containers).
The InodeAllocator class now frees all the space the inode occupies, including
the B+tree if it's a container (by calling the new Inode::Free() method).
Inode::Free() implementation (logic removed from bfs_remove_vnode()).
Now secures the inode from being loaded by setting the INODE_NOT_READY flag
(completely handled by the InodeAllocator class).
The inode is now removed from its parent if something went wrong after it
had been added.
Utilizes the new BPlusTree::Remove() method where appropriate.
Inode::GetAttribute() now checks if the inode opened is really an attribute.
Inode::InitCheck() now fails with B_BUSY if the INODE_NOT_READY flag is set.
InodeAllocator::Keep() now writes back the inode.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2055 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-21 20:42:44 +00:00
Axel Dörfler
9fec50f9db Added new Inode::Free() method which frees all space associated with an
inode.
Some style cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2054 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-21 20:34:04 +00:00
Axel Dörfler
8a3e35d8c3 AllocationBlock::Allocate() still had the 0xffff thing implemented, now
also the numBlocks parameter is ASSERTed - when compiled with DEBUG turned
off, BFS will enter the kernel debugger in this case (through the use of
the DIE() macro).
Same for AllocationBlock::Free() (but the 0xffff mode was already removed
there).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2053 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-21 20:32:54 +00:00
Axel Dörfler
98887c634e Symbolic link data streams (for long symlinks) now are located in the same
allocation group as the inode, if possible.
Moved the group used blocks info maintaining code into AllocationGroup::Allocate()
and AllocationGroup::Free() (instead of letting the BlockAllocator class do
the work).
Removed the buggy and useless extra 0xffff mode for AllocationBlock::Allocate()
and AllocationBlock::Free(), both methods now ASSERT their parameter range.
Changed some comments, style cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2052 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-21 20:27:57 +00:00
Axel Dörfler
def426bce2 Added a BPlusTree::Remove() inline method for strings.
Style cleanups.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2051 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-21 20:22:36 +00:00
Axel Dörfler
2edddca0dc Removed the unused INODE_EMPTY flag, and introduced a new INODE_NOT_READY
flag which is used during construction of an inode.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2050 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-21 20:21:28 +00:00
Axel Dörfler
696b26708c The Locker class now uses ASSERT() to be sure the semaphore could be locked.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2049 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-21 20:20:12 +00:00
Axel Dörfler
537e538aa6 Added two new macros, ASSERT(), and DIE().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2048 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-21 20:15:25 +00:00
Axel Dörfler
95f8931641 BlockAllocator::CheckInode() now has support for the double indirect region
of the stream (so the "chkbfs" functionality is complete now).
Fixed wrong block number report in BlockAllocator::CheckBlockRun(), blocks are
now printed out in absolute numbers (not allocation_group relative anymore).
Use Inode::IsContainer() where necessary instead of Inode::IsDirectory().
Fixed a big and nasty bug in AllocationBlock::SetTo(): the number of bits in
a block could be calculated wrong for a partial allocation group which need
more than one block in the bitmap - hopefully, that was the last remaining
big bug in the block allocator.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2032 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-20 01:59:14 +00:00
Axel Dörfler
68ca164dc3 Switched from Inode::IsDirectory() to Inode::IsContainer() where necessary.
Now makes use of the changed Inode::Create() logic.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2031 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-20 01:52:03 +00:00
Axel Dörfler
52fafe627e Changed the parameter logic from Inode::Create() - it now also keeps the
inode locked if the _inode parameter is passed.
Makes some more use of the new type identificators.
Symlinks are no longer added to the "size" index (compatibility with BFS, and it also
makes much more sense).
Now sets S_STR_INDEX for directories, if no index type was set (again, compatibility
issue with BFS).
Fixed a bug in the Inode::GrowStream() method in the double indirect region.
Some style updates.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2030 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-20 01:50:03 +00:00
Axel Dörfler
67fa10dcde Added some more type identification methods and constants.
Renamed Inode::IsDirectory() to Inode::IsContainer() (since it is also true
for index/attribute directories).
Introduced a new Inode::IsDirectory() that only checks for real and standard
directories. Let's hope I've fixed more bugs with that than introduced new
ones...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2029 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-20 01:44:17 +00:00
Axel Dörfler
b24d7c8bf7 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
2002-11-20 01:42:01 +00:00
Axel Dörfler
3f870da9c3 Almost complete and working "chkbfs" functionality for BFS. It can be used
via the private ioctls defined in bfs_control.h.
Detects all kinds of errors, and can correct most of them. It doesn't fix
any errors in the b+trees (like the ones created by an earlier version
of the BPlusTree class ;-), and it also can't fix the "blocks are already set"
error, which occurs if more than one file claims a particular block (or
range of blocks) for itself.
The double indirect data range is not yet supported, so use with care, or
run the original chkbfs afterwards to fix any errors because of that.
Might not yet analyze 100% correct (shows way to many errors for my tastes...).
A "chkbfs" command will be made available shortly.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1994 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:28:47 +00:00
Axel Dörfler
27fe0a4b4b 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
2002-11-18 01:22:33 +00:00
Axel Dörfler
c113e0ecfd Added another ToDo item...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1991 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:21:06 +00:00
Axel Dörfler
adb9970c9e This file defines the private BFS ioctls to control the "chkbfs" mechanism
and other stuff.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1990 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:19:55 +00:00
Axel Dörfler
359c7618f0 Changed because of renaming IsValidBlockRun() to ValidateBlockRun().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1989 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:18:40 +00:00
Axel Dörfler
dbba7407de Renamed Volume::IsValidBlockRun() to Volume::ValidateBlockRun() because it
returns a status_t, not a boolean value.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1988 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:17:41 +00:00
Axel Dörfler
0c9a17ce08 Added a simple (and completely non-reliable) C implementation for atomic_set(),
and atomic_test_and_set() for userland testing purposes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1987 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:16:27 +00:00
Axel Dörfler
7781a5df6b Now uses block_run::MergeableWith() in Inode::GrowStream() - that also fixes
the bug where a block_run could get a zero length after merging it...
Updated a comment in Inode::Remove().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1986 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:14:30 +00:00
Axel Dörfler
2afbd5e712 Added new method block_run::MergeableWith() which checks if two different
block_runs can be merged together.
Added a constant for the maximum length of a block_run.
Added a flag constant to the inode that prevents freeing up its space
after it has been removed - this is only useful for the "chkbfs" stuff.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1985 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:12:56 +00:00
Axel Dörfler
8ea2f57ddd Added some more type identifying methods and constants (i.e. Inode::IsAttribute()).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1984 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-18 01:10:31 +00:00
Matthew Wilber
78b736e8bc I'm not sure why that return was there in the first place
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1967 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-16 22:06:03 +00:00
Matthew Wilber
0f2c902adb I'm not sure what that return was doing there in the first place
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1966 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-16 22:05:26 +00:00
Axel Dörfler
6f6aedf0b3 Fixed the "famous" VM bug; read_pos() returns the number of bytes read, so
Cache::Read() != B_OK failed if the underlying class used that function.
We can now boot R5 with VM turned on without any problems (what a stupid bug).
As a side effect, you can now also mount volumes on your BFS disk, which was
also broken because of this bug.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1930 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-14 00:24:31 +00:00
Axel Dörfler
e94373bfa0 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
2002-11-14 00:22:16 +00:00
Axel Dörfler
601f33e246 It's no longer possible to remove or recreate a file that is opened with
uncached access.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1928 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-14 00:21:04 +00:00
Axel Dörfler
b334e2f00f Replaced the simple "return" with the RETURN_ERROR() macro for fatal errors
to make them visible in the log.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1927 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-14 00:19:49 +00:00
Axel Dörfler
ae01c8b752 Now includes <string.h> which is needed for the strerror() function used
in the macros.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1926 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-14 00:18:50 +00:00