mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Consolidate `ALIGN, __ALIGN_MASK, ARRAY_SIZE` macros and add them to lib/zt_common.h. While at it, adapt coding style. Reviewed-by: Philipp Rudo <prudo@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
53 lines
1.0 KiB
C
53 lines
1.0 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)
|
|
|
|
#endif
|