diff --git a/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/Jamfile b/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/Jamfile new file mode 100644 index 0000000000..959ccdd493 --- /dev/null +++ b/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/Jamfile @@ -0,0 +1,22 @@ +SubDir OBOS_TOP src tests add-ons kernel file_systems bfs structureSizes ; + +SubDirHdrs $(OBOS_TOP) src add-ons kernel file_systems bfs ; + +{ + local defines = [ FDefines USER ] ; # _NO_INLINE_ASM + SubDirCcFlags $(defines) -fno-exceptions -fno-rtti ; #-fcheck-memory-usage + SubDirC++Flags $(defines) -fno-exceptions -fno-rtti ; #-fcheck-memory-usage +} + +# To check the effects of different compiler options to the structures +# without _PACKED use: +# $ OPTIM=-Ox DEBUG=0 NO_TEST_DEBUG=1 jam -a + +SimpleTest structureSizes + : structureSizes.cpp + : ; + +# Tell Jam where to find these sources +SEARCH on [ FGristFiles BufferPool.cpp ] + = [ FDirName $(OBOS_TOP) src add-ons kernel file_systems bfs ] ; + diff --git a/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/structureSizes.cpp b/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/structureSizes.cpp new file mode 100644 index 0000000000..cd326688eb --- /dev/null +++ b/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/structureSizes.cpp @@ -0,0 +1,37 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include + +#undef _PACKED +#define _PACKED + +#include "bfs.h" + +#include +#include + + +#define SIZEOF(x) "%20s = %lu\n", #x, sizeof(x) +#define OFFSETOF(x, y) #x "." #y " at offset %lu\n", offsetof(x, y) + + +int +main(int argc, char **argv) +{ + printf(SIZEOF(disk_super_block)); + printf(SIZEOF(small_data)); + printf(SIZEOF(data_stream)); + printf(SIZEOF(bfs_inode)); + + puts(""); + + printf(OFFSETOF(bfs_inode, inode_size)); + printf(OFFSETOF(bfs_inode, etc)); + printf(OFFSETOF(bfs_inode, data)); + + return 0; +}