mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-22 07:56:33 -05:00
Better handling of return value in handle_create().
This commit is contained in:
parent
a84bd62ee6
commit
5c0b7d2e6c
3 changed files with 27 additions and 19 deletions
6
handle.h
6
handle.h
|
|
@ -30,14 +30,16 @@ struct snapraid_handle {
|
|||
int f; /**< Handle of the file. */
|
||||
struct stat st; /**< Stat info of the opened file. */
|
||||
data_off_t valid_size; /**< Size of the valid data. */
|
||||
int created; /**< If the file was created, or it was already existing. */
|
||||
int created; /**< If the file was created, otherwise it was already existing. */
|
||||
int truncated; /**< If the file was truncated. */
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a file.
|
||||
* The file is created if missing, and opened with write access.
|
||||
* If the file has a different size than expected, it's enlarged or truncated to the correct size.
|
||||
* If the file is truncated 1 is returned.
|
||||
* If the file is created, the handle->created is set.
|
||||
* If the file is truncated, the handle->truncated is set.
|
||||
* The initial size of the file is stored in the file->st struct.
|
||||
* If the file cannot be opened for write access, it's opened with read-only access.
|
||||
* The read-only access works only if the file has already the correct size and doesn't need to be modified.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue