#!/bin/sh aclocal autoheader (libtoolize --automake --copy --force || glibtoolize --automake --copy --force) autoconf automake --add-missing --copy --foreign cd argp-standalone;./autogen.sh General Public License, version 3 or any later version (LGPLv3 or later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. */ #ifndef _COMMON_UTILS_H #define _COMMON_UTILS_H #include #include #include #include #include #include #include #include #ifndef GF_BSD_HOST_OS #include #endif #include #include #ifndef ffsll #define ffsll(x) __builtin_ffsll(x) #endif void trap (void); #define GF_UNIVERSAL_ANSWER 42 /* :O */ /* To solve type punned error */ #define VOID(ptr) ((void **) ((void *) ptr)) #include "logging.h" #include "glusterfs.h" #include "locking.h" #include "mem-pool.h" #include "compat-uuid.h" #include "iatt.h" #include "uuid.h" #include "libglusterfs-messages.h" #include "protocol-common.h" #define STRINGIFY(val) #val #define TOSTRING(val) STRINGIFY(val) #define alloca0(size) ({void *__ptr; __ptr = alloca(size); memset(__ptr, 0, size); __ptr; }) #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define roof(a,b) ((((a)+(b)-1)/((b!=0)?(b):1))*(b)) #define floor(a,b) (((a)/((b!=0)?(b):1))*(b)) #define IPv4_ADDR_SIZE 32 #define GF_UNIT_KB 1024ULL #define GF_UNIT_MB 1048576ULL #define GF_UNIT_GB 1073741824ULL #define GF_UNIT_TB 1099511627776ULL #define GF_UNIT_PB 1125899906842624ULL #define GF_UNIT_B_STRING "B" #define GF_UNIT_KB_STRING "KB" #define GF_UNIT_MB_STRING "MB" #define GF_UNIT_GB_STRING "GB" #define GF_UNIT_TB_STRING "TB" #define GF_UNIT_PB_STRING "PB" #define GF_UNIT_PERCENT_STRING "%" #define GEOREP "geo-replication" #define GHADOOP "glusterfs-hadoop" #define GLUSTERD_NAME "glusterd" #define GF_SELINUX_XATTR_KEY "security.selinux" #define WIPE(statp) do { typeof(*statp) z = {0,}; if (statp) *statp = z; } while (0) #define IS_EXT_FS(fs_name) \ (!strcmp (fs_name, "ext2") || \ !strcmp (fs_name, "ext3") || \ !strcmp (fs_name, "ext4")) /* process mode definitions */ #define GF_SERVER_PROCESS 0 #define GF_CLIENT_PROCESS 1 #define GF_GLUSTERD_PROCESS 2 /* Defining this here as it is needed by glusterd for setting * nfs port in volume status. */ #define GF_NFS3_PORT 2049 #define GF_CLIENT_PORT_CEILING 1024 #define GF_IANA_PRIV_PORTS_START 49152 /* RFC 6335 */ #define GF_CLNT_INSECURE_PORT_CEILING (GF_IANA_PRIV_PORTS_START - 1) #define GF_PORT_MAX 65535 #define GF_PORT_ARRAY_SIZE ((GF_PORT_MAX + 7) / 8) #define GF_LOCK_TIMER 180 #define GF_MINUTE_IN_SECONDS 60 #define GF_HOUR_IN_SECONDS (60*60) #define GF_DAY_IN_SECONDS (24*60*60) #define GF_WEEK_IN_SECONDS (7*24*60*60) /* Default timeout for both barrier and changelog translator */ #define BARRIER_TIMEOUT "120" /* Default value of signing waiting time to sign a file for bitrot */ #define SIGNING_TIMEOUT "120" /* xxhash */ #define GF_XXH64_DIGEST_LENGTH 8 #define GF_XXHSUM64_DEFAULT_SEED 0 /* Shard */ #define GF_XATTR_SHARD_FILE_SIZE "trusted.glusterfs.shard.file-size" #define SHARD_ROOT_GFID "be318638-e8a0-4c6d-977d-7a937aa84806" /* Lease: buffer length for stringified lease id * Format: 4hexnum-4hexnum-4hexnum-4hexnum-4hexnum-4hexnum-4hexnum-4hexnum * Eg:6c69-6431-2d63-6c6e-7431-0000-0000-0000 */ #define GF_LEASE_ID_BUF_SIZE ((LEASE_ID_SIZE * 2) + \ (LEASE_ID_SIZE / 2)) #define GF_PERCENTAGE(val, total)