mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
dll: fuse: debug output goes to stderr; configurable with -oDebugLog=FILE
This commit is contained in:
parent
c080e86f11
commit
193de36301
@ -112,7 +112,7 @@ usage: passthrough OPTIONS
|
|||||||
|
|
||||||
options:
|
options:
|
||||||
-d DebugFlags [-1: enable all debug logs]
|
-d DebugFlags [-1: enable all debug logs]
|
||||||
-D DebugLogFile [file path; use - for stdout]
|
-D DebugLogFile [file path; use - for stderr]
|
||||||
-u \Server\Share [UNC prefix (single backslash)]
|
-u \Server\Share [UNC prefix (single backslash)]
|
||||||
-p Directory [directory to expose as pass through file system]
|
-p Directory [directory to expose as pass through file system]
|
||||||
-m MountPoint [X:|*|directory]
|
-m MountPoint [X:|*|directory]
|
||||||
@ -138,7 +138,7 @@ The variable `DebugLogFile` is used to control the WinFsp debug logging mechanis
|
|||||||
if (0 != DebugLogFile)
|
if (0 != DebugLogFile)
|
||||||
{
|
{
|
||||||
if (0 == wcscmp(L"-", DebugLogFile))
|
if (0 == wcscmp(L"-", DebugLogFile))
|
||||||
DebugLogHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
DebugLogHandle = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
else
|
else
|
||||||
DebugLogHandle = CreateFileW(
|
DebugLogHandle = CreateFileW(
|
||||||
DebugLogFile,
|
DebugLogFile,
|
||||||
|
@ -32,6 +32,7 @@ struct fsp_fuse_core_opt_data
|
|||||||
{
|
{
|
||||||
struct fsp_fuse_env *env;
|
struct fsp_fuse_env *env;
|
||||||
int help, debug;
|
int help, debug;
|
||||||
|
HANDLE DebugLogHandle;
|
||||||
int set_umask, umask,
|
int set_umask, umask,
|
||||||
set_uid, uid,
|
set_uid, uid,
|
||||||
set_gid, gid,
|
set_gid, gid,
|
||||||
@ -52,6 +53,8 @@ static struct fuse_opt fsp_fuse_core_opts[] =
|
|||||||
FSP_FUSE_CORE_OPT("-d", debug, 1),
|
FSP_FUSE_CORE_OPT("-d", debug, 1),
|
||||||
FSP_FUSE_CORE_OPT("debug", debug, 1),
|
FSP_FUSE_CORE_OPT("debug", debug, 1),
|
||||||
|
|
||||||
|
FUSE_OPT_KEY("DebugLog=", 'D'),
|
||||||
|
|
||||||
FUSE_OPT_KEY("hard_remove", FUSE_OPT_KEY_DISCARD),
|
FUSE_OPT_KEY("hard_remove", FUSE_OPT_KEY_DISCARD),
|
||||||
FUSE_OPT_KEY("use_ino", FUSE_OPT_KEY_DISCARD),
|
FUSE_OPT_KEY("use_ino", FUSE_OPT_KEY_DISCARD),
|
||||||
FUSE_OPT_KEY("readdir_ino", FUSE_OPT_KEY_DISCARD),
|
FUSE_OPT_KEY("readdir_ino", FUSE_OPT_KEY_DISCARD),
|
||||||
@ -450,6 +453,7 @@ static int fsp_fuse_core_opt_proc(void *opt_data0, const char *arg, int key,
|
|||||||
case 'h':
|
case 'h':
|
||||||
FspServiceLog(EVENTLOG_ERROR_TYPE, L""
|
FspServiceLog(EVENTLOG_ERROR_TYPE, L""
|
||||||
FSP_FUSE_LIBRARY_NAME " options:\n"
|
FSP_FUSE_LIBRARY_NAME " options:\n"
|
||||||
|
" -o DebugLog=FILE debug log file (deflt: stderr)\n"
|
||||||
" -o SectorSize=N sector size for Windows (512-4096, deflt: 4096)\n"
|
" -o SectorSize=N sector size for Windows (512-4096, deflt: 4096)\n"
|
||||||
" -o SectorsPerAllocationUnit=N sectors per allocation unit (deflt: 1)\n"
|
" -o SectorsPerAllocationUnit=N sectors per allocation unit (deflt: 1)\n"
|
||||||
" -o MaxComponentLength=N max file name component length (deflt: 255)\n"
|
" -o MaxComponentLength=N max file name component length (deflt: 255)\n"
|
||||||
@ -466,6 +470,17 @@ static int fsp_fuse_core_opt_proc(void *opt_data0, const char *arg, int key,
|
|||||||
FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION);
|
FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION);
|
||||||
opt_data->help = 1;
|
opt_data->help = 1;
|
||||||
return 1;
|
return 1;
|
||||||
|
case 'D':
|
||||||
|
arg += sizeof "DebugLog=" - 1;
|
||||||
|
opt_data->DebugLogHandle = CreateFileA(
|
||||||
|
arg,
|
||||||
|
FILE_APPEND_DATA,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
|
0,
|
||||||
|
OPEN_ALWAYS,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
0);
|
||||||
|
return 0;
|
||||||
case 'U':
|
case 'U':
|
||||||
if ('U' == arg[2])
|
if ('U' == arg[2])
|
||||||
arg += sizeof "--UNC=" - 1;
|
arg += sizeof "--UNC=" - 1;
|
||||||
@ -508,6 +523,7 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
|
|||||||
|
|
||||||
memset(&opt_data, 0, sizeof opt_data);
|
memset(&opt_data, 0, sizeof opt_data);
|
||||||
opt_data.env = env;
|
opt_data.env = env;
|
||||||
|
opt_data.DebugLogHandle = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
opt_data.VolumeParams.FileInfoTimeout = 1000; /* default FileInfoTimeout for FUSE file systems */
|
opt_data.VolumeParams.FileInfoTimeout = 1000; /* default FileInfoTimeout for FUSE file systems */
|
||||||
|
|
||||||
if (-1 == fsp_fuse_opt_parse(env, args, &opt_data, fsp_fuse_core_opts, fsp_fuse_core_opt_proc))
|
if (-1 == fsp_fuse_opt_parse(env, args, &opt_data, fsp_fuse_core_opts, fsp_fuse_core_opt_proc))
|
||||||
@ -515,6 +531,16 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
|
|||||||
if (opt_data.help)
|
if (opt_data.help)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (opt_data.debug)
|
||||||
|
{
|
||||||
|
if (INVALID_HANDLE_VALUE == opt_data.DebugLogHandle)
|
||||||
|
{
|
||||||
|
ErrorMessage = L": cannot open debug log file.";
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
FspDebugLogSetHandle(opt_data.DebugLogHandle);
|
||||||
|
}
|
||||||
|
|
||||||
if ((opt_data.set_uid && -1 == opt_data.uid) ||
|
if ((opt_data.set_uid && -1 == opt_data.uid) ||
|
||||||
(opt_data.set_gid && -1 == opt_data.gid))
|
(opt_data.set_gid && -1 == opt_data.gid))
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
|||||||
if (0 != DebugLogFile)
|
if (0 != DebugLogFile)
|
||||||
{
|
{
|
||||||
if (0 == wcscmp(L"-", DebugLogFile))
|
if (0 == wcscmp(L"-", DebugLogFile))
|
||||||
DebugLogHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
DebugLogHandle = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
else
|
else
|
||||||
DebugLogHandle = CreateFileW(
|
DebugLogHandle = CreateFileW(
|
||||||
DebugLogFile,
|
DebugLogFile,
|
||||||
@ -184,7 +184,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"
|
" -D DebugLogFile [file path; use - for stderr]\n"
|
||||||
" -i [case insensitive file system]\n"
|
" -i [case insensitive file system]\n"
|
||||||
" -t FileInfoTimeout [millis]\n"
|
" -t FileInfoTimeout [millis]\n"
|
||||||
" -n MaxFileNodes\n"
|
" -n MaxFileNodes\n"
|
||||||
|
@ -846,7 +846,7 @@ static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
|||||||
if (0 != DebugLogFile)
|
if (0 != DebugLogFile)
|
||||||
{
|
{
|
||||||
if (0 == wcscmp(L"-", DebugLogFile))
|
if (0 == wcscmp(L"-", DebugLogFile))
|
||||||
DebugLogHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
DebugLogHandle = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
else
|
else
|
||||||
DebugLogHandle = CreateFileW(
|
DebugLogHandle = CreateFileW(
|
||||||
DebugLogFile,
|
DebugLogFile,
|
||||||
@ -903,7 +903,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"
|
" -D DebugLogFile [file path; use - for stderr]\n"
|
||||||
" -u \\Server\\Share [UNC prefix (single backslash)]\n"
|
" -u \\Server\\Share [UNC prefix (single backslash)]\n"
|
||||||
" -p Directory [directory to expose as pass through file system]\n"
|
" -p Directory [directory to expose as pass through file system]\n"
|
||||||
" -m MountPoint [X:|*|directory]\n";
|
" -m MountPoint [X:|*|directory]\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user