nfs-ganesha 1.4
|
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/param.h>
#include <syslog.h>
#include <inttypes.h>
#include <errno.h>
#include <pthread.h>
Go to the source code of this file.
Classes | |
struct | loglev |
struct | family_error_t |
struct | family_t |
struct | log_error_t |
struct | cleanup_list_element |
struct | log_component_info |
Defines | |
#define | likely(x) (x) |
#define | unlikely(x) (x) |
#define | MAXPATHLEN 1024 |
#define | STR_LEN 256 |
#define | NIV_MAJOR NIV_MAJ |
#define | LOG_MAX_STRLEN 2048 |
#define | LOG_LABEL_LEN 50 |
#define | LOG_MSG_LEN 255 |
#define | ERR_NULL -1 |
#define | ERR_SYS 0 |
#define | SUCCES 0 |
#define | ERR_FAILURE 1 |
#define | EVNT 2 |
#define | ERR_EVNT 2 |
#define | ERR_PTHREAD_KEY_CREATE 3 |
#define | ERR_MALLOC 4 |
#define | ERR_SIGACTION 5 |
#define | ERR_PTHREAD_ONCE 6 |
#define | ERR_FICHIER_LOG 7 |
#define | ERR_GETHOSTBYNAME 8 |
#define | ERR_MMAP 9 |
#define | ERR_SOCKET 10 |
#define | ERR_BIND 11 |
#define | ERR_CONNECT 12 |
#define | ERR_LISTEN 13 |
#define | ERR_ACCEPT 14 |
#define | ERR_RRESVPORT 15 |
#define | ERR_GETHOSTNAME 16 |
#define | ERR_GETSOCKNAME 17 |
#define | ERR_IOCTL 18 |
#define | ERR_UTIME 19 |
#define | ERR_XDR 20 |
#define | ERR_CHMOD 21 |
#define | ERR_SEND 22 |
#define | ERR_GETHOSTBYADDR 23 |
#define | ERR_PREAD 24 |
#define | ERR_PWRITE 25 |
#define | ERR_STAT 26 |
#define | ERR_GETPEERNAME 27 |
#define | ERR_FORK 28 |
#define | ERR_GETSERVBYNAME 29 |
#define | ERR_MUNMAP 30 |
#define | ERR_STATVFS 31 |
#define | ERR_OPENDIR 32 |
#define | ERR_READDIR 33 |
#define | ERR_CLOSEDIR 34 |
#define | ERR_LSTAT 35 |
#define | ERR_GETWD 36 |
#define | ERR_CHDIR 37 |
#define | ERR_CHOWN 38 |
#define | ERR_MKDIR 39 |
#define | ERR_OPEN 40 |
#define | ERR_READ 41 |
#define | ERR_WRITE 42 |
#define | ERR_UTIMES 43 |
#define | ERR_READLINK 44 |
#define | ERR_SYMLINK 45 |
#define | ERR_SYSTEM 46 |
#define | ERR_POPEN 47 |
#define | ERR_LSEEK 48 |
#define | ERR_PTHREAD_CREATE 49 |
#define | ERR_RECV 50 |
#define | ERR_FOPEN 51 |
#define | ERR_GETCWD 52 |
#define | ERR_SETUID 53 |
#define | ERR_RENAME 54 |
#define | ERR_UNLINK 55 |
#define | ERR_SELECT 56 |
#define | ERR_WAIT 57 |
#define | ERR_SETSID 58 |
#define | ERR_SETGID 59 |
#define | ERR_GETGROUPS 60 |
#define | ERR_SETGROUPS 61 |
#define | ERR_UMASK 62 |
#define | ERR_CREAT 63 |
#define | ERR_SETSOCKOPT 64 |
#define | ERR_DIRECTIO 65 |
#define | ERR_GETRLIMIT 66 |
#define | ERR_SETRLIMIT 67 |
#define | ERR_TRUNCATE 68 |
#define | ERR_PTHREAD_MUTEX_INIT 69 |
#define | ERR_PTHREAD_COND_INIT 70 |
#define | ERR_FCNTL 71 |
#define | ERR_POSIX 1 |
#define | ERR_LRU 10 |
#define | ERR_HASHTABLE 11 |
#define | ERR_FSAL 13 |
#define | ERR_GHOSTFS 15 |
#define | ERR_CACHE_INODE 16 |
#define | ERR_CACHE_CONTENT 17 |
#define | SetLogLevel(level_to_set) SetComponentLogLevel(COMPONENT_ALL, level_to_set) |
#define | ReturnLevelComponent(component) LogComponents[component].comp_log_level |
#define | LogAlways(component, format, args...) |
#define | LogTest(format, args...) |
#define | LogFatal(component, format, args...) |
#define | LogMajor(component, format, args...) |
#define | LogCrit(component, format, args...) |
#define | LogWarn(component, format, args...) |
#define | LogEvent(component, format, args...) |
#define | LogInfo(component, format, args...) |
#define | LogDebug(component, format, args...) |
#define | LogMidDebug(component, format, args...) |
#define | LogFullDebug(component, format, args...) |
#define | LogAtLevel(component, level, format, args...) |
#define | LogError(component, a, b, c) |
#define | isLevel(component, level) (unlikely(LogComponents[component].comp_log_level >= level)) |
#define | isInfo(component) (unlikely(LogComponents[component].comp_log_level >= NIV_INFO)) |
#define | isDebug(component) (unlikely(LogComponents[component].comp_log_level >= NIV_DEBUG)) |
#define | isMidDebug(component) (unlikely(LogComponents[component].comp_log_level >= NIV_MID_DEBUG)) |
#define | isFullDebug(component) (unlikely(LogComponents[component].comp_log_level >= NIV_FULL_DEBUG)) |
Typedefs | |
typedef enum log_levels | log_levels_t |
typedef enum log_components | log_components_t |
typedef struct loglev | log_level_t |
typedef family_error_t | status_t |
typedef family_error_t | errctx_t |
typedef void(* | cleanup_function )(void) |
typedef struct cleanup_list_element | cleanup_list_element |
typedef struct log_component_info | log_component_info |
Enumerations | |
enum | log_levels { NIV_NULL, NIV_FATAL, NIV_MAJ, NIV_CRIT, NIV_WARN, NIV_EVENT, NIV_INFO, NIV_DEBUG, NIV_MID_DEBUG, NIV_FULL_DEBUG, NB_LOG_LEVEL } |
enum | log_components { COMPONENT_ALL = 0, COMPONENT_LOG, COMPONENT_LOG_EMERG, COMPONENT_MEMALLOC, COMPONENT_MEMLEAKS, COMPONENT_FSAL, COMPONENT_NFSPROTO, COMPONENT_NFS_V4, COMPONENT_NFS_V4_PSEUDO, COMPONENT_FILEHANDLE, COMPONENT_NFS_SHELL, COMPONENT_DISPATCH, COMPONENT_CACHE_CONTENT, COMPONENT_CACHE_INODE, COMPONENT_CACHE_INODE_GC, COMPONENT_CACHE_INODE_LRU, COMPONENT_HASHTABLE, COMPONENT_HASHTABLE_CACHE, COMPONENT_LRU, COMPONENT_DUPREQ, COMPONENT_RPCSEC_GSS, COMPONENT_INIT, COMPONENT_MAIN, COMPONENT_IDMAPPER, COMPONENT_NFS_READDIR, COMPONENT_NFS_V4_LOCK, COMPONENT_NFS_V4_XATTR, COMPONENT_NFS_V4_REFERRAL, COMPONENT_MEMCORRUPT, COMPONENT_CONFIG, COMPONENT_CLIENTID, COMPONENT_STDOUT, COMPONENT_SESSIONS, COMPONENT_PNFS, COMPONENT_RPC_CACHE, COMPONENT_RW_LOCK, COMPONENT_NLM, COMPONENT_RPC, COMPONENT_NFS_CB, COMPONENT_THREAD, COMPONENT_NFS_V4_ACL, COMPONENT_STATE, COMPONENT_9P, COMPONENT_9P_DISPATCH, COMPONENT_FSAL_UP, COMPONENT_DBUS, LOG_MESSAGE_VERBOSITY, COMPONENT_COUNT } |
enum | log_type { SYSLOG = 0, FILELOG, STDERRLOG, STDOUTLOG, TESTLOG, BUFFLOG } |
Functions | |
void | SetNamePgm (char *nom) |
void | SetNameHost (char *nom) |
void | SetDefaultLogging (char *name) |
void | SetNameFunction (char *nom) |
void | GetNameFunction (char *name, int len) |
int | AddFamilyError (int num_family, char *nom_family, family_error_t *tab_err) |
char * | ReturnNameFamilyError (int num_family) |
void | InitLogging () |
void | SetLevelDebug (int level_to_set) |
int | ReturnLevelAscii (const char *LevelEnAscii) |
char * | ReturnLevelInt (int level) |
int | MakeLogError (char *buffer, int num_family, int num_error, int status, int ma_ligne) |
int | log_vsnprintf (char *out, size_t n, char *format, va_list arguments) |
int | log_snprintf (char *out, size_t n, char *format,...) |
int | log_fprintf (FILE *file, char *format,...) |
void | RegisterCleanup (cleanup_list_element *clean) |
void | Cleanup (void) |
void | Fatal (void) |
int | SetComponentLogFile (log_components_t component, char *name) |
void | SetComponentLogBuffer (log_components_t component, char *buffer) |
void | SetComponentLogLevel (log_components_t component, int level_to_set) |
int | DisplayLogComponentLevel (log_components_t component, char *function, log_levels_t level, char *format,...) __attribute__((format(printf |
int int | DisplayErrorComponentLogLine (log_components_t component, char *function, int num_family, int num_error, int status, int ma_ligne) |
void | rpc_warnx (char *fmt,...) |
Variables | |
log_level_t | tabLogLevel [NB_LOG_LEVEL] |
#define isDebug | ( | component | ) | (unlikely(LogComponents[component].comp_log_level >= NIV_DEBUG)) |
#define isFullDebug | ( | component | ) | (unlikely(LogComponents[component].comp_log_level >= NIV_FULL_DEBUG)) |
#define isInfo | ( | component | ) | (unlikely(LogComponents[component].comp_log_level >= NIV_INFO)) |
#define isLevel | ( | component, | |
level | |||
) | (unlikely(LogComponents[component].comp_log_level >= level)) |
#define isMidDebug | ( | component | ) | (unlikely(LogComponents[component].comp_log_level >= NIV_MID_DEBUG)) |
#define LogAlways | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (likely(LogComponents[component].comp_log_type != TESTLOG || \ LogComponents[component].comp_log_level <= NIV_FULL_DEBUG)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, NIV_NULL, \ "%s: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define LogAtLevel | ( | component, | |
level, | |||
format, | |||
args... | |||
) |
do { \ if (unlikely(LogComponents[component].comp_log_level >= level)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, level, \ "%s: %s: " format, \ LogComponents[component].comp_str, tabLogLevel[level].short_str, ## args ); \ } while (0)
#define LogCrit | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (likely(LogComponents[component].comp_log_level >= NIV_CRIT)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, NIV_CRIT, \ "%s: CRITICAL ERROR: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define LogDebug | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (unlikely(LogComponents[component].comp_log_level >= NIV_DEBUG)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, NIV_DEBUG, \ "%s: DEBUG: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define LogError | ( | component, | |
a, | |||
b, | |||
c | |||
) |
do { \ if (unlikely(LogComponents[component].comp_log_level >= NIV_CRIT)) \ DisplayErrorComponentLogLine( component,(char *)__FUNCTION__, a, b, c, __LINE__ ); \ } while (0)
#define LogEvent | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (likely(LogComponents[component].comp_log_level >= NIV_EVENT)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, NIV_EVENT, \ "%s: EVENT: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define LogFatal | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (likely(LogComponents[component].comp_log_level >= NIV_FATAL)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, NIV_FATAL, \ "%s: FATAL ERROR: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define LogFullDebug | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (unlikely(LogComponents[component].comp_log_level >= NIV_FULL_DEBUG)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, NIV_FULL_DEBUG, \ "%s: FULLDEBUG: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define LogInfo | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (unlikely(LogComponents[component].comp_log_level >= NIV_INFO)) \ DisplayLogComponentLevel(component, (char *) __FUNCTION__, NIV_INFO, \ "%s: INFO: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define LogMajor | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (likely(LogComponents[component].comp_log_level >= NIV_MAJOR)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, NIV_MAJ, \ "%s: MAJOR ERROR: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define LogMidDebug | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (unlikely(LogComponents[component].comp_log_level >= NIV_MID_DEBUG)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, NIV_MID_DEBUG, \ "%s: MID DEBUG: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define LogTest | ( | format, | |
args... | |||
) |
do { \ DisplayLogComponentLevel(COMPONENT_ALL, (char *)__FUNCTION__, NIV_NULL, \ format, ## args ); \ } while (0)
#define LogWarn | ( | component, | |
format, | |||
args... | |||
) |
do { \ if (likely(LogComponents[component].comp_log_level >= NIV_WARN)) \ DisplayLogComponentLevel(component, (char *)__FUNCTION__, NIV_WARN, \ "%s: WARN: " format, \ LogComponents[component].comp_str, ## args ); \ } while (0)
#define ReturnLevelComponent | ( | component | ) | LogComponents[component].comp_log_level |
#define SetLogLevel | ( | level_to_set | ) | SetComponentLogLevel(COMPONENT_ALL, level_to_set) |
typedef void(* cleanup_function)(void) |
typedef struct cleanup_list_element cleanup_list_element |
typedef family_error_t errctx_t |
typedef struct log_component_info log_component_info |
typedef enum log_components log_components_t |
typedef struct loglev log_level_t |
typedef enum log_levels log_levels_t |
typedef family_error_t status_t |
enum log_components |
enum log_levels |
enum log_type |
int AddFamilyError | ( | int | num_family, |
char * | nom_family, | ||
family_error_t * | tab_err | ||
) |
Definition at line 698 of file log_functions.c.
void Cleanup | ( | void | ) |
Definition at line 200 of file log_functions.c.
int int DisplayErrorComponentLogLine | ( | log_components_t | component, |
char * | function, | ||
int | num_family, | ||
int | num_error, | ||
int | status, | ||
int | ma_ligne | ||
) |
Definition at line 1164 of file log_functions.c.
int DisplayLogComponentLevel | ( | log_components_t | component, |
char * | function, | ||
log_levels_t | level, | ||
char * | format, | ||
... | |||
) |
void Fatal | ( | void | ) |
Definition at line 210 of file log_functions.c.
void GetNameFunction | ( | char * | name, |
int | len | ||
) |
Definition at line 323 of file log_functions.c.
void InitLogging | ( | ) |
Definition at line 494 of file log_functions.c.
int log_fprintf | ( | FILE * | file, |
char * | format, | ||
... | |||
) |
Definition at line 866 of file log_functions.c.
int log_snprintf | ( | char * | out, |
size_t | n, | ||
char * | format, | ||
... | |||
) |
Definition at line 854 of file log_functions.c.
int log_vsnprintf | ( | char * | out, |
size_t | n, | ||
char * | format, | ||
va_list | arguments | ||
) |
Definition at line 847 of file log_functions.c.
int MakeLogError | ( | char * | buffer, |
int | num_family, | ||
int | num_error, | ||
int | status, | ||
int | ma_ligne | ||
) |
Definition at line 780 of file log_functions.c.
void RegisterCleanup | ( | cleanup_list_element * | clean | ) |
Definition at line 194 of file log_functions.c.
int ReturnLevelAscii | ( | const char * | LevelEnAscii | ) |
Definition at line 339 of file log_functions.c.
char* ReturnLevelInt | ( | int | level | ) |
Definition at line 351 of file log_functions.c.
char* ReturnNameFamilyError | ( | int | num_family | ) |
Definition at line 726 of file log_functions.c.
void rpc_warnx | ( | char * | fmt, |
... | |||
) |
Definition at line 1315 of file log_functions.c.
void SetComponentLogBuffer | ( | log_components_t | component, |
char * | buffer | ||
) |
Definition at line 1305 of file log_functions.c.
int SetComponentLogFile | ( | log_components_t | component, |
char * | name | ||
) |
Definition at line 1259 of file log_functions.c.
void SetComponentLogLevel | ( | log_components_t | component, |
int | level_to_set | ||
) |
Definition at line 427 of file log_functions.c.
void SetDefaultLogging | ( | char * | name | ) |
Definition at line 1244 of file log_functions.c.
void SetLevelDebug | ( | int | level_to_set | ) |
Definition at line 470 of file log_functions.c.
void SetNameFunction | ( | char * | nom | ) |
Definition at line 387 of file log_functions.c.
void SetNameHost | ( | char * | nom | ) |
Definition at line 377 of file log_functions.c.
void SetNamePgm | ( | char * | nom | ) |
Definition at line 366 of file log_functions.c.
log_level_t tabLogLevel[NB_LOG_LEVEL] |
Definition at line 58 of file log_functions.c.