"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fsmove/src/io/io_posix.hh" between
fstransform-0.9.3-src.tar.gz and fstransform-0.9.4.tar.gz

About: fstransform is a tool to change a file-system from one format to another, for example from jfs, xfs, or reiser to ext2, ext3, or ext4, in-place and without the need for backup.

io_posix.hh  (fstransform-0.9.3-src):io_posix.hh  (fstransform-0.9.4)
skipping to change at line 58 skipping to change at line 58
*/ */
APPROX_BLOCK_SIZE = 4096, APPROX_BLOCK_SIZE = 4096,
/** /**
* APPROX_INODE_COST is an approximated disk space used by an inode * APPROX_INODE_COST is an approximated disk space used by an inode
* (directory, file or special device) even if it contains no actual da ta. * (directory, file or special device) even if it contains no actual da ta.
*/ */
APPROX_INODE_COST = 256, APPROX_INODE_COST = 256,
}; };
/** /**
* fill 'disk_stat' with information about the file-system containing 'path'
.
* return error if statvfs() fails or if free disk space becomes critically
low
*/
int disk_stat(const char * path, fm_disk_stat & disk_stat);
/**
* return true if estimated free space is comfortably high enough to write ' bytes_to_write' * return true if estimated free space is comfortably high enough to write ' bytes_to_write'
* if first_check is true, does a more conservative estimation, requiring tw ice more free space than normal * if first_check is true, does a more conservative estimation, requiring tw ice more free space than normal
*/ */
bool enough_free_space(ft_uoff bytes_to_write = 0, bool first_check = false) ; bool enough_free_space(ft_uoff bytes_to_write = 0, bool first_check = false) ;
/** /**
* add bytes_just_written to bytes_copied_since_last_check. * call sync(), then call disk_stat() twice: one time on source_root() and a
* nother on target_root().
* if enough_free_space() returns false, * return error if statvfs() fails or if free disk space becomes critical
* also call check_free_space() and reset bytes_copied_since_last_check to z ly low
ero
*/ */
int periodic_check_free_space(ft_size bytes_just_written = APPROX_INODE_COST , ft_uoff bytes_to_write = 0); int check_free_space();
/** /**
* call disk_stat() twice: one time on source_root() and another on target_r oot(). * fill 'disk_stat' with information about the file-system containing 'path' .
* return error if statvfs() fails or if free disk space becomes critically low * return error if statvfs() fails or if free disk space becomes critically low
*/ */
int check_free_space(); int disk_stat(const char * path, fm_disk_stat & disk_stat);
/** /**
* use some file-system specific trickery to try and free some space. * use some file-system specific trickery to try and free some space.
* currently, it runs 'xfs_fsr <path>' which can free some space on 'xfs' fi le-systems * currently, it runs 'xfs_fsr <path>' which can free some space on 'xfs' fi le-systems
*/ */
void try_to_make_free_space(const char * path); void try_to_make_free_space(const char * path);
/** /**
* fill 'stat' with information about the file/directory/special-device 'pat h' * fill 'stat' with information about the file/directory/special-device 'pat h'
*/ */
int stat(const ft_string & path, ft_stat & stat); int stat(const ft_string & path, ft_stat & stat);
/** /**
* move a single file/socket/device or a whole directory tree * move a single file/socket/device or a whole directory tree
*/ */
int move(const ft_string & source_path, const ft_string & target_path); int move(const ft_string & source_path, const ft_string & target_path);
/** /**
* move the single regurlar file 'source_path' to 'target_path'. * try to rename a file, directory or special-device from 'source_path' to '
target_path'.
*/
int move_rename(const char * source, const char * target);
/**
* move the single regular file 'source_path' to 'target_path'.
*/ */
int move_file(const ft_string & source_path, const ft_stat & source_stat, co nst ft_string & target_path); int move_file(const ft_string & source_path, const ft_stat & source_stat, co nst ft_string & target_path);
/** /**
* move the single special-device 'source_path' to 'target_path'. * move the single special-device 'source_path' to 'target_path'.
*/ */
int move_special(const ft_string & source_path, const ft_stat & source_stat, const ft_string & target_path); int move_special(const ft_string & source_path, const ft_stat & source_stat, const ft_string & target_path);
/** /**
* try to rename a file, directory or special-device from 'source_path' to ' target_path'. * move the single directory 'source_path' to 'target_path'.
*/ */
int move_rename(const char * source, const char * target); int move_dir(const ft_string & source_path, const ft_stat & source_stat, con st ft_string & target_path);
/** /**
* forward or backward copy file/stream contents from in_fd to out_fd. * forward or backward copy file/stream contents from in_fd to out_fd.
* *
* if disk space is low, we copy backward and progressively truncate in_fd t o conserve space: * if disk space is low, we copy backward and progressively truncate in_fd t o conserve space:
* results in heavy fragmentation on target file, but at least we can contin ue * results in heavy fragmentation on target file, but at least we can contin ue
*/ */
int copy_stream(int in_fd, int out_fd, const ft_stat & stat, const char * so urce, const char * target); int copy_stream(int in_fd, int out_fd, const ft_stat & stat, const char * so urce, const char * target);
/** /**
skipping to change at line 177 skipping to change at line 174
int full_write(int out_fd, const char * data, ft_size len, const char * targ et_path); int full_write(int out_fd, const char * data, ft_size len, const char * targ et_path);
/** /**
* check inode_cache for hard links and recreate them. * check inode_cache for hard links and recreate them.
* must be called if and only if stat.st_nlink > 1. * must be called if and only if stat.st_nlink > 1.
* *
* returns EAGAIN if inode was not in inode_cache * returns EAGAIN if inode was not in inode_cache
*/ */
int hard_link(const ft_stat & stat, const ft_string & target_path); int hard_link(const ft_stat & stat, const ft_string & target_path);
/**
* copy the permission bits, owner/group and timestamps from 'stat' to 'targ
et'
*/
int copy_stat(const char * target, const ft_stat & stat);
/** create a target directory */ /** create a target directory */
int create_dir(const ft_string & path); int create_dir(const ft_string & path);
/** /**
* remove a source directory, which must be empty
* exception: will not remove '/lost+found' directory inside source_root()
*/
int remove_dir(const ft_string & path);
/**
* return true if path is the source directory lost+found. * return true if path is the source directory lost+found.
* Treated specially because it is emptied but not removed. * Treated specially because it is emptied but not removed.
*/ */
bool is_source_lost_found(const ft_string & path) const; bool is_source_lost_found(const ft_string & path) const;
/** /**
* return true if path is the target directory lost+found. * return true if path is the target directory lost+found.
* Treated specially because it is allowed to exist already. * Treated specially because it is allowed to exist already.
*/ */
bool is_target_lost_found(const ft_string & path) const; bool is_target_lost_found(const ft_string & path) const;
protected:
/** call ::sync(). slow, but needed to get accurate disk stats when loop dev
ices are involved */
virtual void sync();
/**
* add bytes_just_written to bytes_copied_since_last_check.
*
* if enough_free_space() returns false,
* also call check_free_space() and reset bytes_copied_since_last_check to z
ero
*/
int periodic_check_free_space(ft_uoff bytes_just_written = APPROX_INODE_COST
, ft_uoff bytes_to_write = 0);
/**
* copy the permission bits, owner/group and timestamps from 'stat' to 'targ
et'
*/
int copy_stat(const char * target, const ft_stat & stat);
/**
* copy the contents of single regular file 'source_path' to 'target_path'.
*/
virtual int copy_file_contents(const ft_string & source_path, const ft_stat
& source_stat, const ft_string & target_path);
/**
* remove a regular file inside source directory
*/
virtual int remove_file(const char * source_path);
/**
* remove a special file inside source directory
*/
virtual int remove_special(const char * source_path);
/**
* remove a source directory, which must be empty
* exception: will not remove '/lost+found' directory inside source_root()
*/
virtual int remove_dir(const ft_string & path);
public: public:
/** constructor */ /** constructor */
fm_io_posix(); fm_io_posix();
/** destructor. calls close() */ /** destructor. calls close() */
virtual ~fm_io_posix(); virtual ~fm_io_posix();
/** return true if this fr_io_posix is currently (and correctly) open */ /** return true if this fr_io_posix is currently (and correctly) open */
virtual bool is_open() const; virtual bool is_open() const;
 End of changes. 11 change blocks. 
31 lines changed or deleted 59 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)