|
Motr
M0
|
Data Structures | |
| struct | m0_bitmap |
| struct | m0_bitmap_onwire |
Macros | |
| #define | M0_BITMAP_WORDS(nr) (((nr) + (M0_BITMAP_BITS-1)) >> M0_BITMAP_BITSHIFT) |
| #define | M0_BITMAP_SHIFT(idx) ((idx) >> M0_BITMAP_BITSHIFT) |
| #define | M0_BITMAP_MASK(idx) (1UL << ((idx) & (M0_BITMAP_BITS-1))) |
Enumerations | |
| enum | { M0_BITMAP_BITS = (8 * sizeof ((struct m0_bitmap *)0)->b_words[0]), M0_BITMAP_BITSHIFT = 6 } |
Functions | |
| M0_BASSERT (M0_BITMAP_BITS==(1UL<< M0_BITMAP_BITSHIFT)) | |
| M0_BASSERT (M0_BITMAP_WORDS(0)==0) | |
| M0_BASSERT (M0_BITMAP_WORDS(1)==1) | |
| M0_BASSERT (M0_BITMAP_WORDS(63)==1) | |
| M0_BASSERT (M0_BITMAP_WORDS(64)==1) | |
| M0_BASSERT (M0_BITMAP_WORDS(65)==2) | |
| M0_INTERNAL int | m0_bitmap_init (struct m0_bitmap *map, size_t nr) |
| M0_INTERNAL void | m0_bitmap_fini (struct m0_bitmap *map) |
| M0_INTERNAL bool | m0_bitmap_get (const struct m0_bitmap *map, size_t idx) |
| M0_INTERNAL int | m0_bitmap_ffs (const struct m0_bitmap *map) |
| M0_INTERNAL int | m0_bitmap_ffz (const struct m0_bitmap *map) |
| M0_INTERNAL void | m0_bitmap_set (struct m0_bitmap *map, size_t idx, bool val) |
| M0_INTERNAL void | m0_bitmap_reset (struct m0_bitmap *map) |
| M0_INTERNAL void | m0_bitmap_copy (struct m0_bitmap *dst, const struct m0_bitmap *src) |
| M0_INTERNAL size_t | m0_bitmap_set_nr (const struct m0_bitmap *map) |
| M0_INTERNAL int | m0_bitmap_onwire_init (struct m0_bitmap_onwire *ow_map, size_t nr) |
| M0_INTERNAL void | m0_bitmap_onwire_fini (struct m0_bitmap_onwire *ow_map) |
| M0_INTERNAL void | m0_bitmap_store (const struct m0_bitmap *im_map, struct m0_bitmap_onwire *ow_map) |
| M0_INTERNAL void | m0_bitmap_load (const struct m0_bitmap_onwire *ow_map, struct m0_bitmap *im_map) |
| struct m0_bitmap_onwire | M0_XCA_DOMAIN (conf|rpc) |
| M0_BASSERT (8==sizeof((struct m0_bitmap *) 0) ->b_words[0]) | |
| #define M0_BITMAP_MASK | ( | idx | ) | (1UL << ((idx) & (M0_BITMAP_BITS-1))) |
Mask off a single bit within a word. Use M0_BITMAP_SHIFT() to select the correct word, then use M0_BITMAP_MASK() to access the individual bit within that word.
| idx | bit offset into the bitmap |
| #define M0_BITMAP_SHIFT | ( | idx | ) | ((idx) >> M0_BITMAP_BITSHIFT) |
Shift a m0_bitmap bit index to get the word index. Use M0_BITMAP_SHIFT() to select the correct word, then use M0_BITMAP_MASK() to access the individual bit within that word.
| idx | bit offset into the bitmap |
| #define M0_BITMAP_WORDS | ( | nr | ) | (((nr) + (M0_BITMAP_BITS-1)) >> M0_BITMAP_BITSHIFT) |
| anonymous enum |
Number of bits in a word (m0_bitmap.b_words). And the number of bits to shift to convert bit offset to word index.
| Enumerator | |
|---|---|
| M0_BITMAP_BITS | |
| M0_BITMAP_BITSHIFT | |
| M0_BASSERT | ( | M0_BITMAP_BITS | = =(1UL<< M0_BITMAP_BITSHIFT) | ) |
| M0_BASSERT | ( | M0_BITMAP_WORDS(0) | = =0 | ) |
| M0_BASSERT | ( | M0_BITMAP_WORDS(1) | = =1 | ) |
| M0_BASSERT | ( | M0_BITMAP_WORDS(63) | = =1 | ) |
| M0_BASSERT | ( | M0_BITMAP_WORDS(64) | = =1 | ) |
| M0_BASSERT | ( | M0_BITMAP_WORDS(65) | = =2 | ) |
| M0_BASSERT | ( | 8 | = =sizeof((struct m0_bitmap *) 0) ->b_words[0] | ) |
Copies the bit values from one bitmap to another.
| dst | destination bitmap, must already be initialised. If dst is larger than src, bits beyond src->b_nr are cleared in dst. |
| src | source bitmap |
Definition at line 158 of file bitmap.c.

| M0_INTERNAL int m0_bitmap_ffs | ( | const struct m0_bitmap * | map | ) |
| M0_INTERNAL int m0_bitmap_ffz | ( | const struct m0_bitmap * | map | ) |
| M0_INTERNAL void m0_bitmap_fini | ( | struct m0_bitmap * | map | ) |
| M0_INTERNAL bool m0_bitmap_get | ( | const struct m0_bitmap * | map, |
| size_t | idx | ||
| ) |
| M0_INTERNAL int m0_bitmap_init | ( | struct m0_bitmap * | map, |
| size_t | nr | ||
| ) |
Initialise a bitmap to hold nr bits. The array to store bits is allocated internally.
On success, the bitmap is initialised with all bits initially set to false.
| map | bitmap object to initialize |
| nr | size of the bitmap, in bits |
| 0 | success |
| !0 | failure, -errno |
Definition at line 86 of file bitmap.c.

| M0_INTERNAL void m0_bitmap_load | ( | const struct m0_bitmap_onwire * | ow_map, |
| struct m0_bitmap * | im_map | ||
| ) |
| M0_INTERNAL void m0_bitmap_onwire_fini | ( | struct m0_bitmap_onwire * | ow_map | ) |
| M0_INTERNAL int m0_bitmap_onwire_init | ( | struct m0_bitmap_onwire * | ow_map, |
| size_t | nr | ||
| ) |
Initialise an on-wire bitmap to hold nr bits. The array to store bits is allocated internally.
On success, the bitmap is initialised with all bits initially set to false.
| ow_map | on-wire bitmap object to initialise |
| nr | size of the bitmap, in bits |
| 0 | success |
| !0 | failure, -errno |
Definition at line 182 of file bitmap.c.


| M0_INTERNAL void m0_bitmap_reset | ( | struct m0_bitmap * | map | ) |
| M0_INTERNAL void m0_bitmap_set | ( | struct m0_bitmap * | map, |
| size_t | idx, | ||
| bool | val | ||
| ) |
Set a bit value in a bitmap.
| map | bitmap to modify |
| idx | bit offset to modify. Attempting to set a bit beyond the size of the bitmap results is not allowed (causes and assert to fail). |
| val | new bit value, true or false |
Definition at line 139 of file bitmap.c.

| M0_INTERNAL size_t m0_bitmap_set_nr | ( | const struct m0_bitmap * | map | ) |
| M0_INTERNAL void m0_bitmap_store | ( | const struct m0_bitmap * | im_map, |
| struct m0_bitmap_onwire * | ow_map | ||
| ) |
Converts in-memory struct m0_bitmap to on-wire struct m0_bitmap_onwire.
| im_map | in-memory bitmap object to be converted into on-wire bitmap object. |
| ow_map | pre-initialised on-wire bitmap object |
Definition at line 200 of file bitmap.c.

| struct m0_bitmap_onwire M0_XCA_DOMAIN | ( | conf| | rpc | ) |