diff options
Diffstat (limited to 'lib/sqfs')
-rw-r--r-- | lib/sqfs/src/io/file.c | 14 | ||||
-rw-r--r-- | lib/sqfs/src/io/istream.c | 10 | ||||
-rw-r--r-- | lib/sqfs/src/io/ostream.c | 12 | ||||
-rw-r--r-- | lib/sqfs/src/io/unix.c | 8 | ||||
-rw-r--r-- | lib/sqfs/src/io/win32.c | 8 |
5 files changed, 26 insertions, 26 deletions
diff --git a/lib/sqfs/src/io/file.c b/lib/sqfs/src/io/file.c index 881730d..27ab5d6 100644 --- a/lib/sqfs/src/io/file.c +++ b/lib/sqfs/src/io/file.c @@ -53,7 +53,7 @@ static void stdio_destroy(sqfs_object_t *base) { sqfs_file_stdio_t *file = (sqfs_file_stdio_t *)base; - sqfs_close_native_file(file->fd); + sqfs_native_file_close(file->fd); free(file); } @@ -79,7 +79,7 @@ static sqfs_object_t *stdio_copy(const sqfs_object_t *base) memcpy(copy, file, size); - if (sqfs_duplicate_native_file(file->fd, ©->fd)) { + if (sqfs_native_file_duplicate(file->fd, ©->fd)) { os_error_t error = get_os_error_state(); free(copy); copy = NULL; @@ -106,7 +106,7 @@ static int stdio_read_at(sqfs_file_t *base, sqfs_u64 offset, if ((offset + size - 1) >= file->size) return SQFS_ERROR_OUT_OF_BOUNDS; - ret = sqfs_seek_native_file(file->fd, offset, SQFS_FILE_SEEK_START); + ret = sqfs_native_file_seek(file->fd, offset, SQFS_FILE_SEEK_START); if (ret) return ret; @@ -131,7 +131,7 @@ static int stdio_write_at(sqfs_file_t *base, sqfs_u64 offset, if (size == 0) return 0; - ret = sqfs_seek_native_file(file->fd, offset, SQFS_FILE_SEEK_START); + ret = sqfs_native_file_seek(file->fd, offset, SQFS_FILE_SEEK_START); if (ret) return ret; @@ -218,7 +218,7 @@ static int stdio_truncate(sqfs_file_t *base, sqfs_u64 size) sqfs_file_stdio_t *file = (sqfs_file_stdio_t *)base; int ret; - ret = sqfs_seek_native_file(file->fd, size, SQFS_FILE_SEEK_START | + ret = sqfs_native_file_seek(file->fd, size, SQFS_FILE_SEEK_START | SQFS_FILE_SEEK_TRUNCATE); if (ret) return ret; @@ -254,7 +254,7 @@ sqfs_file_t *sqfs_open_file(const char *filename, sqfs_u32 flags) sqfs_object_init(file, stdio_destroy, stdio_copy); memcpy(file->name, filename, namelen); - if (sqfs_open_native_file(&file->fd, filename, flags)) + if (sqfs_native_file_open(&file->fd, filename, flags)) goto fail; file_opened = true; @@ -272,7 +272,7 @@ sqfs_file_t *sqfs_open_file(const char *filename, sqfs_u32 flags) fail: err = get_os_error_state(); if (file_opened) - sqfs_close_native_file(file->fd); + sqfs_native_file_close(file->fd); free(file); set_os_error_state(err); return NULL; diff --git a/lib/sqfs/src/io/istream.c b/lib/sqfs/src/io/istream.c index c3399fe..7e1b896 100644 --- a/lib/sqfs/src/io/istream.c +++ b/lib/sqfs/src/io/istream.c @@ -129,7 +129,7 @@ static void file_destroy(sqfs_object_t *obj) { file_istream_t *file = (file_istream_t *)obj; - sqfs_close_native_file(file->fd); + sqfs_native_file_close(file->fd); free(file->path); free(file); } @@ -159,7 +159,7 @@ int sqfs_istream_open_handle(sqfs_istream_t **out, const char *path, return SQFS_ERROR_ALLOC; } - ret = sqfs_duplicate_native_file(fd, &file->fd); + ret = sqfs_native_file_duplicate(fd, &file->fd); if (ret) { os_error_t err = get_os_error_state(); free(file->path); @@ -167,7 +167,7 @@ int sqfs_istream_open_handle(sqfs_istream_t **out, const char *path, set_os_error_state(err); return ret; } - sqfs_close_native_file(fd); + sqfs_native_file_close(fd); strm->get_buffered_data = file_get_buffered_data; strm->advance_buffer = file_advance_buffer; @@ -188,14 +188,14 @@ int sqfs_istream_open_file(sqfs_istream_t **out, const char *path, if (flags & (SQFS_FILE_OPEN_OVERWRITE | SQFS_FILE_OPEN_NO_SPARSE)) return SQFS_ERROR_ARG_INVALID; - ret = sqfs_open_native_file(&fd, path, flags); + ret = sqfs_native_file_open(&fd, path, flags); if (ret) return ret; ret = sqfs_istream_open_handle(out, path, fd, flags); if (ret != 0) { os_error_t err = get_os_error_state(); - sqfs_close_native_file(fd); + sqfs_native_file_close(fd); set_os_error_state(err); } diff --git a/lib/sqfs/src/io/ostream.c b/lib/sqfs/src/io/ostream.c index ba8e29a..139b450 100644 --- a/lib/sqfs/src/io/ostream.c +++ b/lib/sqfs/src/io/ostream.c @@ -86,7 +86,7 @@ static int realize_sparse(file_ostream_t *file) free(buffer); } else { - ret = sqfs_seek_native_file(file->fd, file->sparse_count, + ret = sqfs_native_file_seek(file->fd, file->sparse_count, SQFS_FILE_SEEK_CURRENT | SQFS_FILE_SEEK_TRUNCATE); if (ret) @@ -139,7 +139,7 @@ static void file_destroy(sqfs_object_t *obj) { file_ostream_t *file = (file_ostream_t *)obj; - sqfs_close_native_file(file->fd); + sqfs_native_file_close(file->fd); free(file->path); free(file); } @@ -175,7 +175,7 @@ int sqfs_ostream_open_handle(sqfs_ostream_t **out, const char *path, return SQFS_ERROR_ALLOC; } - ret = sqfs_duplicate_native_file(fd, &file->fd); + ret = sqfs_native_file_duplicate(fd, &file->fd); if (ret) { os_error_t err = get_os_error_state(); free(file->path); @@ -184,7 +184,7 @@ int sqfs_ostream_open_handle(sqfs_ostream_t **out, const char *path, return ret; } - sqfs_close_native_file(fd); + sqfs_native_file_close(fd); file->flags = flags; strm->append = file_append; @@ -205,14 +205,14 @@ int sqfs_ostream_open_file(sqfs_ostream_t **out, const char *path, if (flags & SQFS_FILE_OPEN_READ_ONLY) return SQFS_ERROR_ARG_INVALID; - ret = sqfs_open_native_file(&fd, path, flags); + ret = sqfs_native_file_open(&fd, path, flags); if (ret) return ret; ret = sqfs_ostream_open_handle(out, path, fd, flags); if (ret) { os_error_t err = get_os_error_state(); - sqfs_close_native_file(fd); + sqfs_native_file_close(fd); set_os_error_state(err); return ret; } diff --git a/lib/sqfs/src/io/unix.c b/lib/sqfs/src/io/unix.c index 45af2ce..2e97394 100644 --- a/lib/sqfs/src/io/unix.c +++ b/lib/sqfs/src/io/unix.c @@ -14,7 +14,7 @@ #include <fcntl.h> #include <errno.h> -int sqfs_open_native_file(sqfs_file_handle_t *out, const char *filename, +int sqfs_native_file_open(sqfs_file_handle_t *out, const char *filename, sqfs_u32 flags) { int open_mode; @@ -41,19 +41,19 @@ int sqfs_open_native_file(sqfs_file_handle_t *out, const char *filename, return (*out < 0) ? SQFS_ERROR_IO : 0; } -void sqfs_close_native_file(sqfs_file_handle_t fd) +void sqfs_native_file_close(sqfs_file_handle_t fd) { while (close(fd) != 0 && errno == EINTR) ; } -int sqfs_duplicate_native_file(sqfs_file_handle_t in, sqfs_file_handle_t *out) +int sqfs_native_file_duplicate(sqfs_file_handle_t in, sqfs_file_handle_t *out) { *out = dup(in); return (*out < 0) ? SQFS_ERROR_IO : 0; } -int sqfs_seek_native_file(sqfs_file_handle_t fd, +int sqfs_native_file_seek(sqfs_file_handle_t fd, sqfs_s64 offset, sqfs_u32 flags) { int whence; diff --git a/lib/sqfs/src/io/win32.c b/lib/sqfs/src/io/win32.c index decfd23..abb3a57 100644 --- a/lib/sqfs/src/io/win32.c +++ b/lib/sqfs/src/io/win32.c @@ -14,7 +14,7 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> -int sqfs_open_native_file(sqfs_file_handle_t *out, const char *filename, +int sqfs_native_file_open(sqfs_file_handle_t *out, const char *filename, sqfs_u32 flags) { int access_flags, creation_mode, share_mode; @@ -74,12 +74,12 @@ int sqfs_open_native_file(sqfs_file_handle_t *out, const char *filename, return (*out == INVALID_HANDLE_VALUE) ? SQFS_ERROR_IO : 0; } -void sqfs_close_native_file(sqfs_file_handle_t hnd) +void sqfs_native_file_close(sqfs_file_handle_t hnd) { CloseHandle(hnd); } -int sqfs_duplicate_native_file(sqfs_file_handle_t in, sqfs_file_handle_t *out) +int sqfs_native_file_duplicate(sqfs_file_handle_t in, sqfs_file_handle_t *out) { HANDLE hProc = GetCurrentProcess(); BOOL ret = DuplicateHandle(hProc, in, hProc, out, 0, @@ -88,7 +88,7 @@ int sqfs_duplicate_native_file(sqfs_file_handle_t in, sqfs_file_handle_t *out) return ret ? 0 : SQFS_ERROR_IO; } -int sqfs_seek_native_file(sqfs_file_handle_t fd, +int sqfs_native_file_seek(sqfs_file_handle_t fd, sqfs_s64 offset, sqfs_u32 flags) { LARGE_INTEGER pos; |