Added a simple test program to check if the disk structure sizes change

with different compiler options - couldn't find anything, though.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6213 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-01-21 15:54:53 +00:00
parent 67ab3b5bed
commit 0207f71894
2 changed files with 59 additions and 0 deletions

View File

@ -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 ] ;

View File

@ -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 <SupportDefs.h>
#undef _PACKED
#define _PACKED
#include "bfs.h"
#include <stdio.h>
#include <stddef.h>
#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;
}