From: Erwin de K. <erw...@ph...> - 2006-02-02 17:45:53
|
Hi Bram and others I have implemented the file truncation using the extended approach: 1- perform regular close of the file 2- reopen the file in read mode to avoid calling of p_close_idx() in p_read_hdr() 3- read the header using p_read_hdr() 4- calculate file length 5- close file 6- set file length by a) reopening the file in update mode, b) advancing the file pointer to file length using fio_fp_set_filepointer(), c) calling SetEndOfFile(), d) and closing the file To this end, I have added code to p_close_idx() and I have added a function p_fio_set_end_of_file(const char* filename, fio_offset_t offset) to cpfspd_fio to implement step 6. Currently this is done for all files, so also for files that were opened for reading only. This is not ok, since the date and time attributes of read-only files will be updated. I do not know if it is save to assume in p_close_idx() that if p_files[idx].mode equals p_mode_read, then the file should not be truncated. Any comments on this? How do you want me to send the changes? Shall I submit a patch file through the sourceforge site? Best regards, --Erwin |