Search

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

Function Documentation

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.

Parameters
[in]jpjob parameters structure.
[in]min_lcnminimum LCN of region.
[in]min_lengthminimum length of region, in clusters.
[out]max_lengthlength of the biggest region found.
Note
In case of termination request returns NULL immediately.

Definition at line 50 of file search.c.

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.

Parameters
[in]jpjob parameters structure.
[in]min_lcnminimum LCN of region.
[in]min_lengthminimum length of region, in clusters.
[out]max_lengthlength of the biggest region found.
Note
In case of termination request returns NULL immediately.

Definition at line 83 of file search.c.

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.

Parameters
[in]jpjob parameters structure.
[in]start_lcna point which divides disk into two parts (see below).
[in]min_lengthminimal accepted length of the region, in clusters.
[in]preferred_positionone of the FIND_MATCHING_RGN_xxx constants: FIND_MATCHING_RGN_FORWARD - region after the start_lcn preferred FIND_MATCHING_RGN_BACKWARD - region before the start_lcn preferred FIND_MATCHING_RGN_ANY - any region accepted
Note
In case of termination request returns NULL immediately.

Definition at line 122 of file search.c.

winx_volume_region* find_largest_free_region ( udefrag_job_parameters *  jp)

Searches for largest free space region.

Note
In case of termination request returns NULL immediately.

Definition at line 160 of file search.c.

int create_file_blocks_tree ( udefrag_job_parameters *  jp)

Creates and initializes the binary tree of all file blocks.

Returns
Zero for success, negative value otherwise.
Note
jp->file_blocks must be initialized by NULL or contain pointer to a valid tree before this call.

Definition at line 230 of file search.c.

References destroy_file_blocks_tree().

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.

Returns
Zero for success, negative value otherwise.
Note
Destroys the tree in case of errors.

Definition at line 255 of file search.c.

References destroy_file_blocks_tree().

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.

Returns
Zero for success, negative value otherwise.

Definition at line 294 of file search.c.

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.

Parameters
[in]jpjob parameters.
[in,out]min_lcnpointer to variable containing minimum LCN - file blocks below it will be ignored.
[in]flagsone of SKIP_xxx flags defined in udefrag.h
[out]first_filepointer to variable receiving information about the file the first block belongs to.
Returns
Pointer to the first block. NULL indicates failure.

Definition at line 350 of file search.c.

References destroy_file_blocks_tree().