Memory optimizations.

This commit is contained in:
Nuno Cruces
2023-04-11 15:33:38 +01:00
parent 23ee4ccb0b
commit 005b15610a
10 changed files with 42 additions and 36 deletions

View File

@@ -196,22 +196,22 @@ const (
)
// https://www.sqlite.org/c3ref/c_iocap_atomic.html
type _DeviceChars uint32
type _DeviceCharacteristic uint32
const (
_IOCAP_ATOMIC _DeviceChars = 0x00000001
_IOCAP_ATOMIC512 _DeviceChars = 0x00000002
_IOCAP_ATOMIC1K _DeviceChars = 0x00000004
_IOCAP_ATOMIC2K _DeviceChars = 0x00000008
_IOCAP_ATOMIC4K _DeviceChars = 0x00000010
_IOCAP_ATOMIC8K _DeviceChars = 0x00000020
_IOCAP_ATOMIC16K _DeviceChars = 0x00000040
_IOCAP_ATOMIC32K _DeviceChars = 0x00000080
_IOCAP_ATOMIC64K _DeviceChars = 0x00000100
_IOCAP_SAFE_APPEND _DeviceChars = 0x00000200
_IOCAP_SEQUENTIAL _DeviceChars = 0x00000400
_IOCAP_UNDELETABLE_WHEN_OPEN _DeviceChars = 0x00000800
_IOCAP_POWERSAFE_OVERWRITE _DeviceChars = 0x00001000
_IOCAP_IMMUTABLE _DeviceChars = 0x00002000
_IOCAP_BATCH_ATOMIC _DeviceChars = 0x00004000
_IOCAP_ATOMIC _DeviceCharacteristic = 0x00000001
_IOCAP_ATOMIC512 _DeviceCharacteristic = 0x00000002
_IOCAP_ATOMIC1K _DeviceCharacteristic = 0x00000004
_IOCAP_ATOMIC2K _DeviceCharacteristic = 0x00000008
_IOCAP_ATOMIC4K _DeviceCharacteristic = 0x00000010
_IOCAP_ATOMIC8K _DeviceCharacteristic = 0x00000020
_IOCAP_ATOMIC16K _DeviceCharacteristic = 0x00000040
_IOCAP_ATOMIC32K _DeviceCharacteristic = 0x00000080
_IOCAP_ATOMIC64K _DeviceCharacteristic = 0x00000100
_IOCAP_SAFE_APPEND _DeviceCharacteristic = 0x00000200
_IOCAP_SEQUENTIAL _DeviceCharacteristic = 0x00000400
_IOCAP_UNDELETABLE_WHEN_OPEN _DeviceCharacteristic = 0x00000800
_IOCAP_POWERSAFE_OVERWRITE _DeviceCharacteristic = 0x00001000
_IOCAP_IMMUTABLE _DeviceCharacteristic = 0x00002000
_IOCAP_BATCH_ATOMIC _DeviceCharacteristic = 0x00004000
)

View File

@@ -362,7 +362,7 @@ func vfsSectorSize(ctx context.Context, mod api.Module, pFile uint32) uint32 {
return _DEFAULT_SECTOR_SIZE
}
func vfsDeviceCharacteristics(ctx context.Context, mod api.Module, pFile uint32) _DeviceChars {
func vfsDeviceCharacteristics(ctx context.Context, mod api.Module, pFile uint32) _DeviceCharacteristic {
file := getVFSFile(ctx, mod, pFile)
if file.psow {
return _IOCAP_POWERSAFE_OVERWRITE

View File

@@ -11,8 +11,8 @@ import (
type vfsFile struct {
*os.File
lock _LockLevel
lockTimeout time.Duration
lock _LockLevel
psow bool
syncDir bool
readOnly bool