Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | 6dfd8af61b68c83f35fa5269fd55ca71edb92d3a |
|---|---|
| Date: | 2009-06-14 13:49:36 |
| User: | stephan |
| Comment: | added --debug-flags/-D to the command-line tools. |
Tags And Properties
- branch=trunk inherited from [d21fde6e87]
- sym-trunk inherited from [d21fde6e87]
Changes
Changes to WHEFSApp.c
| Old (28fd4281f6920f85) | New (fba6a11633fc1956) | |||
|---|---|---|---|---|
| 1 | /** | 1 | /** | |
| 2 | Code which is not part of libwhefs but may be shared between vfs-related tools. | 2 | Code which is not part of libwhefs but may be shared between vfs-related tools. | |
| 3 | It provides a very minimal app framework for whefs applications, like 'ls', | 3 | It provides a very minimal app framework for whefs applications, like 'ls', | |
| 4 | 'cp', 'mkfs' and friends. | 4 | 'cp', 'mkfs' and friends. | |
| 5 | 5 | |||
| 73 hidden lines | ||||
| 79 | { | 79 | { | |
| 80 | char const * appName; | 80 | char const * appName; | |
| 81 | char const * usageText; | 81 | char const * usageText; | |
| 82 | char const * helpText; | 82 | char const * helpText; | |
| 83 | char const * fsName; | 83 | char const * fsName; | |
| > | 84 | char const * debugFlags; | ||
| 84 | whefs_fs * fs; | 85 | whefs_fs * fs; | |
| 85 | WHEFSApp_fe * fe; | 86 | WHEFSApp_fe * fe; | |
| 86 | bool verbose; | 87 | bool verbose; | |
| 87 | ArgSpec * argsSpec; | 88 | ArgSpec * argsSpec; | |
| 88 | } WHEFSApp = | 89 | } WHEFSApp = | |
| 326 hidden lines | ||||
| 415 | {"help", ArgTypeIgnore, 0, "Show help text.", 0, 0 }, | 416 | {"help", ArgTypeIgnore, 0, "Show help text.", 0, 0 }, | |
| 416 | 417 | |||
| 417 | {"v", ArgTypeBool, &WHEFSApp.verbose, "Enables verbose mode.", 0, 0 }, | 418 | {"v", ArgTypeBool, &WHEFSApp.verbose, "Enables verbose mode.", 0, 0 }, | |
| 418 | {"verbose", ArgTypeBool, &WHEFSApp.verbose, "Enables verbose mode.", 0, 0 }, | 419 | {"verbose", ArgTypeBool, &WHEFSApp.verbose, "Enables verbose mode.", 0, 0 }, | |
| 419 | 420 | |||
| > | 421 | {"D", ArgTypeCString, &WHEFSApp.debugFlags, "Same as --debug-flags", 0, 0 }, | ||
| > | 422 | {"debug-flags", ArgTypeCString, &WHEFSApp.debugFlags, "Enables certain libwhefs debug flags. See whefs_setup_debug_arg() in the API docs.", 0, 0 }, | ||
| > | 423 | |||
| 420 | {"V", ArgTypeIgnore, 0, "Show whefs version information.", 0, 0 }, | 424 | {"V", ArgTypeIgnore, 0, "Show whefs version information.", 0, 0 }, | |
| 421 | {"version", ArgTypeIgnore, 0, "Show whefs version information.", 0, 0 }, | 425 | {"version", ArgTypeIgnore, 0, "Show whefs version information.", 0, 0 }, | |
| 422 | {0} | 426 | {0} | |
| 423 | }; | 427 | }; | |
| 424 | 428 | |||
| 79 hidden lines | ||||
| 504 | } | 508 | } | |
| 505 | int WHEFSApp_init( int argc, | 509 | int WHEFSApp_init( int argc, | |
| 506 | char const ** argv, | 510 | char const ** argv, | |
| 507 | int openMode /* should be from WHEFSApp_OpenModes enum */, | 511 | int openMode /* should be from WHEFSApp_OpenModes enum */, | |
| 508 | bool * gotHelp, | 512 | bool * gotHelp, | |
| 509 | ArgSpec * spec ) | | | 513 | ArgSpec * argspec ) |
| 510 | { | 514 | { | |
| 511 | if( ! argc || !argv ) return whefs_rc.ArgError; | 515 | if( ! argc || !argv ) return whefs_rc.ArgError; | |
| 512 | WHEFSApp.appName = argv[0]; | 516 | WHEFSApp.appName = argv[0]; | |
| 513 | WHEFSApp.argsSpec = spec; | | | 517 | WHEFSApp.argsSpec = argspec; |
| | | 518 | WHEFSApp.debugFlags = 0; | ||
| 514 | atexit( WHEFSApp_atexit ); | 519 | atexit( WHEFSApp_atexit ); | |
| 515 | whefs_setup_debug( stderr, (unsigned int)-1 ); | | | 520 | whefs_setup_debug( stderr, 0 ); //(unsigned int)-1 ); |
| | | 521 | //whefs_setup_debug_arg( stderr, "" ); | ||
| 516 | if( gotHelp ) *gotHelp = false; | 522 | if( gotHelp ) *gotHelp = false; | |
| 517 | 523 | |||
| 518 | if( 1 == argc ) | 524 | if( 1 == argc ) | |
| 519 | { | 525 | { | |
| 520 | if( gotHelp ) *gotHelp = true; | 526 | if( gotHelp ) *gotHelp = true; | |
| 5 hidden lines | ||||
| 526 | 532 | |||
| 527 | const size_t gac = whargv_global.argc; | 533 | const size_t gac = whargv_global.argc; | |
| 528 | whargv_entry * garg = whargv_global.argv; | 534 | whargv_entry * garg = whargv_global.argv; | |
| 529 | size_t i = 0; | 535 | size_t i = 0; | |
| 530 | int rc = whefs_rc.OK; | 536 | int rc = whefs_rc.OK; | |
| > | 537 | bool setDebug = false; | ||
| 531 | #define RC if ( whefs_rc.OK != rc ) return rc | 538 | #define RC if ( whefs_rc.OK != rc ) return rc | |
| 532 | for( ; (i < gac) && garg; ++i, ++garg ) | 539 | for( ; (i < gac) && garg; ++i, ++garg ) | |
| 533 | { | 540 | { | |
| 534 | #if 0 | 541 | #if 0 | |
| 535 | MARKER("arg entry: key=[%s] val=[%s] is_long=%d is_dash=%d is_numflag=%d\n", | 542 | MARKER("arg entry: key=[%s] val=[%s] is_long=%d is_dash=%d is_numflag=%d\n", | |
| 4 hidden lines | ||||
| 540 | { | 547 | { | |
| 541 | if( gotHelp ) *gotHelp = true; | 548 | if( gotHelp ) *gotHelp = true; | |
| 542 | WHEFSApp_show_help(); | 549 | WHEFSApp_show_help(); | |
| 543 | return 0; | 550 | return 0; | |
| 544 | } | 551 | } | |
| > | 552 | if( !setDebug && WHEFSApp.debugFlags ) | ||
| > | 553 | { | ||
| > | 554 | VERBOSE("Setting debug flags to [%s]\n",WHEFSApp.debugFlags); | ||
| > | 555 | whefs_setup_debug_arg( stderr, WHEFSApp.debugFlags ); | ||
| > | 556 | setDebug = true; | ||
| > | 557 | } | ||
| > | 558 | |||
| 545 | if( garg->is_nonflag ) | 559 | if( garg->is_nonflag ) | |
| 546 | { | 560 | { | |
| 547 | if( ! WHEFSApp.fsName ) | 561 | if( ! WHEFSApp.fsName ) | |
| 548 | { | 562 | { | |
| 549 | WHEFSApp.fsName = garg->val; | 563 | WHEFSApp.fsName = garg->val; | |
| 24 hidden lines | ||||
| 574 | { | 588 | { | |
| 575 | WHEFSApp.verbose = true; | 589 | WHEFSApp.verbose = true; | |
| 576 | VERBOSE("Verbose mode activated.\n"); | 590 | VERBOSE("Verbose mode activated.\n"); | |
| 577 | continue; | 591 | continue; | |
| 578 | } | 592 | } | |
| 579 | if( spec ) | | | 593 | ArgSpec * arr[2] = {0,0}; |
| | | 594 | arr[0] = &WHEFSApp_SharedArgs[0]; | ||
| | | 595 | arr[1] = argspec; | ||
| | | 596 | bool gotSpec = false; | ||
| | | 597 | for( int i = 0; i <= 2; ++i ) | ||
| 580 | { | 598 | { | |
| 581 | ArgSpec * as = spec; | | | 599 | ArgSpec * as = arr[i]; |
| 582 | bool gotSpec = false; | | | ||
| 583 | for( ; as && as->name; ++as ) | 600 | for( ; as && as->name; ++as ) | |
| 584 | { | 601 | { | |
| 585 | if( 0 != strcmp( as->name, garg->key ) ) continue; | | | 602 | gotSpec = (0 == strcmp( as->name, garg->key )); |
| 586 | gotSpec = true; | | | 603 | //APPMSG("Trying arg [%s] vs [%s] rc=%d\n",garg->key,as->name,gotSpec); |
| | | 604 | if( ! gotSpec ) continue; | ||
| | | 605 | //APPMSG("Matched arg [%s] vs [%s] rc=%d. val=[%s]\n",garg->key,as->name,rc,garg->val); | ||
| 587 | rc = ArgSpec_convert( as, garg->val ); | 606 | rc = ArgSpec_convert( as, garg->val ); | |
| 588 | if( whefs_rc.OK != rc ) | 607 | if( whefs_rc.OK != rc ) | |
| 589 | { | 608 | { | |
| 590 | APPERR("Error parsing flag '%s'!\n", garg->key ); | 609 | APPERR("Error parsing flag '%s'!\n", garg->key ); | |
| 591 | return rc; | 610 | return rc; | |
| 593 | if( as->callback ) | 612 | if( as->callback ) | |
| 594 | { | 613 | { | |
| 595 | int rc = as->callback( as->name, garg->val, as->cbData ); | 614 | int rc = as->callback( as->name, garg->val, as->cbData ); | |
| 596 | if( 0 != rc ) return rc; | 615 | if( 0 != rc ) return rc; | |
| 597 | } | 616 | } | |
| > | 617 | break; | ||
| 598 | } | 618 | } | |
| 599 | if( ! gotSpec ) | | | 619 | if( gotSpec ) break; |
| 600 | { | | | ||
| 601 | APPERR("Unknown argument flag '%s'\n", garg->key ); | | | ||
| 602 | return whefs_rc.ArgError; | | | ||
| 603 | } | | | ||
| 604 | } | 620 | } | |
| > | 621 | if( ! gotSpec ) | ||
| > | 622 | { | ||
| > | 623 | APPERR("Unknown argument flag '%s'\n", garg->key ); | ||
| > | 624 | return whefs_rc.ArgError; | ||
| > | 625 | } | ||
| > | 626 | |||
| 605 | } | 627 | } | |
| 606 | #undef RC | 628 | #undef RC | |
| 607 | if( !WHEFSApp.fsName || ((openMode != WHEFSApp_NoOpen) && ! WHEFSApp.fs) ) | 629 | if( !WHEFSApp.fsName || ((openMode != WHEFSApp_NoOpen) && ! WHEFSApp.fs) ) | |
| 608 | { | 630 | { | |
| 609 | APPERR("No EFS file specified! The EFS file must be the first non-flag argument.\n"); | 631 | APPERR("No EFS file specified! The EFS file must be the first non-flag argument.\n"); | |
| 610 | return whefs_rc.ArgError; | 632 | return whefs_rc.ArgError; | |
| 611 | } | 633 | } | |
| 612 | return whefs_rc.OK; | 634 | return whefs_rc.OK; | |
| 613 | } | 635 | } | |
| 614 | 636 | |||
Changes to whdbg.h
| Old (62d539d29edb7939) | New (7d638f095f900e1d) | |||
|---|---|---|---|---|
| 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 | |||
| 60 hidden lines | ||||
| 66 | 66 | |||
| 67 | /** @enum whdbg_flags | 67 | /** @enum whdbg_flags | |
| 68 | 68 | |||
| 69 | The whdbg_flags enum contains a bitmask of logging/debugging flags, | 69 | The whdbg_flags enum contains a bitmask of logging/debugging flags, | |
| 70 | for use with whdbg() and friends. | 70 | for use with whdbg() and friends. | |
| > | 71 | |||
| > | 72 | |||
| > | 73 | FIXME: clearly define message categories and IDs. The current system | ||
| > | 74 | is not at all extendible from client code. | ||
| 71 | */ | 75 | */ | |
| 72 | enum whdbg_flags { | 76 | enum whdbg_flags { | |
| 73 | 77 | |||
| 74 | /** | 78 | /** | |
| 75 | Never log any debug message. | 79 | Never log any debug message. | |
| 7 hidden lines | ||||
| 83 | 87 | |||
| 84 | /** | 88 | /** | |
| 85 | Log allocation events. This is inherently | 89 | Log allocation events. This is inherently | |
| 86 | dangerous, as logging can cause an alloc. | 90 | dangerous, as logging can cause an alloc. | |
| 87 | */ | 91 | */ | |
| 88 | WHDBG_ALLOC_ERR = WHDBG_ERROR | 0x02, | | | 92 | WHDBG_ALLOC_ERR = WHDBG_ERROR | 0x01, |
| 89 | 93 | |||
| 90 | /** | 94 | /** | |
| 91 | Log error messages. | 95 | Log error messages. | |
| 92 | */ | 96 | */ | |
| 93 | WHDBG_IO_ERROR = WHDBG_ERROR | 0x0001, | | | 97 | WHDBG_IO_ERROR = WHDBG_ERROR | 0x02, |
| 94 | 98 | |||
| 95 | /** | 99 | /** | |
| 96 | FIXME markers | 100 | FIXME markers | |
| 97 | */ | 101 | */ | |
| 98 | WHDBG_FIXME = WHDBG_ERROR | 0x02, | | | 102 | WHDBG_FIXME = WHDBG_ERROR | 0x04, |
| 99 | 103 | |||
| 100 | /** | 104 | /** | |
| 101 | General warning mask. | 105 | General warning mask. | |
| 102 | */ | 106 | */ | |
| 103 | WHDBG_WARNING = 0x20000000, | 107 | WHDBG_WARNING = 0x20000000, | |
| 221 hidden lines | ||||
| 325 | #ifdef __cplusplus | 329 | #ifdef __cplusplus | |
| 326 | } /* extern "C" */ | 330 | } /* extern "C" */ | |
| 327 | #endif | 331 | #endif | |
| 328 | 332 | |||
| 329 | #endif /* WANDERINGHORSE_NET_WHDBG_H_INCLUDED */ | 333 | #endif /* WANDERINGHORSE_NET_WHDBG_H_INCLUDED */ | |
Changes to whefs.c
| Old (7da2480245c73d82) | New (9a76446b1b518575) | |||
|---|---|---|---|---|
| 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 | */ | |
| 68 hidden lines | ||||
| 74 | void whefs_setup_debug( FILE * ostream, unsigned int flags ) | 74 | void whefs_setup_debug( FILE * ostream, unsigned int flags ) | |
| 75 | { | 75 | { | |
| 76 | whdbg_set_stream( ostream ); | 76 | whdbg_set_stream( ostream ); | |
| 77 | whdbg_set_flags( (-1==flags) ? WHEFS_DBG_F_DEFAULT : flags ); | 77 | whdbg_set_flags( (-1==flags) ? WHEFS_DBG_F_DEFAULT : flags ); | |
| 78 | } | 78 | } | |
| > | 79 | |||
| > | 80 | |||
| > | 81 | typedef struct | ||
| > | 82 | { | ||
| > | 83 | char letter; | ||
| > | 84 | unsigned int flag; | ||
| > | 85 | char const * descr; | ||
| > | 86 | } whefs_dbg_flag_info; | ||
| > | 87 | static const whefs_dbg_flag_info whefs_dbg_flags[] = | ||
| > | 88 | {// keep sorted on the letter field. | ||
| > | 89 | {'a',WHDBG_ALWAYS,"All messages."}, | ||
| > | 90 | {'c',WHEFS_DBG_F_CACHE,"Caching messages."}, | ||
| > | 91 | {'d',WHEFS_DBG_F_DEFAULT,"Default log level."}, | ||
| > | 92 | {'e',WHEFS_DBG_F_ERROR,"Error messages."}, | ||
| > | 93 | {'f',WHEFS_DBG_F_FIXME,"FIXME messages."}, | ||
| > | 94 | {'h',WHEFS_DBG_F_DEFAULTS_HACKER,"Hacker-level messages."}, | ||
| > | 95 | {'l',WHEFS_DBG_F_LOCK,"Locking messages."}, | ||
| > | 96 | {'n',WHEFS_DBG_F_NYI,"NYI messages."}, | ||
| > | 97 | {'w',WHEFS_DBG_F_WARNING,"Warning messages."}, | ||
| > | 98 | {0,0,0} | ||
| > | 99 | }; | ||
| > | 100 | |||
| > | 101 | void whefs_setup_debug_arg( FILE * ostream, char const * arg ) | ||
| > | 102 | { | ||
| > | 103 | unsigned int flags = 0; | ||
| > | 104 | if( arg ) for( ; *arg; ++arg ) | ||
| > | 105 | { | ||
| > | 106 | whefs_dbg_flag_info const * fi = &whefs_dbg_flags[0]; | ||
| > | 107 | for( ; fi->letter && (*arg >= fi->letter); ++fi ) | ||
| > | 108 | { | ||
| > | 109 | if( *arg == fi->letter ) | ||
| > | 110 | { | ||
| > | 111 | flags |= fi->flag; | ||
| > | 112 | break; | ||
| > | 113 | } | ||
| > | 114 | } | ||
| > | 115 | } | ||
| > | 116 | whefs_setup_debug( ostream, flags ); | ||
| > | 117 | } | ||
| > | 118 | |||
| > | 119 | |||
| > | 120 | |||
| 79 | 121 | |||
Changes to whefs.h
| Old (03a584abaa91f5f0) | 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> | |
| 1045 hidden lines | ||||
| 1051 | Pass a flags val of 0 to disable all debug output, otherwise pass | 1051 | Pass a flags val of 0 to disable all debug output, otherwise pass | |
| 1052 | a value used by the internal debugging routines. Pass -1 to use | 1052 | a value used by the internal debugging routines. Pass -1 to use | |
| 1053 | the default debugging flags, wh | 1053 | the default debugging flags, wh | |
| 1054 | */ | 1054 | */ | |
| 1055 | void whefs_setup_debug( FILE * ostream, unsigned int flags ); | 1055 | void whefs_setup_debug( FILE * ostream, unsigned int flags ); | |
| > | 1056 | |||
| > | 1057 | /** | ||
| > | 1058 | Identical whefs_setup_debug(), but takes the debug flags as a | ||
| > | 1059 | string, for use primarily in main() argument handling. Each letter | ||
| > | 1060 | (case-sensitive) represents one category of debugging message: | ||
| > | 1061 | |||
| > | 1062 | 'a' = All messages. | ||
| > | 1063 | |||
| > | 1064 | 'c' = Caching messages. | ||
| > | 1065 | |||
| > | 1066 | 'd' = Default log level. | ||
| > | 1067 | |||
| > | 1068 | 'e' = Error messages. | ||
| > | 1069 | |||
| > | 1070 | 'f' = FIXME messages. | ||
| > | 1071 | |||
| > | 1072 | 'h' = Hacker-level messages. | ||
| > | 1073 | |||
| > | 1074 | 'l' = Locking messages. | ||
| > | 1075 | |||
| > | 1076 | 'n' = NYI messages. | ||
| > | 1077 | |||
| > | 1078 | 'w' = Warning messages. | ||
| > | 1079 | |||
| > | 1080 | |||
| > | 1081 | Unknown characters are ignored. | ||
| > | 1082 | |||
| > | 1083 | */ | ||
| > | 1084 | void whefs_setup_debug_arg( FILE * ostream, char const * arg ); | ||
| 1056 | 1085 | |||
| 1057 | 1086 | |||
| 1058 | /** | 1087 | /** | |
| 1059 | Returns an array of numbers which represent this library's file | 1088 | Returns an array of numbers which represent this library's file | |
| 1060 | format version number. The bytes are conventionally { YYYY, MM, DD, | 1089 | format version number. The bytes are conventionally { YYYY, MM, DD, | |
| 79 hidden lines | ||||
| 1140 | #ifdef __cplusplus | 1169 | #ifdef __cplusplus | |
| 1141 | } /* extern "C" */ | 1170 | } /* extern "C" */ | |
| 1142 | #endif | 1171 | #endif | |
| 1143 | 1172 | |||
| 1144 | #endif /* WANDERINGHORSE_NET_WHEFS_H_INCLUDED */ | 1173 | #endif /* WANDERINGHORSE_NET_WHEFS_H_INCLUDED */ | |
Changes to whefs_details.c
| Old (d89e8cf98e024cbe) | New (8bde80f305ca6936) | |||
|---|---|---|---|---|
| 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 | |
| 41 hidden lines | ||||
| 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_FIXME | 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_DEVELOPER = WHEFS_DBG_F_DEFAULTS_CLIENT | 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 | #if defined(NDEBUG) | 54 | #if defined(NDEBUG) | |
| 54 | WHEFS_DBG_F_DEFAULT = WHEFS_DBG_F_DEFAULTS_CLIENT | | | 55 | WHEFS_DBG_F_DEFAULT = 0 |
| | | 56 | //WHEFS_DBG_F_DEFAULTS_CLIENT | ||
| 55 | #else | 57 | #else | |
| 56 | WHEFS_DBG_F_DEFAULT = WHEFS_DBG_F_DEFAULTS_DEVELOPER | | | 58 | WHEFS_DBG_F_DEFAULT = WHEFS_DBG_F_DEFAULTS_HACKER |
| 57 | #endif | 59 | #endif | |
| 58 | }; | 60 | }; | |
| 59 | 61 | |||
| 60 | #define WHEFS_DBG WHDBG(WHEFS_DBG_F_ALWAYS) | 62 | #define WHEFS_DBG WHDBG(WHEFS_DBG_F_ALWAYS) | |
| 61 | #define WHEFS_DBG_ERR WHDBG(WHEFS_DBG_F_ERROR) | 63 | #define WHEFS_DBG_ERR WHDBG(WHEFS_DBG_F_ERROR) | |
| 699 hidden lines | ||||
| 761 | void whefs_inode_hash_cache_sort(whefs_fs * fs ); | 763 | void whefs_inode_hash_cache_sort(whefs_fs * fs ); | |
| 762 | 764 | |||
| 763 | 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 ); | |
| 764 | 766 | |||
| 765 | #endif /* WANDERINGHORSE_NET_WHEFS_DETAILS_C_INCLUDED */ | 767 | #endif /* WANDERINGHORSE_NET_WHEFS_DETAILS_C_INCLUDED */ | |
Changes to whefs_fs.c
| Old (5171845990494600) | New (82b4dbaece4de700) | |||
|---|---|---|---|---|
| 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 | |||
| 695 hidden lines | ||||
| 701 | fs->dev = 0; | 701 | fs->dev = 0; | |
| 702 | } | 702 | } | |
| 703 | fs->dev = whio_dev_for_filename( filename, writeMode ? "r+b" : "rb" ); | 703 | fs->dev = whio_dev_for_filename( filename, writeMode ? "r+b" : "rb" ); | |
| 704 | if( writeMode && !fs->dev ) | 704 | if( writeMode && !fs->dev ) | |
| 705 | { /* didn't exist (we assume), so try to create it */ | 705 | { /* didn't exist (we assume), so try to create it */ | |
| 706 | //WHEFS_DBG("Opening [%s] with 'r+' failed. Trying 'w+'...", filename ); | | | 706 | WHEFS_DBG_WARN("Opening [%s] with 'r+' failed. Trying 'w+'...", filename ); |
| 707 | fs->dev = whio_dev_for_filename( filename, "w+b" ); | 707 | fs->dev = whio_dev_for_filename( filename, "w+b" ); | |
| 708 | } | 708 | } | |
| 709 | if( ! fs->dev ) return 0; | 709 | if( ! fs->dev ) return 0; | |
| 710 | whefs_fs_check_fileno( fs ); | 710 | whefs_fs_check_fileno( fs ); | |
| 711 | int lk = whefs_fs_lock( fs, writeMode, 0, SEEK_SET, 0 ); | 711 | int lk = whefs_fs_lock( fs, writeMode, 0, SEEK_SET, 0 ); | |
| 745 hidden lines | ||||
| 1457 | if( whefs_rc.OK != rc ) break; | 1457 | if( whefs_rc.OK != rc ) break; | |
| 1458 | } | 1458 | } | |
| 1459 | whefs_fs_flush( fs ); | 1459 | whefs_fs_flush( fs ); | |
| 1460 | return rc; | 1460 | return rc; | |
| 1461 | } | 1461 | } | |