#include <super.h>
#include <bitops.h>
#include <block_map.h>
#include <new_inode.h>
#include <release_fssys.h>
#include <progress.h>
#include <version.h>
struct any_sb_info { char *si_itfilename; /* inode table filename */ unsigned long si_blocksize; /* blocksize */ unsigned long si_inodes; /* count of inodes */ unsigned long *si_inode_bitmap; /* map of inodes */ struct any_inode *si_inode_table; /* array of inodes */ };The structure is superblock analog in other filesystems.
The si_itfilename field fills with opening inode table and may be used with writing inode table if wasn't specified other filename.
The si_inode_bitmap field is bitmap which says if a inode is busy.
The si_inode_table field is actually inode table. Array of si_inodes any_inode structures (described below).
struct any_inode { uint16_t i_mode; /* File mode */ uint16_t i_uid; /* Low 16 bits of Owner Uid */ uint16_t i_gid; /* Low 16 bits of Group Id */ uint64_t i_size; /* Size in bytes */ uint32_t i_atime; /* Access time */ uint32_t i_ctime; /* Creation time */ uint32_t i_mtime; /* Modification time */ uint16_t i_links_count; /* Links count */ union { struct any_file_frags *file_frags; /* File fragments */ struct any_dir *dir; /* Directory entries */ char *symlink; /* Symbolic link */ dev_t device; /* Device */ } i_info; size_t i_it_file_offset; /* Offset in inode table file */ }
The structure is some modified of ext2fs inode structure ext2_inode.
The most entries description you may find in stat(2).
Union i_info keeps link to inode table information part which depend on inode type.
For regular file is description of location its fragment on the disk.
For directories is its entries list.
For symbolic links is link string.
For device is device type (see description of st_rdev entry in stat(2) structure)
The i_it_file_offset field used by writing inode table function.
struct any_dir { uint32_t d_ndirents; /* count of entries */ struct any_dirent* d_dirent; /* first directory entry */ void* d_data; /* link to additional data (used in GUI) */ };
The d_dirent field is pointer to Singly-linked directory entries list.
struct any_dirent { char* d_name; /* entry name */ uint32_t d_inode; /* inode number */ struct any_dirent *d_next; /* the next directory entry */ };
struct any_file_frags { uint32_t fr_nfrags; /* fragments count */ struct any_file_fragment *fr_frags; /* fragments */ };The fr_frags field is array of fr_nfrags enties which describes each file fragment.
struct any_file_fragment { uint32_t fr_start; /* start fragment block number */ uint32_t fr_length; /* fragment length in blocks */ };
Blocksize used in the structure as unit of measurement defined in any_sb_info structure.
0 value of fr_start entry means sparse-fragment (i.e. which doesn't keeps on the disk, but considered that it filled with zeroes)
New inode table fills with zeroes.
Returns 0 if successful or -ENOMEM if not enough memory.
Mean that after this call the si_inode_bitmap and si_inode_table entries of any_sb_info structure of inode table may change its values i.e. inode table and map may change its location in the memory) and any pointers on inodes calculated before the call with expression like (it->si_inode_table + ino) or &(it->si_inode_table[ino]) will needed to update.
Returns 0 if successful or exit from program with ENOMEM status.
Returns 0 if successful or -ENOMEM, -ENAMETOOLONG, -EINVAL in case of error. If there was input/output error errno variable keeps more detailed error code.
If itfilename == NULL, then it gets filename from it->si_itfilename.
Mean that the call doesn't free memory with inode table (although read_it call allocate memory for new inode table)
Return 0 if successful or 1 if there is error. In case of input/output error errno variable keeps more detailed error code.
Returns the value of bit before setting.
Returns the value of bit before clearing.
Return number of founded bit, or value which not less than size in unsuccessful case.
Return number of founded bit, or value which not less than size in unsuccessful case.
Map before the call must be allocated and filled with zeroes.
Besides the functions set the zero block as system.
The function returns 0 if successful or -1, if in the inode table was founded files, with shared blocks (set last check_intersect parameter to disable check for block intersects, it used in anysurrect).
It means that the function must never find already set bit in the bitmap (possibly, set by itself as used block with other inode).
New inode number puts to *newino.
In case device creating (special file), data pointer must link to variable with dev_t type which keep device type.
Returns zero in successful case. Close program (with exit) if not enough memory.
Puts founded inode number to *ino.
Returns 0 in successful case, 1 if entry doesn't exist, or -1 if root inode is not directory or free inode.
In the program must be difined mode_t dir_umask; variable whick keeps umask for new directories.
Function of this type must read/write n blocks beginning from in/from (before allocated) buffer.
The function must returns 0 in successful case or negative value in case of input/output error.
Put to this variable right value before any_release() call.
Put to this variable right value before any_release() call.
The function of the type must return 0, if tested block is free.
The function must return 1, only, if device block will kept with system information.
Put to this variable right value before any_release() call.
Put to this variable right value before any_release() call.
The function uses any_readblk and any_writeblk functions to read/write device, any_getblkcount function to get device size, also any_testblk function to get information about system blocks on device.
The function uses readblk and writeblk functions to read/write device, getblkcount function to get device size, also testblk function to get information about system blocks on device.
The function used in utilities for filesystem building build_e2fs and build_xfs, after freing blocks from system information. Because its declaration wasn't move to other file.
The functions was get from e2fsprogs with some modifications.
Maximal value may be set to zero if count of precessed units
(blocks, files and so on) not known (maybe the progress line will show
counting if the entries), in this case the progress line will not
<label>: <number of processed entry>/<total entries>
but without printing "total entries" field:
<label>: <number of processed entry>
The possibility used in build_it for filesystems which don't returns right count of used inodes (e.g. VFAT).
The function returns cursor and write new progress value.
Function used in anysurrect utility to decide if need return cursor to necessary position for progress updating, which changed with printing type of the working surrecter indicator.
Function used in anysurrect utility to decide if need print new value of type of the working surrecter indicator after progress line updating.
anyfs-tools(8), build_it(8), anysurrect(8), stat(2)