From 259bd84cc9260e1721b8458fc361d9c72c4b70d2 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Sat, 11 Jun 2016 14:08:05 -0700 Subject: [PATCH] dll: fuse: testing --- src/dll/fuse/fuse.c | 5 +++++ src/dll/fuse/fuse_intf.c | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/dll/fuse/fuse.c b/src/dll/fuse/fuse.c index 0b8b0b07..5cddf694 100644 --- a/src/dll/fuse/fuse.c +++ b/src/dll/fuse/fuse.c @@ -326,6 +326,8 @@ static NTSTATUS fsp_fuse_svcstart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv) f->VolumeParams.SectorSize = FSP_FUSE_SECTORSIZE_MIN; if (f->VolumeParams.SectorSize > FSP_FUSE_SECTORSIZE_MAX) f->VolumeParams.SectorSize = FSP_FUSE_SECTORSIZE_MAX; + if (f->VolumeParams.SectorsPerAllocationUnit == 0) + f->VolumeParams.SectorsPerAllocationUnit = 1; if (f->VolumeParams.MaxComponentLength > 255) f->VolumeParams.MaxComponentLength = 255; @@ -640,6 +642,9 @@ FSP_FUSE_API struct fuse_context *fsp_fuse_get_context(struct fsp_fuse_env *rese FSP_FUSE_API NTSTATUS fsp_fuse_ntstatus_from_errno(struct fsp_fuse_env *env, int err) { + if (0 > err) + err = -err; + if ('C' == env->environment) switch (err) { diff --git a/src/dll/fuse/fuse_intf.c b/src/dll/fuse/fuse_intf.c index e790c44f..501d6d2f 100644 --- a/src/dll/fuse/fuse_intf.c +++ b/src/dll/fuse/fuse_intf.c @@ -201,7 +201,8 @@ static NTSTATUS fsp_fuse_intf_GetFileInfoEx(FSP_FILE_SYSTEM *FileSystem, *PGid = stbuf.st_gid; *PMode = stbuf.st_mode; - AllocationUnit = f->VolumeParams.SectorSize * f->VolumeParams.SectorsPerAllocationUnit; + AllocationUnit = (UINT64)f->VolumeParams.SectorSize * + (UINT64)f->VolumeParams.SectorsPerAllocationUnit; FileInfo->FileAttributes = (stbuf.st_mode & 0040000) ? FILE_ATTRIBUTE_DIRECTORY : 0; FileInfo->ReparseTag = 0; FileInfo->AllocationSize = @@ -513,6 +514,7 @@ static NTSTATUS fsp_fuse_intf_Open(FSP_FILE_SYSTEM *FileSystem, memset(&fi, 0, sizeof fi); switch (Request->Req.Create.DesiredAccess & (FILE_READ_DATA | FILE_WRITE_DATA)) { + default: case FILE_READ_DATA: fi.flags = 0/*O_RDONLY*/; break; @@ -765,7 +767,8 @@ static NTSTATUS fsp_fuse_intf_Write(FSP_FILE_SYSTEM *FileSystem, if (!NT_SUCCESS(Result)) return Result; - AllocationUnit = f->VolumeParams.SectorSize * f->VolumeParams.SectorsPerAllocationUnit; + AllocationUnit = (UINT64)f->VolumeParams.SectorSize * + (UINT64)f->VolumeParams.SectorsPerAllocationUnit; FileInfoBuf.FileSize = Offset + bytes; FileInfo->AllocationSize = (FileInfoBuf.FileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit; @@ -961,7 +964,8 @@ static NTSTATUS fsp_fuse_intf_SetFileSizeCommon(FSP_FILE_SYSTEM *FileSystem, if (!NT_SUCCESS(Result)) return Result; - AllocationUnit = f->VolumeParams.SectorSize * f->VolumeParams.SectorsPerAllocationUnit; + AllocationUnit = (UINT64)f->VolumeParams.SectorSize * + (UINT64)f->VolumeParams.SectorsPerAllocationUnit; FileInfo->AllocationSize = (NewFileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit; FileInfoBuf.FileSize = NewFileSize;