* 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
This commit is contained in:
Stephan Aßmus 2006-02-26 17:40:41 +00:00
parent f41837b49f
commit 6106f57e21
4 changed files with 16 additions and 30 deletions

View File

@ -1,6 +1,6 @@
/* Debug - debug stuff
*
* Copyright 2001-2004, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2001-2006, Axel Dörfler, axeld@pinc-software.de.
* Some code is based on work previously done by Marcus Overhagen.
*
* This file may be used under the terms of the MIT License.
@ -44,20 +44,6 @@ dump_block_run(const char *prefix, const block_run &run)
}
void
dump_inode(Inode &inode)
{
Print("Inode (%p) {\n", &inode);
Print("\tfVolume = %p\n", inode.fVolume);
Print("\tfBlockNumber = 0x%16Lx\n", inode.BlockNumber());
Print("\tfTree = %p\n", inode.fTree);
Print("\tfAttributes = %p\n", inode.fAttributes);
Print("\tfOldSize = 0x%16Lx\n", inode.fOldSize);
Print("\tfOldLastModified = 0x%16Lx\n", inode.fOldLastModified);
Print("}\n");
}
void
dump_super_block(const disk_super_block *superBlock)
{
@ -271,7 +257,7 @@ dbg_inode(int argc, char **argv)
}
Inode *inode = (Inode *)parse_expression(argv[1]);
dump_inode(*inode);
dump_inode(&inode->Node());
return B_OK;
}

View File

@ -1,6 +1,6 @@
/* Debug - debug stuff
*
* Copyright 2001-2005, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2001-2006, Axel Dörfler, axeld@pinc-software.de.
* This file may be used under the terms of the MIT License.
*/
#ifndef DEBUG_H
@ -92,7 +92,6 @@
// some structure dump functions
extern void dump_block_run(const char *prefix, block_run &run);
extern void dump_inode(Inode &inode);
extern void dump_super_block(const disk_super_block *superBlock);
extern void dump_data_stream(const data_stream *stream);
extern void dump_inode(const bfs_inode *inode);

View File

@ -1,6 +1,6 @@
/* Inode - inode access functions
*
* Copyright 2001-2005, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2001-2006, Axel Dörfler, axeld@pinc-software.de.
* This file may be used under the terms of the MIT License.
*/
@ -171,7 +171,10 @@ bfs_inode::InitCheck(Volume *volume)
Inode::Inode(Volume *volume, vnode_id id)
:
fVolume(volume),
fID(id)
fID(id),
fTree(NULL),
fAttributes(NULL),
fCache(NULL)
{
PRINT(("Inode::Inode(volume = %p, id = %Ld) @ %p\n", volume, id, this));
@ -187,9 +190,6 @@ Inode::Inode(Volume *volume, vnode_id id)
fOldSize = Size();
fOldLastModified = LastModified();
fTree = NULL;
fCache = NULL;
if (IsContainer())
fTree = new BPlusTree(this);
if (IsFile() || IsAttribute())
@ -200,7 +200,10 @@ Inode::Inode(Volume *volume, vnode_id id)
Inode::Inode(Volume *volume, Transaction &transaction, vnode_id id, mode_t mode, block_run &run)
:
fVolume(volume),
fID(id)
fID(id),
fTree(NULL),
fAttributes(NULL),
fCache(NULL)
{
PRINT(("Inode::Inode(volume = %p, transaction = %p, id = %Ld) @ %p\n",
volume, &transaction, id, this));
@ -233,9 +236,6 @@ Inode::Inode(Volume *volume, Transaction &transaction, vnode_id id, mode_t mode,
// these two will help to maintain the indices
fOldSize = Size();
fOldLastModified = LastModified();
fTree = NULL;
fCache = NULL;
}
@ -1154,6 +1154,7 @@ Inode::FindBlockRun(off_t pos, block_run &run, off_t &offset)
return fVolume->ValidateBlockRun(run);
}
}
//PRINT(("FindBlockRun() failed in direct range: size = %Ld, pos = %Ld\n",data->size,pos));
return B_ENTRY_NOT_FOUND;
}

View File

@ -1,6 +1,6 @@
/* kernel_interface - file system interface to BeOS' vnode layer
*
* Copyright 2001-2005, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2001-2006, Axel Dörfler, axeld@pinc-software.de.
* This file may be used under the terms of the MIT License.
*/
@ -373,7 +373,7 @@ bfs_read_pages(fs_volume _fs, fs_vnode _node, fs_cookie _cookie, off_t pos,
{
Inode *inode = (Inode *)_node;
if (!inode->HasUserAccessableStream())
if (inode->FileCache() == NULL)
RETURN_ERROR(B_BAD_VALUE);
ReadLocked locked(inode->Lock());
@ -411,7 +411,7 @@ bfs_write_pages(fs_volume _fs, fs_vnode _node, fs_cookie _cookie, off_t pos,
{
Inode *inode = (Inode *)_node;
if (!inode->HasUserAccessableStream())
if (inode->FileCache() == NULL)
RETURN_ERROR(B_BAD_VALUE);
ReadLocked locked(inode->Lock());