drivers/md/persistent-data/dm-bitset.h
Source file repositories/reference/linux-study-clean/drivers/md/persistent-data/dm-bitset.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/persistent-data/dm-bitset.h- Extension
.h- Size
- 6633 bytes
- Lines
- 207
- Domain
- Driver Families
- Bucket
- drivers/md
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dm-array.h
Detected Declarations
struct dm_disk_bitsetstruct dm_bitset_cursor
Annotated Snippet
struct dm_disk_bitset {
struct dm_array_info array_info;
uint32_t current_index;
uint64_t current_bits;
bool current_index_set:1;
bool dirty:1;
};
/*
* Sets up a dm_disk_bitset structure. You don't need to do anything with
* this structure when you finish using it.
*
* tm - the transaction manager that should supervise this structure
* info - the structure being initialised
*/
void dm_disk_bitset_init(struct dm_transaction_manager *tm,
struct dm_disk_bitset *info);
/*
* Create an empty, zero length bitset.
*
* info - describes the bitset
* new_root - on success, points to the new root block
*/
int dm_bitset_empty(struct dm_disk_bitset *info, dm_block_t *new_root);
/*
* Creates a new bitset populated with values provided by a callback
* function. This is more efficient than creating an empty bitset,
* resizing, and then setting values since that process incurs a lot of
* copying.
*
* info - describes the array
* root - the root block of the array on disk
* size - the number of entries in the array
* fn - the callback
* context - passed to the callback
*/
typedef int (*bit_value_fn)(uint32_t index, bool *value, void *context);
int dm_bitset_new(struct dm_disk_bitset *info, dm_block_t *root,
uint32_t size, bit_value_fn fn, void *context);
/*
* Resize the bitset.
*
* info - describes the bitset
* old_root - the root block of the array on disk
* old_nr_entries - the number of bits in the old bitset
* new_nr_entries - the number of bits you want in the new bitset
* default_value - the value for any new bits
* new_root - on success, points to the new root block
*/
int dm_bitset_resize(struct dm_disk_bitset *info, dm_block_t old_root,
uint32_t old_nr_entries, uint32_t new_nr_entries,
bool default_value, dm_block_t *new_root);
/*
* Frees the bitset.
*/
int dm_bitset_del(struct dm_disk_bitset *info, dm_block_t root);
/*
* Set a bit.
*
* info - describes the bitset
* root - the root block of the bitset
* index - the bit index
* new_root - on success, points to the new root block
*
* -ENODATA will be returned if the index is out of bounds.
*/
int dm_bitset_set_bit(struct dm_disk_bitset *info, dm_block_t root,
uint32_t index, dm_block_t *new_root);
/*
* Clears a bit.
*
* info - describes the bitset
* root - the root block of the bitset
* index - the bit index
* new_root - on success, points to the new root block
*
* -ENODATA will be returned if the index is out of bounds.
*/
int dm_bitset_clear_bit(struct dm_disk_bitset *info, dm_block_t root,
uint32_t index, dm_block_t *new_root);
/*
Annotation
- Immediate include surface: `dm-array.h`.
- Detected declarations: `struct dm_disk_bitset`, `struct dm_bitset_cursor`.
- Atlas domain: Driver Families / drivers/md.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.