|
Basic Solution File System - BSFS
|
Header file for managing queues of BSpan entries in the BSFS file system. More...
Classes | |
| struct | bspan_node |
| Node structure for a BSpan queue. More... | |
| struct | bspan_queue_t |
| FIFO queue structure for managing BSpan entries. More... | |
Typedefs | |
| typedef struct bspan_node | bspan_node_t |
Functions | |
| void | init_bspan_queue (bspan_queue_t *queue) |
| Initializes a bspan queue. | |
| int | enqueue_bspan (bspan_queue_t *queue, uint32_t file_blk, uint32_t disk_blk, uint16_t length) |
| Enqueues a bspan into the queue. | |
| bspan_t | dequeue_bspan (bspan_queue_t *queue) |
| Dequeues and returns the bspan from the front of the queue. | |
| bspan_queue_t * | copy_bspan_queue (bspan_queue_t *original) |
| Copies a bspan queue. | |
| int | is_bspan_queue_empty (bspan_queue_t *queue) |
| Checks if the bspan queue is empty. | |
| void | free_bspan_queue (bspan_queue_t *queue) |
| Frees all elements of the bspan queue. | |
Header file for managing queues of BSpan entries in the BSFS file system.
This file defines the data structures and types used for managing a FIFO queue of block spans (bspan_t), which represent contiguous sequences of allocated blocks. These queues are used internally during allocation operations (e.g., when allocating space for a file) to track which disk blocks have been reserved and in what order.
| bspan_queue_t * copy_bspan_queue | ( | bspan_queue_t * | original | ) |
Copies a bspan queue.
This function creates a new queue and copies all the elements from the original queue into the new queue. The new queue is returned.
| original | Pointer to the bspan queue to be copied. |
| bspan_t dequeue_bspan | ( | bspan_queue_t * | queue | ) |
Dequeues and returns the bspan from the front of the queue.
This function removes the first bspan from the queue and returns it. If the queue is empty, the program exits with an error.
| queue | Pointer to the bspan queue from which the bspan will be dequeued. |
| int enqueue_bspan | ( | bspan_queue_t * | queue, |
| uint32_t | file_blk, | ||
| uint32_t | disk_blk, | ||
| uint16_t | length ) |
Enqueues a bspan into the queue.
This function creates a new node to store the bspan and adds it to the end of the queue. If the queue is empty, the new node becomes both the front and the rear of the queue.
| queue | Pointer to the bspan queue where the bspan will be added. |
| file_blk | The file block associated with the bspan. |
| disk_blk | The disk block associated with the bspan. |
| length | The length of the bspan. |
| void free_bspan_queue | ( | bspan_queue_t * | queue | ) |
Frees all elements of the bspan queue.
This function removes all elements from the queue, freeing the memory allocated for each node.
| queue | Pointer to the bspan queue to be freed. |
| void init_bspan_queue | ( | bspan_queue_t * | queue | ) |
Initializes a bspan queue.
The function sets the front and rear pointers of the queue to NULL, indicating that the queue is empty.
| queue | Pointer to the bspan queue to be initialized. |
| int is_bspan_queue_empty | ( | bspan_queue_t * | queue | ) |
Checks if the bspan queue is empty.
This function returns 1 if the queue is empty, and 0 otherwise.
| queue | Pointer to the bspan queue to be checked. |