mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-17 20:58:34 +02:00
Rename posix driver files/functions for consistency.
The posix driver was developed over time and the naming is not very consistent. Rename the files and functions to work well with other drivers and generally favor longer names since the driver functions are seldom (eventually never) used outside the driver itself.
This commit is contained in:
parent
ab1762663c
commit
fd14ceb399
@ -53,7 +53,7 @@
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Storage refactoring. Posix file functions now differentiate between open and missing errors. Don't use negations in objects below Storage.</p>
|
||||
<p>Storage refactoring. Posix file functions now differentiate between open and missing errors. Don't use negations in objects below Storage. Rename posix driver files/functions for consistency.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
|
@ -55,7 +55,7 @@ These includes are from the src directory. There is no Perl-specific code in th
|
||||
#include "crypto/random.h"
|
||||
#include "perl/config.h"
|
||||
#include "postgres/pageChecksum.h"
|
||||
#include "storage/driver/posix/driver.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Helper macros
|
||||
|
@ -86,10 +86,10 @@ my @stryCFile =
|
||||
'crypto/random.c',
|
||||
'perl/config.c',
|
||||
'postgres/pageChecksum.c',
|
||||
'storage/driver/posix/driver.c',
|
||||
'storage/driver/posix/driverFile.c',
|
||||
'storage/driver/posix/driverRead.c',
|
||||
'storage/driver/posix/driverWrite.c',
|
||||
'storage/driver/posix/storage.c',
|
||||
'storage/driver/posix/common.c',
|
||||
'storage/driver/posix/fileRead.c',
|
||||
'storage/driver/posix/fileWrite.c',
|
||||
'storage/fileRead.c',
|
||||
'storage/fileWrite.c',
|
||||
'storage/helper.c',
|
||||
|
60
src/Makefile
60
src/Makefile
@ -113,10 +113,10 @@ SRCS = \
|
||||
postgres/info.c \
|
||||
postgres/pageChecksum.c \
|
||||
protocol/storage/helper.c \
|
||||
storage/driver/posix/driver.c \
|
||||
storage/driver/posix/driverFile.c \
|
||||
storage/driver/posix/driverRead.c \
|
||||
storage/driver/posix/driverWrite.c \
|
||||
storage/driver/posix/storage.c \
|
||||
storage/driver/posix/common.c \
|
||||
storage/driver/posix/fileRead.c \
|
||||
storage/driver/posix/fileWrite.c \
|
||||
storage/fileRead.c \
|
||||
storage/fileWrite.c \
|
||||
storage/helper.c \
|
||||
@ -142,22 +142,22 @@ install: pgbackrest
|
||||
####################################################################################################################################
|
||||
# Compile rules
|
||||
####################################################################################################################################
|
||||
command/archive/common.o: command/archive/common.c command/archive/common.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h postgres/version.h protocol/storage/helper.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
command/archive/common.o: command/archive/common.c command/archive/common.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h postgres/version.h protocol/storage/helper.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c command/archive/common.c -o command/archive/common.o
|
||||
|
||||
command/archive/get/file.o: command/archive/get/file.c command/archive/common.h command/archive/get/file.h command/control/control.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipDecompress.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/infoArchive.h info/infoPg.h postgres/info.h protocol/storage/helper.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
command/archive/get/file.o: command/archive/get/file.c command/archive/common.h command/archive/get/file.h command/control/control.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h compress/gzip.h compress/gzipDecompress.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/infoArchive.h info/infoPg.h postgres/info.h protocol/storage/helper.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c command/archive/get/file.c -o command/archive/get/file.o
|
||||
|
||||
command/archive/get/get.o: command/archive/get/get.c command/archive/common.h command/archive/get/file.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/info.h protocol/storage/helper.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
command/archive/get/get.o: command/archive/get/get.c command/archive/common.h command/archive/get/file.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/info.h protocol/storage/helper.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c command/archive/get/get.c -o command/archive/get/get.o
|
||||
|
||||
command/archive/push/push.o: command/archive/push/push.c command/archive/common.h command/command.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
command/archive/push/push.o: command/archive/push/push.c command/archive/common.h command/command.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c command/archive/push/push.c -o command/archive/push/push.o
|
||||
|
||||
command/command.o: command/command.c common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h version.h
|
||||
$(CC) $(CFLAGS) -c command/command.c -o command/command.o
|
||||
|
||||
command/control/control.o: command/control/control.c command/control/control.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
command/control/control.o: command/control/control.c command/control/control.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c command/control/control.c -o command/control/control.o
|
||||
|
||||
command/help/help.o: command/help/help.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/handle.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h version.h
|
||||
@ -181,7 +181,7 @@ common/exit.o: common/exit.c command/command.h common/debug.h common/error.auto.
|
||||
common/fork.o: common/fork.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h
|
||||
$(CC) $(CFLAGS) -c common/fork.c -o common/fork.o
|
||||
|
||||
common/ini.o: common/ini.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
common/ini.o: common/ini.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c common/ini.c -o common/ini.o
|
||||
|
||||
common/io/bufferRead.o: common/io/bufferRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferRead.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||
@ -214,7 +214,7 @@ common/io/read.o: common/io/read.c common/debug.h common/error.auto.h common/err
|
||||
common/io/write.o: common/io/write.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||
$(CC) $(CFLAGS) -c common/io/write.c -o common/io/write.o
|
||||
|
||||
common/lock.o: common/lock.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handle.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
common/lock.o: common/lock.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handle.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c common/lock.c -o common/lock.o
|
||||
|
||||
common/log.o: common/log.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/time.h common/type/convert.h
|
||||
@ -280,7 +280,7 @@ config/define.o: config/define.c common/assert.h common/debug.h common/error.aut
|
||||
config/load.o: config/load.c command/command.h common/debug.h common/error.auto.h common/error.h common/io/io.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h
|
||||
$(CC) $(CFLAGS) -c config/load.c -o config/load.o
|
||||
|
||||
config/parse.o: config/parse.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/parse.auto.c config/parse.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
config/parse.o: config/parse.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/parse.auto.c config/parse.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c config/parse.c -o config/parse.o
|
||||
|
||||
crypto/cipherBlock.o: crypto/cipherBlock.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/convert.h crypto/cipher.h crypto/cipherBlock.h crypto/crypto.h crypto/random.h
|
||||
@ -295,13 +295,13 @@ crypto/hash.o: crypto/hash.c common/debug.h common/error.auto.h common/error.h c
|
||||
crypto/random.o: crypto/random.c common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h crypto/random.h
|
||||
$(CC) $(CFLAGS) -c crypto/random.c -o crypto/random.o
|
||||
|
||||
info/info.o: info/info.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/hash.h info/info.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
info/info.o: info/info.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/hash.h info/info.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c info/info.c -o info/info.o
|
||||
|
||||
info/infoArchive.o: info/infoArchive.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/infoArchive.h info/infoPg.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
info/infoArchive.o: info/infoArchive.c common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/infoArchive.h info/infoPg.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c info/infoArchive.c -o info/infoArchive.o
|
||||
|
||||
info/infoPg.o: info/infoPg.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/hash.h info/info.h info/infoPg.h postgres/info.h postgres/version.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
info/infoPg.o: info/infoPg.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/hash.h info/info.h info/infoPg.h postgres/info.h postgres/version.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c info/infoPg.c -o info/infoPg.o
|
||||
|
||||
main.o: main.c command/archive/get/get.h command/archive/push/push.h command/command.h command/help/help.h common/debug.h common/error.auto.h common/error.h common/exit.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h version.h
|
||||
@ -310,38 +310,38 @@ main.o: main.c command/archive/get/get.h command/archive/push/push.h command/com
|
||||
perl/config.o: perl/config.c common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h
|
||||
$(CC) $(CFLAGS) -c perl/config.c -o perl/config.o
|
||||
|
||||
perl/exec.o: perl/exec.c ../libc/LibC.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h crypto/cipher.h crypto/cipherBlock.h crypto/hash.h crypto/random.h perl/config.h perl/embed.auto.c perl/exec.h perl/libc.auto.c postgres/pageChecksum.h storage/driver/posix/driver.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/info.h version.h ../libc/xs/common/encode.xsh ../libc/xs/crypto/cipherBlock.xsh ../libc/xs/crypto/hash.xsh
|
||||
perl/exec.o: perl/exec.c ../libc/LibC.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h crypto/cipher.h crypto/cipherBlock.h crypto/hash.h crypto/random.h perl/config.h perl/embed.auto.c perl/exec.h perl/libc.auto.c postgres/pageChecksum.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/info.h version.h ../libc/xs/common/encode.xsh ../libc/xs/crypto/cipherBlock.xsh ../libc/xs/crypto/hash.xsh
|
||||
$(CC) $(CFLAGS) -c perl/exec.c -o perl/exec.o
|
||||
|
||||
postgres/info.o: postgres/info.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h postgres/info.h postgres/type.h postgres/version.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
postgres/info.o: postgres/info.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h postgres/info.h postgres/type.h postgres/version.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c postgres/info.c -o postgres/info.o
|
||||
|
||||
postgres/pageChecksum.o: postgres/pageChecksum.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h postgres/pageChecksum.h postgres/type.h
|
||||
$(CC) $(CFLAGS) -funroll-loops -ftree-vectorize -c postgres/pageChecksum.c -o postgres/pageChecksum.o
|
||||
|
||||
protocol/storage/helper.o: protocol/storage/helper.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/storage/helper.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h version.h
|
||||
protocol/storage/helper.o: protocol/storage/helper.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/storage/helper.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c protocol/storage/helper.c -o protocol/storage/helper.o
|
||||
|
||||
storage/driver/posix/driver.o: storage/driver/posix/driver.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/driver.h storage/driver/posix/driverFile.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c storage/driver/posix/driver.c -o storage/driver/posix/driver.o
|
||||
storage/driver/posix/common.o: storage/driver/posix/common.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/driver/posix/common.h
|
||||
$(CC) $(CFLAGS) -c storage/driver/posix/common.c -o storage/driver/posix/common.o
|
||||
|
||||
storage/driver/posix/driverFile.o: storage/driver/posix/driverFile.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/driver/posix/driverFile.h
|
||||
$(CC) $(CFLAGS) -c storage/driver/posix/driverFile.c -o storage/driver/posix/driverFile.o
|
||||
storage/driver/posix/fileRead.o: storage/driver/posix/fileRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/driver/posix/common.h storage/driver/posix/fileRead.h
|
||||
$(CC) $(CFLAGS) -c storage/driver/posix/fileRead.c -o storage/driver/posix/fileRead.o
|
||||
|
||||
storage/driver/posix/driverRead.o: storage/driver/posix/driverRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/driver/posix/driverFile.h storage/driver/posix/driverRead.h
|
||||
$(CC) $(CFLAGS) -c storage/driver/posix/driverRead.c -o storage/driver/posix/driverRead.o
|
||||
storage/driver/posix/fileWrite.o: storage/driver/posix/fileWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/common.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileWrite.h storage/info.h version.h
|
||||
$(CC) $(CFLAGS) -c storage/driver/posix/fileWrite.c -o storage/driver/posix/fileWrite.o
|
||||
|
||||
storage/driver/posix/driverWrite.o: storage/driver/posix/driverWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/driver.h storage/driver/posix/driverFile.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileWrite.h storage/info.h version.h
|
||||
$(CC) $(CFLAGS) -c storage/driver/posix/driverWrite.c -o storage/driver/posix/driverWrite.o
|
||||
storage/driver/posix/storage.o: storage/driver/posix/storage.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/common.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c storage/driver/posix/storage.c -o storage/driver/posix/storage.o
|
||||
|
||||
storage/fileRead.o: storage/fileRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/driver/posix/driverRead.h storage/fileRead.h
|
||||
storage/fileRead.o: storage/fileRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/driver/posix/fileRead.h storage/fileRead.h
|
||||
$(CC) $(CFLAGS) -c storage/fileRead.c -o storage/fileRead.o
|
||||
|
||||
storage/fileWrite.o: storage/fileWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/driver/posix/driverWrite.h storage/fileWrite.h version.h
|
||||
storage/fileWrite.o: storage/fileWrite.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/driver/posix/fileWrite.h storage/fileWrite.h version.h
|
||||
$(CC) $(CFLAGS) -c storage/fileWrite.c -o storage/fileWrite.o
|
||||
|
||||
storage/helper.o: storage/helper.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
storage/helper.o: storage/helper.c common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c storage/helper.c -o storage/helper.o
|
||||
|
||||
storage/storage.o: storage/storage.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/driver/posix/driver.h storage/driver/posix/driverRead.h storage/driver/posix/driverWrite.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h version.h
|
||||
storage/storage.o: storage/storage.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h version.h
|
||||
$(CC) $(CFLAGS) -c storage/storage.c -o storage/storage.o
|
||||
|
@ -60,7 +60,7 @@ lockAcquireFile(const String *lockFile, double lockTimeout, bool failOnNoLock)
|
||||
do
|
||||
{
|
||||
// Attempt to open the file
|
||||
if ((result = open(strPtr(lockFile), O_WRONLY | O_CREAT, STORAGE_FILE_MODE_DEFAULT)) == -1)
|
||||
if ((result = open(strPtr(lockFile), O_WRONLY | O_CREAT, STORAGE_MODE_FILE_DEFAULT)) == -1)
|
||||
{
|
||||
// Save the error for reporting outside the loop
|
||||
errNo = errno;
|
||||
|
@ -63,7 +63,7 @@ These includes are from the src directory. There is no Perl-specific code in th
|
||||
#include "crypto/random.h"
|
||||
#include "perl/config.h"
|
||||
#include "postgres/pageChecksum.h"
|
||||
#include "storage/driver/posix/driver.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Helper macros
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Routines For Posix
|
||||
Posix Common File Routines
|
||||
***********************************************************************************************************************************/
|
||||
// So fsync() will work on older glib versions
|
||||
#ifndef _POSIX_C_SOURCE
|
||||
@ -11,7 +11,7 @@ Storage File Routines For Posix
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/debug.h"
|
||||
#include "storage/driver/posix/driverFile.h"
|
||||
#include "storage/driver/posix/common.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Open a file
|
||||
@ -19,7 +19,7 @@ Open a file
|
||||
Returns the handle of the open file, or -1 for reads if the file is missing and -1 for writes if the path is mssing.
|
||||
***********************************************************************************************************************************/
|
||||
int
|
||||
storageFilePosixOpen(
|
||||
storageDriverPosixFileOpen(
|
||||
const String *name, int flags, mode_t mode, bool ignoreMissing, bool file, const char *purpose)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
@ -55,7 +55,7 @@ storageFilePosixOpen(
|
||||
Sync a file/directory handle
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFilePosixSync(int handle, const String *name, bool file, bool closeOnError)
|
||||
storageDriverPosixFileSync(int handle, const String *name, bool file, bool closeOnError)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(INT, handle);
|
||||
@ -85,7 +85,7 @@ storageFilePosixSync(int handle, const String *name, bool file, bool closeOnErro
|
||||
Close a file/directory handle
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFilePosixClose(int handle, const String *name, bool file)
|
||||
storageDriverPosixFileClose(int handle, const String *name, bool file)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(INT, handle);
|
@ -1,8 +1,8 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Routines For Posix
|
||||
Posix Common File Routines
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_POSIX_DRIVERFILE_H
|
||||
#define STORAGE_DRIVER_POSIX_DRIVERFILE_H
|
||||
#ifndef STORAGE_DRIVER_POSIX_COMMON_H
|
||||
#define STORAGE_DRIVER_POSIX_COMMON_H
|
||||
|
||||
#include "common/error.h"
|
||||
#include "common/type/string.h"
|
||||
@ -10,8 +10,8 @@ Storage File Routines For Posix
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
int storageFilePosixOpen(const String *name, int flags, mode_t mode, bool ignoreMissing, bool file, const char *purpose);
|
||||
void storageFilePosixSync(int handle, const String *name, bool file, bool closeOnError);
|
||||
void storageFilePosixClose(int handle, const String *name, bool file);
|
||||
int storageDriverPosixFileOpen(const String *name, int flags, mode_t mode, bool ignoreMissing, bool file, const char *purpose);
|
||||
void storageDriverPosixFileSync(int handle, const String *name, bool file, bool closeOnError);
|
||||
void storageDriverPosixFileClose(int handle, const String *name, bool file);
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Read Driver For Posix
|
||||
Posix Storage File Read Driver
|
||||
***********************************************************************************************************************************/
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
@ -8,13 +8,13 @@ Storage File Read Driver For Posix
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "storage/driver/posix/driverFile.h"
|
||||
#include "storage/driver/posix/driverRead.h"
|
||||
#include "storage/driver/posix/common.h"
|
||||
#include "storage/driver/posix/fileRead.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Storage file structure
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
struct StorageFileReadPosix
|
||||
struct StorageDriverPosixFileRead
|
||||
{
|
||||
MemContext *memContext;
|
||||
|
||||
@ -28,8 +28,8 @@ struct StorageFileReadPosix
|
||||
/***********************************************************************************************************************************
|
||||
Create a new file
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileReadPosix *
|
||||
storageFileReadPosixNew(const String *name, bool ignoreMissing)
|
||||
StorageDriverPosixFileRead *
|
||||
storageDriverPosixFileReadNew(const String *name, bool ignoreMissing)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STRING, name);
|
||||
@ -38,12 +38,12 @@ storageFileReadPosixNew(const String *name, bool ignoreMissing)
|
||||
FUNCTION_TEST_ASSERT(name != NULL);
|
||||
FUNCTION_DEBUG_END();
|
||||
|
||||
StorageFileReadPosix *this = NULL;
|
||||
StorageDriverPosixFileRead *this = NULL;
|
||||
|
||||
// Create the file object
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageFileReadPosix")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageDriverPosixFileRead")
|
||||
{
|
||||
this = memNew(sizeof(StorageFileReadPosix));
|
||||
this = memNew(sizeof(StorageDriverPosixFileRead));
|
||||
this->memContext = MEM_CONTEXT_NEW();
|
||||
this->name = strDup(name);
|
||||
this->ignoreMissing = ignoreMissing;
|
||||
@ -52,17 +52,17 @@ storageFileReadPosixNew(const String *name, bool ignoreMissing)
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
FUNCTION_DEBUG_RESULT(STORAGE_FILE_READ_POSIX, this);
|
||||
FUNCTION_DEBUG_RESULT(STORAGE_DRIVER_POSIX_FILE_READ, this);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Open the file
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileReadPosixOpen(StorageFileReadPosix *this)
|
||||
storageDriverPosixFileReadOpen(StorageDriverPosixFileRead *this)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_READ_POSIX, this);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_READ, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_ASSERT(this->handle == -1);
|
||||
@ -71,12 +71,12 @@ storageFileReadPosixOpen(StorageFileReadPosix *this)
|
||||
bool result = false;
|
||||
|
||||
// Open the file and handle errors
|
||||
this->handle = storageFilePosixOpen(this->name, O_RDONLY, 0, this->ignoreMissing, true, "read");
|
||||
this->handle = storageDriverPosixFileOpen(this->name, O_RDONLY, 0, this->ignoreMissing, true, "read");
|
||||
|
||||
// On success set free callback to ensure file handle is freed
|
||||
if (this->handle != -1)
|
||||
{
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageFileReadPosixFree, this);
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageDriverPosixFileReadFree, this);
|
||||
result = true;
|
||||
}
|
||||
|
||||
@ -87,10 +87,10 @@ storageFileReadPosixOpen(StorageFileReadPosix *this)
|
||||
Read from a file
|
||||
***********************************************************************************************************************************/
|
||||
size_t
|
||||
storageFileReadPosix(StorageFileReadPosix *this, Buffer *buffer)
|
||||
storageDriverPosixFileRead(StorageDriverPosixFileRead *this, Buffer *buffer)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_READ_POSIX, this);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_READ, this);
|
||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
||||
|
||||
FUNCTION_DEBUG_ASSERT(this != NULL && this->handle != -1);
|
||||
@ -126,10 +126,10 @@ storageFileReadPosix(StorageFileReadPosix *this, Buffer *buffer)
|
||||
Close the file
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFileReadPosixClose(StorageFileReadPosix *this)
|
||||
storageDriverPosixFileReadClose(StorageDriverPosixFileRead *this)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_READ_POSIX, this);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_READ, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_DEBUG_END();
|
||||
@ -138,7 +138,7 @@ storageFileReadPosixClose(StorageFileReadPosix *this)
|
||||
if (this->handle != -1)
|
||||
{
|
||||
// Close the file
|
||||
storageFilePosixClose(this->handle, this->name, true);
|
||||
storageDriverPosixFileClose(this->handle, this->name, true);
|
||||
|
||||
this->handle = -1;
|
||||
}
|
||||
@ -150,10 +150,10 @@ storageFileReadPosixClose(StorageFileReadPosix *this)
|
||||
Has file reached EOF?
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileReadPosixEof(StorageFileReadPosix *this)
|
||||
storageDriverPosixFileReadEof(const StorageDriverPosixFileRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_READ, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -165,10 +165,10 @@ storageFileReadPosixEof(StorageFileReadPosix *this)
|
||||
Should a missing file be ignored?
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileReadPosixIgnoreMissing(StorageFileReadPosix *this)
|
||||
storageDriverPosixFileReadIgnoreMissing(const StorageDriverPosixFileRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_READ, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -180,10 +180,10 @@ storageFileReadPosixIgnoreMissing(StorageFileReadPosix *this)
|
||||
File name
|
||||
***********************************************************************************************************************************/
|
||||
const String *
|
||||
storageFileReadPosixName(StorageFileReadPosix *this)
|
||||
storageDriverPosixFileReadName(const StorageDriverPosixFileRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_READ, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -195,15 +195,15 @@ storageFileReadPosixName(StorageFileReadPosix *this)
|
||||
Free the file
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFileReadPosixFree(StorageFileReadPosix *this)
|
||||
storageDriverPosixFileReadFree(StorageDriverPosixFileRead *this)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_READ_POSIX, this);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_READ, this);
|
||||
FUNCTION_DEBUG_END();
|
||||
|
||||
if (this != NULL)
|
||||
{
|
||||
storageFileReadPosixClose(this);
|
||||
storageDriverPosixFileReadClose(this);
|
||||
memContextFree(this->memContext);
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Read Driver For Posix
|
||||
Posix Storage File Read Driver
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_POSIX_DRIVERREAD_H
|
||||
#define STORAGE_DRIVER_POSIX_DRIVERREAD_H
|
||||
#ifndef STORAGE_DRIVER_POSIX_FILEREAD_H
|
||||
#define STORAGE_DRIVER_POSIX_FILEREAD_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Read file object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileReadPosix StorageFileReadPosix;
|
||||
typedef struct StorageDriverPosixFileRead StorageDriverPosixFileRead;
|
||||
|
||||
#include "common/type/buffer.h"
|
||||
#include "common/type/string.h"
|
||||
@ -15,33 +15,33 @@ typedef struct StorageFileReadPosix StorageFileReadPosix;
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileReadPosix *storageFileReadPosixNew(const String *name, bool ignoreMissing);
|
||||
StorageDriverPosixFileRead *storageDriverPosixFileReadNew(const String *name, bool ignoreMissing);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
bool storageFileReadPosixOpen(StorageFileReadPosix *this);
|
||||
size_t storageFileReadPosix(StorageFileReadPosix *this, Buffer *buffer);
|
||||
void storageFileReadPosixClose(StorageFileReadPosix *this);
|
||||
bool storageDriverPosixFileReadOpen(StorageDriverPosixFileRead *this);
|
||||
size_t storageDriverPosixFileRead(StorageDriverPosixFileRead *this, Buffer *buffer);
|
||||
void storageDriverPosixFileReadClose(StorageDriverPosixFileRead *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Getters
|
||||
***********************************************************************************************************************************/
|
||||
bool storageFileReadPosixEof(StorageFileReadPosix *this);
|
||||
bool storageFileReadPosixIgnoreMissing(StorageFileReadPosix *this);
|
||||
const String *storageFileReadPosixName(StorageFileReadPosix *this);
|
||||
bool storageDriverPosixFileReadEof(const StorageDriverPosixFileRead *this);
|
||||
bool storageDriverPosixFileReadIgnoreMissing(const StorageDriverPosixFileRead *this);
|
||||
const String *storageDriverPosixFileReadName(const StorageDriverPosixFileRead *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Destructor
|
||||
***********************************************************************************************************************************/
|
||||
void storageFileReadPosixFree(StorageFileReadPosix *this);
|
||||
void storageDriverPosixFileReadFree(StorageDriverPosixFileRead *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_DEBUG_STORAGE_FILE_READ_POSIX_TYPE \
|
||||
StorageFileReadPosix *
|
||||
#define FUNCTION_DEBUG_STORAGE_FILE_READ_POSIX_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageFileReadPosix", buffer, bufferSize)
|
||||
#define FUNCTION_DEBUG_STORAGE_DRIVER_POSIX_FILE_READ_TYPE \
|
||||
StorageDriverPosixFileRead *
|
||||
#define FUNCTION_DEBUG_STORAGE_DRIVER_POSIX_FILE_READ_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageDriverPosixFileRead", buffer, bufferSize)
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Write Driver For Posix
|
||||
Posix Storage File Write Driver
|
||||
***********************************************************************************************************************************/
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
@ -9,15 +9,15 @@ Storage File Write Driver For Posix
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "storage/driver/posix/driverFile.h"
|
||||
#include "storage/driver/posix/driverWrite.h"
|
||||
#include "storage/driver/posix/driver.h"
|
||||
#include "storage/driver/posix/common.h"
|
||||
#include "storage/driver/posix/fileWrite.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/fileWrite.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Storage file structure
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
struct StorageFileWritePosix
|
||||
struct StorageDriverPosixFileWrite
|
||||
{
|
||||
MemContext *memContext;
|
||||
|
||||
@ -45,8 +45,8 @@ Since open is called more than once use constants to make sure these parameters
|
||||
/***********************************************************************************************************************************
|
||||
Create a new file
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWritePosix *
|
||||
storageFileWritePosixNew(
|
||||
StorageDriverPosixFileWrite *
|
||||
storageDriverPosixFileWriteNew(
|
||||
const String *name, mode_t modeFile, mode_t modePath, bool createPath, bool syncFile, bool syncPath, bool atomic)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
@ -61,14 +61,14 @@ storageFileWritePosixNew(
|
||||
FUNCTION_TEST_ASSERT(name != NULL);
|
||||
FUNCTION_DEBUG_END();
|
||||
|
||||
StorageFileWritePosix *this = NULL;
|
||||
StorageDriverPosixFileWrite *this = NULL;
|
||||
|
||||
ASSERT_DEBUG(name != NULL);
|
||||
|
||||
// Create the file
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageFileWritePosix")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageDriverPosixFileWrite")
|
||||
{
|
||||
this = memNew(sizeof(StorageFileWritePosix));
|
||||
this = memNew(sizeof(StorageDriverPosixFileWrite));
|
||||
this->memContext = MEM_CONTEXT_NEW();
|
||||
this->path = strPath(name);
|
||||
this->name = strDup(name);
|
||||
@ -84,24 +84,24 @@ storageFileWritePosixNew(
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
FUNCTION_DEBUG_RESULT(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_DEBUG_RESULT(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Open the file
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFileWritePosixOpen(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteOpen(StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_ASSERT(this->handle == -1);
|
||||
FUNCTION_DEBUG_END();
|
||||
|
||||
// Open the file and handle errors
|
||||
this->handle = storageFilePosixOpen(
|
||||
this->handle = storageDriverPosixFileOpen(
|
||||
this->nameTmp, FILE_OPEN_FLAGS, this->modeFile, this->createPath, true, FILE_OPEN_PURPOSE);
|
||||
|
||||
// If path is missing
|
||||
@ -111,12 +111,12 @@ storageFileWritePosixOpen(StorageFileWritePosix *this)
|
||||
storageDriverPosixPathCreate(this->path, false, false, this->modePath);
|
||||
|
||||
// Try the open again
|
||||
this->handle = storageFilePosixOpen(
|
||||
this->handle = storageDriverPosixFileOpen(
|
||||
this->nameTmp, FILE_OPEN_FLAGS, this->modeFile, false, true, FILE_OPEN_PURPOSE);
|
||||
}
|
||||
// On success set free callback to ensure file handle is freed
|
||||
else
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageFileWritePosixFree, this);
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageDriverPosixFileWriteFree, this);
|
||||
|
||||
FUNCTION_DEBUG_RESULT_VOID();
|
||||
}
|
||||
@ -125,10 +125,10 @@ storageFileWritePosixOpen(StorageFileWritePosix *this)
|
||||
Write to a file
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFileWritePosix(StorageFileWritePosix *this, const Buffer *buffer)
|
||||
storageDriverPosixFileWrite(StorageDriverPosixFileWrite *this, const Buffer *buffer)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
FUNCTION_DEBUG_PARAM(BUFFER, buffer);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
@ -147,10 +147,10 @@ storageFileWritePosix(StorageFileWritePosix *this, const Buffer *buffer)
|
||||
Close the file
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFileWritePosixClose(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteClose(StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_DEBUG_END();
|
||||
@ -160,10 +160,10 @@ storageFileWritePosixClose(StorageFileWritePosix *this)
|
||||
{
|
||||
// Sync the file
|
||||
if (this->syncFile)
|
||||
storageFilePosixSync(this->handle, this->name, true, false);
|
||||
storageDriverPosixFileSync(this->handle, this->name, true, false);
|
||||
|
||||
// Close the file
|
||||
storageFilePosixClose(this->handle, this->name, true);
|
||||
storageDriverPosixFileClose(this->handle, this->name, true);
|
||||
|
||||
// Rename from temp file
|
||||
if (this->atomic)
|
||||
@ -189,10 +189,10 @@ Will the file be written atomically?
|
||||
For the posix driver this means writing to a temp file first and then renaming once it is closed and synced.
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileWritePosixAtomic(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteAtomic(const StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -204,10 +204,10 @@ storageFileWritePosixAtomic(StorageFileWritePosix *this)
|
||||
Will the path be created for the file if it does not exist?
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileWritePosixCreatePath(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteCreatePath(const StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -219,10 +219,10 @@ storageFileWritePosixCreatePath(StorageFileWritePosix *this)
|
||||
Mode for the file to be created
|
||||
***********************************************************************************************************************************/
|
||||
mode_t
|
||||
storageFileWritePosixModeFile(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteModeFile(const StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -234,10 +234,10 @@ storageFileWritePosixModeFile(StorageFileWritePosix *this)
|
||||
Mode for any paths that are created while writing the file
|
||||
***********************************************************************************************************************************/
|
||||
mode_t
|
||||
storageFileWritePosixModePath(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteModePath(const StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -249,10 +249,10 @@ storageFileWritePosixModePath(StorageFileWritePosix *this)
|
||||
File name
|
||||
***********************************************************************************************************************************/
|
||||
const String *
|
||||
storageFileWritePosixName(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteName(const StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -264,10 +264,10 @@ storageFileWritePosixName(StorageFileWritePosix *this)
|
||||
File path
|
||||
***********************************************************************************************************************************/
|
||||
const String *
|
||||
storageFileWritePosixPath(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWritePath(const StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -279,10 +279,10 @@ storageFileWritePosixPath(StorageFileWritePosix *this)
|
||||
Will the file be synced after it is closed?
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileWritePosixSyncFile(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteSyncFile(const StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -294,10 +294,10 @@ storageFileWritePosixSyncFile(StorageFileWritePosix *this)
|
||||
Will the directory be synced to disk after the write is completed?
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileWritePosixSyncPath(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteSyncPath(const StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
@ -309,15 +309,15 @@ storageFileWritePosixSyncPath(StorageFileWritePosix *this)
|
||||
Free the file
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFileWritePosixFree(StorageFileWritePosix *this)
|
||||
storageDriverPosixFileWriteFree(StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_WRITE_POSIX, this);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, this);
|
||||
FUNCTION_DEBUG_END();
|
||||
|
||||
if (this != NULL)
|
||||
{
|
||||
storageFileWritePosixClose(this);
|
||||
storageDriverPosixFileWriteClose(this);
|
||||
memContextFree(this->memContext);
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Write Driver For Posix
|
||||
Posix Storage File Write Driver
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_POSIX_DRIVERWRITE_H
|
||||
#define STORAGE_DRIVER_POSIX_DRIVERWRITE_H
|
||||
#ifndef STORAGE_DRIVER_POSIX_FILEWRITE_H
|
||||
#define STORAGE_DRIVER_POSIX_FILEWRITE_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Write file object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileWritePosix StorageFileWritePosix;
|
||||
typedef struct StorageDriverPosixFileWrite StorageDriverPosixFileWrite;
|
||||
|
||||
#include "common/type/buffer.h"
|
||||
#include "common/type/string.h"
|
||||
@ -17,39 +17,39 @@ typedef struct StorageFileWritePosix StorageFileWritePosix;
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWritePosix *storageFileWritePosixNew(
|
||||
StorageDriverPosixFileWrite *storageDriverPosixFileWriteNew(
|
||||
const String *name, mode_t modeFile, mode_t modePath, bool createPath, bool syncFile, bool syncPath, bool atomic);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
void storageFileWritePosixOpen(StorageFileWritePosix *this);
|
||||
void storageFileWritePosix(StorageFileWritePosix *this, const Buffer *buffer);
|
||||
void storageFileWritePosixClose(StorageFileWritePosix *this);
|
||||
void storageDriverPosixFileWriteOpen(StorageDriverPosixFileWrite *this);
|
||||
void storageDriverPosixFileWrite(StorageDriverPosixFileWrite *this, const Buffer *buffer);
|
||||
void storageDriverPosixFileWriteClose(StorageDriverPosixFileWrite *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Getters
|
||||
***********************************************************************************************************************************/
|
||||
bool storageFileWritePosixAtomic(StorageFileWritePosix *this);
|
||||
bool storageFileWritePosixCreatePath(StorageFileWritePosix *this);
|
||||
mode_t storageFileWritePosixModeFile(StorageFileWritePosix *this);
|
||||
mode_t storageFileWritePosixModePath(StorageFileWritePosix *this);
|
||||
const String *storageFileWritePosixName(StorageFileWritePosix *this);
|
||||
const String *storageFileWritePosixPath(StorageFileWritePosix *this);
|
||||
bool storageFileWritePosixSyncFile(StorageFileWritePosix *this);
|
||||
bool storageFileWritePosixSyncPath(StorageFileWritePosix *this);
|
||||
bool storageDriverPosixFileWriteAtomic(const StorageDriverPosixFileWrite *this);
|
||||
bool storageDriverPosixFileWriteCreatePath(const StorageDriverPosixFileWrite *this);
|
||||
mode_t storageDriverPosixFileWriteModeFile(const StorageDriverPosixFileWrite *this);
|
||||
mode_t storageDriverPosixFileWriteModePath(const StorageDriverPosixFileWrite *this);
|
||||
const String *storageDriverPosixFileWriteName(const StorageDriverPosixFileWrite *this);
|
||||
const String *storageDriverPosixFileWritePath(const StorageDriverPosixFileWrite *this);
|
||||
bool storageDriverPosixFileWriteSyncFile(const StorageDriverPosixFileWrite *this);
|
||||
bool storageDriverPosixFileWriteSyncPath(const StorageDriverPosixFileWrite *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Destructor
|
||||
***********************************************************************************************************************************/
|
||||
void storageFileWritePosixFree(StorageFileWritePosix *this);
|
||||
void storageDriverPosixFileWriteFree(StorageDriverPosixFileWrite *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_DEBUG_STORAGE_FILE_WRITE_POSIX_TYPE \
|
||||
StorageFileWritePosix *
|
||||
#define FUNCTION_DEBUG_STORAGE_FILE_WRITE_POSIX_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageFileWritePosix", buffer, bufferSize)
|
||||
#define FUNCTION_DEBUG_STORAGE_DRIVER_POSIX_FILE_WRITE_TYPE \
|
||||
StorageDriverPosixFileWrite *
|
||||
#define FUNCTION_DEBUG_STORAGE_DRIVER_POSIX_FILE_WRITE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageDriverPosixFileWrite", buffer, bufferSize)
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage Driver Posix
|
||||
Posix Storage Driver
|
||||
***********************************************************************************************************************************/
|
||||
// So lstat() will work on older glib versions
|
||||
#ifndef _POSIX_C_SOURCE
|
||||
@ -17,8 +17,8 @@ Storage Driver Posix
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/regExp.h"
|
||||
#include "storage/driver/posix/driver.h"
|
||||
#include "storage/driver/posix/driverFile.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/driver/posix/common.h"
|
||||
#include "storage/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -171,11 +171,11 @@ storageDriverPosixList(const String *path, bool errorOnMissing, const String *ex
|
||||
Move a file
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageDriverPosixMove(StorageFileReadPosix *source, StorageFileWritePosix *destination)
|
||||
storageDriverPosixMove(StorageDriverPosixFileRead *source, StorageDriverPosixFileWrite *destination)
|
||||
{
|
||||
FUNCTION_DEBUG_BEGIN(logLevelTrace);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_READ_POSIX, source);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_FILE_WRITE_POSIX, destination);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_READ, source);
|
||||
FUNCTION_DEBUG_PARAM(STORAGE_DRIVER_POSIX_FILE_WRITE, destination);
|
||||
|
||||
FUNCTION_TEST_ASSERT(source != NULL);
|
||||
FUNCTION_TEST_ASSERT(destination != NULL);
|
||||
@ -185,9 +185,9 @@ storageDriverPosixMove(StorageFileReadPosix *source, StorageFileWritePosix *dest
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
const String *sourceFile = storageFileReadPosixName(source);
|
||||
const String *destinationFile = storageFileWritePosixName(destination);
|
||||
const String *destinationPath = storageFileWritePosixPath(destination);
|
||||
const String *sourceFile = storageDriverPosixFileReadName(source);
|
||||
const String *destinationFile = storageDriverPosixFileWriteName(destination);
|
||||
const String *destinationPath = storageDriverPosixFileWritePath(destination);
|
||||
|
||||
// Attempt to move the file
|
||||
if (rename(strPtr(sourceFile), strPtr(destinationFile)) == -1)
|
||||
@ -198,13 +198,13 @@ storageDriverPosixMove(StorageFileReadPosix *source, StorageFileWritePosix *dest
|
||||
if (!storageDriverPosixExists(sourceFile))
|
||||
THROW_SYS_ERROR_FMT(FileMissingError, "unable to move missing file '%s'", strPtr(sourceFile));
|
||||
|
||||
if (!storageFileWritePosixCreatePath(destination))
|
||||
if (!storageDriverPosixFileWriteCreatePath(destination))
|
||||
{
|
||||
THROW_SYS_ERROR_FMT(
|
||||
PathMissingError, "unable to move '%s' to missing path '%s'", strPtr(sourceFile), strPtr(destinationPath));
|
||||
}
|
||||
|
||||
storageDriverPosixPathCreate(destinationPath, false, false, storageFileWritePosixModePath(destination));
|
||||
storageDriverPosixPathCreate(destinationPath, false, false, storageDriverPosixFileWriteModePath(destination));
|
||||
result = storageDriverPosixMove(source, destination);
|
||||
}
|
||||
// Else the destination is on a different device so a copy will be needed
|
||||
@ -219,7 +219,7 @@ storageDriverPosixMove(StorageFileReadPosix *source, StorageFileWritePosix *dest
|
||||
else
|
||||
{
|
||||
// Sync source path if the destination path was synced and the paths are not equal
|
||||
if (storageFileWritePosixSyncPath(destination))
|
||||
if (storageDriverPosixFileWriteSyncPath(destination))
|
||||
{
|
||||
String *sourcePath = strPath(sourceFile);
|
||||
|
||||
@ -335,16 +335,16 @@ storageDriverPosixPathSync(const String *path, bool ignoreMissing)
|
||||
FUNCTION_DEBUG_END();
|
||||
|
||||
// Open directory and handle errors
|
||||
int handle = storageFilePosixOpen(path, O_RDONLY, 0, ignoreMissing, false, "sync");
|
||||
int handle = storageDriverPosixFileOpen(path, O_RDONLY, 0, ignoreMissing, false, "sync");
|
||||
|
||||
// On success
|
||||
if (handle != -1)
|
||||
{
|
||||
// Attempt to sync the directory
|
||||
storageFilePosixSync(handle, path, false, true);
|
||||
storageDriverPosixFileSync(handle, path, false, true);
|
||||
|
||||
// Close the directory
|
||||
storageFilePosixClose(handle, path, false);
|
||||
storageDriverPosixFileClose(handle, path, false);
|
||||
}
|
||||
|
||||
FUNCTION_DEBUG_RESULT_VOID();
|
@ -1,15 +1,15 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage Driver Posix
|
||||
Posix Storage Driver
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_POSIX_DRIVER_H
|
||||
#define STORAGE_DRIVER_POSIX_DRIVER_H
|
||||
#ifndef STORAGE_DRIVER_POSIX_STORAGE_H
|
||||
#define STORAGE_DRIVER_POSIX_STORAGE_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "common/type/buffer.h"
|
||||
#include "common/type/stringList.h"
|
||||
#include "storage/driver/posix/driverRead.h"
|
||||
#include "storage/driver/posix/driverWrite.h"
|
||||
#include "storage/driver/posix/fileRead.h"
|
||||
#include "storage/driver/posix/fileWrite.h"
|
||||
#include "storage/info.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -18,7 +18,7 @@ Function
|
||||
bool storageDriverPosixExists(const String *path);
|
||||
StorageInfo storageDriverPosixInfo(const String *file, bool ignoreMissing);
|
||||
StringList *storageDriverPosixList(const String *path, bool errorOnMissing, const String *expression);
|
||||
bool storageDriverPosixMove(StorageFileReadPosix *source, StorageFileWritePosix *destination);
|
||||
bool storageDriverPosixMove(StorageDriverPosixFileRead *source, StorageDriverPosixFileWrite *destination);
|
||||
void storageDriverPosixPathCreate(const String *path, bool errorOnExists, bool noParentCreate, mode_t mode);
|
||||
void storageDriverPosixPathRemove(const String *path, bool errorOnMissing, bool recurse);
|
||||
void storageDriverPosixPathSync(const String *path, bool ignoreMissing);
|
@ -13,7 +13,7 @@ Storage file structure
|
||||
struct StorageFileRead
|
||||
{
|
||||
MemContext *memContext;
|
||||
StorageFileReadPosix *fileDriver;
|
||||
StorageDriverPosixFileRead *fileDriver;
|
||||
IoRead *io;
|
||||
};
|
||||
|
||||
@ -37,11 +37,11 @@ storageFileReadNew(const String *name, bool ignoreMissing)
|
||||
this = memNew(sizeof(StorageFileRead));
|
||||
this->memContext = memContextCurrent();
|
||||
|
||||
this->fileDriver = storageFileReadPosixNew(name, ignoreMissing);
|
||||
this->fileDriver = storageDriverPosixFileReadNew(name, ignoreMissing);
|
||||
|
||||
this->io = ioReadNew(
|
||||
this->fileDriver, (IoReadOpen)storageFileReadPosixOpen, (IoReadProcess)storageFileReadPosix,
|
||||
(IoReadClose)storageFileReadPosixClose, (IoReadEof)storageFileReadPosixEof);
|
||||
this->fileDriver, (IoReadOpen)storageDriverPosixFileReadOpen, (IoReadProcess)storageDriverPosixFileRead,
|
||||
(IoReadClose)storageDriverPosixFileReadClose, (IoReadEof)storageDriverPosixFileReadEof);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
@ -70,7 +70,7 @@ storageFileReadMove(StorageFileRead *this, MemContext *parentNew)
|
||||
/***********************************************************************************************************************************
|
||||
Get file driver
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileReadPosix *
|
||||
StorageDriverPosixFileRead *
|
||||
storageFileReadDriver(const StorageFileRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
@ -79,7 +79,7 @@ storageFileReadDriver(const StorageFileRead *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(STORAGE_FILE_READ_POSIX, this->fileDriver);
|
||||
FUNCTION_TEST_RESULT(STORAGE_DRIVER_POSIX_FILE_READ, this->fileDriver);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -109,7 +109,7 @@ storageFileReadIgnoreMissing(const StorageFileRead *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(BOOL, storageFileReadPosixIgnoreMissing(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(BOOL, storageDriverPosixFileReadIgnoreMissing(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -124,7 +124,7 @@ storageFileReadName(const StorageFileRead *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(CONST_STRING, storageFileReadPosixName(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(CONST_STRING, storageDriverPosixFileReadName(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
|
@ -12,7 +12,7 @@ typedef struct StorageFileRead StorageFileRead;
|
||||
#include "common/io/read.h"
|
||||
#include "common/type/buffer.h"
|
||||
#include "common/type/string.h"
|
||||
#include "storage/driver/posix/driverRead.h"
|
||||
#include "storage/driver/posix/fileRead.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
@ -27,7 +27,7 @@ StorageFileRead *storageFileReadMove(StorageFileRead *this, MemContext *parentNe
|
||||
/***********************************************************************************************************************************
|
||||
Getters
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileReadPosix *storageFileReadDriver(const StorageFileRead *this);
|
||||
StorageDriverPosixFileRead *storageFileReadDriver(const StorageFileRead *this);
|
||||
IoRead *storageFileReadIo(const StorageFileRead *this);
|
||||
bool storageFileReadIgnoreMissing(const StorageFileRead *this);
|
||||
const String *storageFileReadName(const StorageFileRead *this);
|
||||
|
@ -13,7 +13,7 @@ Storage file structure
|
||||
struct StorageFileWrite
|
||||
{
|
||||
MemContext *memContext;
|
||||
StorageFileWritePosix *fileDriver;
|
||||
StorageDriverPosixFileWrite *fileDriver;
|
||||
IoWrite *io;
|
||||
};
|
||||
|
||||
@ -48,11 +48,11 @@ storageFileWriteNew(
|
||||
this = memNew(sizeof(StorageFileWrite));
|
||||
this->memContext = MEM_CONTEXT_NEW();
|
||||
|
||||
this->fileDriver = storageFileWritePosixNew(name, modeFile, modePath, noCreatePath, noSyncFile, noSyncPath, noAtomic);
|
||||
this->fileDriver = storageDriverPosixFileWriteNew(name, modeFile, modePath, noCreatePath, noSyncFile, noSyncPath, noAtomic);
|
||||
|
||||
this->io = ioWriteNew(
|
||||
this->fileDriver, (IoWriteOpen)storageFileWritePosixOpen, (IoWriteProcess)storageFileWritePosix,
|
||||
(IoWriteClose)storageFileWritePosixClose);
|
||||
this->fileDriver, (IoWriteOpen)storageDriverPosixFileWriteOpen, (IoWriteProcess)storageDriverPosixFileWrite,
|
||||
(IoWriteClose)storageDriverPosixFileWriteClose);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
@ -92,7 +92,7 @@ storageFileWriteAtomic(const StorageFileWrite *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(BOOL, storageFileWritePosixAtomic(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(BOOL, storageDriverPosixFileWriteAtomic(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -107,13 +107,13 @@ storageFileWriteCreatePath(const StorageFileWrite *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(BOOL, storageFileWritePosixCreatePath(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(BOOL, storageDriverPosixFileWriteCreatePath(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get file driver
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWritePosix *
|
||||
StorageDriverPosixFileWrite *
|
||||
storageFileWriteFileDriver(const StorageFileWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
@ -122,7 +122,7 @@ storageFileWriteFileDriver(const StorageFileWrite *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(STORAGE_FILE_WRITE_POSIX, this->fileDriver);
|
||||
FUNCTION_TEST_RESULT(STORAGE_DRIVER_POSIX_FILE_WRITE, this->fileDriver);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -152,7 +152,7 @@ storageFileWriteModeFile(const StorageFileWrite *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(MODE, storageFileWritePosixModeFile(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(MODE, storageDriverPosixFileWriteModeFile(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -167,7 +167,7 @@ storageFileWriteModePath(const StorageFileWrite *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(MODE, storageFileWritePosixModePath(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(MODE, storageDriverPosixFileWriteModePath(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -182,7 +182,7 @@ storageFileWriteName(const StorageFileWrite *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(CONST_STRING, storageFileWritePosixName(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(CONST_STRING, storageDriverPosixFileWriteName(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -197,7 +197,7 @@ storageFileWritePath(const StorageFileWrite *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(CONST_STRING, storageFileWritePosixPath(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(CONST_STRING, storageDriverPosixFileWritePath(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -212,7 +212,7 @@ storageFileWriteSyncFile(const StorageFileWrite *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(BOOL, storageFileWritePosixSyncFile(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(BOOL, storageDriverPosixFileWriteSyncFile(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -227,7 +227,7 @@ storageFileWriteSyncPath(const StorageFileWrite *this)
|
||||
FUNCTION_TEST_ASSERT(this != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RESULT(BOOL, storageFileWritePosixSyncPath(this->fileDriver));
|
||||
FUNCTION_TEST_RESULT(BOOL, storageDriverPosixFileWriteSyncPath(this->fileDriver));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
|
@ -14,7 +14,7 @@ typedef struct StorageFileWrite StorageFileWrite;
|
||||
#include "common/io/write.h"
|
||||
#include "common/type/buffer.h"
|
||||
#include "common/type/string.h"
|
||||
#include "storage/driver/posix/driverWrite.h"
|
||||
#include "storage/driver/posix/fileWrite.h"
|
||||
#include "version.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -38,7 +38,7 @@ Getters
|
||||
***********************************************************************************************************************************/
|
||||
bool storageFileWriteAtomic(const StorageFileWrite *this);
|
||||
bool storageFileWriteCreatePath(const StorageFileWrite *this);
|
||||
StorageFileWritePosix *storageFileWriteFileDriver(const StorageFileWrite *this);
|
||||
StorageDriverPosixFileWrite *storageFileWriteFileDriver(const StorageFileWrite *this);
|
||||
IoWrite *storageFileWriteIo(const StorageFileWrite *this);
|
||||
mode_t storageFileWriteModeFile(const StorageFileWrite *this);
|
||||
mode_t storageFileWriteModePath(const StorageFileWrite *this);
|
||||
|
@ -10,7 +10,7 @@ Storage Manager
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/wait.h"
|
||||
#include "storage/driver/posix/driver.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -50,8 +50,8 @@ storageNew(const String *path, StorageNewParam param)
|
||||
this = (Storage *)memNew(sizeof(Storage));
|
||||
this->memContext = MEM_CONTEXT_NEW();
|
||||
this->path = strDup(path);
|
||||
this->modeFile = param.modeFile == 0 ? STORAGE_FILE_MODE_DEFAULT : param.modeFile;
|
||||
this->modePath = param.modePath == 0 ? STORAGE_PATH_MODE_DEFAULT : param.modePath;
|
||||
this->modeFile = param.modeFile == 0 ? STORAGE_MODE_FILE_DEFAULT : param.modeFile;
|
||||
this->modePath = param.modePath == 0 ? STORAGE_MODE_PATH_DEFAULT : param.modePath;
|
||||
this->write = param.write;
|
||||
this->pathExpressionFunction = param.pathExpressionFunction;
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ typedef struct Storage Storage;
|
||||
/***********************************************************************************************************************************
|
||||
Default file and path modes
|
||||
***********************************************************************************************************************************/
|
||||
#define STORAGE_FILE_MODE_DEFAULT 0640
|
||||
#define STORAGE_PATH_MODE_DEFAULT 0750
|
||||
#define STORAGE_MODE_FILE_DEFAULT 0640
|
||||
#define STORAGE_MODE_PATH_DEFAULT 0750
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Path expression callback function type - used to modify paths based on expressions enclosed in <>
|
||||
|
@ -1023,35 +1023,35 @@ src/postgres/version.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/posix/driver.c:
|
||||
src/storage/driver/posix/storage.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/posix/driver.h:
|
||||
src/storage/driver/posix/storage.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/posix/driverFile.c:
|
||||
src/storage/driver/posix/common.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/posix/driverFile.h:
|
||||
src/storage/driver/posix/common.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/posix/driverRead.c:
|
||||
src/storage/driver/posix/fileRead.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/posix/driverRead.h:
|
||||
src/storage/driver/posix/fileRead.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/posix/driverWrite.c:
|
||||
src/storage/driver/posix/fileWrite.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/posix/driverWrite.h:
|
||||
src/storage/driver/posix/fileWrite.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
|
@ -498,9 +498,9 @@ unit:
|
||||
total: 3
|
||||
|
||||
coverage:
|
||||
storage/driver/posix/driverFile: full
|
||||
storage/driver/posix/driverRead: full
|
||||
storage/driver/posix/driverWrite: full
|
||||
storage/driver/posix/common: full
|
||||
storage/driver/posix/fileRead: full
|
||||
storage/driver/posix/fileWrite: full
|
||||
storage/fileRead: full
|
||||
storage/fileWrite: full
|
||||
|
||||
@ -509,7 +509,7 @@ unit:
|
||||
total: 14
|
||||
|
||||
coverage:
|
||||
storage/driver/posix/driver: full
|
||||
storage/driver/posix/storage: full
|
||||
storage/storage: full
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -30,40 +30,40 @@ testRun(void)
|
||||
if (testBegin("StorageFile"))
|
||||
{
|
||||
TEST_ERROR_FMT(
|
||||
storageFilePosixOpen(pathNoPerm, O_RDONLY, 0, false, false, "test"), PathOpenError,
|
||||
storageDriverPosixFileOpen(pathNoPerm, O_RDONLY, 0, false, false, "test"), PathOpenError,
|
||||
"unable to open '%s' for test: [13] Permission denied", strPtr(pathNoPerm));
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
String *fileName = strNewFmt("%s/test.file", testPath());
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageFilePosixOpen(fileName, O_RDONLY, 0, false, true, "read"), FileMissingError,
|
||||
storageDriverPosixFileOpen(fileName, O_RDONLY, 0, false, true, "read"), FileMissingError,
|
||||
"unable to open '%s' for read: [2] No such file or directory", strPtr(fileName));
|
||||
|
||||
TEST_RESULT_INT(storageFilePosixOpen(fileName, O_RDONLY, 0, true, true, "read"), -1, "missing file ignored");
|
||||
TEST_RESULT_INT(storageDriverPosixFileOpen(fileName, O_RDONLY, 0, true, true, "read"), -1, "missing file ignored");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
int handle = -1;
|
||||
|
||||
TEST_RESULT_INT(system(strPtr(strNewFmt("touch %s", strPtr(fileName)))), 0, "create read file");
|
||||
TEST_ASSIGN(handle, storageFilePosixOpen(fileName, O_RDONLY, 0, false, true, "read"), "open read file");
|
||||
TEST_ASSIGN(handle, storageDriverPosixFileOpen(fileName, O_RDONLY, 0, false, true, "read"), "open read file");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ERROR_FMT(
|
||||
storageFilePosixSync(-99, fileName, false, false), PathSyncError,
|
||||
storageDriverPosixFileSync(-99, fileName, false, false), PathSyncError,
|
||||
"unable to sync '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
TEST_ERROR_FMT(
|
||||
storageFilePosixSync(-99, fileName, true, true), FileSyncError,
|
||||
storageDriverPosixFileSync(-99, fileName, true, true), FileSyncError,
|
||||
"unable to sync '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
TEST_RESULT_VOID(storageFilePosixSync(handle, fileName, true, false), "sync file");
|
||||
TEST_RESULT_VOID(storageDriverPosixFileSync(handle, fileName, true, false), "sync file");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ERROR_FMT(
|
||||
storageFilePosixClose(-99, fileName, true), FileCloseError,
|
||||
storageDriverPosixFileClose(-99, fileName, true), FileCloseError,
|
||||
"unable to close '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
TEST_RESULT_VOID(storageFilePosixClose(handle, fileName, true), "close file");
|
||||
TEST_RESULT_VOID(storageDriverPosixFileClose(handle, fileName, true), "close file");
|
||||
|
||||
TEST_RESULT_INT(system(strPtr(strNewFmt("rm %s", strPtr(fileName)))), 0, "remove read file");
|
||||
}
|
||||
@ -150,7 +150,8 @@ testRun(void)
|
||||
TEST_RESULT_VOID(ioRead(storageFileReadIo(file), outBuffer), " no data to load");
|
||||
TEST_RESULT_INT(bufUsed(outBuffer), 0, " buffer is empty");
|
||||
|
||||
TEST_RESULT_VOID(storageFileReadPosix(storageFileReadDriver(file), outBuffer), " no data to load from driver either");
|
||||
TEST_RESULT_VOID(
|
||||
storageDriverPosixFileRead(storageFileReadDriver(file), outBuffer), " no data to load from driver either");
|
||||
TEST_RESULT_INT(bufUsed(outBuffer), 0, " buffer is empty");
|
||||
|
||||
TEST_RESULT_BOOL(bufEq(buffer, expectedBuffer), true, " check file contents (all loaded)");
|
||||
@ -162,7 +163,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_VOID(storageFileReadFree(file), " free file");
|
||||
TEST_RESULT_VOID(storageFileReadFree(NULL), " free null file");
|
||||
TEST_RESULT_VOID(storageFileReadPosixFree(NULL), " free null file");
|
||||
TEST_RESULT_VOID(storageDriverPosixFileReadFree(NULL), " free null file");
|
||||
|
||||
TEST_RESULT_VOID(storageFileReadMove(NULL, memContextTop()), " move null file");
|
||||
}
|
||||
@ -217,17 +218,17 @@ testRun(void)
|
||||
storageRemoveP(storageTest, fileTmp, .errorOnMissing = true);
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageFileWritePosix(storageFileWriteFileDriver(file), buffer), FileWriteError,
|
||||
storageDriverPosixFileWrite(storageFileWriteFileDriver(file), buffer), FileWriteError,
|
||||
"unable to write '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
TEST_ERROR_FMT(
|
||||
storageFileWritePosixClose(storageFileWriteFileDriver(file)), FileSyncError,
|
||||
storageDriverPosixFileWriteClose(storageFileWriteFileDriver(file)), FileSyncError,
|
||||
"unable to sync '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
// Disable file sync so the close can be reached
|
||||
file->fileDriver->syncFile = false;
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageFileWritePosixClose(storageFileWriteFileDriver(file)), FileCloseError,
|
||||
storageDriverPosixFileWriteClose(storageFileWriteFileDriver(file)), FileCloseError,
|
||||
"unable to close '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
// Set file handle to -1 so the close on free with not fail
|
||||
@ -263,7 +264,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(ioWriteClose(storageFileWriteIo(file)), " close file");
|
||||
TEST_RESULT_VOID(storageFileWriteFree(file), " free file");
|
||||
TEST_RESULT_VOID(storageFileWriteFree(NULL), " free null file");
|
||||
TEST_RESULT_VOID(storageFileWritePosixFree(NULL), " free null posix file");
|
||||
TEST_RESULT_VOID(storageDriverPosixFileWriteFree(NULL), " free null posix file");
|
||||
TEST_RESULT_VOID(storageFileWriteMove(NULL, memContextTop()), " move null file");
|
||||
|
||||
Buffer *expectedBuffer = storageGetNP(storageNewReadNP(storageTest, fileName));
|
||||
|
Loading…
x
Reference in New Issue
Block a user