mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-08 04:52:10 -05:00
tst: memfs: add -D option to specify debug log file
This commit is contained in:
parent
dd815f3c39
commit
e13233ef32
@ -38,6 +38,7 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
|||||||
{
|
{
|
||||||
wchar_t **argp, **arge;
|
wchar_t **argp, **arge;
|
||||||
ULONG DebugFlags = 0;
|
ULONG DebugFlags = 0;
|
||||||
|
PWSTR DebugLogFile = 0;
|
||||||
ULONG Flags = MemfsDisk;
|
ULONG Flags = MemfsDisk;
|
||||||
ULONG FileInfoTimeout = INFINITE;
|
ULONG FileInfoTimeout = INFINITE;
|
||||||
ULONG MaxFileNodes = 1024;
|
ULONG MaxFileNodes = 1024;
|
||||||
@ -45,6 +46,7 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
|||||||
PWSTR MountPoint = 0;
|
PWSTR MountPoint = 0;
|
||||||
PWSTR VolumePrefix = 0;
|
PWSTR VolumePrefix = 0;
|
||||||
PWSTR RootSddl = 0;
|
PWSTR RootSddl = 0;
|
||||||
|
HANDLE DebugLogHandle = INVALID_HANDLE_VALUE;
|
||||||
MEMFS *Memfs = 0;
|
MEMFS *Memfs = 0;
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
|
|
||||||
@ -59,6 +61,9 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
|||||||
case L'd':
|
case L'd':
|
||||||
argtol(DebugFlags);
|
argtol(DebugFlags);
|
||||||
break;
|
break;
|
||||||
|
case L'D':
|
||||||
|
argtos(DebugLogFile);
|
||||||
|
break;
|
||||||
case L'm':
|
case L'm':
|
||||||
argtos(MountPoint);
|
argtos(MountPoint);
|
||||||
break;
|
break;
|
||||||
@ -90,6 +95,26 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
|||||||
if (MemfsDisk == Flags && 0 == MountPoint)
|
if (MemfsDisk == Flags && 0 == MountPoint)
|
||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
|
if (0 != DebugLogFile)
|
||||||
|
{
|
||||||
|
if (0 == wcscmp(L"-", DebugLogFile))
|
||||||
|
DebugLogHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
else
|
||||||
|
DebugLogHandle = CreateFileW(
|
||||||
|
DebugLogFile,
|
||||||
|
FILE_APPEND_DATA,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
|
0,
|
||||||
|
OPEN_ALWAYS,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
0);
|
||||||
|
if (INVALID_HANDLE_VALUE == DebugLogHandle)
|
||||||
|
{
|
||||||
|
fail(L"cannot open debug log file");
|
||||||
|
goto usage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Result = MemfsCreate(Flags, FileInfoTimeout, MaxFileNodes, MaxFileSize, VolumePrefix, RootSddl,
|
Result = MemfsCreate(Flags, FileInfoTimeout, MaxFileNodes, MaxFileSize, VolumePrefix, RootSddl,
|
||||||
&Memfs);
|
&Memfs);
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
@ -98,6 +123,8 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (INVALID_HANDLE_VALUE != DebugLogHandle)
|
||||||
|
FspDebugLogSetHandle(DebugLogHandle);
|
||||||
FspFileSystemSetDebugLog(MemfsFileSystem(Memfs), DebugFlags);
|
FspFileSystemSetDebugLog(MemfsFileSystem(Memfs), DebugFlags);
|
||||||
|
|
||||||
if (0 != MountPoint && L'\0' != MountPoint[0])
|
if (0 != MountPoint && L'\0' != MountPoint[0])
|
||||||
@ -142,6 +169,7 @@ usage:
|
|||||||
"\n"
|
"\n"
|
||||||
"options:\n"
|
"options:\n"
|
||||||
" -d DebugFlags [-1: enable all debug logs]\n"
|
" -d DebugFlags [-1: enable all debug logs]\n"
|
||||||
|
" -D DebugLogFile [file path; use - for stdout]\n"
|
||||||
" -t FileInfoTimeout [millis]\n"
|
" -t FileInfoTimeout [millis]\n"
|
||||||
" -n MaxFileNodes\n"
|
" -n MaxFileNodes\n"
|
||||||
" -s MaxFileSize [bytes]\n"
|
" -s MaxFileSize [bytes]\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user