Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | e28b89a1c31695e2c34680649970705508fd6cea |
|---|---|
| Date: | 2010-03-10 21:09:40 |
| User: | stephan |
| Comment: | doc additions. |
Tags And Properties
- branch=trunk inherited from [c3e484d316]
- sym-trunk inherited from [c3e484d316]
Changes
Changes to include/wh/whio/whio_epfs.h
| Old (3aba8bcf9cd4e359) | New (d55a19e52ade8675) | |||
|---|---|---|---|---|
| 1 | #ifndef WANDERINGHORSE_NET_WHIO_EPFS_H_INCLUDED | 1 | #ifndef WANDERINGHORSE_NET_WHIO_EPFS_H_INCLUDED | |
| 2 | #define WANDERINGHORSE_NET_WHIO_EPFS_H_INCLUDED | 2 | #define WANDERINGHORSE_NET_WHIO_EPFS_H_INCLUDED | |
| 3 | #include "whio_dev.h" /* core whio_dev API. */ | 3 | #include "whio_dev.h" /* core whio_dev API. */ | |
| 4 | #include "whio_encode.h" /* for whio_sizeof_encoded_xxx */ | 4 | #include "whio_encode.h" /* for whio_sizeof_encoded_xxx */ | |
| 5 | #include "whio_epfs_config.h" /* EPFS compile-time config options. */ | 5 | #include "whio_epfs_config.h" /* EPFS compile-time config options. */ | |
| 1968 hidden lines | ||||
| 1974 | please try not using this, to be sure that the allocator is not | 1974 | please try not using this, to be sure that the allocator is not | |
| 1975 | the problem. | 1975 | the problem. | |
| 1976 | */ | 1976 | */ | |
| 1977 | int whio_epfs_mempool_setup( whio_epfs * fs, void * mem, whio_size_t size, bool fallback ); | 1977 | int whio_epfs_mempool_setup( whio_epfs * fs, void * mem, whio_size_t size, bool fallback ); | |
| 1978 | 1978 | |||
| 1979 | /** | | | 1979 | /** @deprecated Made obsolete via evolution. |
| 1980 | A type for collecting certain metrics from a whio_epfs memory | | | 1980 | |
| | | 1981 | A type for collecting certain metrics from a whio_epfs memory | ||
| 1981 | pool. It is mainly intended for debuggering. | 1982 | pool. It is mainly intended for debuggering. | |
| 1982 | */ | 1983 | */ | |
| 1983 | struct whio_epfs_mempool_stats_t | 1984 | struct whio_epfs_mempool_stats_t | |
| 1984 | { | 1985 | { | |
| 1985 | /** Number of allocated objects in the pool. */ | 1986 | /** Number of allocated objects in the pool. */ | |
| 14 hidden lines | ||||
| 2000 | whio_size_t memorySize; | 2001 | whio_size_t memorySize; | |
| 2001 | }; | 2002 | }; | |
| 2002 | /** Convenience typedef. */ | 2003 | /** Convenience typedef. */ | |
| 2003 | typedef struct whio_epfs_mempool_stats_t whio_epfs_mempool_stats_t; | 2004 | typedef struct whio_epfs_mempool_stats_t whio_epfs_mempool_stats_t; | |
| 2004 | 2005 | |||
| 2005 | /** | | | 2006 | /** @deprecated |
| | | 2007 | |||
| | | 2008 | This function will go away once the allocator abstraction | ||
| | | 2009 | layer is consistently used internally. | ||
| | | 2010 | |||
| 2006 | Populates dest, which may not be null, with some current | 2011 | Populates dest, which may not be null, with some current | |
| 2007 | metrics from fs' memory pool. | 2012 | metrics from fs' memory pool. | |
| 2008 | 2013 | |||
| 2009 | On success 0 is returned and dest is modified. On error non-0 | 2014 | On success 0 is returned and dest is modified. On error non-0 | |
| 2010 | is returned and dest is not modified. | 2015 | is returned and dest is not modified. | |
| 442 hidden lines | ||||
| 2453 | whio_epfs_foreach_inode(). | 2458 | whio_epfs_foreach_inode(). | |
| 2454 | */ | 2459 | */ | |
| 2455 | typedef int (*whio_epfs_inode_foreach_f)( whio_epfs * fs, whio_epfs_inode const * ent, void * clientData ); | 2460 | typedef int (*whio_epfs_inode_foreach_f)( whio_epfs * fs, whio_epfs_inode const * ent, void * clientData ); | |
| 2456 | 2461 | |||
| 2457 | /** | 2462 | /** | |
| 2458 | whio_epfs_inode_predicate_f describes a predicate functor for use with | | | 2463 | whio_epfs_inode_predicate_f() describes a predicate functor for use with |
| 2459 | whio_epfs_inode_foreach(). n is the current inode being iterated | 2464 | whio_epfs_inode_foreach(). n is the current inode being iterated | |
| 2460 | over. clientData is the client-determined argument passed to | 2465 | over. clientData is the client-determined argument passed to | |
| 2461 | whio_epfs_inode_foreach(). | 2466 | whio_epfs_inode_foreach(). | |
| 2462 | */ | 2467 | */ | |
| 2463 | typedef bool (*whio_epfs_inode_predicate_f)( whio_epfs * fs, whio_epfs_inode const * n, void * clientData ); | 2468 | typedef bool (*whio_epfs_inode_predicate_f)( whio_epfs * fs, whio_epfs_inode const * n, void * clientData ); | |
| 2464 | 2469 | |||
| 2465 | /** | 2470 | /** | |
| 2466 | A whio_epfs_inode_predicate_f implementation which always | | | 2471 | A whio_epfs_inode_predicate_f() implementation which always |
| 2467 | returns true if fs and n are not null. This is intended for use | 2472 | returns true if fs and n are not null. This is intended for use | |
| 2468 | with whio_epfs_foreach_inode() and friends, and can be used to | 2473 | with whio_epfs_foreach_inode() and friends, and can be used to | |
| 2469 | match all (even unused) inodes. | 2474 | match all (even unused) inodes. | |
| 2470 | */ | 2475 | */ | |
| 2471 | bool whio_epfs_inode_predicate_true( whio_epfs * fs, whio_epfs_inode const * n, void * clientData ); | 2476 | bool whio_epfs_inode_predicate_true( whio_epfs * fs, whio_epfs_inode const * n, void * clientData ); | |
| 2472 | 2477 | |||
| 2473 | 2478 | |||
| 2474 | /** | 2479 | /** | |
| 2475 | Walks each inode entry in fs, starting at the begin position | 2480 | Walks each inode entry in fs, starting at the begin position | |
| 2476 | and going until one before the end position. (That is, the | | | 2481 | and going until one before the end position. (That is, |
| 2477 | begin/end range is in the form [begin,end)). For each entry | | | 2482 | begin/end measures an exclusive range in the form |
| 2478 | forEach(fs,entry,forEachData) may or may not be called, | | | 2483 | [begin,end)). For each entry forEach(fs,entry,forEachData) may |
| 2479 | depending on the where parameter (described below). If | | | 2484 | or may not be called, depending on the where parameter |
| 2480 | forEach() returns any value other than whio_rc.OK then looping | | | 2485 | (described below). If forEach() returns any value other than 0 |
| 2481 | stops and that return code is returned. | | | 2486 | then looping stops and that return code is returned. |
| 2482 | 2487 | |||
| 2483 | As a special case, if end is 0 then it is treated as "until | | | 2488 | Note that inode indexes start with 1, not 0. As a special case, |
| 2484 | the end of the inode list." | | | 2489 | if end is 0 then it is treated as "until the end of the inode |
| | | 2490 | list." | ||
| 2485 | 2491 | |||
| 2486 | The forEach function may not be null. The forEachData pointer | 2492 | The forEach function may not be null. The forEachData pointer | |
| 2487 | may be anything - it is passed on as-is to the forEach | 2493 | may be anything - it is passed on as-is to the forEach | |
| 2488 | function. | 2494 | function. | |
| 2489 | 2495 | |||
| 18 hidden lines | ||||
| 2508 | - reading an inode fails: some propagated error code. | 2514 | - reading an inode fails: some propagated error code. | |
| 2509 | 2515 | |||
| 2510 | - If forEach() returns non-0, procecssing stops and that | 2516 | - If forEach() returns non-0, procecssing stops and that | |
| 2511 | result is returned. | 2517 | result is returned. | |
| 2512 | 2518 | |||
| 2513 | ACHTUNG: this bypasses the opened-inodes cache (because search time | | | 2519 | ACHTUNG: this bypasses the opened-inodes cache (because search |
| 2514 | would grow exponentially as the number of opened inodes grew). Thus | | | 2520 | time would grow exponentially as the number of opened inodes |
| 2515 | the data passed to forEach() may not reflect unflushed state of | | | 2521 | grew). Thus the inodes passed to forEach() may not reflect |
| 2516 | inodes which are currently opened for write access. | | | 2522 | unflushed state of inodes which are currently opened for write |
| | | 2523 | access. | ||
| 2517 | */ | 2524 | */ | |
| 2518 | int whio_epfs_foreach_inode_in_range( whio_epfs * fs, | 2525 | int whio_epfs_foreach_inode_in_range( whio_epfs * fs, | |
| 2519 | whio_epfs_id_t begin, | 2526 | whio_epfs_id_t begin, | |
| 2520 | whio_epfs_id_t end, | 2527 | whio_epfs_id_t end, | |
| 2521 | whio_epfs_inode_predicate_f where, void * whereData, | 2528 | whio_epfs_inode_predicate_f where, void * whereData, | |
| 54 hidden lines | ||||
| 2576 | 2583 | |||
| 2577 | inp in expected to be a null-terminated string in one of these | 2584 | inp in expected to be a null-terminated string in one of these | |
| 2578 | formats: | 2585 | formats: | |
| 2579 | 2586 | |||
| 2580 | 1) ### | 2587 | 1) ### | |
| > | 2588 | |||
| 2581 | 2) ###-### | 2589 | 2) ###-### | |
| 2582 | 2590 | |||
| 2583 | Where ### is an inode ID in a format supported by | 2591 | Where ### is an inode ID in a format supported by | |
| 2584 | whio_epfs_parse_id(). | 2592 | whio_epfs_parse_id(). | |
| 2585 | 2593 | |||
| 31 hidden lines | ||||
| 2617 | Writes a client-defined label to the fs. | 2625 | Writes a client-defined label to the fs. | |
| 2618 | 2626 | |||
| 2619 | The legal argument combinations for (lbl,n) are: | 2627 | The legal argument combinations for (lbl,n) are: | |
| 2620 | 2628 | |||
| 2621 | - lbl must be at least n bytes long, and n must be no greater | 2629 | - lbl must be at least n bytes long, and n must be no greater | |
| 2622 | than whio_epfs_sizeof_label_payload. | | | 2630 | than whio_epfs_sizeof_label_payload. If n is less than |
| | | 2631 | whio_epfs_sizeof_label_payload then the written label will be | ||
| | | 2632 | padded with NULLs to fill that length. | ||
| 2623 | 2633 | |||
| 2624 | - If lbl is NULL then a blank (all-null) label is written and n | 2634 | - If lbl is NULL then a blank (all-null) label is written and n | |
| 2625 | is ignored. | 2635 | is ignored. | |
| 2626 | 2636 | |||
| 2627 | - If n is 0 the effect is the same as if lbl is NULL. | 2637 | - If n is 0 the effect is the same as if lbl is NULL. | |
| 16 hidden lines | ||||
| 2644 | /** | 2654 | /** | |
| 2645 | Reads the client-defined label from fs and copies it to lbl. | 2655 | Reads the client-defined label from fs and copies it to lbl. | |
| 2646 | lbl must be valid memory at least | 2656 | lbl must be valid memory at least | |
| 2647 | whio_epfs_sizeof_label_payload bytes long, and on success | 2657 | whio_epfs_sizeof_label_payload bytes long, and on success | |
| 2648 | exactly whio_epfs_sizeof_label_payload bytes will be copied to | 2658 | exactly whio_epfs_sizeof_label_payload bytes will be copied to | |
| 2649 | it. On failure lbl will not be modified. | | | 2659 | it. If the client needs to guaranty that lbl gets |
| | | 2660 | null-terminated, he should allocate it as 1 byte larger than | ||
| | | 2661 | whio_epfs_sizeof_label_payload and add a null byte to it. | ||
| | | 2662 | |||
| | | 2663 | On failure lbl will not be modified. | ||
| 2650 | 2664 | |||
| 2651 | Returns 0 on success. | 2665 | Returns 0 on success. | |
| 2652 | 2666 | |||
| 2653 | Errors include: | 2667 | Errors include: | |
| 2654 | 2668 | |||
| 10 hidden lines | ||||
| 2665 | #ifdef __cplusplus | 2679 | #ifdef __cplusplus | |
| 2666 | } /* extern "C" */ | 2680 | } /* extern "C" */ | |
| 2667 | #endif | 2681 | #endif | |
| 2668 | 2682 | |||
| 2669 | #endif /* WANDERINGHORSE_NET_WHIO_EPFS_H_INCLUDED */ | 2683 | #endif /* WANDERINGHORSE_NET_WHIO_EPFS_H_INCLUDED */ | |