From: Stefan Metzmacher Date: Tue, 8 Jun 2021 08:56:22 +0000 (+0200) Subject: vfs_preopen: introduce "preopen" debug class X-Git-Tag: tevent-0.11.0~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6aaa36497f6dc6d4a8488d6ff8f43a6591eda59;p=thirdparty%2Fsamba.git vfs_preopen: introduce "preopen" debug class It might be useful to change the level/location of debug messages specific to this module. Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/docs-xml/smbdotconf/logging/loglevel.xml b/docs-xml/smbdotconf/logging/loglevel.xml index c1fcfe451c6..434c5d06832 100644 --- a/docs-xml/smbdotconf/logging/loglevel.xml +++ b/docs-xml/smbdotconf/logging/loglevel.xml @@ -68,6 +68,7 @@ fruit full_audit media_harmony + preopen recycle shadow_copy shadow_copy diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c index 1549fda0b5e..c54daaf44c8 100644 --- a/source3/modules/vfs_preopen.c +++ b/source3/modules/vfs_preopen.c @@ -26,6 +26,11 @@ #include "lib/util/smb_strtox.h" #include "lib/global_contexts.h" +static int vfs_preopen_debug_level = DBGC_VFS; + +#undef DBGC_CLASS +#define DBGC_CLASS vfs_preopen_debug_level + struct preopen_state; struct preopen_helper { @@ -469,6 +474,23 @@ static struct vfs_fn_pointers vfs_preopen_fns = { static_decl_vfs; NTSTATUS vfs_preopen_init(TALLOC_CTX *ctx) { - return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, - "preopen", &vfs_preopen_fns); + NTSTATUS status; + + status = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, + "preopen", + &vfs_preopen_fns); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + vfs_preopen_debug_level = debug_add_class("preopen"); + if (vfs_preopen_debug_level == -1) { + vfs_preopen_debug_level = DBGC_VFS; + DBG_ERR("Couldn't register custom debugging class!\n"); + } else { + DBG_DEBUG("Debug class number of 'preopen': %d\n", + vfs_preopen_debug_level); + } + + return NT_STATUS_OK; }