dll: fuse: testing

This commit is contained in:
Bill Zissimopoulos 2016-06-11 14:08:05 -07:00
parent 6bc3ec7c8a
commit 259bd84cc9
2 changed files with 12 additions and 3 deletions

View File

@ -326,6 +326,8 @@ static NTSTATUS fsp_fuse_svcstart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
f->VolumeParams.SectorSize = FSP_FUSE_SECTORSIZE_MIN; f->VolumeParams.SectorSize = FSP_FUSE_SECTORSIZE_MIN;
if (f->VolumeParams.SectorSize > FSP_FUSE_SECTORSIZE_MAX) if (f->VolumeParams.SectorSize > FSP_FUSE_SECTORSIZE_MAX)
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) if (f->VolumeParams.MaxComponentLength > 255)
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, FSP_FUSE_API NTSTATUS fsp_fuse_ntstatus_from_errno(struct fsp_fuse_env *env,
int err) int err)
{ {
if (0 > err)
err = -err;
if ('C' == env->environment) if ('C' == env->environment)
switch (err) switch (err)
{ {

View File

@ -201,7 +201,8 @@ static NTSTATUS fsp_fuse_intf_GetFileInfoEx(FSP_FILE_SYSTEM *FileSystem,
*PGid = stbuf.st_gid; *PGid = stbuf.st_gid;
*PMode = stbuf.st_mode; *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->FileAttributes = (stbuf.st_mode & 0040000) ? FILE_ATTRIBUTE_DIRECTORY : 0;
FileInfo->ReparseTag = 0; FileInfo->ReparseTag = 0;
FileInfo->AllocationSize = FileInfo->AllocationSize =
@ -513,6 +514,7 @@ static NTSTATUS fsp_fuse_intf_Open(FSP_FILE_SYSTEM *FileSystem,
memset(&fi, 0, sizeof fi); memset(&fi, 0, sizeof fi);
switch (Request->Req.Create.DesiredAccess & (FILE_READ_DATA | FILE_WRITE_DATA)) switch (Request->Req.Create.DesiredAccess & (FILE_READ_DATA | FILE_WRITE_DATA))
{ {
default:
case FILE_READ_DATA: case FILE_READ_DATA:
fi.flags = 0/*O_RDONLY*/; fi.flags = 0/*O_RDONLY*/;
break; break;
@ -765,7 +767,8 @@ static NTSTATUS fsp_fuse_intf_Write(FSP_FILE_SYSTEM *FileSystem,
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
return Result; return Result;
AllocationUnit = f->VolumeParams.SectorSize * f->VolumeParams.SectorsPerAllocationUnit; AllocationUnit = (UINT64)f->VolumeParams.SectorSize *
(UINT64)f->VolumeParams.SectorsPerAllocationUnit;
FileInfoBuf.FileSize = Offset + bytes; FileInfoBuf.FileSize = Offset + bytes;
FileInfo->AllocationSize = FileInfo->AllocationSize =
(FileInfoBuf.FileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit; (FileInfoBuf.FileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit;
@ -961,7 +964,8 @@ static NTSTATUS fsp_fuse_intf_SetFileSizeCommon(FSP_FILE_SYSTEM *FileSystem,
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
return Result; return Result;
AllocationUnit = f->VolumeParams.SectorSize * f->VolumeParams.SectorsPerAllocationUnit; AllocationUnit = (UINT64)f->VolumeParams.SectorSize *
(UINT64)f->VolumeParams.SectorsPerAllocationUnit;
FileInfo->AllocationSize = FileInfo->AllocationSize =
(NewFileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit; (NewFileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit;
FileInfoBuf.FileSize = NewFileSize; FileInfoBuf.FileSize = NewFileSize;