search.c File Reference

File blocks and free space regions searching. More...

Go to the source code of this file.

Functions

winx_volume_region * find_first_free_region (udefrag_job_parameters *jp, ULONGLONG min_lcn, ULONGLONG min_length, ULONGLONG *max_length)
 Searches for free space region starting at the beginning of the volume.
 
winx_volume_region * find_last_free_region (udefrag_job_parameters *jp, ULONGLONG min_lcn, ULONGLONG min_length, ULONGLONG *max_length)
 Searches for free space region starting at the end of the volume.
 
winx_volume_region * find_matching_free_region (udefrag_job_parameters *jp, ULONGLONG start_lcn, ULONGLONG min_length, int preferred_position)
 Searches for best matching free space region.
 
winx_volume_region * find_largest_free_region (udefrag_job_parameters *jp)
 Searches for largest free space region.
 
int create_file_blocks_tree (udefrag_job_parameters *jp)
 Creates and initializes the binary tree of all file blocks.
 
int add_block_to_file_blocks_tree (udefrag_job_parameters *jp, winx_file_info *file, winx_blockmap *block)
 Adds a file block to the binary tree of all file blocks.
 
int remove_block_from_file_blocks_tree (udefrag_job_parameters *jp, winx_blockmap *block)
 Removes a file block from the binary tree of all file blocks.
 
void destroy_file_blocks_tree (udefrag_job_parameters *jp)
 Destroys the binary tree of all file blocks.
 
winx_blockmap * find_first_block (udefrag_job_parameters *jp, ULONGLONG *min_lcn, int flags, winx_file_info **first_file)
 Searches for the first movable file block after the specified cluster on the volume.
 

Detailed Description

File blocks and free space regions searching.

We use binary search trees whenever possible to speed things up. If memory allocation fails for some operation on a binary tree, we destroy it and use alternative searching in double linked lists.

Definition in file search.c.