Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | a4fb6833989dd8121c7d1af57164e02b0c2d4db7 |
|---|---|
| Date: | 2009-06-16 23:56:09 |
| User: | stephan |
| Comment: | backed out changes from commit dd959311de. They lead to a leak via whefs_string_copy_cstring(). |
Tags And Properties
- branch=trunk inherited from [d21fde6e87]
- sym-trunk inherited from [d21fde6e87]
Changes
Changes to test.c
| Old (d8a4a93d6a765376) | New (d17fef391a1d7930) | |||
|---|---|---|---|---|
| 1 | /* | 1 | /* | |
| 2 | Test/demo app for libwhefs. | 2 | Test/demo app for libwhefs. | |
| 3 | 3 | |||
| 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/) | 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/) | |
| 5 | 5 | |||
| 226 hidden lines | ||||
| 232 | whefs_fclose( F2 ); | 232 | whefs_fclose( F2 ); | |
| 233 | #endif | 233 | #endif | |
| 234 | 234 | |||
| 235 | 235 | |||
| 236 | 236 | |||
| 237 | #if 1//set this to 0 to test a leak: | < | ||
| 238 | whefs_fclose( F ); | 237 | whefs_fclose( F ); | |
| 239 | #endif | < | ||
| 240 | 238 | |||
| 241 | whefs_fs_finalize( fs ); | 239 | whefs_fs_finalize( fs ); | |
| 242 | MARKER("ending test\n"); | 240 | MARKER("ending test\n"); | |
| 243 | return 0; | 241 | return 0; | |
| 244 | } | 242 | } | |
| 324 hidden lines | ||||
| 569 | WHEFSApp.helpText = | 567 | WHEFSApp.helpText = | |
| 570 | "Basic test/sanity-check program for whefs." | 568 | "Basic test/sanity-check program for whefs." | |
| 571 | ; | 569 | ; | |
| 572 | int rc = 0; | 570 | int rc = 0; | |
| 573 | WHEFSApp_init( argc, argv, WHEFSApp_NoOpen, 0, 0 ); // ignore return. | 571 | WHEFSApp_init( argc, argv, WHEFSApp_NoOpen, 0, 0 ); // ignore return. | |
| > | 572 | |||
| > | 573 | //whefs_setup_debug_arg( stderr, "hcl" ); | ||
| 574 | ThisApp.fsopts = whefs_fs_options_default; | 574 | ThisApp.fsopts = whefs_fs_options_default; | |
| 575 | ThisApp.fsopts.inode_count = 16; | 575 | ThisApp.fsopts.inode_count = 16; | |
| 576 | ThisApp.fsopts.block_count = 32; | 576 | ThisApp.fsopts.block_count = 32; | |
| 577 | ThisApp.fsopts.filename_length = 32; | 577 | ThisApp.fsopts.filename_length = 32; | |
| 578 | ThisApp.fsopts.block_size = 1024 * 2; | 578 | ThisApp.fsopts.block_size = 1024 * 2; | |
| 579 | //if(!rc) rc = test_encodings(); | | | 579 | if(!rc) rc = test_encodings(); |
| 580 | //if(!rc) rc = test_hash(); | | | 580 | if(!rc) rc = test_hash(); |
| 581 | if(!rc) rc = test_one(); | 581 | if(!rc) rc = test_one(); | |
| 582 | if(!rc) rc = test_ramfs(); | 582 | if(!rc) rc = test_ramfs(); | |
| 583 | if(!rc) rc = test_multiple_files(); | 583 | if(!rc) rc = test_multiple_files(); | |
| 584 | if(!rc) rc = test_truncate(); | 584 | if(!rc) rc = test_truncate(); | |
| 585 | if(!rc) rc = test_caching(); | 585 | if(!rc) rc = test_caching(); | |
| 587 | (0==rc) | 587 | (0==rc) | |
| 588 | ? "You win :)" | 588 | ? "You win :)" | |
| 589 | : "You lose :("); | 589 | : "You lose :("); | |
| 590 | return rc; | 590 | return rc; | |
| 591 | } | 591 | } | |
Changes to whdbg.h
| Old (1b1f2cafdaa02194) | New (1a80a6d82911e1ba) | |||
|---|---|---|---|---|
| 1 | #ifndef WANDERINGHORSE_NET_WHDBG_H_INCLUDED | 1 | #ifndef WANDERINGHORSE_NET_WHDBG_H_INCLUDED | |
| 2 | #define WANDERINGHORSE_NET_WHDBG_H_INCLUDED 1 | 2 | #define WANDERINGHORSE_NET_WHDBG_H_INCLUDED 1 | |
| 3 | 3 | |||
| 4 | /** @page whdbg_page_main whdbg: Debugging Library for C | 4 | /** @page whdbg_page_main whdbg: Debugging Library for C | |
| 5 | 5 | |||
| 89 hidden lines | ||||
| 95 | Log error messages. | 95 | Log error messages. | |
| 96 | */ | 96 | */ | |
| 97 | WHDBG_IO_ERROR = WHDBG_ERROR | 0x02, | 97 | WHDBG_IO_ERROR = WHDBG_ERROR | 0x02, | |
| 98 | 98 | |||
| 99 | /** | 99 | /** | |
| > | 100 | FIXME markers | ||
| > | 101 | */ | ||
| > | 102 | WHDBG_FIXME = WHDBG_ERROR | 0x04, | ||
| > | 103 | |||
| > | 104 | /** | ||
| 100 | General warning mask. | 105 | General warning mask. | |
| 101 | */ | 106 | */ | |
| 102 | WHDBG_WARNING = 0x20000000, | 107 | WHDBG_WARNING = 0x20000000, | |
| 103 | WHDBG_NYI = WHDBG_WARNING | 0x01, | 108 | WHDBG_NYI = WHDBG_WARNING | 0x01, | |
| 104 | 109 | |||
| 105 | WHDBG_INFO = 0x40000000, | 110 | WHDBG_INFO = 0x40000000, | |
| 106 | < | |||
| 107 | /** | 111 | /** | |
| 108 | "For your information..." or "To whom it may concern..." | 112 | "For your information..." or "To whom it may concern..." | |
| 109 | */ | 113 | */ | |
| 110 | WHDBG_FYI = WHDBG_INFO, | 114 | WHDBG_FYI = WHDBG_INFO, | |
| 111 | /** | 115 | /** | |
| 4 hidden lines | ||||
| 116 | 120 | |||
| 117 | /** | 121 | /** | |
| 118 | Log deallocation events. | 122 | Log deallocation events. | |
| 119 | */ | 123 | */ | |
| 120 | WHDBG_DEALLOC = WHDBG_INFO | 0x0002, | 124 | WHDBG_DEALLOC = WHDBG_INFO | 0x0002, | |
| 121 | < | |||
| 122 | /** | < | ||
| 123 | FIXME markers | < | ||
| 124 | */ | < | ||
| 125 | WHDBG_FIXME = WHDBG_INFO | 0x04, | < | ||
| 126 | 125 | |||
| 127 | /** | 126 | /** | |
| 128 | For apps with a "verbose" flag. | 127 | For apps with a "verbose" flag. | |
| 129 | */ | 128 | */ | |
| 130 | WHDBG_VERBOSE = 0x00010000, | 129 | WHDBG_VERBOSE = 0x00010000, | |
| 199 hidden lines | ||||
| 330 | #ifdef __cplusplus | 329 | #ifdef __cplusplus | |
| 331 | } /* extern "C" */ | 330 | } /* extern "C" */ | |
| 332 | #endif | 331 | #endif | |
| 333 | 332 | |||
| 334 | #endif /* WANDERINGHORSE_NET_WHDBG_H_INCLUDED */ | 333 | #endif /* WANDERINGHORSE_NET_WHDBG_H_INCLUDED */ | |
Changes to whefs.h
| Old (c05ff71416f1dce4) | New (5d6f203df1cb67fc) | |||
|---|---|---|---|---|
| 1 | #ifndef WANDERINGHORSE_NET_WHEFS_H_INCLUDED | 1 | #ifndef WANDERINGHORSE_NET_WHEFS_H_INCLUDED | |
| 2 | #define WANDERINGHORSE_NET_WHEFS_H_INCLUDED | 2 | #define WANDERINGHORSE_NET_WHEFS_H_INCLUDED | |
| 3 | 3 | |||
| 4 | #include "whefs_config.h" | 4 | #include "whefs_config.h" | |
| 5 | #include <stddef.h> | 5 | #include <stddef.h> | |
| 1022 hidden lines | ||||
| 1028 | there is any question at all about its lifetime. | 1028 | there is any question at all about its lifetime. | |
| 1029 | 1029 | |||
| 1030 | The returned string is guaranteed to be no longer than | 1030 | The returned string is guaranteed to be no longer than | |
| 1031 | whefs_fs_options_get(whefs_file_fs(f))->filename_length | 1031 | whefs_fs_options_get(whefs_file_fs(f))->filename_length | |
| 1032 | characters (not including the trailing null). | 1032 | characters (not including the trailing null). | |
| 1033 | < | |||
| 1034 | Maintenance note: f is non-const because of an unsightly | < | ||
| 1035 | implementation detail involving how f's name is stored. | < | ||
| 1036 | */ | 1033 | */ | |
| 1037 | char const * whefs_file_name_get( whefs_file * restrict f ); | | | 1034 | char const * whefs_file_name_get( whefs_file const * restrict f ); |
| 1038 | 1035 | |||
| 1039 | /** | 1036 | /** | |
| 1040 | Returns a static string with the URL of the whefs home page. | | | 1037 | Returns a static string pointing to the whefs home page. |
| 1041 | */ | 1038 | */ | |
| 1042 | char const * whefs_home_page_url(); | 1039 | char const * whefs_home_page_url(); | |
| 1043 | 1040 | |||
| 1044 | /** | 1041 | /** | |
| 1045 | Returns a static string containing the file format version | 1042 | Returns a static string containing the file format version | |
| 126 hidden lines | ||||
| 1172 | #ifdef __cplusplus | 1169 | #ifdef __cplusplus | |
| 1173 | } /* extern "C" */ | 1170 | } /* extern "C" */ | |
| 1174 | #endif | 1171 | #endif | |
| 1175 | 1172 | |||
| 1176 | #endif /* WANDERINGHORSE_NET_WHEFS_H_INCLUDED */ | 1173 | #endif /* WANDERINGHORSE_NET_WHEFS_H_INCLUDED */ | |
Changes to whefs_cache.c
| Old (ac9c827ea8d45781) | New (fc433405003ec01e) | |||
|---|---|---|---|---|
| 1 | /** | 1 | /** | |
| 2 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/ | 2 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/ | |
| 3 | 3 | |||
| 4 | License: Public Domain | 4 | License: Public Domain | |
| 5 | 5 | |||
| 18 hidden lines | ||||
| 24 | *db = whefs_string_cache_init; | 24 | *db = whefs_string_cache_init; | |
| 25 | return whefs_rc.OK; | 25 | return whefs_rc.OK; | |
| 26 | } | 26 | } | |
| 27 | 27 | |||
| 28 | } | 28 | } | |
| 29 | < | |||
| 30 | int whefs_string_cache_clear_contents( whefs_string_cache * db ) | 29 | int whefs_string_cache_clear_contents( whefs_string_cache * db ) | |
| 31 | { | 30 | { | |
| 32 | if( ! db ) return whefs_rc.ArgError; | 31 | if( ! db ) return whefs_rc.ArgError; | |
| 33 | else | 32 | else | |
| 34 | { | 33 | { | |
| 308 hidden lines | ||||
| 343 | H.id = id; | 342 | H.id = id; | |
| 344 | rc = whefs_hashid_list_add( fs->cache.hashes, &H ); | 343 | rc = whefs_hashid_list_add( fs->cache.hashes, &H ); | |
| 345 | if(0) WHEFS_DBG("Added to name cache: hash[%"WHEFS_HASHVAL_TYPE_PFMT"]=id[%"WHEFS_ID_TYPE_PFMT"], name=[%s], rc=%d", H.hash, H.id, name, rc ); | 344 | if(0) WHEFS_DBG("Added to name cache: hash[%"WHEFS_HASHVAL_TYPE_PFMT"]=id[%"WHEFS_ID_TYPE_PFMT"], name=[%s], rc=%d", H.hash, H.id, name, rc ); | |
| 346 | return whefs_rc.OK; | 345 | return whefs_rc.OK; | |
| 347 | } | 346 | } | |
Changes to whefs_cache.h
| Old (80626a8fe4189b1e) | New (c0f11fa383755114) | |||
|---|---|---|---|---|
| 1 | #if !defined(WANDERINGHORSE_NET_WHEFS_CACHE_H_INCLUDED) | 1 | #if !defined(WANDERINGHORSE_NET_WHEFS_CACHE_H_INCLUDED) | |
| 2 | #define WANDERINGHORSE_NET_WHEFS_CACHE_H_INCLUDED 1 | 2 | #define WANDERINGHORSE_NET_WHEFS_CACHE_H_INCLUDED 1 | |
| 3 | /* | 3 | /* | |
| 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/ | 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/ | |
| 5 | 5 | |||
| 11 hidden lines | ||||
| 17 | 17 | |||
| 18 | #ifdef __cplusplus | 18 | #ifdef __cplusplus | |
| 19 | extern "C" { | 19 | extern "C" { | |
| 20 | #endif | 20 | #endif | |
| 21 | 21 | |||
| 22 | /** | < | ||
| 23 | An internal type for caching strings via a whio_dev memory | < | ||
| 24 | device. This optimizes the storage by using a contiguous | < | ||
| 25 | array for all strings. Unfortunately, each entry in the cache | < | ||
| 26 | must have a set length, however. | < | ||
| 27 | */ | < | ||
| 28 | struct whefs_string_cache | 22 | struct whefs_string_cache | |
| 29 | { | 23 | { | |
| 30 | /** | < | ||
| 31 | Block device manager for writing strings. | < | ||
| 32 | */ | < | ||
| 33 | whio_blockdev devBlock; | 24 | whio_blockdev devBlock; | |
| 34 | /** | < | ||
| 35 | The storage for the strings. | < | ||
| 36 | */ | < | ||
| 37 | whio_dev * devMem; | 25 | whio_dev * devMem; | |
| 38 | /** | | | 26 | unsigned char buf[WHEFS_MAX_FILENAME_LENGTH+1]; |
| 39 | Internal buffer used for encoding/decoding. | | | ||
| 40 | */ | | | ||
| 41 | //unsigned char buf[WHEFS_MAX_FILENAME_LENGTH+1]; | | | ||
| 42 | }; | 27 | }; | |
| 43 | typedef struct whefs_string_cache whefs_string_cache; | 28 | typedef struct whefs_string_cache whefs_string_cache; | |
| 44 | /** Empty initialization whefs_string_cache object. */ | 29 | /** Empty initialization whefs_string_cache object. */ | |
| 45 | #define whefs_string_cache_init_m { \ | 30 | #define whefs_string_cache_init_m { \ | |
| 46 | whio_blockdev_init_m/*devBlock*/, \ | 31 | whio_blockdev_init_m/*devBlock*/, \ | |
| 47 | 0/*devMem*/ \ | | | 32 | 0/*devMem*/, \ |
| | | 33 | {/*buf*/0} \ | ||
| 48 | } | 34 | } | |
| 49 | 35 | |||
| 50 | /** Empty initialization whefs_string_cache object. */ | 36 | /** Empty initialization whefs_string_cache object. */ | |
| 51 | extern const whefs_string_cache whefs_string_cache_init; | 37 | extern const whefs_string_cache whefs_string_cache_init; | |
| 52 | /** | 38 | /** | |
| 4 hidden lines | ||||
| 57 | Deallocates all resources associated with db, but does not free db | 43 | Deallocates all resources associated with db, but does not free db | |
| 58 | itself. It can be re-used in another call to | 44 | itself. It can be re-used in another call to | |
| 59 | whefs_string_cache_setup() or freed using whefs_string_cache_free(). | 45 | whefs_string_cache_setup() or freed using whefs_string_cache_free(). | |
| 60 | */ | 46 | */ | |
| 61 | int whefs_string_cache_cleanup( whefs_string_cache * db ); | 47 | int whefs_string_cache_cleanup( whefs_string_cache * db ); | |
| 62 | < | |||
| 63 | /** | < | ||
| 64 | Truncates the internal string table of db to 0 bytes, potentially freeing | < | ||
| 65 | up memory. db is still a valid/usable object after calling this. | < | ||
| 66 | */ | < | ||
| 67 | int whefs_string_cache_clear_contents( whefs_string_cache * db ); | < | ||
| 68 | < | |||
| 69 | /** | 48 | /** | |
| 70 | Sets up db, which must be initialized memory (use | 49 | Sets up db, which must be initialized memory (use | |
| 71 | whefs_string_cache_init or whefs_string_cache_init_m to initialize it). | 50 | whefs_string_cache_init or whefs_string_cache_init_m to initialize it). | |
| 72 | db will be able to hold a number (blockCount) of fixed-size blocks of | 51 | db will be able to hold a number (blockCount) of fixed-size blocks of | |
| 73 | blockSize bytes each. | 52 | blockSize bytes each. | |
| 50 hidden lines | ||||
| 124 | 103 | |||
| 125 | @see whefs_string_cache_set(). | 104 | @see whefs_string_cache_set(). | |
| 126 | */ | 105 | */ | |
| 127 | char const * whefs_string_cache_get( whefs_string_cache const * db, whefs_id_type id ); | 106 | char const * whefs_string_cache_get( whefs_string_cache const * db, whefs_id_type id ); | |
| 128 | /** | 107 | /** | |
| 129 | Returns an approximate cost of the memory associated with db, which | | | 108 | Returns an approximate cost of the memory associated with db, which must |
| 130 | must be a fully-setup object. The real cost is slightly higher than | | | 109 | be a fully-setup object. |
| 131 | the returned value, as there are internal details which this code | | | ||
| 132 | does not have access to, so it cannot measure them. | | | ||
| 133 | */ | 110 | */ | |
| 134 | whio_size_t whefs_string_cache_memcost( whefs_string_cache const * db ); | 111 | whio_size_t whefs_string_cache_memcost( whefs_string_cache const * db ); | |
| > | 112 | |||
| > | 113 | /** | ||
| > | 114 | Clears the memory used by db for storing strings, possibly freeing up | ||
| > | 115 | memory. | ||
| > | 116 | */ | ||
| > | 117 | int whefs_string_cache_clear_contents( whefs_string_cache * db ); | ||
| 135 | 118 | |||
| 136 | #ifdef __cplusplus | 119 | #ifdef __cplusplus | |
| 137 | } /* extern "C" */ | 120 | } /* extern "C" */ | |
| 138 | #endif | 121 | #endif | |
| 139 | 122 | |||
| 140 | 123 | |||
| 141 | #endif /* WANDERINGHORSE_NET_WHEFS_CACHE_H_INCLUDED */ | 124 | #endif /* WANDERINGHORSE_NET_WHEFS_CACHE_H_INCLUDED */ | |
Changes to whefs_details.c
| Old (1b8a0b71b97054ff) | New (07b8a5d618bcbcae) | |||
|---|---|---|---|---|
| 1 | #if !defined(WANDERINGHORSE_NET_WHEFS_DETAILS_C_INCLUDED) | 1 | #if !defined(WANDERINGHORSE_NET_WHEFS_DETAILS_C_INCLUDED) | |
| 2 | #define WANDERINGHORSE_NET_WHEFS_DETAILS_C_INCLUDED 1 | 2 | #define WANDERINGHORSE_NET_WHEFS_DETAILS_C_INCLUDED 1 | |
| 3 | #if ! defined __STDC_FORMAT_MACROS | 3 | #if ! defined __STDC_FORMAT_MACROS | |
| 4 | # define __STDC_FORMAT_MACROS 1 | 4 | # define __STDC_FORMAT_MACROS 1 | |
| 5 | #endif | 5 | #endif | |
| 40 hidden lines | ||||
| 46 | WHEFS_DBG_F_ALWAYS = WHDBG_ALWAYS, | 46 | WHEFS_DBG_F_ALWAYS = WHDBG_ALWAYS, | |
| 47 | WHEFS_DBG_F_VERBOSE = WHDBG_VERBOSE, | 47 | WHEFS_DBG_F_VERBOSE = WHDBG_VERBOSE, | |
| 48 | WHEFS_DBG_F_mymask = 0x0f000000, | 48 | WHEFS_DBG_F_mymask = 0x0f000000, | |
| 49 | WHEFS_DBG_F_LOCK = WHEFS_DBG_F_mymask & 0x01000000, | 49 | WHEFS_DBG_F_LOCK = WHEFS_DBG_F_mymask & 0x01000000, | |
| 50 | WHEFS_DBG_F_CACHE = WHEFS_DBG_F_mymask & 0x02000000, | 50 | WHEFS_DBG_F_CACHE = WHEFS_DBG_F_mymask & 0x02000000, | |
| 51 | WHEFS_DBG_F_DEFAULTS_CLIENT = WHEFS_DBG_F_WARNING | WHEFS_DBG_F_ERROR | WHDBG_NYI, | | | 51 | WHEFS_DBG_F_DEFAULTS_CLIENT = WHEFS_DBG_F_WARNING | WHEFS_DBG_F_ERROR | WHDBG_FIXME | WHDBG_NYI, |
| 52 | WHEFS_DBG_F_DEFAULTS_HACKER = WHEFS_DBG_F_DEFAULTS_CLIENT | WHDBG_FIXME | WHEFS_DBG_F_FYI | WHDBG_VERBOSE, // | WHEFS_DBG_F_CACHE, // | WHEFS_DBG_F_LOCK, | | | 52 | WHEFS_DBG_F_DEFAULTS_HACKER = WHEFS_DBG_F_DEFAULTS_CLIENT | WHEFS_DBG_F_FYI | WHDBG_VERBOSE, // | WHEFS_DBG_F_CACHE, // | WHEFS_DBG_F_LOCK, |
| 53 | 53 | |||
| 54 | #if defined(NDEBUG) | 54 | #if defined(NDEBUG) | |
| 55 | WHEFS_DBG_F_DEFAULT = 0 /* they'll be if(0)'d out in this case, anyway. */ | | | 55 | WHEFS_DBG_F_DEFAULT = 0 |
| | | 56 | //WHEFS_DBG_F_DEFAULTS_CLIENT | ||
| 56 | #else | 57 | #else | |
| 57 | WHEFS_DBG_F_DEFAULT = WHEFS_DBG_F_DEFAULTS_CLIENT | | | 58 | WHEFS_DBG_F_DEFAULT = WHEFS_DBG_F_DEFAULTS_HACKER |
| 58 | //WHEFS_DBG_F_DEFAULTS_HACKER | | | ||
| 59 | #endif | 59 | #endif | |
| 60 | }; | 60 | }; | |
| 61 | 61 | |||
| 62 | #define WHEFS_DBG WHDBG(WHEFS_DBG_F_ALWAYS) | 62 | #define WHEFS_DBG WHDBG(WHEFS_DBG_F_ALWAYS) | |
| 63 | #define WHEFS_DBG_ERR WHDBG(WHEFS_DBG_F_ERROR) | 63 | #define WHEFS_DBG_ERR WHDBG(WHEFS_DBG_F_ERROR) | |
| 515 hidden lines | ||||
| 579 | whio_dev * dev; | 579 | whio_dev * dev; | |
| 580 | /** | 580 | /** | |
| 581 | inode ID. | 581 | inode ID. | |
| 582 | */ | 582 | */ | |
| 583 | whefs_id_type inode; | 583 | whefs_id_type inode; | |
| 584 | /** Unfortunate. Should go away. */ | < | ||
| 585 | whefs_string name; | < | ||
| 586 | }; | 584 | }; | |
| 587 | /** Empty initialization object. */ | 585 | /** Empty initialization object. */ | |
| 588 | extern const whefs_file whefs_file_init; | 586 | extern const whefs_file whefs_file_init; | |
| 589 | 587 | |||
| 590 | /** | 588 | /** | |
| 174 hidden lines | ||||
| 765 | void whefs_inode_hash_cache_sort(whefs_fs * fs ); | 763 | void whefs_inode_hash_cache_sort(whefs_fs * fs ); | |
| 766 | 764 | |||
| 767 | int whefs_fs_cache_name( whefs_fs * fs, whefs_id_type id, char const * n ); | 765 | int whefs_fs_cache_name( whefs_fs * fs, whefs_id_type id, char const * n ); | |
| 768 | 766 | |||
| 769 | #endif /* WANDERINGHORSE_NET_WHEFS_DETAILS_C_INCLUDED */ | 767 | #endif /* WANDERINGHORSE_NET_WHEFS_DETAILS_C_INCLUDED */ | |
Changes to whefs_file.c
| Old (e4f7cbfe63fc5ff0) | New (6a0752212fb5e8b9) | |||
|---|---|---|---|---|
| 1 | /* | 1 | /* | |
| 2 | Implementations for the whefs_file-related API. | 2 | Implementations for the whefs_file-related API. | |
| 3 | 3 | |||
| 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/ | 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/ | |
| 5 | 5 | |||
| 6 hidden lines | ||||
| 12 | 12 | |||
| 13 | #define WHEFS_FILE_INIT { \ | 13 | #define WHEFS_FILE_INIT { \ | |
| 14 | 0, /* fs */ \ | 14 | 0, /* fs */ \ | |
| 15 | 0, /* flags */ \ | 15 | 0, /* flags */ \ | |
| 16 | 0, /* dev */ \ | 16 | 0, /* dev */ \ | |
| 17 | 0, /* inode */ \ | | | 17 | 0 /* inode */ \ |
| 18 | whefs_string_init_m /*name*/ \ | | | ||
| 19 | } | 18 | } | |
| 20 | 19 | |||
| 21 | const whefs_file whefs_file_init = WHEFS_FILE_INIT; | 20 | const whefs_file whefs_file_init = WHEFS_FILE_INIT; | |
| 22 | #define WHEFS_FILE_ISOPENED(F) ((F) && ((F)->flags & WHEFS_FLAG_Opened)) | 21 | #define WHEFS_FILE_ISOPENED(F) ((F) && ((F)->flags & WHEFS_FLAG_Opened)) | |
| 23 | #define WHEFS_FILE_ISRO(F) ((F) && ((F)->flags & WHEFS_FLAG_Read)) | 22 | #define WHEFS_FILE_ISRO(F) ((F) && ((F)->flags & WHEFS_FLAG_Read)) | |
| 30 hidden lines | ||||
| 54 | whefs_file_alloc_slots.objs[i] = whefs_file_init; | 53 | whefs_file_alloc_slots.objs[i] = whefs_file_init; | |
| 55 | obj = &whefs_file_alloc_slots.objs[i]; | 54 | obj = &whefs_file_alloc_slots.objs[i]; | |
| 56 | break; | 55 | break; | |
| 57 | } | 56 | } | |
| 58 | #endif /* WHIO_USE_STATIC_MALLOC */ | 57 | #endif /* WHIO_USE_STATIC_MALLOC */ | |
| 59 | if( ! obj ) | | | 58 | if( ! obj ) obj = (whefs_file *) malloc( sizeof(whefs_file) ); |
| 60 | { | | | ||
| 61 | obj = (whefs_file *) malloc( sizeof(whefs_file) ); | | | ||
| 62 | if( obj ) *obj = whefs_file_init; | | | ||
| 63 | } | | | ||
| 64 | return obj; | 59 | return obj; | |
| 65 | } | 60 | } | |
| 66 | 61 | |||
| 67 | static void whefs_file_free( whefs_file * restrict obj ) | 62 | static void whefs_file_free( whefs_file * restrict obj ) | |
| 68 | { | 63 | { | |
| 69 | #if WHIO_USE_STATIC_MALLOC | 64 | #if WHIO_USE_STATIC_MALLOC | |
| 70 | if( (obj < &whefs_file_alloc_slots.objs[0]) || | 65 | if( (obj < &whefs_file_alloc_slots.objs[0]) || | |
| 71 | (obj > &whefs_file_alloc_slots.objs[whefs_file_alloc_count-1]) ) | 66 | (obj > &whefs_file_alloc_slots.objs[whefs_file_alloc_count-1]) ) | |
| 72 | { /* it does not belong to us */ | 67 | { /* it does not belong to us */ | |
| 73 | *obj = whefs_file_init; | < | ||
| 74 | free(obj); | 68 | free(obj); | |
| 75 | return; | 69 | return; | |
| 76 | } | 70 | } | |
| 77 | else | 71 | else | |
| 78 | { | 72 | { | |
| 80 | whefs_file_alloc_slots.objs[ndx] = whefs_file_init; | 74 | whefs_file_alloc_slots.objs[ndx] = whefs_file_init; | |
| 81 | whefs_file_alloc_slots.used[ndx] = 0; | 75 | whefs_file_alloc_slots.used[ndx] = 0; | |
| 82 | return; | 76 | return; | |
| 83 | } | 77 | } | |
| 84 | #else | 78 | #else | |
| 85 | whefs_string_clear( &obj->name, false ); | < | ||
| 86 | *obj = whefs_file_init; | < | ||
| 87 | free(obj); | 79 | free(obj); | |
| 88 | #endif /* WHIO_USE_STATIC_MALLOC */ | 80 | #endif /* WHIO_USE_STATIC_MALLOC */ | |
| 89 | } | 81 | } | |
| 90 | 82 | |||
| 91 | static int whefs_fopen_ro( whefs_file * restrict f, char const * name ) | 83 | static int whefs_fopen_ro( whefs_file * restrict f, char const * name ) | |
| 92 | { | 84 | { | |
| 93 | whefs_inode n = whefs_inode_init; | | | 85 | whefs_inode n; |
| 94 | int rc = whefs_inode_by_name( f->fs, name, &n ); | 86 | int rc = whefs_inode_by_name( f->fs, name, &n ); | |
| 95 | if( whefs_rc.OK == rc ) | 87 | if( whefs_rc.OK == rc ) | |
| 96 | { | 88 | { | |
| 97 | if( f->dev ) f->dev->api->finalize(f->dev); | 89 | if( f->dev ) f->dev->api->finalize(f->dev); | |
| 98 | f->dev = whefs_dev_for_inode( f->fs, n.id, false ); | 90 | f->dev = whefs_dev_for_inode( f->fs, n.id, false ); | |
| 13 hidden lines | ||||
| 112 | 104 | |||
| 113 | static int whefs_fopen_rw( whefs_file * restrict f, char const * name ) | 105 | static int whefs_fopen_rw( whefs_file * restrict f, char const * name ) | |
| 114 | { | 106 | { | |
| 115 | if( ! f || ! name ) return whefs_rc.ArgError; | 107 | if( ! f || ! name ) return whefs_rc.ArgError; | |
| 116 | if( ! whefs_fs_is_rw(f->fs) ) return whefs_rc.AccessError; | 108 | if( ! whefs_fs_is_rw(f->fs) ) return whefs_rc.AccessError; | |
| 117 | whefs_inode n = whefs_inode_init; | | | 109 | whefs_inode n; |
| 118 | int rc = whefs_inode_by_name( f->fs, name, &n ); | 110 | int rc = whefs_inode_by_name( f->fs, name, &n ); | |
| 119 | if( whefs_rc.OK != rc ) do | 111 | if( whefs_rc.OK != rc ) do | |
| 120 | { | 112 | { | |
| 121 | if(0) WHEFS_DBG("fopen(fs,[%s] found no inode. Trying to create one...",name); | 113 | if(0) WHEFS_DBG("fopen(fs,[%s] found no inode. Trying to create one...",name); | |
| 122 | /** | 114 | /** | |
| 29 hidden lines | ||||
| 152 | return rc; | 144 | return rc; | |
| 153 | } | 145 | } | |
| 154 | 146 | |||
| 155 | whefs_file * whefs_fopen( whefs_fs * fs, char const * name, char const * mode ) | 147 | whefs_file * whefs_fopen( whefs_fs * fs, char const * name, char const * mode ) | |
| 156 | { | 148 | { | |
| 157 | if( ! fs || !name || !*name || !mode ) return 0; | | | 149 | if( ! fs || !name || !mode ) return 0; |
| 158 | unsigned int flags = 0; | 150 | unsigned int flags = 0; | |
| 159 | if( 0 && (0 != strchr( mode, 'w' )) ) | 151 | if( 0 && (0 != strchr( mode, 'w' )) ) | |
| 160 | { // FIXME: add support for mode 'w' and 'w+' | 152 | { // FIXME: add support for mode 'w' and 'w+' | |
| 161 | flags = WHEFS_FLAG_ReadWrite; | 153 | flags = WHEFS_FLAG_ReadWrite; | |
| 162 | } | 154 | } | |
| 8 hidden lines | ||||
| 171 | WHEFS_DBG_WARN("EFS is opened read-only, so we cannot open files in read/write mode."); | 163 | WHEFS_DBG_WARN("EFS is opened read-only, so we cannot open files in read/write mode."); | |
| 172 | return 0; | 164 | return 0; | |
| 173 | } | 165 | } | |
| 174 | whefs_file * f = whefs_file_alloc(); | 166 | whefs_file * f = whefs_file_alloc(); | |
| 175 | if( ! f ) return 0; | 167 | if( ! f ) return 0; | |
| > | 168 | *f = whefs_file_init; | ||
| 176 | f->fs = fs; | 169 | f->fs = fs; | |
| 177 | f->flags = flags; | 170 | f->flags = flags; | |
| 178 | int rc = whefs_rc.IOError; | 171 | int rc = whefs_rc.IOError; | |
| 179 | //WHEFS_DBG_FYI("fopen(fs,[%s],[%s]) flags=0x%08x ISRW=%d", name, mode, flags, WHEFS_FILE_ISRW(f) ); | 172 | //WHEFS_DBG_FYI("fopen(fs,[%s],[%s]) flags=0x%08x ISRW=%d", name, mode, flags, WHEFS_FILE_ISRW(f) ); | |
| 180 | rc = WHEFS_FILE_ISRW(f) | 173 | rc = WHEFS_FILE_ISRW(f) | |
| 2 hidden lines | ||||
| 183 | if( (rc != whefs_rc.OK) || !WHEFS_FILE_ISOPENED(f) || WHEFS_FILE_ISERR(f) ) | 176 | if( (rc != whefs_rc.OK) || !WHEFS_FILE_ISOPENED(f) || WHEFS_FILE_ISERR(f) ) | |
| 184 | { | 177 | { | |
| 185 | whefs_fclose( f ); | 178 | whefs_fclose( f ); | |
| 186 | f = 0; | 179 | f = 0; | |
| 187 | } | 180 | } | |
| 188 | else | | | 181 | //WHEFS_DBG("opened whefs_file [%s]. mode=%s, flags=%08x", name, mode, f->flags ); |
| 189 | { | | | ||
| 190 | WHEFS_FIXME("Get rid of whefs_file::name! file=[%s]. mode=%s, flags=%08x", name, mode, f->flags ); | | | ||
| 191 | whefs_string_copy_cstring( &f->name, name ); | | | ||
| 192 | //WHEFS_DBG_FYI("opened whefs_file [%s]. mode=%s, flags=%08x", name, mode, f->flags ); | | | ||
| 193 | } | | | ||
| 194 | return f; | 182 | return f; | |
| 195 | } | 183 | } | |
| 196 | 184 | |||
| 197 | whio_dev * whefs_dev_open( whefs_fs * fs, char const * name, bool writeMode ) | 185 | whio_dev * whefs_dev_open( whefs_fs * fs, char const * name, bool writeMode ) | |
| 198 | { | 186 | { | |
| 232 hidden lines | ||||
| 431 | if( whefs_rc.OK != rc ) return rc; | 419 | if( whefs_rc.OK != rc ) return rc; | |
| 432 | //whefs_inode_flush( f->fs, ino ); | 420 | //whefs_inode_flush( f->fs, ino ); | |
| 433 | return whefs_rc.OK; | 421 | return whefs_rc.OK; | |
| 434 | } | 422 | } | |
| 435 | 423 | |||
| 436 | char const * whefs_file_name_get( whefs_file * restrict f ) | | | 424 | char const * whefs_file_name_get( whefs_file const * restrict f ) |
| 437 | { | 425 | { | |
| 438 | if( ! f ) return 0; | 426 | if( ! f ) return 0; | |
| 439 | #if 0 | < | ||
| 440 | whefs_inode * ino = 0; | 427 | whefs_inode * ino = 0; | |
| 441 | int rc = whefs_inode_search_opened( f->fs, f->inode, &ino ); | 428 | int rc = whefs_inode_search_opened( f->fs, f->inode, &ino ); | |
| 442 | if( whefs_rc.OK != rc ) | 429 | if( whefs_rc.OK != rc ) | |
| 443 | { | 430 | { | |
| 444 | WHEFS_DBG_ERR("This should never ever happen: f appears to be a " | 431 | WHEFS_DBG_ERR("This should never ever happen: f appears to be a " | |
| 445 | "whefs_file, but we could find no associated opened inode!"); | 432 | "whefs_file, but we could find no associated opened inode!"); | |
| 446 | return 0; | 433 | return 0; | |
| 447 | } | 434 | } | |
| 448 | return ino->name.string; | 435 | return ino->name.string; | |
| 449 | #else | < | ||
| 450 | whefs_inode_name_get( f->fs, f->inode, &f->name ); | < | ||
| 451 | return f->name.string; | < | ||
| 452 | #endif | < | ||
| 453 | } | 436 | } | |
| 454 | 437 | |||
| 455 | whio_size_t whefs_fsize( whefs_file const * restrict f ) | 438 | whio_size_t whefs_fsize( whefs_file const * restrict f ) | |
| 456 | { | 439 | { | |
| 457 | #if 1 | 440 | #if 1 | |
| 7 hidden lines | ||||
| 465 | return (f && f->dev) | 448 | return (f && f->dev) | |
| 466 | ? whio_dev_size( f->dev ) | 449 | ? whio_dev_size( f->dev ) | |
| 467 | : whefs_rc.SizeTError; | 450 | : whefs_rc.SizeTError; | |
| 468 | #endif | 451 | #endif | |
| 469 | } | 452 | } | |
Changes to whefs_inode.c
| Old (3ac3cd9cbfe2a82e) | New (ff3760ef7b8e4b23) | |||
|---|---|---|---|---|
| 1 | /* | 1 | /* | |
| 2 | Implementations for whefs_inode operations. | 2 | Implementations for whefs_inode operations. | |
| 3 | 3 | |||
| 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/) | 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/) | |
| 5 | 5 | |||
| 111 hidden lines | ||||
| 117 | /** | 117 | /** | |
| 118 | We have to see if we have an existing entry for the given inode ID, so | 118 | We have to see if we have an existing entry for the given inode ID, so | |
| 119 | we can replace its hashvalue in the cache. If we don't do this we end | 119 | we can replace its hashvalue in the cache. If we don't do this we end | |
| 120 | up with stale/useless entries in the cache. | 120 | up with stale/useless entries in the cache. | |
| 121 | */ | 121 | */ | |
| > | 122 | whefs_inode * nop = 0; | ||
| 122 | whefs_hashid * H = 0; | 123 | whefs_hashid * H = 0; | |
| 123 | char const * nameCheck = name; | 124 | char const * nameCheck = name; | |
| 124 | enum { bufSize = WHEFS_MAX_FILENAME_LENGTH + 1 }; | 125 | enum { bufSize = WHEFS_MAX_FILENAME_LENGTH + 1 }; | |
| 125 | char buf[bufSize] = {0}; | 126 | char buf[bufSize] = {0}; | |
| 126 | whefs_string ncheck = whefs_string_init; | 127 | whefs_string ncheck = whefs_string_init; | |
| 5 hidden lines | ||||
| 132 | assert( (ncheck.string == buf) && "illegal (re)alloc!"); | 133 | assert( (ncheck.string == buf) && "illegal (re)alloc!"); | |
| 133 | if( whefs_rc.OK != rc ) return rc; | 134 | if( whefs_rc.OK != rc ) return rc; | |
| 134 | if( *buf && (0==strcmp(buf,name))) return whefs_rc.OK; | 135 | if( *buf && (0==strcmp(buf,name))) return whefs_rc.OK; | |
| 135 | if( *buf ) nameCheck = ncheck.string; | 136 | if( *buf ) nameCheck = ncheck.string; | |
| 136 | } | 137 | } | |
| > | 138 | #if 1 | ||
| > | 139 | if( whefs_rc.OK == whefs_inode_search_opened( fs, nid, &nop ) ) | ||
| > | 140 | { // FIXME: this is unfortunate. TODO: remove whefs_inode::name altogether. | ||
| > | 141 | whefs_string_copy_cstring( &nop->name, name ); | ||
| > | 142 | } | ||
| > | 143 | #endif | ||
| 137 | 144 | |||
| 138 | WHEFS_DBG_CACHE("inode-name-set searching for [old=%s][new=%s][check=%s].",ncheck.string,name,nameCheck); | 145 | WHEFS_DBG_CACHE("inode-name-set searching for [old=%s][new=%s][check=%s].",ncheck.string,name,nameCheck); | |
| 139 | whefs_id_type ndx = whefs_inode_hash_cache_search_ndx( fs, nameCheck ); | 146 | whefs_id_type ndx = whefs_inode_hash_cache_search_ndx( fs, nameCheck ); | |
| 140 | if( ndx != whefs_id_type_end ) | 147 | if( ndx != whefs_id_type_end ) | |
| 141 | { | 148 | { | |
| 22 hidden lines | ||||
| 164 | { | 171 | { | |
| 165 | H->hash = fs->cache.hashfunc(name); | 172 | H->hash = fs->cache.hashfunc(name); | |
| 166 | //fs->cache.hashes->isSorted = false; | 173 | //fs->cache.hashes->isSorted = false; | |
| 167 | whefs_hashid_list_sort( fs->cache.hashes ); | 174 | whefs_hashid_list_sort( fs->cache.hashes ); | |
| 168 | WHEFS_DBG_CACHE("Replacing hashcode for file [%s].",name); | 175 | WHEFS_DBG_CACHE("Replacing hashcode for file [%s].",name); | |
| > | 176 | if( nop ) | ||
| > | 177 | { | ||
| > | 178 | rc = whefs_string_copy_cstring( &nop->name, name ); | ||
| > | 179 | } | ||
| 169 | } | 180 | } | |
| 170 | if( whefs_rc.OK != rc ) return rc; | 181 | if( whefs_rc.OK != rc ) return rc; | |
| 171 | whefs_string_cache_set( &fs->cache.strings, nid-1, name ); | 182 | whefs_string_cache_set( &fs->cache.strings, nid-1, name ); | |
| 172 | #endif | 183 | #endif | |
| 173 | return rc; | 184 | return rc; | |
| 70 hidden lines | ||||
| 244 | if( (whefs_rc.OK == xc) && nop ) | 255 | if( (whefs_rc.OK == xc) && nop ) | |
| 245 | { | 256 | { | |
| 246 | if( tgt != nop ) | 257 | if( tgt != nop ) | |
| 247 | { | 258 | { | |
| 248 | *tgt = *nop; | 259 | *tgt = *nop; | |
| > | 260 | tgt->name = whefs_string_init; // prevent client from cleaning it. | ||
| 249 | } | 261 | } | |
| 250 | //WHEFS_DBG("whefs_inode_id_read() found opened entry #%"WHEFS_ID_TYPE_PFMT" to read.", n->id); | 262 | //WHEFS_DBG("whefs_inode_id_read() found opened entry #%"WHEFS_ID_TYPE_PFMT" to read.", n->id); | |
| 251 | return whefs_rc.OK; | 263 | return whefs_rc.OK; | |
| 252 | } | 264 | } | |
| 253 | } | 265 | } | |
| 249 hidden lines | ||||
| 503 | { | 515 | { | |
| 504 | whefs_inode_list_free(ent); | 516 | whefs_inode_list_free(ent); | |
| 505 | WHEFS_DBG_ERR("Opening inode #%"WHEFS_ID_TYPE_PFMT" FAILED - whefs_inode_id_read() returned %d", ent->inode.id, rc ); | 517 | WHEFS_DBG_ERR("Opening inode #%"WHEFS_ID_TYPE_PFMT" FAILED - whefs_inode_id_read() returned %d", ent->inode.id, rc ); | |
| 506 | return rc; | 518 | return rc; | |
| 507 | } | 519 | } | |
| > | 520 | rc = whefs_inode_name_get( fs, ent->inode.id, &ent->inode.name ); | ||
| > | 521 | if( whefs_rc.OK != rc ) | ||
| > | 522 | { | ||
| > | 523 | whefs_inode_list_free(ent); | ||
| > | 524 | WHEFS_DBG_ERR("Opening inode #%"WHEFS_ID_TYPE_PFMT" FAILED - whefs_inode_name_get() returned %d", ent->inode.id, rc ); | ||
| > | 525 | return rc; | ||
| > | 526 | } | ||
| 508 | //WHEFS_DBG("Opened inode #%"WHEFS_ID_TYPE_PFMT" with name [%s]", ent->inode.id, ent->inode.name.string ); | 527 | //WHEFS_DBG("Opened inode #%"WHEFS_ID_TYPE_PFMT" with name [%s]", ent->inode.id, ent->inode.name.string ); | |
| 509 | x = &ent->inode; | 528 | x = &ent->inode; | |
| 510 | x->writer = writer; | 529 | x->writer = writer; | |
| 511 | whefs_inode_list * li = fs->opened_nodes; | 530 | whefs_inode_list * li = fs->opened_nodes; | |
| 512 | if( ! li ) | 531 | if( ! li ) | |
| 69 hidden lines | ||||
| 582 | --np->open_count; | 601 | --np->open_count; | |
| 583 | if( 0 == np->open_count ) | 602 | if( 0 == np->open_count ) | |
| 584 | { | 603 | { | |
| 585 | if(0) WHEFS_DBG_FYI("REALLY closing inode #%"WHEFS_ID_TYPE_PFMT": Use count=%u, data size=%u", | 604 | if(0) WHEFS_DBG_FYI("REALLY closing inode #%"WHEFS_ID_TYPE_PFMT": Use count=%u, data size=%u", | |
| 586 | src->id, src->open_count, src->data_size ); | 605 | src->id, src->open_count, src->data_size ); | |
| > | 606 | whefs_string_clear( &np->name, false ); | ||
| 587 | if( li == fs->opened_nodes ) fs->opened_nodes = (li->next ? li->next : li->prev); | 607 | if( li == fs->opened_nodes ) fs->opened_nodes = (li->next ? li->next : li->prev); | |
| 588 | if( li->prev ) li->prev->next = li->next; | 608 | if( li->prev ) li->prev->next = li->next; | |
| 589 | if( li->next ) li->next->prev = li->prev; | 609 | if( li->next ) li->next->prev = li->prev; | |
| 590 | if( np->blocks.list ) | 610 | if( np->blocks.list ) | |
| 591 | { | 611 | { | |
| 228 hidden lines | ||||
| 820 | x += whefs_sizeof_encoded_uint32; | 840 | x += whefs_sizeof_encoded_uint32; | |
| 821 | rc = whefs_id_decode( x, &dest->first_block ); | 841 | rc = whefs_id_decode( x, &dest->first_block ); | |
| 822 | return rc; | 842 | return rc; | |
| 823 | } | 843 | } | |
| 824 | 844 | |||
Changes to whefs_inode.h
| Old (27291146b8c79f6f) | New (5d5be8cd2a102fc6) | |||
|---|---|---|---|---|
| 1 | #if !defined(WANDERINGHORSE_NET_WHEFS_INODE_H_INCLUDED) | 1 | #if !defined(WANDERINGHORSE_NET_WHEFS_INODE_H_INCLUDED) | |
| 2 | #define WANDERINGHORSE_NET_WHEFS_INODE_H_INCLUDED 1 | 2 | #define WANDERINGHORSE_NET_WHEFS_INODE_H_INCLUDED 1 | |
| 3 | /* | 3 | /* | |
| 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/ | 4 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/ | |
| 5 | 5 | |||
| 137 hidden lines | ||||
| 143 | memory. This saves boatloads of i/o for common use cases. | 143 | memory. This saves boatloads of i/o for common use cases. | |
| 144 | Transient. | 144 | Transient. | |
| 145 | */ | 145 | */ | |
| 146 | whefs_block_list blocks; | 146 | whefs_block_list blocks; | |
| 147 | /** Transient string used only by opened nodes. */ | 147 | /** Transient string used only by opened nodes. */ | |
| 148 | //whefs_string name; | | | 148 | whefs_string name; |
| 149 | } whefs_inode; | 149 | } whefs_inode; | |
| 150 | 150 | |||
| 151 | /** Empty inode initialization object. */ | 151 | /** Empty inode initialization object. */ | |
| 152 | #define whefs_inode_init_m { \ | 152 | #define whefs_inode_init_m { \ | |
| 153 | 0, /* id */ \ | 153 | 0, /* id */ \ | |
| 155 | 0, /* first_block */ \ | 155 | 0, /* first_block */ \ | |
| 156 | 0, /* data_size */ \ | 156 | 0, /* data_size */ \ | |
| 157 | 0, /* mtime */ \ | 157 | 0, /* mtime */ \ | |
| 158 | 0, /* open_count */ \ | 158 | 0, /* open_count */ \ | |
| 159 | 0, /* writer */ \ | 159 | 0, /* writer */ \ | |
| 160 | whefs_block_list_init_m /*blocks */ \ | | | 160 | whefs_block_list_init_m /*blocks */, \ |
| 161 | /* whefs_string_init_m name */ \ | | | 161 | whefs_string_init_m /* name */ \ |
| 162 | } | 162 | } | |
| 163 | 163 | |||
| 164 | /** Empty inode initialization object. */ | 164 | /** Empty inode initialization object. */ | |
| 165 | extern const whefs_inode whefs_inode_init; | 165 | extern const whefs_inode whefs_inode_init; | |
| 166 | 166 | |||
| 444 hidden lines | ||||
| 611 | } /* extern "C" */ | 611 | } /* extern "C" */ | |
| 612 | #endif | 612 | #endif | |
| 613 | 613 | |||
| 614 | 614 | |||
| 615 | #endif /* WANDERINGHORSE_NET_WHEFS_INODE_H_INCLUDED */ | 615 | #endif /* WANDERINGHORSE_NET_WHEFS_INODE_H_INCLUDED */ | |