mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
This commit is based on the s390-tools-1.39.0 version. Changes on top of s390-tools-1.39.0: - Add MIT license to all source files - Add LICENSE file - Transform REAMDE to README.md (markdown) - Add AUTHORS.md file - Add CONTRIBUTING.md file - Move changelog from README to CHANGELOG.md file Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com> Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
/*
|
|
* cmsfs-fuse - CMS EDF filesystem support for Linux
|
|
*
|
|
* Common helper functions
|
|
*
|
|
* Copyright IBM Corp. 2010, 2017
|
|
*
|
|
* s390-tools is free software; you can redistribute it and/or modify
|
|
* it under the terms of the MIT license. See LICENSE for details.
|
|
*/
|
|
|
|
#ifndef _HELPER_H
|
|
#define _HELPER_H
|
|
|
|
extern FILE *logfile;
|
|
#define DEBUG_LOGFILE "/tmp/cmsfs-fuse.log"
|
|
|
|
#ifdef DEBUG_ENABLED
|
|
#define DEBUG(...) \
|
|
do { \
|
|
fprintf(logfile, __VA_ARGS__); \
|
|
fflush(logfile); \
|
|
} while (0)
|
|
#else
|
|
#define DEBUG(...)
|
|
#endif
|
|
|
|
#define DIE(...) \
|
|
do { \
|
|
fprintf(stderr, COMP __VA_ARGS__); \
|
|
exit(1); \
|
|
} while (0)
|
|
|
|
#define DIE_PERROR(...) \
|
|
do { \
|
|
perror(COMP __VA_ARGS__); \
|
|
exit(1); \
|
|
} while (0)
|
|
|
|
#define BUG(x) \
|
|
if (x) { \
|
|
fprintf(stderr, COMP " assert failed at " \
|
|
__FILE__ ":%d in %s()\n", __LINE__, __func__); \
|
|
exit(1); \
|
|
}
|
|
|
|
#define WARN(...) \
|
|
do { \
|
|
fprintf(stderr, COMP "Warning, " __VA_ARGS__); \
|
|
} while (0)
|
|
|
|
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
|
|
|
#endif
|