Added support for properly initializing a file system without issueing any
cache warnings. Now prints out actual useful information with the -v option. Removed DEBUG from the build, so that it's now silent and can be used as a replacement of the original. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6482 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -13,7 +13,8 @@ UsePrivateHeaders [ FDirName kernel util ] ;
|
||||
malloc_debug_flags = -fcheck-memory-usage ;
|
||||
}
|
||||
|
||||
local defines = [ FDefines USER DEBUG
|
||||
local defines = [ FDefines USER
|
||||
UNSAFE_GET_VNODE
|
||||
#BFS_BIG_ENDIAN_ONLY
|
||||
$(malloc_debug_defines) ] ;
|
||||
SubDirCcFlags $(defines) -fno-exceptions -fno-rtti $(malloc_debug_flags) ;
|
||||
|
||||
@@ -15,6 +15,33 @@
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
// Note: these structures have been stolen from fs_shell/kernel.c.
|
||||
// They shouldn't be used anywhere else
|
||||
|
||||
extern vnode_ops fs_entry;
|
||||
struct vnode;
|
||||
|
||||
struct vnlist {
|
||||
vnode *head;
|
||||
vnode *tail;
|
||||
int num;
|
||||
};
|
||||
|
||||
struct nspace {
|
||||
nspace_id nsid;
|
||||
my_dev_t dev;
|
||||
my_ino_t ino;
|
||||
fsystem *fs;
|
||||
vnlist vnodes;
|
||||
void *data;
|
||||
vnode * root;
|
||||
vnode * mount;
|
||||
nspace * prev;
|
||||
nspace * next;
|
||||
char shutdown;
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
usage(char *programName)
|
||||
{
|
||||
@@ -95,15 +122,37 @@ main(int argc, char **argv)
|
||||
init_block_cache(4096, 0);
|
||||
init_vnode_layer();
|
||||
|
||||
Volume volume(1);
|
||||
if (install_file_system(&fs_entry, "bfs", 1, -1) == NULL) {
|
||||
printf("can't install my file system\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
struct nspace *mount = (nspace *)malloc(sizeof(nspace));
|
||||
if (add_nspace(mount, NULL, "bfs", -1, -1) < B_OK) {
|
||||
fprintf(stderr, "%s: add mount structure failed\n", programName);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Volume volume(mount->nsid);
|
||||
status_t status = volume.Initialize(deviceName, volumeName, blockSize, flags);
|
||||
if (status < B_OK) {
|
||||
fprintf(stderr, "%s: Initializing volume failed: %s\n", programName, strerror(status));
|
||||
return -1;
|
||||
}
|
||||
|
||||
remove_nspace(mount);
|
||||
|
||||
if (verbose) {
|
||||
// ToDo: dump disk info
|
||||
disk_super_block super = volume.SuperBlock();
|
||||
|
||||
printf("%s: Disk was initialized successfully.\n", programName);
|
||||
printf("\tname: \"%s\"\n", super.name);
|
||||
printf("\tnum blocks: %Ld\n", super.NumBlocks());
|
||||
printf("\tused blocks: %Ld\n", super.UsedBlocks());
|
||||
printf("\tblock size: %lu bytes\n", super.BlockSize());
|
||||
printf("\tnum allocation groups: %ld\n", super.AllocationGroups());
|
||||
printf("\tallocation group size: %ld blocks\n", 1L << super.AllocationGroupShift());
|
||||
printf("\tlog size: %u blocks\n", super.log_blocks.Length());
|
||||
}
|
||||
|
||||
shutdown_block_cache();
|
||||
|
||||
Reference in New Issue
Block a user