Check-in [b44f224092]

Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:b44f224092e63f367590e5b8d400e0ed25a0bf60
Date: 2010-03-10 21:09:12
User: stephan
Comment:minor code reorg.
Tags And Properties
Changes
hide diffs unified diffs patch

Changes to pfs/EPFSApp.c

Old (a038bdeeb642979c) New (efe158fd095129d9)
1 /** 1 /**
2 This file is intended to be #include'd by the whio_epfs tools 2 This file is intended to be #include'd by the whio_epfs tools
3 code. It is a small framework providing the basic shared 3 code. It is a small framework providing the basic shared
4 functionality used by those apps: 4 functionality used by those apps:
5 5
17 hidden lines
23 #include <assert.h> 23 #include <assert.h>
24 #include <stdlib.h> // free() 24 #include <stdlib.h> // free()
25 #include <string.h> // strcmp() 25 #include <string.h> // strcmp()
26 #include <stdio.h> 26 #include <stdio.h>
27 27
> 28 #define USE_ALLOCATOR 1 /* set to 1 to enable mempool support. */
28 enum { 29 enum {
29 /** 30 /**
30 Statically-assigned size of whio_epfs memory pool for EPFS. 31 Statically-assigned size of whio_epfs memory pool for EPFS.
31 */ 32 */
32 AllocatorSize = 33 AllocatorSize =
33 4000 // only a very large EFS with lots of opened records, or large pseudofiles with small block sizes, would need this much. | 34 #if USE_ALLOCATOR
34 //2000 // has worked for me so far (famous last words) | 35 //4000 // only a very large EFS with lots of opened records, or large pseudofiles with small block sizes, would need this much.
| 36 2000 // has worked for me so far (famous last words)
35 //500 // works for small use cases on 32-bit, but not 64-bit. Good for testing allocation failure. 37 //500 // works for small use cases on 32-bit, but not 64-bit. Good for testing allocation failure.
36 //0 // uses stdlib allocators | 38 #else
| 39 0 // uses stdlib allocators
| 40 #endif
37 , 41 ,
38 /** 42 /**
39 Statically-assigned size of whio_alloc() memory pool. | 43 Statically-assigned size of whio_malloc() memory pool.
40 44
41 Due to static destruction ordering and our use of atexit(), we have 45 Due to static destruction ordering and our use of atexit(), we have
42 to be very careful with this option. i was at one point getting 46 to be very careful with this option. i was at one point getting
43 memory corruption because the deallocator was statically destructed 47 memory corruption because the deallocator was statically destructed
44 before the EPFSApp.dev device was. It showed up as an assertion in 48 before the EPFSApp.dev device was. It showed up as an assertion in
45 libc during fclose() (via whio_dev::close()). 49 libc during fclose() (via whio_dev::close()).
46 */ 50 */
47 WhioPoolSize = 51 WhioPoolSize =
> 52 #if USE_ALLOCATOR
48 500 /* should be more than plenty */ 53 500 /* should be more than plenty */
49 //0 // uses stdlib allocators | 54 #else
| 55 0 // uses stdlib allocators
| 56 #endif
50 57
51 }; 58 };
52 enum ArgSpecTypes { 59 enum ArgSpecTypes {
53 ArgTypeIgnore = 0, 60 ArgTypeIgnore = 0,
54 ArgTypeIOSizeT, 61 ArgTypeIOSizeT,
1072 hidden lines
1127 return whio_rc.OK; 1134 return whio_rc.OK;
1128 } 1135 }
1129 1136
1130 1137
1131 #endif /* WANDERINGHORSE_NET_WHIO_EPFSAPP_C_INCLUDED */ 1138 #endif /* WANDERINGHORSE_NET_WHIO_EPFSAPP_C_INCLUDED */