glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

common-utils.h File Reference
#include <stdint.h>
#include <sys/uio.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#include <openssl/md5.h>
#include <alloca.h>
#include <limits.h>
#include <fnmatch.h>
#include <uuid/uuid.h>
#include "glusterfs/mem-pool.h"
#include "glusterfs/compat-uuid.h"
#include "glusterfs/iatt.h"
#include "glusterfs/libglusterfs-messages.h"
Include dependency graph for common-utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dht_changelog_rename_info
 
struct  dnscache
 
struct  dnscache_entry
 
struct  dnscache6
 
struct  list_node
 
union  gf_sock_union
 
struct  _iov_iter
 
struct  token_iter
 

Macros

#define ffsll(x)   __builtin_ffsll(x)
 
#define GF_UNIVERSAL_ANSWER   42 /* :O */
 
#define VOID(ptr)   ((void **)((void *)ptr))
 
#define STRINGIFY(val)   #val
 
#define TOSTRING(val)   STRINGIFY(val)
 
#define alloca0(size)
 
#define min(a, b)   ((a) < (b) ? (a) : (b))
 
#define max(a, b)   ((a) > (b) ? (a) : (b))
 
#define gf_roof(a, b)   ((((a) + (b)-1) / ((b != 0) ? (b) : 1)) * (b))
 
#define gf_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 GLUSTERD_NAME   "glusterd"
 
#define GF_SELINUX_XATTR_KEY   "security.selinux"
 
#define WIPE(statp)
 
#define IS_EXT_FS(fs_name)
 
#define GF_SERVER_PROCESS   0
 
#define GF_CLIENT_PROCESS   1
 
#define GF_GLUSTERD_PROCESS   2
 
#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)
 
#define GF_SEC_IN_NS   1000000000
 
#define GF_MS_IN_NS   1000000
 
#define GF_US_IN_NS   1000
 
#define BARRIER_TIMEOUT   "120"
 
#define SIGNING_TIMEOUT   "120"
 
#define BR_WORKERS   "4"
 
#define GF_XXH64_DIGEST_LENGTH   8
 
#define GF_XXHSUM64_DEFAULT_SEED   0
 
#define GF_XATTR_SHARD_FILE_SIZE   "trusted.glusterfs.shard.file-size"
 
#define SHARD_ROOT_GFID   "be318638-e8a0-4c6d-977d-7a937aa84806"
 
#define DOT_SHARD_REMOVE_ME_GFID   "77dd5a45-dbf5-4592-b31b-b440382302e9"
 
#define GF_LEASE_ID_BUF_SIZE   ((LEASE_ID_SIZE * 2) + (LEASE_ID_SIZE / 2))
 
#define GF_PERCENTAGE(val, total)   (((val)*100) / (total))
 
#define GF_THREAD_NAME_LIMIT   16
 
#define GF_THREAD_NAME_PREFIX   "glfs_"
 
#define VECTORSIZE(count)   (count * (sizeof(struct iovec)))
 
#define STRLEN_0(str)   (strlen(str) + 1)
 
#define VALIDATE_OR_GOTO(arg, label)
 
#define GF_VALIDATE_OR_GOTO(name, arg, label)
 
#define GF_VALIDATE_OR_GOTO_WITH_ERROR(name, arg, label, errno, error)
 
#define GF_CHECK_ALLOC(arg, retval, label)
 
#define GF_CHECK_ALLOC_AND_LOG(name, item, retval, msg, errlabel)
 
#define GF_ASSERT_AND_GOTO_WITH_ERROR(name, arg, label, errno, error)
 
#define GF_VALIDATE_ABSOLUTE_PATH_OR_GOTO(name, arg, label)
 
#define GF_REMOVE_SLASH_FROM_PATH(path, string)
 
#define GF_REMOVE_INTERNAL_XATTR(pattern, dict)
 
#define GF_IF_INTERNAL_XATTR_GOTO(pattern, dict, op_errno, label)
 
#define GF_IF_NATIVE_XATTR_GOTO(pattern, key, op_errno, label)
 
#define GF_ASSERT(x)
 
#define GF_ABORT(msg...)
 
#define GF_UUID_ASSERT(u)
 
#define GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, op_errno)
 
#define GF_HIDDEN_PATH   ".glusterfs"
 
#define GF_UNLINK_PATH   GF_HIDDEN_PATH "/unlink"
 
#define GF_LANDFILL_PATH   GF_HIDDEN_PATH "/landfill"
 
#define IOV_MIN(n)   min(IOV_MAX, n)
 
#define GF_SKIP_IRRELEVANT_ENTRIES(entry, dir, scr)
 

Typedefs

typedef enum _gf_special_pid gf_special_pid_t
 
typedef enum _gf_xlator_ipc_targets _gf_xlator_ipc_targets_t
 
typedef struct dht_changelog_rename_info dht_changelog_rename_info_t
 
typedef int(* gf_cmp) (void *, void *)
 
typedef struct _iov_iter iov_iter_t
 
typedef struct token_iter token_iter_t
 

Enumerations

enum  _gf_special_pid {
  GF_CLIENT_PID_MAX = 0, GF_CLIENT_PID_GSYNCD = -1, GF_CLIENT_PID_HADOOP = -2, GF_CLIENT_PID_DEFRAG = -3,
  GF_CLIENT_PID_NO_ROOT_SQUASH = -4, GF_CLIENT_PID_QUOTA_MOUNT = -5, GF_CLIENT_PID_SELF_HEALD = -6, GF_CLIENT_PID_GLFS_HEAL = -7,
  GF_CLIENT_PID_BITD = -8, GF_CLIENT_PID_SCRUB = -9, GF_CLIENT_PID_TIER_DEFRAG = -10, GF_SERVER_PID_TRASH = -11,
  GF_CLIENT_PID_ADD_REPLICA_MOUNT = -12, GF_CLIENT_PID_SET_UTIME = -13
}
 
enum  _gf_xlator_ipc_targets { GF_IPC_TARGET_CHANGELOG = 0, GF_IPC_TARGET_CTR = 1, GF_IPC_TARGET_UPCALL = 2 }
 
enum  gf_timefmts {
  gf_timefmt_default = 0, gf_timefmt_FT = 0, gf_timefmt_Ymd_T, gf_timefmt_bdT,
  gf_timefmt_F_HMS, gf_timefmt_dirent, gf_timefmt_s, gf_timefmt_last
}
 

Functions

void trap (void)
 
struct list_nodelist_node_add (void *ptr, struct list_head *list)
 
struct list_nodelist_node_add_order (void *ptr, struct list_head *list, int(*compare)(struct list_head *, struct list_head *))
 
void list_node_del (struct list_node *node)
 
struct dnscachegf_dnscache_init (time_t ttl)
 
void gf_dnscache_deinit (struct dnscache *cache)
 
struct dnscache_entrygf_dnscache_entry_init (void)
 
void gf_dnscache_entry_deinit (struct dnscache_entry *entry)
 
char * gf_rev_dns_lookup_cached (const char *ip, struct dnscache *dnscache)
 
char * gf_resolve_path_parent (const char *path)
 
void gf_global_variable_init (void)
 
int32_t gf_resolve_ip6 (const char *hostname, uint16_t port, int family, void **dnscache, struct addrinfo **addr_info)
 
void gf_log_dump_graph (FILE *specfp, glusterfs_graph_t *graph)
 
void gf_print_trace (int32_t signal, glusterfs_ctx_t *ctx)
 
int gf_set_log_file_path (cmd_args_t *cmd_args, glusterfs_ctx_t *ctx)
 
int gf_set_log_ident (cmd_args_t *cmd_args)
 
int gf_process_getspec_servers_list (cmd_args_t *cmd_args, const char *servers_list)
 
int gf_set_volfile_server_common (cmd_args_t *cmd_args, const char *host, const char *transport, int port)
 
static void BIT_SET (unsigned char *array, unsigned int index)
 
static void BIT_CLEAR (unsigned char *array, unsigned int index)
 
static unsigned int BIT_VALUE (unsigned char *array, unsigned int index)
 
static void iov_free (struct iovec *vector, int count)
 
static int iov_length (const struct iovec *vector, int count)
 
static struct iovec * iov_dup (const struct iovec *vector, int count)
 
static bool iov_iter_init (iov_iter_t *iter, const struct iovec *iovec, uint32_t count, uint32_t offset)
 
static bool iov_iter_end (iov_iter_t *iter)
 
static bool iov_iter_next (iov_iter_t *iter, uint32_t size)
 
static uint32_t iov_iter_copy (iov_iter_t *dst, iov_iter_t *src, uint32_t size)
 
static uint32_t iov_iter_to_iovec (iov_iter_t *iter, struct iovec *iovec, int32_t idx, uint32_t size)
 
static int iov_subset (struct iovec *src, int src_count, uint32_t start, uint32_t size, struct iovec **dst, int32_t dst_count)
 
static int iov_skip (struct iovec *iovec, uint32_t count, uint32_t size)
 
static size_t iov_range_copy (const struct iovec *dst, uint32_t dst_count, uint32_t dst_offset, const struct iovec *src, uint32_t src_count, uint32_t src_offset, uint32_t size)
 
static void iov_unload (char *buf, const struct iovec *vector, int count)
 
static size_t iov_load (const struct iovec *vector, int count, char *buf, int size)
 
static size_t iov_copy (const struct iovec *dst, int dcnt, const struct iovec *src, int scnt)
 
static bool memeqzero (const void *data, size_t length)
 
static int mem_0filled (const char *buf, size_t size)
 
static int iov_0filled (const struct iovec *vector, int count)
 
static char * gf_time_fmt (char *dst, size_t sz_dst, time_t utime, unsigned int fmt)
 
ino_t gfid_to_ino (uuid_t gfid)
 
int mkdir_p (char *path, mode_t mode, bool allow_symlinks)
 
int gf_lstat_dir (const char *path, struct stat *stbuf_in)
 
int32_t gf_roundup_power_of_two (int32_t nr)
 
int32_t gf_roundup_next_power_of_two (int32_t nr)
 
char * gf_trim (char *string)
 
int gf_volume_name_validate (const char *volume_name)
 
int gf_string2long (const char *str, long *n)
 
int gf_string2ulong (const char *str, unsigned long *n)
 
int gf_string2int (const char *str, int *n)
 
int gf_string2uint (const char *str, unsigned int *n)
 
int gf_string2double (const char *str, double *n)
 
int gf_string2longlong (const char *str, long long *n)
 
int gf_string2ulonglong (const char *str, unsigned long long *n)
 
int gf_string2int8 (const char *str, int8_t *n)
 
int gf_string2int16 (const char *str, int16_t *n)
 
int gf_string2int32 (const char *str, int32_t *n)
 
int gf_string2int64 (const char *str, int64_t *n)
 
int gf_string2uint8 (const char *str, uint8_t *n)
 
int gf_string2uint16 (const char *str, uint16_t *n)
 
int gf_string2uint32 (const char *str, uint32_t *n)
 
int gf_string2uint64 (const char *str, uint64_t *n)
 
int gf_strstr (const char *str, const char *delim, const char *match)
 
int gf_string2ulong_base10 (const char *str, unsigned long *n)
 
int gf_string2uint_base10 (const char *str, unsigned int *n)
 
int gf_string2uint8_base10 (const char *str, uint8_t *n)
 
int gf_string2uint16_base10 (const char *str, uint16_t *n)
 
int gf_string2uint32_base10 (const char *str, uint32_t *n)
 
int gf_string2uint64_base10 (const char *str, uint64_t *n)
 
int gf_string2bytesize_uint64 (const char *str, uint64_t *n)
 
int gf_string2bytesize_int64 (const char *str, int64_t *n)
 
int gf_string2percent_or_bytesize (const char *str, double *n, bool *is_percent)
 
int gf_string2boolean (const char *str, bool *b)
 
int gf_strn2boolean (const char *str, const int len, bool *b)
 
int gf_string2percent (const char *str, double *n)
 
int gf_string2time (const char *str, uint32_t *n)
 
int gf_lockfd (int fd)
 
int gf_unlockfd (int fd)
 
int get_checksum_for_file (int fd, uint32_t *checksum, int op_version)
 
int log_base2 (unsigned long x)
 
int get_checksum_for_path (char *path, uint32_t *checksum, int op_version)
 
int get_file_mtime (const char *path, time_t *stamp)
 
char * strtail (char *str, const char *pattern)
 
void skipwhite (char **s)
 
char * nwstrtail (char *str, char *pattern)
 
char * token_iter_init (char *str, char sep, token_iter_t *tit)
 
bool next_token (char **tokenp, token_iter_t *tit)
 
void drop_token (char *token, token_iter_t *tit)
 
bool mask_match (const uint32_t a, const uint32_t b, const uint32_t m)
 
bool gf_is_ip_in_net (const char *network, const char *ip_str)
 
char valid_host_name (char *address, int length)
 
char valid_ipv4_address (char *address, int length, bool wildcard_acc)
 
char valid_ipv6_address (char *address, int length, bool wildcard_acc)
 
char valid_internet_address (char *address, bool wildcard_acc, bool cidr)
 
bool valid_mount_auth_address (char *address)
 
bool valid_ipv4_subnetwork (const char *address)
 
bool gf_sock_union_equal_addr (union gf_sock_union *a, union gf_sock_union *b)
 
char * gf_rev_dns_lookup (const char *ip)
 
char * uuid_utoa (uuid_t uuid)
 
char * uuid_utoa_r (uuid_t uuid, char *dst)
 
char * lkowner_utoa (gf_lkowner_t *lkowner)
 
char * lkowner_utoa_r (gf_lkowner_t *lkowner, char *dst, int len)
 
char * leaseid_utoa (const char *lease_id)
 
bool is_valid_lease_id (const char *lease_id)
 
char * gf_leaseid_get (void)
 
char * gf_existing_leaseid (void)
 
void gf_array_insertionsort (void *a, int l, int r, size_t elem_size, gf_cmp cmp)
 
int gf_is_str_int (const char *value)
 
char * gf_uint64_2human_readable (uint64_t)
 
int validate_brick_name (char *brick)
 
char * get_host_name (char *word, char **host)
 
char * get_path_name (char *word, char **path)
 
void gf_path_strip_trailing_slashes (char *path)
 
uint64_t get_mem_size (void)
 
int gf_strip_whitespace (char *str, int len)
 
int gf_canonicalize_path (char *path)
 
char * generate_glusterfs_ctx_id (void)
 
char * gf_get_reserved_ports (void)
 
int gf_process_reserved_ports (unsigned char *ports, uint32_t ceiling)
 
bool gf_ports_reserved (char *blocked_port, unsigned char *ports, uint32_t ceiling)
 
int gf_get_hostname_from_ip (char *client_ip, char **hostname)
 
bool gf_is_local_addr (char *hostname)
 
bool gf_is_same_address (char *host1, char *host2)
 
void gf_xxh64_wrapper (const unsigned char *data, size_t const len, unsigned long long const seed, char *xxh64)
 
int gf_gfid_generate_from_xxh64 (uuid_t gfid, char *key)
 
int gf_set_timestamp (const char *src, const char *dest)
 
int gf_thread_create (pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg, const char *name,...)
 
int gf_thread_vcreate (pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg, const char *name, va_list args)
 
int gf_thread_create_detached (pthread_t *thread, void *(*start_routine)(void *), void *arg, const char *name,...)
 
void gf_thread_set_name (pthread_t thread, const char *name,...)
 
void gf_thread_set_vname (pthread_t thread, const char *name, va_list args)
 
bool gf_is_pid_running (int pid)
 
bool gf_is_service_running (char *pidfile, int *pid)
 
bool gf_valid_pid (const char *pid, int length)
 
int gf_skip_header_section (int fd, int header_len)
 
bool dht_is_linkfile (struct iatt *buf, struct _dict *dict)
 
int gf_check_log_format (const char *value)
 
int gf_check_logger (const char *value)
 
bool gf_compare_sockaddr (const struct sockaddr *addr1, const struct sockaddr *addr2)
 
char * gf_backtrace_save (char *buf)
 
void gf_backtrace_done (char *buf)
 
gf_loglevel_t fop_log_level (glusterfs_fop_t fop, int op_errno)
 
int32_t gf_build_absolute_path (char *current_path, char *relative_path, char **path)
 
int recursive_rmdir (const char *delete_path)
 
int gf_get_index_by_elem (char **array, char *elem)
 
int glusterfs_is_local_pathinfo (char *pathinfo, bool *local)
 
int gf_thread_cleanup_xint (pthread_t thread)
 
ssize_t gf_nread (int fd, void *buf, size_t count)
 
ssize_t gf_nwrite (int fd, const void *buf, size_t count)
 
void _mask_cancellation (void)
 
void _unmask_cancellation (void)
 
bool gf_is_zero_filled_stat (struct iatt *buf)
 
void gf_zero_fill_stat (struct iatt *buf)
 
bool gf_is_valid_xattr_namespace (char *k)
 
const char * gf_inode_type_to_str (ia_type_t type)
 
int32_t gf_bits_count (uint64_t n)
 
int32_t gf_bits_index (uint64_t n)
 
const char * gf_fop_string (glusterfs_fop_t fop)
 
int gf_fop_int (char *fop)
 
char * get_ip_from_addrinfo (struct addrinfo *addr, char **ip)
 
int close_fds_except (int *fdv, size_t count)
 
int gf_getgrouplist (const char *user, gid_t group, gid_t **groups)
 
int glusterfs_compute_sha256 (const unsigned char *content, size_t size, char *sha256_hash)
 
char * gf_strncpy (char *dest, const char *src, const size_t dest_size)
 
void gf_strTrim (char **s)
 
int gf_replace_old_iatt_in_dict (struct _dict *)
 
int gf_replace_new_iatt_in_dict (struct _dict *)
 
xlator_cmdline_option_tfind_xlator_option_in_cmd_args_t (const char *option_name, cmd_args_t *args)
 
int gf_d_type_from_ia_type (ia_type_t type)
 
int gf_nanosleep (uint64_t nsec)
 

Variables

char * vol_type_str []
 

Macro Definition Documentation

◆ alloca0

#define alloca0 (   size)
Value:
({ \
void *__ptr; \
__ptr = alloca(size); \
memset(__ptr, 0, size); \
__ptr; \
})

Definition at line 49 of file common-utils.h.

◆ BARRIER_TIMEOUT

#define BARRIER_TIMEOUT   "120"

Definition at line 122 of file common-utils.h.

◆ BR_WORKERS

#define BR_WORKERS   "4"

Definition at line 126 of file common-utils.h.

◆ DOT_SHARD_REMOVE_ME_GFID

#define DOT_SHARD_REMOVE_ME_GFID   "77dd5a45-dbf5-4592-b31b-b440382302e9"

Definition at line 135 of file common-utils.h.

◆ ffsll

#define ffsll (   x)    __builtin_ffsll(x)

Definition at line 30 of file common-utils.h.

◆ GEOREP

#define GEOREP   "geo-replication"

Definition at line 79 of file common-utils.h.

◆ GF_ABORT

#define GF_ABORT (   msg...)
Value:
do { \
gf_msg_callingfn("", GF_LOG_CRITICAL, 0, LG_MSG_ASSERTION_FAILED, \
"Assertion failed: " msg); \
abort(); \
} while (0)

Definition at line 443 of file common-utils.h.

◆ GF_ASSERT

#define GF_ASSERT (   x)
Value:
do { \
if (!(x)) { \
gf_msg_callingfn("", GF_LOG_ERROR, 0, LG_MSG_ASSERTION_FAILED, \
"Assertion failed: " #x); \
} \
} while (0)

Definition at line 434 of file common-utils.h.

◆ GF_ASSERT_AND_GOTO_WITH_ERROR

#define GF_ASSERT_AND_GOTO_WITH_ERROR (   name,
  arg,
  label,
  errno,
  error 
)
Value:
do { \
if (!arg) { \
GF_ASSERT(0); \
errno = error; \
goto label; \
} \
} while (0)

Definition at line 356 of file common-utils.h.

◆ GF_CHECK_ALLOC

#define GF_CHECK_ALLOC (   arg,
  retval,
  label 
)
Value:
do { \
if (!(arg)) { \
retval = -ENOMEM; \
goto label; \
} \
} while (0)

Definition at line 339 of file common-utils.h.

◆ GF_CHECK_ALLOC_AND_LOG

#define GF_CHECK_ALLOC_AND_LOG (   name,
  item,
  retval,
  msg,
  errlabel 
)
Value:
do { \
if (!(item)) { \
(retval) = -ENOMEM; \
gf_msg(name, GF_LOG_CRITICAL, ENOMEM, LG_MSG_NO_MEMORY, (msg)); \
goto errlabel; \
} \
} while (0)

Definition at line 347 of file common-utils.h.

◆ GF_CLIENT_PORT_CEILING

#define GF_CLIENT_PORT_CEILING   1024

Definition at line 107 of file common-utils.h.

◆ GF_CLIENT_PROCESS

#define GF_CLIENT_PROCESS   1

Definition at line 99 of file common-utils.h.

◆ GF_CLNT_INSECURE_PORT_CEILING

#define GF_CLNT_INSECURE_PORT_CEILING   (GF_IANA_PRIV_PORTS_START - 1)

Definition at line 109 of file common-utils.h.

◆ GF_DAY_IN_SECONDS

#define GF_DAY_IN_SECONDS   (24 * 60 * 60)

Definition at line 115 of file common-utils.h.

◆ gf_floor

#define gf_floor (   a,
 
)    (((a) / ((b != 0) ? (b) : 1)) * (b))

Definition at line 60 of file common-utils.h.

◆ GF_GLUSTERD_PROCESS

#define GF_GLUSTERD_PROCESS   2

Definition at line 100 of file common-utils.h.

◆ GF_HIDDEN_PATH

#define GF_HIDDEN_PATH   ".glusterfs"

Definition at line 467 of file common-utils.h.

◆ GF_HOUR_IN_SECONDS

#define GF_HOUR_IN_SECONDS   (60 * 60)

Definition at line 114 of file common-utils.h.

◆ GF_IANA_PRIV_PORTS_START

#define GF_IANA_PRIV_PORTS_START   49152 /* RFC 6335 */

Definition at line 108 of file common-utils.h.

◆ GF_IF_INTERNAL_XATTR_GOTO

#define GF_IF_INTERNAL_XATTR_GOTO (   pattern,
  dict,
  op_errno,
  label 
)
Value:
do { \
if (!dict) { \
gf_msg(this->name, GF_LOG_ERROR, 0, LG_MSG_DICT_NULL, \
"setxattr dict is null"); \
goto label; \
} \
if (dict_foreach_fnmatch(dict, pattern, dict_null_foreach_fn, NULL) > \
0) { \
op_errno = EPERM; \
gf_msg(this->name, GF_LOG_ERROR, op_errno, LG_MSG_NO_PERM, \
"attempt to set internal" \
" xattr: %s", \
pattern); \
goto label; \
} \
} while (0)

Definition at line 396 of file common-utils.h.

◆ GF_IF_NATIVE_XATTR_GOTO

#define GF_IF_NATIVE_XATTR_GOTO (   pattern,
  key,
  op_errno,
  label 
)
Value:
do { \
if (!key) { \
gf_msg(this->name, GF_LOG_ERROR, 0, LG_MSG_NO_KEY, \
"no key for removexattr"); \
goto label; \
} \
if (!fnmatch(pattern, key, 0)) { \
op_errno = EPERM; \
gf_msg(this->name, GF_LOG_ERROR, op_errno, LG_MSG_NO_PERM, \
"attempt to remove internal " \
"xattr: %s", \
key); \
goto label; \
} \
} while (0)

Definition at line 414 of file common-utils.h.

◆ GF_IGNORE_IF_GSYNCD_SAFE_ERROR

#define GF_IGNORE_IF_GSYNCD_SAFE_ERROR (   frame,
  op_errno 
)
Value:
(((frame->root->pid == GF_CLIENT_PID_GSYNCD) && \
(op_errno == EEXIST || op_errno == ENOENT)) \
? 0 \
: 1)

Definition at line 454 of file common-utils.h.

◆ GF_LANDFILL_PATH

#define GF_LANDFILL_PATH   GF_HIDDEN_PATH "/landfill"

Definition at line 469 of file common-utils.h.

◆ GF_LEASE_ID_BUF_SIZE

#define GF_LEASE_ID_BUF_SIZE   ((LEASE_ID_SIZE * 2) + (LEASE_ID_SIZE / 2))

Definition at line 141 of file common-utils.h.

◆ GF_LOCK_TIMER

#define GF_LOCK_TIMER   180

Definition at line 112 of file common-utils.h.

◆ GF_MINUTE_IN_SECONDS

#define GF_MINUTE_IN_SECONDS   60

Definition at line 113 of file common-utils.h.

◆ GF_MS_IN_NS

#define GF_MS_IN_NS   1000000

Definition at line 118 of file common-utils.h.

◆ GF_NFS3_PORT

#define GF_NFS3_PORT   2049

Definition at line 105 of file common-utils.h.

◆ GF_PERCENTAGE

#define GF_PERCENTAGE (   val,
  total 
)    (((val)*100) / (total))

Definition at line 143 of file common-utils.h.

◆ GF_PORT_ARRAY_SIZE

#define GF_PORT_ARRAY_SIZE   ((GF_PORT_MAX + 7) / 8)

Definition at line 111 of file common-utils.h.

◆ GF_PORT_MAX

#define GF_PORT_MAX   65535

Definition at line 110 of file common-utils.h.

◆ GF_REMOVE_INTERNAL_XATTR

#define GF_REMOVE_INTERNAL_XATTR (   pattern,
  dict 
)
Value:
do { \
if (!dict) { \
gf_msg(this->name, GF_LOG_ERROR, 0, LG_MSG_DICT_NULL, \
"dict is null"); \
break; \
} \
dict_foreach_fnmatch(dict, pattern, dict_remove_foreach_fn, NULL); \
} while (0)

Definition at line 386 of file common-utils.h.

◆ GF_REMOVE_SLASH_FROM_PATH

#define GF_REMOVE_SLASH_FROM_PATH (   path,
  string 
)
Value:
do { \
int i = 0; \
for (i = 1; i < strlen(path); i++) { \
string[i - 1] = path[i]; \
if (string[i - 1] == '/') \
string[i - 1] = '-'; \
} \
} while (0)

Definition at line 376 of file common-utils.h.

◆ gf_roof

#define gf_roof (   a,
 
)    ((((a) + (b)-1) / ((b != 0) ? (b) : 1)) * (b))

Definition at line 59 of file common-utils.h.

◆ GF_SEC_IN_NS

#define GF_SEC_IN_NS   1000000000

Definition at line 117 of file common-utils.h.

◆ GF_SELINUX_XATTR_KEY

#define GF_SELINUX_XATTR_KEY   "security.selinux"

Definition at line 82 of file common-utils.h.

◆ GF_SERVER_PROCESS

#define GF_SERVER_PROCESS   0

Definition at line 98 of file common-utils.h.

◆ GF_SKIP_IRRELEVANT_ENTRIES

#define GF_SKIP_IRRELEVANT_ENTRIES (   entry,
  dir,
  scr 
)
Value:
do { \
entry = NULL; \
if (dir) { \
entry = sys_readdir(dir, scr); \
while (entry && (!strcmp(entry->d_name, ".") || \
!fnmatch("*.tmp", entry->d_name, 0) || \
!strcmp(entry->d_name, ".."))) { \
entry = sys_readdir(dir, scr); \
} \
} \
} while (0)

Definition at line 473 of file common-utils.h.

◆ GF_THREAD_NAME_LIMIT

#define GF_THREAD_NAME_LIMIT   16

Definition at line 148 of file common-utils.h.

◆ GF_THREAD_NAME_PREFIX

#define GF_THREAD_NAME_PREFIX   "glfs_"

Definition at line 149 of file common-utils.h.

◆ GF_UNIT_B_STRING

#define GF_UNIT_B_STRING   "B"

Definition at line 70 of file common-utils.h.

◆ GF_UNIT_GB

#define GF_UNIT_GB   1073741824ULL

Definition at line 66 of file common-utils.h.

◆ GF_UNIT_GB_STRING

#define GF_UNIT_GB_STRING   "GB"

Definition at line 73 of file common-utils.h.

◆ GF_UNIT_KB

#define GF_UNIT_KB   1024ULL

Definition at line 64 of file common-utils.h.

◆ GF_UNIT_KB_STRING

#define GF_UNIT_KB_STRING   "KB"

Definition at line 71 of file common-utils.h.

◆ GF_UNIT_MB

#define GF_UNIT_MB   1048576ULL

Definition at line 65 of file common-utils.h.

◆ GF_UNIT_MB_STRING

#define GF_UNIT_MB_STRING   "MB"

Definition at line 72 of file common-utils.h.

◆ GF_UNIT_PB

#define GF_UNIT_PB   1125899906842624ULL

Definition at line 68 of file common-utils.h.

◆ GF_UNIT_PB_STRING

#define GF_UNIT_PB_STRING   "PB"

Definition at line 75 of file common-utils.h.

◆ GF_UNIT_PERCENT_STRING

#define GF_UNIT_PERCENT_STRING   "%"

Definition at line 77 of file common-utils.h.

◆ GF_UNIT_TB

#define GF_UNIT_TB   1099511627776ULL

Definition at line 67 of file common-utils.h.

◆ GF_UNIT_TB_STRING

#define GF_UNIT_TB_STRING   "TB"

Definition at line 74 of file common-utils.h.

◆ GF_UNIVERSAL_ANSWER

#define GF_UNIVERSAL_ANSWER   42 /* :O */

Definition at line 36 of file common-utils.h.

◆ GF_UNLINK_PATH

#define GF_UNLINK_PATH   GF_HIDDEN_PATH "/unlink"

Definition at line 468 of file common-utils.h.

◆ GF_US_IN_NS

#define GF_US_IN_NS   1000

Definition at line 119 of file common-utils.h.

◆ GF_UUID_ASSERT

#define GF_UUID_ASSERT (   u)
Value:
if (gf_uuid_is_null(u)) \
GF_ASSERT(!"uuid null");

Definition at line 450 of file common-utils.h.

◆ GF_VALIDATE_ABSOLUTE_PATH_OR_GOTO

#define GF_VALIDATE_ABSOLUTE_PATH_OR_GOTO (   name,
  arg,
  label 
)
Value:
do { \
GF_VALIDATE_OR_GOTO(name, arg, label); \
if ((arg[0]) != '/') { \
errno = EINVAL; \
gf_msg_callingfn(name, GF_LOG_ERROR, EINVAL, LG_MSG_INVALID_ARG, \
"invalid argument: " #arg); \
goto label; \
} \
} while (0)

Definition at line 365 of file common-utils.h.

◆ GF_VALIDATE_OR_GOTO

#define GF_VALIDATE_OR_GOTO (   name,
  arg,
  label 
)
Value:
do { \
if (!arg) { \
errno = EINVAL; \
gf_msg_callingfn(name, GF_LOG_ERROR, errno, LG_MSG_INVALID_ARG, \
"invalid argument: " #arg); \
goto label; \
} \
} while (0)

Definition at line 319 of file common-utils.h.

◆ GF_VALIDATE_OR_GOTO_WITH_ERROR

#define GF_VALIDATE_OR_GOTO_WITH_ERROR (   name,
  arg,
  label,
  errno,
  error 
)
Value:
do { \
if (!arg) { \
errno = error; \
gf_msg_callingfn(name, GF_LOG_ERROR, EINVAL, LG_MSG_INVALID_ARG, \
"invalid argument: " #arg); \
goto label; \
} \
} while (0)

Definition at line 329 of file common-utils.h.

◆ GF_WEEK_IN_SECONDS

#define GF_WEEK_IN_SECONDS   (7 * 24 * 60 * 60)

Definition at line 116 of file common-utils.h.

◆ GF_XATTR_SHARD_FILE_SIZE

#define GF_XATTR_SHARD_FILE_SIZE   "trusted.glusterfs.shard.file-size"

Definition at line 133 of file common-utils.h.

◆ GF_XXH64_DIGEST_LENGTH

#define GF_XXH64_DIGEST_LENGTH   8

Definition at line 129 of file common-utils.h.

◆ GF_XXHSUM64_DEFAULT_SEED

#define GF_XXHSUM64_DEFAULT_SEED   0

Definition at line 130 of file common-utils.h.

◆ GLUSTERD_NAME

#define GLUSTERD_NAME   "glusterd"

Definition at line 80 of file common-utils.h.

◆ IOV_MIN

#define IOV_MIN (   n)    min(IOV_MAX, n)

Definition at line 471 of file common-utils.h.

◆ IPv4_ADDR_SIZE

#define IPv4_ADDR_SIZE   32

Definition at line 62 of file common-utils.h.

◆ IS_EXT_FS

#define IS_EXT_FS (   fs_name)
Value:
(!strcmp(fs_name, "ext2") || !strcmp(fs_name, "ext3") || \
!strcmp(fs_name, "ext4"))

Definition at line 93 of file common-utils.h.

◆ max

#define max (   a,
 
)    ((a) > (b) ? (a) : (b))

Definition at line 58 of file common-utils.h.

◆ min

#define min (   a,
 
)    ((a) < (b) ? (a) : (b))

Definition at line 57 of file common-utils.h.

◆ SHARD_ROOT_GFID

#define SHARD_ROOT_GFID   "be318638-e8a0-4c6d-977d-7a937aa84806"

Definition at line 134 of file common-utils.h.

◆ SIGNING_TIMEOUT

#define SIGNING_TIMEOUT   "120"

Definition at line 125 of file common-utils.h.

◆ STRINGIFY

#define STRINGIFY (   val)    #val

Definition at line 46 of file common-utils.h.

◆ STRLEN_0

#define STRLEN_0 (   str)    (strlen(str) + 1)

Definition at line 306 of file common-utils.h.

◆ TOSTRING

#define TOSTRING (   val)    STRINGIFY(val)

Definition at line 47 of file common-utils.h.

◆ VALIDATE_OR_GOTO

#define VALIDATE_OR_GOTO (   arg,
  label 
)
Value:
do { \
if (!arg) { \
errno = EINVAL; \
gf_msg_callingfn((this ? (this->name) : "(Govinda! Govinda!)"), \
"invalid argument: " #arg); \
goto label; \
} \
} while (0)

Definition at line 308 of file common-utils.h.

◆ VECTORSIZE

#define VECTORSIZE (   count)    (count * (sizeof(struct iovec)))

Definition at line 304 of file common-utils.h.

◆ VOID

#define VOID (   ptr)    ((void **)((void *)ptr))

Definition at line 39 of file common-utils.h.

◆ WIPE

#define WIPE (   statp)
Value:
do { \
typeof(*statp) z = { \
0, \
}; \
if (statp) \
*statp = z; \
} while (0)

Definition at line 84 of file common-utils.h.

Typedef Documentation

◆ _gf_xlator_ipc_targets_t

Definition at line 34 of file common-utils.h.

◆ dht_changelog_rename_info_t

◆ gf_cmp

typedef int(* gf_cmp) (void *, void *)

Definition at line 206 of file common-utils.h.

◆ gf_special_pid_t

Definition at line 34 of file common-utils.h.

◆ iov_iter_t

typedef struct _iov_iter iov_iter_t

◆ token_iter_t

typedef struct token_iter token_iter_t

Enumeration Type Documentation

◆ _gf_special_pid

Enumerator
GF_CLIENT_PID_MAX 
GF_CLIENT_PID_GSYNCD 
GF_CLIENT_PID_HADOOP 
GF_CLIENT_PID_DEFRAG 
GF_CLIENT_PID_NO_ROOT_SQUASH 
GF_CLIENT_PID_QUOTA_MOUNT 
GF_CLIENT_PID_SELF_HEALD 
GF_CLIENT_PID_GLFS_HEAL 
GF_CLIENT_PID_BITD 
GF_CLIENT_PID_SCRUB 
GF_CLIENT_PID_TIER_DEFRAG 
GF_SERVER_PID_TRASH 
GF_CLIENT_PID_ADD_REPLICA_MOUNT 
GF_CLIENT_PID_SET_UTIME 

Definition at line 157 of file common-utils.h.

◆ _gf_xlator_ipc_targets

Enumerator
GF_IPC_TARGET_CHANGELOG 
GF_IPC_TARGET_CTR 
GF_IPC_TARGET_UPCALL 

Definition at line 174 of file common-utils.h.

◆ gf_timefmts

Enumerator
gf_timefmt_default 
gf_timefmt_FT 
gf_timefmt_Ymd_T 
gf_timefmt_bdT 
gf_timefmt_F_HMS 
gf_timefmt_dirent 
gf_timefmt_s 
gf_timefmt_last 

Definition at line 783 of file common-utils.h.

Function Documentation

◆ _mask_cancellation()

◆ _unmask_cancellation()

◆ BIT_CLEAR()

static void BIT_CLEAR ( unsigned char *  array,
unsigned int  index 
)
inlinestatic

Definition at line 287 of file common-utils.h.

Referenced by _dict_modify_flag(), and af_inet_bind_to_port_lt_ceiling().

◆ BIT_SET()

static void BIT_SET ( unsigned char *  array,
unsigned int  index 
)
inlinestatic

Definition at line 278 of file common-utils.h.

Referenced by _dict_modify_flag(), and gf_ports_reserved().

◆ BIT_VALUE()

static unsigned int BIT_VALUE ( unsigned char *  array,
unsigned int  index 
)
inlinestatic

Definition at line 296 of file common-utils.h.

Referenced by af_inet_bind_to_port_lt_ceiling(), and dict_check_flag().

◆ close_fds_except()

int close_fds_except ( int *  fdv,
size_t  count 
)

◆ dht_is_linkfile()

bool dht_is_linkfile ( struct iatt buf,
struct _dict dict 
)

◆ drop_token()

void drop_token ( char *  token,
token_iter_t tit 
)

Definition at line 2393 of file common-utils.c.

References token_iter::end, and src.changelog::end.

Referenced by init(), and mount_param_to_flag().

◆ find_xlator_option_in_cmd_args_t()

xlator_cmdline_option_t* find_xlator_option_in_cmd_args_t ( const char *  option_name,
cmd_args_t args 
)

◆ fop_log_level()

gf_loglevel_t fop_log_level ( glusterfs_fop_t  fop,
int  op_errno 
)

Definition at line 4510 of file common-utils.c.

References ENODATA, syncdaemon.resource::ENOTSUP, GF_FOP_ENTRYLK, GF_FOP_FENTRYLK, GF_FOP_FGETXATTR, GF_FOP_FINODELK, GF_FOP_FREMOVEXATTR, GF_FOP_FSETXATTR, GF_FOP_GETXATTR, GF_FOP_INODELK, GF_FOP_LK, GF_FOP_MKDIR, GF_FOP_MKNOD, GF_FOP_REMOVEXATTR, GF_FOP_SEEK, GF_FOP_SETXATTR, GF_LOG_DEBUG, and GF_LOG_ERROR.

Referenced by _posix_handle_xattr_keyvalue_pair(), afr_openfd_fix_open_cbk(), client3_3_entrylk_cbk(), client3_3_finodelk_cbk(), client3_3_flush_cbk(), client3_3_inodelk_cbk(), client3_3_mkdir_cbk(), client3_3_mknod_cbk(), client3_3_open_cbk(), client3_3_opendir_cbk(), client3_3_xattrop_cbk(), client4_0_entrylk_cbk(), client4_0_finodelk_cbk(), client4_0_flush_cbk(), client4_0_inodelk_cbk(), client4_0_mkdir_cbk(), client4_0_mknod_cbk(), client4_0_open_cbk(), client4_0_opendir_cbk(), client4_0_xattrop_cbk(), do_xattrop(), ec_update_size_version_done(), posix_seek(), server4_copy_file_range_cbk(), server4_discard_cbk(), server4_entrylk_cbk(), server4_fallocate_cbk(), server4_fentrylk_cbk(), server4_fgetxattr_cbk(), server4_finodelk_cbk(), server4_flush_cbk(), server4_fremovexattr_cbk(), server4_fsetattr_cbk(), server4_fstat_cbk(), server4_fsync_cbk(), server4_fsyncdir_cbk(), server4_ftruncate_cbk(), server4_fxattrop_cbk(), server4_getxattr_cbk(), server4_inodelk_cbk(), server4_lease_cbk(), server4_lk_cbk(), server4_lookup_cbk(), server4_mkdir_cbk(), server4_mknod_cbk(), server4_open_cbk(), server4_opendir_cbk(), server4_rchecksum_cbk(), server4_readdir_cbk(), server4_readdirp_cbk(), server4_readv_cbk(), server4_seek_cbk(), server4_stat_cbk(), server4_unlink_cbk(), server4_writev_cbk(), server4_xattrop_cbk(), server4_zerofill_cbk(), server_discard_cbk(), server_entrylk_cbk(), server_fallocate_cbk(), server_fentrylk_cbk(), server_fgetxattr_cbk(), server_finodelk_cbk(), server_flush_cbk(), server_fremovexattr_cbk(), server_fsetattr_cbk(), server_fstat_cbk(), server_fsync_cbk(), server_fsyncdir_cbk(), server_ftruncate_cbk(), server_fxattrop_cbk(), server_getxattr_cbk(), server_inodelk_cbk(), server_lease_cbk(), server_lk_cbk(), server_lookup_cbk(), server_mkdir_cbk(), server_mknod_cbk(), server_open_cbk(), server_opendir_cbk(), server_rchecksum_cbk(), server_readdir_cbk(), server_readdirp_cbk(), server_readv_cbk(), server_seek_cbk(), server_stat_cbk(), server_unlink_cbk(), server_writev_cbk(), server_xattrop_cbk(), and server_zerofill_cbk().

◆ generate_glusterfs_ctx_id()

char* generate_glusterfs_ctx_id ( void  )

◆ get_checksum_for_file()

int get_checksum_for_file ( int  fd,
uint32_t *  checksum,
int  op_version 
)

◆ get_checksum_for_path()

int get_checksum_for_path ( char *  path,
uint32_t *  checksum,
int  op_version 
)

◆ get_file_mtime()

int get_file_mtime ( const char *  path,
time_t *  stamp 
)

get_file_mtime – Given a path, get the mtime for the file

@path: The filepath to check the mtime on @stamp: The parameter to set after we get the mtime

Returns
: success: 0 errors : Errors returned by the stat () call

Definition at line 2134 of file common-utils.c.

References GF_LOG_ERROR, gf_smsg, GF_VALIDATE_OR_GOTO, LG_MSG_FILE_STAT_FAILED, out, sys_stat(), and THIS.

Referenced by _mnt3_auth_param_refresh_thread(), and _mnt3_has_file_changed().

◆ get_host_name()

◆ get_ip_from_addrinfo()

char* get_ip_from_addrinfo ( struct addrinfo *  addr,
char **  ip 
)

◆ get_mem_size()

uint64_t get_mem_size ( void  )

Definition at line 3115 of file common-utils.c.

Referenced by check_cache_size_ok().

◆ get_path_name()

char* get_path_name ( char *  word,
char **  path 
)

Definition at line 3083 of file common-utils.c.

Referenced by glusterd_brickinfo_new_from_brick().

◆ gf_array_insertionsort()

void gf_array_insertionsort ( void *  a,
int  l,
int  r,
size_t  elem_size,
gf_cmp  cmp 
)

Definition at line 2963 of file common-utils.c.

References gf_array_elem(), and gf_elem_swap().

Referenced by cli_cmd_sort(), and cmd_profile_volume_brick_out().

◆ gf_backtrace_done()

void gf_backtrace_done ( char *  buf)

◆ gf_backtrace_save()

char* gf_backtrace_save ( char *  buf)

◆ gf_bits_count()

◆ gf_bits_index()

int32_t gf_bits_index ( uint64_t  n)

Definition at line 5118 of file common-utils.c.

References ffsll.

Referenced by __afr_set_in_flight_sb_status(), and ec_bits_consume().

◆ gf_build_absolute_path()

int32_t gf_build_absolute_path ( char *  current_path,
char *  relative_path,
char **  path 
)

◆ gf_canonicalize_path()

◆ gf_check_log_format()

int gf_check_log_format ( const char *  value)

◆ gf_check_logger()

int gf_check_logger ( const char *  value)

◆ gf_compare_sockaddr()

bool gf_compare_sockaddr ( const struct sockaddr *  addr1,
const struct sockaddr *  addr2 
)

Definition at line 4289 of file common-utils.c.

References _gf_false, _gf_true, and GF_ASSERT.

Referenced by gd_peerinfo_find_from_addrinfo().

◆ gf_d_type_from_ia_type()

int gf_d_type_from_ia_type ( ia_type_t  type)

◆ gf_dnscache_deinit()

void gf_dnscache_deinit ( struct dnscache cache)

gf_dnscache_deinit – cleanup resources used by struct dnscache

Definition at line 585 of file common-utils.c.

References dnscache::cache_dict, dict_unref(), GF_FREE, GF_LOG_WARNING, and gf_msg_plain.

Referenced by ios_conf_destroy().

◆ gf_dnscache_entry_deinit()

void gf_dnscache_entry_deinit ( struct dnscache_entry entry)

gf_dnscache_entry_deinit – Free memory used by a dnscache entry

@entry: Pointer to deallocate

Definition at line 615 of file common-utils.c.

References dnscache_entry::fqdn, GF_FREE, and dnscache_entry::ip.

Referenced by gf_rev_dns_lookup_cached().

◆ gf_dnscache_entry_init()

struct dnscache_entry* gf_dnscache_entry_init ( void  )

gf_dnscache_entry_init – Initialize a dnscache entry

Returns
: SUCCESS: Pointer to an allocated dnscache entry struct FAILURE: NULL

Definition at line 602 of file common-utils.c.

References GF_CALLOC, and gf_common_mt_dnscache_entry.

Referenced by gf_rev_dns_lookup_cached().

◆ gf_dnscache_init()

struct dnscache* gf_dnscache_init ( time_t  ttl)

gf_dnscache_init – Initializes a dnscache struct and sets the ttl to the specified value in the parameter.

@ttl: the TTL in seconds

Returns
: SUCCESS: Pointer to an allocated dnscache struct FAILURE: NULL

Definition at line 564 of file common-utils.c.

References dnscache::cache_dict, dict_new(), gf_common_mt_dnscache, GF_FREE, GF_MALLOC, and dnscache::ttl.

Referenced by init().

◆ gf_existing_leaseid()

char* gf_existing_leaseid ( void  )

Definition at line 2939 of file common-utils.c.

References glusterfs_leaseid_exist().

Referenced by get_fop_attr_thrd_key(), set_fop_attr_glfd(), and unset_fop_attr().

◆ gf_fop_int()

int gf_fop_int ( char *  fop)

Definition at line 5136 of file common-utils.c.

References gf_fop_list, GF_FOP_MAXVALUE, and GF_FOP_NULL.

Referenced by delay_gen_parse_fill_fops(), and error_gen_parse_fill_fops().

◆ gf_fop_string()

◆ gf_get_hostname_from_ip()

◆ gf_get_index_by_elem()

◆ gf_get_reserved_ports()

char* gf_get_reserved_ports ( void  )

◆ gf_getgrouplist()

int gf_getgrouplist ( const char *  user,
gid_t  group,
gid_t **  groups 
)

gf_getgrouplist - get list of groups to which a user belongs

A convenience wrapper for getgrouplist(3).

Parameters
user- same as in getgrouplist(3)
group- same as in getgrouplist(3)
groups- pointer to a gid_t pointer

gf_getgrouplist allocates a gid_t buffer which is big enough to hold the list of auxiliary group ids for user, up to the GF_MAX_AUX_GROUPS threshold. Upon successful invocation groups will be pointed to that buffer.

Returns
success: the number of auxiliary group ids retrieved failure: -1

Definition at line 5228 of file common-utils.c.

References GF_CALLOC, gf_common_mt_groups_t, GF_FREE, GF_MAX_AUX_GROUPS, GF_REALLOC, and SMALL_GROUP_COUNT.

Referenced by frame_fill_groups(), gid_resolve(), and nfs_fix_groups().

◆ gf_gfid_generate_from_xxh64()

int gf_gfid_generate_from_xxh64 ( uuid_t  gfid,
char *  key 
)

This is the algorithm followed for generating new gfid 1) generate xxh64 hash using snapname and original gfid of the object 2) Using the canonicalized form of above hash as the key, generate another hash 3) Combine both of the 8 byte hashes to generate a 16 byte uuid_t type 4) Use the above uuid as the gfid

Each byte of the hash is stored separately in different elements of the character array represented by uuid_t Ex: tmp[0] = (hash_2 >> 56) & 0xFF This saves the most significant byte of hash_2 in tmp[0] tmp[1] = (hash_2 >> 48) & 0xFF This saves next most significant byte of hash_2 in tmp[1] So on. tmp[0] - tmp[7] holds the contents of hash_2 tmp[8] - tmp[15] hold the conents of hash_1

The hash generated (i.e. of type XXH64_hash_t) is 8 bytes long. And for gfid 16 byte uuid is needed. Hecne the 2 hashes are combined to form one 16 byte entity.

Definition at line 229 of file common-utils.c.

References gf_gfid_from_xxh64(), GF_LOG_WARNING, gf_msg_callingfn, gf_msg_debug, GF_XXH64_DIGEST_LENGTH, gf_xxh64_hash_wrapper(), GF_XXHSUM64_DEFAULT_SEED, LG_MSG_XXH64_TO_GFID_FAILED, out, THIS, and uuid_utoa().

Referenced by svs_uuid_generate().

◆ gf_global_variable_init()

void gf_global_variable_init ( void  )

◆ gf_inode_type_to_str()

◆ gf_is_ip_in_net()

bool gf_is_ip_in_net ( const char *  network,
const char *  ip_str 
)

gf_is_ip_in_net – Checks if an IP Address is in a network. A network should be specified by something like '10.5.153.0/24' (in CIDR notation).

Returns
: Sets to true if the IP is in the network @ip_str : The IP to check @network: The network to check the IP against.
: success: _gf_true failure: -EINVAL for bad args, retval of inet_pton otherwise

Definition at line 2168 of file common-utils.c.

References _gf_false, GF_ASSERT, gf_boolean_t, GF_LOG_ERROR, gf_smsg, LG_MSG_INET_PTON_FAILED, out, and strdupa.

Referenced by _mnt3_auth_subnet_match(), and compare_addr_and_update().

◆ gf_is_local_addr()

◆ gf_is_pid_running()

bool gf_is_pid_running ( int  pid)

Definition at line 4142 of file common-utils.c.

References _gf_false, _gf_true, sys_close(), and sys_open().

Referenced by gf_is_service_running().

◆ gf_is_same_address()

bool gf_is_same_address ( char *  host1,
char *  host2 
)

◆ gf_is_service_running()

◆ gf_is_str_int()

int gf_is_str_int ( const char *  value)

Definition at line 2982 of file common-utils.c.

References GF_FREE, gf_strdup(), GF_VALIDATE_OR_GOTO, out, and THIS.

Referenced by cli_cmd_volume_top_parse().

◆ gf_is_valid_xattr_namespace()

bool gf_is_valid_xattr_namespace ( char *  k)

Definition at line 5071 of file common-utils.c.

References _gf_false, and _gf_true.

Referenced by _posix_xattr_get_set_from_backend(), and afr_xattr_match_needed().

◆ gf_is_zero_filled_stat()

bool gf_is_zero_filled_stat ( struct iatt buf)

Definition at line 5047 of file common-utils.c.

References iatt::ia_ctime, and iatt::ia_nlink.

Referenced by nfs3_stat_to_post_op_attr(), and nfs3_stat_to_pre_op_attr().

◆ gf_leaseid_get()

char* gf_leaseid_get ( void  )

Definition at line 2933 of file common-utils.c.

References glusterfs_leaseid_buf_get().

Referenced by pub_glfs_setfsleaseid().

◆ gf_lockfd()

int gf_lockfd ( int  fd)

◆ gf_log_dump_graph()

void gf_log_dump_graph ( FILE *  specfp,
glusterfs_graph_t graph 
)

◆ gf_lstat_dir()

int gf_lstat_dir ( const char *  path,
struct stat *  stbuf_in 
)

◆ gf_nanosleep()

int gf_nanosleep ( uint64_t  nsec)

Definition at line 5413 of file common-utils.c.

References GF_SEC_IN_NS.

Referenced by delay_gen(), posix_fsyncer(), pub_glfs_fini(), stop_gsync(), and tbf_tokengenerator().

◆ gf_nread()

ssize_t gf_nread ( int  fd,
void *  buf,
size_t  count 
)

Definition at line 4840 of file common-utils.c.

References out, and sys_read().

Referenced by quota_conf_read_gfid(), and quota_conf_read_header().

◆ gf_nwrite()

ssize_t gf_nwrite ( int  fd,
const void *  buf,
size_t  count 
)

Definition at line 4863 of file common-utils.c.

References out, and sys_write().

Referenced by glusterd_quota_conf_write_gfid(), and glusterd_quota_conf_write_header().

◆ gf_path_strip_trailing_slashes()

void gf_path_strip_trailing_slashes ( char *  path)

◆ gf_ports_reserved()

bool gf_ports_reserved ( char *  blocked_port,
unsigned char *  ports,
uint32_t  ceiling 
)

◆ gf_print_trace()

◆ gf_process_getspec_servers_list()

int gf_process_getspec_servers_list ( cmd_args_t cmd_args,
const char *  servers_list 
)

◆ gf_process_reserved_ports()

int gf_process_reserved_ports ( unsigned char *  ports,
uint32_t  ceiling 
)

◆ gf_replace_new_iatt_in_dict()

◆ gf_replace_old_iatt_in_dict()

◆ gf_resolve_ip6()

int32_t gf_resolve_ip6 ( const char *  hostname,
uint16_t  port,
int  family,
void **  dnscache,
struct addrinfo **  addr_info 
)

◆ gf_resolve_path_parent()

char* gf_resolve_path_parent ( const char *  path)

gf_resolve_path_parent – Given a path, returns an allocated string containing the parent's path. @path: Path to parse

Returns
: The parent path if found, NULL otherwise

Definition at line 420 of file common-utils.c.

References GF_LOG_DEBUG, gf_msg_callingfn, gf_strdup(), GF_VALIDATE_OR_GOTO, LG_MSG_INVALID_STRING, out, strdupa, and THIS.

Referenced by mnt3_authenticate_request().

◆ gf_rev_dns_lookup()

char* gf_rev_dns_lookup ( const char *  ip)

gf_rev_dns_lookup – Perform a reverse DNS lookup on the IP address.

@ip: The IP address to perform a reverse lookup on

Returns
: success: Allocated string containing the hostname failure: NULL

Definition at line 396 of file common-utils.c.

References gf_get_hostname_from_ip(), GF_LOG_INFO, gf_smsg, GF_VALIDATE_OR_GOTO, LG_MSG_RESOLVE_HOSTNAME_FAILED, and out.

Referenced by _mnt3_authenticate_req().

◆ gf_rev_dns_lookup_cached()

char* gf_rev_dns_lookup_cached ( const char *  ip,
struct dnscache dnscache 
)

gf_rev_dns_lookup – Perform a reverse DNS lookup on the IP address.

@ip: The IP address to perform a reverse lookup on

Returns
: success: Allocated string containing the hostname failure: NULL

Definition at line 631 of file common-utils.c.

References _gf_false, _gf_true, bin_to_data(), dnscache::cache_dict, _data::data, dict_del(), dict_get(), dict_set(), dnscache_entry::fqdn, gf_boolean_t, gf_dnscache_entry_deinit(), gf_dnscache_entry_init(), gf_get_hostname_from_ip(), gf_log_callingfn, GF_LOG_CRITICAL, gf_strdup(), dnscache_entry::ip, out, dnscache_entry::timestamp, and dnscache::ttl.

Referenced by _io_stats_write_latency_sample().

◆ gf_roundup_next_power_of_two()

int32_t gf_roundup_next_power_of_two ( int32_t  nr)

Definition at line 3039 of file common-utils.c.

References GF_LOG_WARNING, gf_smsg, LG_MSG_NEGATIVE_NUM_PASSED, and out.

Referenced by gf_fd_fdtable_expand(), and strvprintf().

◆ gf_roundup_power_of_two()

int32_t gf_roundup_power_of_two ( int32_t  nr)

Definition at line 3015 of file common-utils.c.

References GF_LOG_WARNING, gf_smsg, LG_MSG_NEGATIVE_NUM_PASSED, and out.

◆ gf_set_log_file_path()

◆ gf_set_log_ident()

int gf_set_log_ident ( cmd_args_t cmd_args)

Definition at line 3943 of file common-utils.c.

References gf_asprintf(), _cmd_args::log_file, and _cmd_args::log_ident.

Referenced by logging_init().

◆ gf_set_timestamp()

int gf_set_timestamp ( const char *  src,
const char *  dest 
)

◆ gf_set_volfile_server_common()

◆ gf_skip_header_section()

int gf_skip_header_section ( int  fd,
int  header_len 
)

Definition at line 4125 of file common-utils.c.

References GF_LOG_ERROR, gf_smsg, LG_MSG_SKIP_HEADER_FAILED, and sys_lseek().

Referenced by quota_conf_skip_header().

◆ gf_sock_union_equal_addr()

bool gf_sock_union_equal_addr ( union gf_sock_union a,
union gf_sock_union b 
)

gf_sock_union_equal_addr - check if two given gf_sock_unions have same addr

Parameters
a- first sock union
b- second sock union
Returns
_gf_true if a and b have same ipv{4,6} addr, _gf_false otherwise

Definition at line 2788 of file common-utils.c.

References _gf_false, _gf_true, GF_LOG_ERROR, gf_msg_debug, gf_smsg, LG_MSG_INVALID_ENTRY, gf_sock_union::sin, gf_sock_union::sin6, and gf_sock_union::storage.

Referenced by rpcsvc_client_lookup().

◆ gf_string2boolean()

◆ gf_string2bytesize_int64()

int gf_string2bytesize_int64 ( const char *  str,
int64_t *  n 
)

◆ gf_string2bytesize_uint64()

int gf_string2bytesize_uint64 ( const char *  str,
uint64_t *  n 
)

◆ gf_string2double()

int gf_string2double ( const char *  str,
double *  n 
)

Definition at line 1425 of file common-utils.c.

References _gf_string2double().

Referenced by parse_opts(), and xlator_option_validate_double().

◆ gf_string2int()

◆ gf_string2int16()

int gf_string2int16 ( const char *  str,
int16_t *  n 
)

Definition at line 1462 of file common-utils.c.

References _gf_string2long().

◆ gf_string2int32()

int gf_string2int32 ( const char *  str,
int32_t *  n 
)

◆ gf_string2int64()

int gf_string2int64 ( const char *  str,
int64_t *  n 
)

Definition at line 1500 of file common-utils.c.

References _gf_string2longlong().

◆ gf_string2int8()

int gf_string2int8 ( const char *  str,
int8_t *  n 
)

Definition at line 1443 of file common-utils.c.

References _gf_string2long().

◆ gf_string2long()

int gf_string2long ( const char *  str,
long *  n 
)

Definition at line 1395 of file common-utils.c.

References _gf_string2long().

◆ gf_string2longlong()

int gf_string2longlong ( const char *  str,
long long *  n 
)

Definition at line 1431 of file common-utils.c.

References _gf_string2longlong().

Referenced by xlator_option_validate_int().

◆ gf_string2percent()

◆ gf_string2percent_or_bytesize()

int gf_string2percent_or_bytesize ( const char *  str,
double *  n,
bool *  is_percent 
)

◆ gf_string2time()

int gf_string2time ( const char *  str,
uint32_t *  n 
)

◆ gf_string2uint()

int gf_string2uint ( const char *  str,
unsigned int *  n 
)

◆ gf_string2uint16()

int gf_string2uint16 ( const char *  str,
uint16_t *  n 
)

Definition at line 1533 of file common-utils.c.

References _gf_string2ulong().

◆ gf_string2uint16_base10()

int gf_string2uint16_base10 ( const char *  str,
uint16_t *  n 
)

Definition at line 1621 of file common-utils.c.

References _gf_string2ulong().

◆ gf_string2uint32()

int gf_string2uint32 ( const char *  str,
uint32_t *  n 
)

Definition at line 1552 of file common-utils.c.

References _gf_string2ulong().

Referenced by dht_setxattr(), and parse_opts().

◆ gf_string2uint32_base10()

int gf_string2uint32_base10 ( const char *  str,
uint32_t *  n 
)

Definition at line 1640 of file common-utils.c.

References _gf_string2ulong().

◆ gf_string2uint64()

int gf_string2uint64 ( const char *  str,
uint64_t *  n 
)

◆ gf_string2uint64_base10()

int gf_string2uint64_base10 ( const char *  str,
uint64_t *  n 
)

Definition at line 1659 of file common-utils.c.

References _gf_string2ulonglong().

◆ gf_string2uint8()

int gf_string2uint8 ( const char *  str,
uint8_t *  n 
)

Definition at line 1514 of file common-utils.c.

References _gf_string2ulong().

◆ gf_string2uint8_base10()

int gf_string2uint8_base10 ( const char *  str,
uint8_t *  n 
)

Definition at line 1602 of file common-utils.c.

References _gf_string2ulong().

◆ gf_string2uint_base10()

int gf_string2uint_base10 ( const char *  str,
unsigned int *  n 
)

Definition at line 1596 of file common-utils.c.

References _gf_string2uint().

Referenced by parse_opts().

◆ gf_string2ulong()

int gf_string2ulong ( const char *  str,
unsigned long *  n 
)

Definition at line 1401 of file common-utils.c.

References _gf_string2ulong().

◆ gf_string2ulong_base10()

int gf_string2ulong_base10 ( const char *  str,
unsigned long *  n 
)

Definition at line 1590 of file common-utils.c.

References _gf_string2ulong().

◆ gf_string2ulonglong()

int gf_string2ulonglong ( const char *  str,
unsigned long long *  n 
)

Definition at line 1437 of file common-utils.c.

References _gf_string2ulonglong().

Referenced by xlator_option_validate_int().

◆ gf_strip_whitespace()

int gf_strip_whitespace ( char *  str,
int  len 
)

Definition at line 3154 of file common-utils.c.

References GF_ASSERT, gf_common_mt_char, GF_FREE, and GF_MALLOC.

Referenced by cli_cmd_ganesha_parse(), and cli_cmd_volume_set_parse().

◆ gf_strn2boolean()

int gf_strn2boolean ( const char *  str,
const int  len,
bool *  b 
)

Definition at line 1948 of file common-utils.c.

References _gf_false, _gf_true, GF_LOG_WARNING, gf_msg_callingfn, LG_MSG_INVALID_ARG, and THIS.

Referenced by dict_get_str_boolean().

◆ gf_strncpy()

◆ gf_strstr()

int gf_strstr ( const char *  str,
const char *  delim,
const char *  match 
)

Definition at line 990 of file common-utils.c.

References GF_LOG_WARNING, gf_msg_callingfn, LG_MSG_INVALID_ARG, out, and THIS.

Referenced by server_build_config().

◆ gf_strTrim()

void gf_strTrim ( char **  s)

Definition at line 2245 of file common-utils.c.

References src.changelog::end.

Referenced by is_mdc_key_satisfied(), and mdc_load_reqs().

◆ gf_thread_cleanup_xint()

int gf_thread_cleanup_xint ( pthread_t  thread)

◆ gf_thread_create()

◆ gf_thread_create_detached()

int gf_thread_create_detached ( pthread_t *  thread,
void *(*)(void *)  start_routine,
void *  arg,
const char *  name,
  ... 
)

◆ gf_thread_set_name()

void gf_thread_set_name ( pthread_t  thread,
const char *  name,
  ... 
)

Definition at line 4041 of file common-utils.c.

References gf_thread_set_vname().

◆ gf_thread_set_vname()

void gf_thread_set_vname ( pthread_t  thread,
const char *  name,
va_list  args 
)

◆ gf_thread_vcreate()

int gf_thread_vcreate ( pthread_t *  thread,
const pthread_attr_t *  attr,
void *(*)(void *)  start_routine,
void *  arg,
const char *  name,
va_list  args 
)

◆ gf_time_fmt()

◆ gf_trim()

char* gf_trim ( char *  string)

Definition at line 967 of file common-utils.c.

Referenced by glusterd_build_snap_device_path(), and glusterd_is_thinp_brick().

◆ gf_uint64_2human_readable()

◆ gf_unlockfd()

int gf_unlockfd ( int  fd)

◆ gf_valid_pid()

bool gf_valid_pid ( const char *  pid,
int  length 
)

Definition at line 4197 of file common-utils.c.

References _gf_false, _gf_true, gf_boolean_t, and out.

Referenced by cli_cmd_volume_statedump_options_parse().

◆ gf_volume_name_validate()

int gf_volume_name_validate ( const char *  volume_name)

Definition at line 1025 of file common-utils.c.

References GF_LOG_WARNING, gf_msg_callingfn, LG_MSG_INVALID_ARG, and THIS.

◆ gf_xxh64_wrapper()

void gf_xxh64_wrapper ( const unsigned char *  data,
size_t const  len,
unsigned long long const  seed,
char *  xxh64 
)

◆ gf_zero_fill_stat()

void gf_zero_fill_stat ( struct iatt buf)

Definition at line 5064 of file common-utils.c.

References iatt::ia_ctime, and iatt::ia_nlink.

Referenced by afr_zero_fill_stat().

◆ gfid_to_ino()

◆ glusterfs_compute_sha256()

int glusterfs_compute_sha256 ( const unsigned char *  content,
size_t  size,
char *  sha256_hash 
)

Definition at line 5285 of file common-utils.c.

Referenced by glusterfs_graph_attach(), mgmt_getspec_cbk(), and mgmt_process_volfile().

◆ glusterfs_is_local_pathinfo()

int glusterfs_is_local_pathinfo ( char *  pathinfo,
bool *  local 
)

Definition at line 4818 of file common-utils.c.

References _gf_false, _gf_true, get_pathinfo_host(), and out.

Referenced by afr_local_discovery_cbk(), and syncop_is_subvol_local().

◆ iov_0filled()

static int iov_0filled ( const struct iovec *  vector,
int  count 
)
inlinestatic

Definition at line 769 of file common-utils.h.

References mem_0filled().

Referenced by __afr_is_sink_zero_filled(), and __afr_selfheal_data_read_write().

◆ iov_copy()

static size_t iov_copy ( const struct iovec *  dst,
int  dcnt,
const struct iovec *  src,
int  scnt 
)
inlinestatic

Definition at line 736 of file common-utils.h.

References iov_range_copy().

◆ iov_dup()

◆ iov_free()

static void iov_free ( struct iovec *  vector,
int  count 
)
inlinestatic

Definition at line 487 of file common-utils.h.

References FREE, and GF_FREE.

◆ iov_iter_copy()

static uint32_t iov_iter_copy ( iov_iter_t dst,
iov_iter_t src,
uint32_t  size 
)
inlinestatic

Definition at line 588 of file common-utils.h.

References _iov_iter::len, and _iov_iter::ptr.

Referenced by iov_range_copy().

◆ iov_iter_end()

static bool iov_iter_end ( iov_iter_t iter)
inlinestatic

Definition at line 557 of file common-utils.h.

References _iov_iter::count.

◆ iov_iter_init()

static bool iov_iter_init ( iov_iter_t iter,
const struct iovec *  iovec,
uint32_t  count,
uint32_t  offset 
)
inlinestatic

Definition at line 532 of file common-utils.h.

References _iov_iter::count, _iov_iter::iovec, _iov_iter::len, and _iov_iter::ptr.

Referenced by iov_range_copy(), and iov_subset().

◆ iov_iter_next()

static bool iov_iter_next ( iov_iter_t iter,
uint32_t  size 
)
inlinestatic

Definition at line 563 of file common-utils.h.

References _iov_iter::count, GF_ASSERT, _iov_iter::iovec, _iov_iter::len, and _iov_iter::ptr.

Referenced by iov_range_copy(), and iov_subset().

◆ iov_iter_to_iovec()

static uint32_t iov_iter_to_iovec ( iov_iter_t iter,
struct iovec *  iovec,
int32_t  idx,
uint32_t  size 
)
inlinestatic

Definition at line 605 of file common-utils.h.

References _iov_iter::len, and _iov_iter::ptr.

Referenced by iov_subset().

◆ iov_length()

◆ iov_load()

static size_t iov_load ( const struct iovec *  vector,
int  count,
char *  buf,
int  size 
)
inlinestatic

Definition at line 715 of file common-utils.h.

References min.

Referenced by __socket_cached_read().

◆ iov_range_copy()

static size_t iov_range_copy ( const struct iovec *  dst,
uint32_t  dst_count,
uint32_t  dst_offset,
const struct iovec *  src,
uint32_t  src_count,
uint32_t  src_offset,
uint32_t  size 
)
inlinestatic

Definition at line 679 of file common-utils.h.

References iov_iter_copy(), iov_iter_init(), and iov_iter_next().

Referenced by ioc_update_pages(), and iov_copy().

◆ iov_skip()

static int iov_skip ( struct iovec *  iovec,
uint32_t  count,
uint32_t  size 
)
inlinestatic

Definition at line 655 of file common-utils.h.

Referenced by __wb_modify_write_request().

◆ iov_subset()

static int iov_subset ( struct iovec *  src,
int  src_count,
uint32_t  start,
uint32_t  size,
struct iovec **  dst,
int32_t  dst_count 
)
inlinestatic

◆ iov_unload()

static void iov_unload ( char *  buf,
const struct iovec *  vector,
int  count 
)
inlinestatic

Definition at line 703 of file common-utils.h.

Referenced by __wb_collapse_small_writes(), and iobuf_copy().

◆ is_valid_lease_id()

bool is_valid_lease_id ( const char *  lease_id)

Definition at line 2878 of file common-utils.c.

References _gf_false, _gf_true, gf_boolean_t, LEASE_ID_SIZE, and out.

Referenced by process_lease_req().

◆ leaseid_utoa()

char* leaseid_utoa ( const char *  lease_id)

◆ list_node_add()

struct list_node* list_node_add ( void *  ptr,
struct list_head list 
)

Definition at line 4942 of file common-utils.c.

References _list_node_add(), list_node::list, and list_node::ptr.

◆ list_node_add_order()

struct list_node* list_node_add_order ( void *  ptr,
struct list_head list,
int(*)(struct list_head *, struct list_head *)  compare 
)

Definition at line 4948 of file common-utils.c.

References _list_node_add(), list_node::list, and list_node::ptr.

Referenced by cli_quotad_getlimit_cbk().

◆ list_node_del()

void list_node_del ( struct list_node node)

Definition at line 4955 of file common-utils.c.

References GF_FREE, list_node::list, and list_del_init().

Referenced by cli_quotad_getlimit_cbk().

◆ lkowner_utoa()

◆ lkowner_utoa_r()

char* lkowner_utoa_r ( gf_lkowner_t lkowner,
char *  dst,
int  len 
)

Definition at line 2869 of file common-utils.c.

References lkowner_unparse().

◆ log_base2()

int log_base2 ( unsigned long  x)

Definition at line 375 of file common-utils.c.

Referenced by init(), ios_bump_read(), and ios_bump_write().

◆ mask_match()

bool mask_match ( const uint32_t  a,
const uint32_t  b,
const uint32_t  m 
)

Definition at line 2834 of file common-utils.c.

Referenced by mnt3_match_subnet_v4(), and rpcsvc_match_subnet_v4().

◆ mem_0filled()

static int mem_0filled ( const char *  buf,
size_t  size 
)
inlinestatic

◆ memeqzero()

static bool memeqzero ( const void *  data,
size_t  length 
)
static

Definition at line 743 of file common-utils.h.

Referenced by mem_0filled().

◆ mkdir_p()

◆ next_token()

bool next_token ( char **  tokenp,
token_iter_t tit 
)

next_token – fetch next token in tokenization inited by token_iter_init().

@tokenp: pointer to token @tit: pointer to iteration state

Returns
: true if iteration ends, else false

The token pointed by @tokenp can be used after a call to next_token(). When next_token() returns true the iteration is to be stopped and the string with which the tokenization was inited (see token_iter_init() is restored, apart from dropped tokens (see drop_token()).

Definition at line 2317 of file common-utils.c.

References _gf_false, src.changelog::end, gf_boolean_t, and token_iter::sep.

Referenced by init(), and mount_param_to_flag().

◆ nwstrtail()

char* nwstrtail ( char *  str,
char *  pattern 
)

Definition at line 2262 of file common-utils.c.

References skipwhite().

Referenced by glusterd_parse_inode_size(), and parse_mount_pattern_desc().

◆ recursive_rmdir()

◆ skipwhite()

void skipwhite ( char **  s)

Definition at line 2238 of file common-utils.c.

Referenced by nwstrtail(), and parse_mount_pattern_desc().

◆ strtail()

◆ token_iter_init()

char* token_iter_init ( char *  str,
char  sep,
token_iter_t tit 
)

token_iter_init – initialize tokenization

@str: string to be tokenized @sep: token separator character @tit: pointer to iteration state

Returns
: token string

The returned token string and tit are not to be used directly, but through next_token().

Definition at line 2292 of file common-utils.c.

References token_iter::end, and token_iter::sep.

Referenced by init(), and mount_param_to_flag().

◆ trap()

void trap ( void  )

Definition at line 962 of file common-utils.c.

◆ uuid_utoa()

char* uuid_utoa ( uuid_t  uuid)

Definition at line 2841 of file common-utils.c.

References gf_uuid_unparse(), and glusterfs_uuid_buf_get().

Referenced by __add_lease(), __afr_selfheal_data(), __afr_selfheal_data_finalize_source(), __afr_selfheal_entry(), __afr_selfheal_metadata_do(), __afr_selfheal_metadata_finalize_source(), __afr_selfheal_metadata_mark_pending_xattrs(), __afr_selfheal_name_expunge(), __arbiter_inode_ctx_get(), __ec_heal_data(), __ec_heal_data_prepare(), __ec_heal_entry(), __ec_heal_mark_sinks(), __ec_heal_name(), __ec_heal_trim_sinks(), __entrylk_prune_stale(), __glusterd_brick_op_cbk(), __glusterd_cluster_lock_cbk(), __glusterd_cluster_unlock_cbk(), __glusterd_commit_op_cbk(), __glusterd_friend_add_cbk(), __glusterd_friend_remove_cbk(), __glusterd_friend_update_cbk(), __glusterd_handle_cluster_lock(), __glusterd_handle_cluster_unlock(), __glusterd_handle_commit_op(), __glusterd_handle_copy_file(), __glusterd_handle_create_volume(), __glusterd_handle_friend_update(), __glusterd_handle_gsync_set(), __glusterd_handle_incoming_friend_req(), __glusterd_handle_incoming_unfriend_req(), __glusterd_handle_probe_query(), __glusterd_handle_stage_op(), __glusterd_handle_sys_exec(), __glusterd_mgmt_hndsk_version_ack_cbk(), __glusterd_mgmt_hndsk_version_cbk(), __glusterd_peer_dump_version_cbk(), __glusterd_peer_rpc_notify(), __glusterd_probe_cbk(), __glusterd_stage_op_cbk(), __inode_path(), __inode_unlock_lock(), __inodelk_prune_stale(), __is_dentry_cyclic(), __mnt3_resolve_export_subdir_comp(), __nlc_inode_ctx_timer_start(), __posix_fd_ctx_get(), __posix_get_mdata_xattr(), __quota_init_inode_ctx(), __remove_lease(), __server_get_volume_info(), __svc_fd_ctx_get_or_new(), __svs_fd_ctx_get_or_new(), _add_task_to_dict(), _fill_writev_xdata(), _gd_syncop_commit_op_cbk(), _gd_syncop_mgmt_lock_cbk(), _gd_syncop_mgmt_unlock_cbk(), _gd_syncop_stage_op_cbk(), _gf_server_log_fsetxattr_failure(), _gf_server_log_setxattr_failure(), _index_action(), _mq_create_xattrs_txn(), _posix_get_marker_all_contributions(), _posix_handle_xattr_keyvalue_pair(), _posix_remove_xattr(), _posix_xattr_get_set(), _posix_xattr_get_set_from_backend(), add_inode_to_client_list(), afr_add_lock_to_saved_locks(), afr_can_set_split_brain_choice(), afr_changelog_fsync_cbk(), afr_changelog_populate_xdata(), afr_changelog_post_op_fail(), afr_dom_lock_acquire_cbk(), afr_getlk_cbk(), afr_gfid_split_brain_source(), afr_handle_failure_using_thin_arbiter(), afr_handle_quorum(), afr_lk_transaction(), afr_lk_txn_unlock_cbk(), afr_lk_unlock_cbk(), afr_lock_heal_cbk(), afr_lock_heal_do(), afr_log_locks_failure(), afr_log_selfheal(), afr_mark_split_brain_source_sinks_by_policy(), afr_read_txn(), afr_remove_lock_from_saved_locks(), afr_selfheal_data(), afr_selfheal_data_do(), afr_selfheal_detect_gfid_and_type_mismatch(), afr_selfheal_entry(), afr_selfheal_entry_delete(), afr_selfheal_entry_dirent(), afr_selfheal_entry_do(), afr_selfheal_name_type_mismatch_check(), afr_selfheal_unlocked_inspect(), afr_set_inode_local(), afr_set_split_brain_choice(), afr_sh_fav_by_ctime(), afr_sh_fav_by_majority(), afr_sh_fav_by_mtime(), afr_sh_fav_by_size(), afr_shd_entry_changes_index_inode(), afr_shd_index_inode(), afr_ta_post_op_do(), afr_ta_post_op_synctask(), afr_ta_read_txn(), afr_ta_read_txn_synctask(), afr_unlock_partial_lock_cbk(), barrier_dump_stub(), binary_to_ascii(), bitd_compare_ckum(), bitd_fetch_signature(), bitd_is_bad_file(), bitd_oneshot_crawl(), bitd_scrub_post_compute_check(), bitd_scrub_pre_compute_check(), br_brick_callback(), br_calculate_obj_checksum(), br_get_bad_objects_from_child(), br_log_object(), br_lookup_bad_obj_dir(), br_object_open(), br_object_read_block_and_sign(), br_object_read_sign(), br_prepare_loc(), br_process_object(), br_schedule_object_reopen(), br_scrubber_scrub_begin(), br_sign_object(), br_stub_add(), br_stub_add_fd_to_inode(), br_stub_anon_fd_ctx(), br_stub_bad_objects_path(), br_stub_check_bad_object(), br_stub_del(), br_stub_dir_create(), br_stub_fremovexattr(), br_stub_fsetxattr(), br_stub_fsetxattr_bad_object_cbk(), br_stub_ftruncate(), br_stub_handle_bad_object_key(), br_stub_handle_internal_xattr(), br_stub_handle_object_reopen(), br_stub_handle_object_signature(), br_stub_is_bad_object(), br_stub_is_object_stale(), br_stub_mark_object_bad(), br_stub_need_versioning(), br_stub_open(), br_stub_truncate(), br_stub_unlink(), br_stub_unlink_cbk(), br_stub_versioning_prep(), br_stub_writev(), br_trigger_sign(), brick_graph_add_io_stats(), brick_graph_add_posix(), changelog_encode_ascii(), changelog_fill_entry_buf(), changelog_handle_virtual_xattr(), changelog_snap_handle_ascii_change(), check_ancestory_2_cbk(), check_ancestory_continue(), cli_cmd_quota_handle_list_all(), client_get_remote_fd(), cvlt_download(), cvlt_read(), cvlt_readv_complete(), del_entry_fn(), del_stale_dir_handle(), dht_check_and_open_fd_on_subvol_complete(), dht_check_and_open_fd_on_subvol_task(), dht_free_disk_available_subvol(), dht_fremovexattr(), dht_init_local_subvols_and_nodeuuids(), dht_layout_preset(), dht_linkfile_create_lookup_cbk(), dht_linkfile_setattr_cbk(), dht_lookup_everywhere_cbk(), dht_lookup_linkfile_cbk(), dht_lookup_linkfile_create_cbk(), dht_migration_complete_check_task(), dht_readdirp_cbk(), dht_rebalance_inprogress_task(), dht_rename_cbk(), dht_rename_lookup_cbk(), dht_selfheal_dir_setattr(), dht_selfheal_dir_setattr_cbk(), dht_setxattr(), dht_subvol_get_hashed(), dht_truncate(), dht_xattrop(), do_blocked_fops(), do_fd_cleanup(), do_forget(), ec_create_name(), ec_delete_stale_name(), ec_flush(), ec_fsync(), ec_heal_data(), ec_heal_do(), ec_heal_entry(), ec_heal_metadata(), ec_heal_name(), ec_heal_readv_cbk(), ec_heal_writev_cbk(), ec_manager_heal_block(), ec_rebuild_data(), ec_restore_time_and_adjust_versions(), ec_shd_index_heal(), ec_shd_index_inode(), entry_fn(), fill_shd_status_for_local_bricks(), fuse_access_resume(), fuse_attr_cbk(), fuse_create_resume(), fuse_entry_cbk(), fuse_fd_cbk(), fuse_getattr_resume(), fuse_getxattr_resume(), fuse_invalidate(), fuse_invalidate_entry(), fuse_invalidate_inode(), fuse_listxattr_resume(), fuse_loc_fill(), fuse_lookup_resume(), fuse_migrate_fd(), fuse_migrate_fd_open(), fuse_migrate_locks(), fuse_mkdir_resume(), fuse_mknod_resume(), fuse_open_resume(), fuse_opendir_resume(), fuse_readlink_cbk(), fuse_readlink_resume(), fuse_readv_cbk(), fuse_release(), fuse_releasedir(), fuse_removexattr_resume(), fuse_rename_cbk(), fuse_resolve_entry_cbk(), fuse_resolve_fd(), fuse_resolve_gfid(), fuse_resolve_gfid_cbk(), fuse_rmdir_resume(), fuse_setattr_cbk(), fuse_setattr_resume(), fuse_setxattr_resume(), fuse_statfs_resume(), fuse_symlink_resume(), fuse_unlink_cbk(), fuse_unlink_resume(), fuse_writev_cbk(), gd_add_friend_to_dict(), gd_add_vol_snap_details_to_dict(), gd_collate_errors(), gd_mgmt_v3_collate_errors(), gd_sync_task_begin(), generate_glusterfs_ctx_id(), get_path_resume_cbk(), gf_defrag_handle_hardlink(), gf_gfid_generate_from_xxh64(), gf_proto_cache_invalidation_from_upcall(), gf_svc_create(), gf_svc_forget(), gf_svc_fsetxattr(), gf_svc_fsync(), gf_svc_lookup_cbk(), gf_svc_mkdir(), gf_svc_mknod(), gf_svc_opendir(), gf_svc_opendir_cbk(), gf_svc_readdir(), gf_svc_readdir_on_special_dir(), gf_svc_readdirp(), gf_svc_readdirp_cbk(), gf_svc_readdirp_lookup_cbk(), gf_svc_removexattr(), gf_svc_rename(), gf_svc_rmdir(), gf_svc_setattr(), gf_svc_setxattr(), gf_svc_symlink(), gf_svc_unlink(), glfs_h_poll_cache_invalidation(), glfs_refresh_inode_safe(), glfs_resolve_component(), glfsh_heal_splitbrain_file(), glusterd_ac_friend_add(), glusterd_ac_friend_remove(), glusterd_ac_handle_friend_add_req(), glusterd_ac_reverse_probe_begin(), glusterd_ac_send_friend_remove_req(), glusterd_ac_send_friend_update(), glusterd_ac_update_friend(), glusterd_acquire_multiple_locks_per_entity(), glusterd_add_brick_to_dict(), glusterd_add_missed_snaps_to_dict(), glusterd_add_node_to_dict(), glusterd_add_shd_to_dict(), glusterd_add_snap_to_dict(), glusterd_add_snapd_to_dict(), glusterd_add_volume_detail_to_dict(), glusterd_add_volume_to_dict(), glusterd_bitrot_volume_node_rsp(), glusterd_brick_op(), glusterd_brick_start(), glusterd_check_restart_gsync_session(), glusterd_clear_txn_opinfo(), glusterd_commit_op(), glusterd_conn_build_socket_filepath(), glusterd_create_snap_object(), glusterd_defrag_volume_node_rsp(), glusterd_dict_mgmt_v3_lock_statedump(), glusterd_dict_set_volid(), glusterd_dump_peer(), glusterd_dump_priv(), glusterd_event_connected_inject(), glusterd_find_snap_by_id(), glusterd_find_snap_by_name(), glusterd_friend_remove_notify(), glusterd_friend_sm(), glusterd_generate_and_set_task_id(), glusterd_generate_txn_id(), glusterd_get_each_snap_object_status(), glusterd_get_gfid_from_brick(), glusterd_get_txn_opinfo(), glusterd_handle_brick_op_fn(), glusterd_handle_commit_fn(), glusterd_handle_defrag_start(), glusterd_handle_mgmt_v3_lock_fn(), glusterd_handle_mgmt_v3_unlock_fn(), glusterd_handle_post_validate_fn(), glusterd_handle_pre_validate_fn(), glusterd_handle_snap_limit(), glusterd_handle_snapshot_clone(), glusterd_handle_snapshot_create(), glusterd_handle_snapshot_fn(), glusterd_lock(), glusterd_mgmt_handshake(), glusterd_mgmt_v3_lock(), glusterd_mgmt_v3_lock_entity(), glusterd_mgmt_v3_lock_peers(), glusterd_mgmt_v3_lock_peers_cbk_fn(), glusterd_mgmt_v3_unlock(), glusterd_mgmt_v3_unlock_entity(), glusterd_mgmt_v3_unlock_peers(), glusterd_mgmt_v3_unlock_peers_cbk_fn(), glusterd_new_shd_svc_start(), glusterd_op_ac_commit_op(), glusterd_op_sm(), glusterd_peer_dump_version(), glusterd_peer_has_missed_snap_delete(), glusterd_peerinfo_find(), glusterd_peerinfo_find_by_uuid(), glusterd_perform_missed_snap_ops(), glusterd_print_snapinfo_by_vol(), glusterd_profile_volume_brick_rsp(), glusterd_quota_conf_write_gfid(), glusterd_read_status_file(), glusterd_rpc_friend_add(), glusterd_rpc_friend_remove(), glusterd_set_txn_opinfo(), glusterd_snapshot_activate_commit(), glusterd_snapshot_clone_commit(), glusterd_snapshot_create_commit(), glusterd_snapshot_create_postvalidate(), glusterd_snapshot_deactivate_commit(), glusterd_snapshot_get_snap_detail(), glusterd_snapshot_get_snapvol_detail(), glusterd_snapshot_get_volnames_uuids(), glusterd_snapshot_remove_commit(), glusterd_snapshot_remove_prevalidate(), glusterd_snapshot_restore(), glusterd_stage_op(), glusterd_start_gsync(), glusterd_store_brickinfo_write(), glusterd_store_delete_peerinfo(), glusterd_store_delete_snap(), glusterd_store_delete_volume(), glusterd_store_global_info(), glusterd_store_peer_write(), glusterd_store_snapinfo_write(), glusterd_svc_build_gfproxyd_socket_filepath(), glusterd_svc_build_shd_socket_filepath(), glusterd_svc_build_snapd_socket_filepath(), glusterd_syctasked_mgmt_v3_unlock(), glusterd_synctasked_mgmt_v3_lock(), glusterd_take_missing_brick_snapshots(), glusterd_uuid_generate_save(), glusterd_uuid_init(), glusterd_validate_volume_id(), glusterd_vol_add_quota_conf_to_dict(), glusterd_volume_exclude_options_write(), glusterd_volume_heal_use_rsp_dict(), glusterd_volume_start_glusterfs(), glusterd_volume_write_snap_details(), index_entry_create(), index_inode_path(), inode_dump(), inode_dump_to_dict(), ioc_dispatch_requests(), ioc_inode_dump(), ioc_open_cbk(), is_bad_gfid_file_current(), is_index_file_current(), loc_gfid_utoa(), loc_path(), make_gfid_path(), make_index_path(), marker_build_ancestry_cbk(), marker_create_cbk(), marker_do_rename(), marker_error_handler(), marker_get_oldpath_contribution(), marker_lookup_cbk(), marker_mkdir_cbk(), marker_mknod_cbk(), marker_readdirp_cbk(), marker_rename_done(), marker_symlink_cbk(), mdc_inode_iatt_get(), mdc_inode_iatt_set_validate(), mdc_inode_xatt_get(), mdc_inode_xatt_set(), mnt3svc_mount_inode(), mq_build_ancestry(), mq_initiate_quota_task(), mq_inode_loc_fill(), mq_reduce_parent_size_task(), mq_remove_contri(), mq_update_contri(), mq_xattr_state(), nfs3_fh_resolve_entry_hard(), nfs3_fh_resolve_inode_hard(), nfs_inode_loc_fill(), notify(), pl_dump_inode_priv(), pl_entrylk_log_cleanup(), pl_fgetxattr(), pl_fgetxattr_handle_lockinfo(), pl_fsetxattr_handle_lockinfo(), pl_inodelk_log_cleanup(), pl_print_lockee(), pl_setxattr_cbk(), posix_acl_ctx_get(), posix_acl_ctx_new(), posix_acl_log_permit_denied(), posix_check_dev_file(), posix_common_removexattr(), posix_copy_file_range(), posix_create_link_if_gfid_exists(), posix_cs_build_xattr_rsp(), posix_do_fallocate(), posix_fdstat(), posix_fetch_mdata_xattr(), posix_forget(), posix_fsyncer_process(), posix_getxattr(), posix_gfid_heal(), posix_handle_gfid_path(), posix_handle_hard(), posix_handle_mkdir_hashes(), posix_handle_path(), posix_handle_relpath(), posix_handle_unset(), posix_handle_unset_gfid(), posix_init(), posix_istat(), posix_link(), posix_make_ancestryfromgfid(), posix_mkdir(), posix_mv_old_trash_into_new_trash(), posix_open(), posix_pstat(), posix_rchecksum(), posix_readdirp_fill(), posix_readv(), posix_remove_gfid2path_xattr(), posix_rename(), posix_resolve(), posix_resolve_dirgfid_to_path(), posix_rmdir(), posix_set_ctime(), posix_set_ctime_cfr(), posix_set_gfid2path_xattr(), posix_set_mdata_xattr(), posix_set_mdata_xattr_legacy_files(), posix_set_parent_ctime(), posix_store_mdata_xattr(), posix_symlinks_match(), posix_unlink(), posix_unlink_gfid_handle_and_entry(), posix_update_ctime_in_mdata(), posix_update_utime_in_mdata(), posix_writev(), process_lease_req(), pub_glfs_h_create_from_handle(), pub_glfs_object_copy(), quota_check_limit_continuation(), quota_create_cbk(), quota_fallocate(), quota_fallocate_cbk(), quota_fallocate_helper(), quota_fill_inodectx(), quota_fsetattr_cbk(), quota_fstat_cbk(), quota_fsync_cbk(), quota_ftruncate_cbk(), quota_get_limit_dir_continuation(), quota_inode_loc_fill(), quota_inode_parent(), quota_link_cbk(), quota_link_continue(), quota_log_helper(), quota_mknod_cbk(), quota_readlink_cbk(), quota_readv_cbk(), quota_rename_cbk(), quota_rename_continue(), quota_setattr_cbk(), quota_stat_cbk(), quota_statfs_validate_cbk(), quota_symlink_cbk(), quota_truncate_cbk(), quota_unlink_cbk(), quota_validate(), quota_validate_cbk(), quota_writev(), quota_writev_cbk(), quota_writev_helper(), resolve_anonfd_simple(), resolve_entry_simple(), resolve_gfid(), resolve_gfid_cbk(), resolve_gfid_entry_cbk(), resolve_pargfid_to_path(), send_fuse_err(), server3_3_lk(), server4_0_icreate(), server4_0_lk(), server4_access_cbk(), server4_create_cbk(), server4_create_resume(), server4_discard_cbk(), server4_entrylk_cbk(), server4_fallocate_cbk(), server4_fentrylk_cbk(), server4_fgetxattr_cbk(), server4_finodelk_cbk(), server4_flush_cbk(), server4_fremovexattr_cbk(), server4_fsetattr_cbk(), server4_fstat_cbk(), server4_fsync_cbk(), server4_fsyncdir_cbk(), server4_ftruncate_cbk(), server4_fxattrop_cbk(), server4_getactivelk_cbk(), server4_getxattr_cbk(), server4_icreate_cbk(), server4_inodelk_cbk(), server4_ipc_cbk(), server4_lease_cbk(), server4_lk_cbk(), server4_lookup_cbk(), server4_mkdir_cbk(), server4_mknod_cbk(), server4_open_cbk(), server4_opendir_cbk(), server4_put_cbk(), server4_rchecksum_cbk(), server4_readdir_cbk(), server4_readdirp_cbk(), server4_readlink_cbk(), server4_readv_cbk(), server4_removexattr_cbk(), server4_rmdir_cbk(), server4_seek_cbk(), server4_setactivelk_cbk(), server4_setattr_cbk(), server4_stat_cbk(), server4_symlink_cbk(), server4_truncate_cbk(), server4_unlink_cbk(), server4_writev_cbk(), server4_xattrop_cbk(), server4_zerofill_cbk(), server_access_cbk(), server_create_cbk(), server_create_resume(), server_discard_cbk(), server_entrylk_cbk(), server_fallocate_cbk(), server_fentrylk_cbk(), server_fgetxattr_cbk(), server_finodelk_cbk(), server_flush_cbk(), server_fremovexattr_cbk(), server_fsetattr_cbk(), server_fstat_cbk(), server_fsync_cbk(), server_fsyncdir_cbk(), server_ftruncate_cbk(), server_fxattrop_cbk(), server_getactivelk_cbk(), server_getxattr_cbk(), server_inodelk_cbk(), server_ipc_cbk(), server_lease_cbk(), server_lk_cbk(), server_lookup_cbk(), server_mkdir_cbk(), server_mknod_cbk(), server_open_cbk(), server_opendir_cbk(), server_rchecksum_cbk(), server_readdir_cbk(), server_readdirp_cbk(), server_readlink_cbk(), server_readv_cbk(), server_removexattr_cbk(), server_rmdir_cbk(), server_seek_cbk(), server_setactivelk_cbk(), server_setattr_cbk(), server_stat_cbk(), server_symlink_cbk(), server_truncate_cbk(), server_unlink_cbk(), server_writev_cbk(), server_xattrop_cbk(), server_zerofill_cbk(), set_afr_pending_xattrs_option(), set_ns_from_fd(), set_ns_from_loc(), shard_common_inode_write_begin(), shard_common_inode_write_do(), shard_common_inode_write_post_lookup_handler(), shard_common_lookup_shards(), shard_common_lookup_shards_cbk(), shard_common_remove_xattr(), shard_common_resolve_shards(), shard_common_resume_mknod(), shard_common_set_xattr(), shard_common_stat_cbk(), shard_create_cbk(), shard_create_marker_file_under_remove_me(), shard_fsetattr(), shard_fstat(), shard_fsync(), shard_ftruncate(), shard_link(), shard_mknod_cbk(), shard_modify_size_and_block_count(), shard_post_lookup_fsync_handler(), shard_post_lookup_shards_unlink_handler(), shard_readdir_do(), shard_readv(), shard_refresh_base_file(), shard_rename(), shard_rename_src_base_file(), shard_seek(), shard_set_iattr_invoke_post_handler(), shard_setattr(), shard_stat(), shard_truncate(), shard_truncate_htol(), shard_truncate_htol_cbk(), shard_truncate_last_shard(), shard_truncate_last_shard_cbk(), shard_unlink(), shard_unlink_shards_do(), shard_update_file_size(), shard_update_file_size_cbk(), svs_access(), svs_fgetxattr(), svs_flush(), svs_forget(), svs_fstat(), svs_getxattr(), svs_inode_glfs_mapping(), svs_lookup_gfid(), svs_open(), svs_opendir(), svs_readdir(), svs_readdirp(), svs_readlink(), svs_readv(), svs_release(), svs_releasedir(), svs_stat(), svs_statfs(), svs_uuid_generate(), syncop_dirfd(), this_fd_set_ctx(), trace_access(), trace_access_cbk(), trace_create(), trace_create_cbk(), trace_entrylk(), trace_entrylk_cbk(), trace_fentrylk(), trace_fentrylk_cbk(), trace_fgetxattr(), trace_fgetxattr_cbk(), trace_finodelk(), trace_finodelk_cbk(), trace_flush(), trace_flush_cbk(), trace_forget(), trace_fsetattr(), trace_fsetattr_cbk(), trace_fsetxattr(), trace_fsetxattr_cbk(), trace_fstat(), trace_fstat_cbk(), trace_fsync(), trace_fsync_cbk(), trace_fsyncdir(), trace_fsyncdir_cbk(), trace_ftruncate(), trace_ftruncate_cbk(), trace_fxattrop(), trace_fxattrop_cbk(), trace_getxattr(), trace_getxattr_cbk(), trace_inodelk(), trace_inodelk_cbk(), trace_link_cbk(), trace_lk(), trace_lk_cbk(), trace_lookup(), trace_lookup_cbk(), trace_mkdir(), trace_mkdir_cbk(), trace_mknod(), trace_mknod_cbk(), trace_open(), trace_open_cbk(), trace_opendir(), trace_opendir_cbk(), trace_rchecksum(), trace_rchecksum_cbk(), trace_readdir(), trace_readdir_cbk(), trace_readdirp(), trace_readdirp_cbk(), trace_readlink(), trace_readlink_cbk(), trace_readv(), trace_readv_cbk(), trace_release(), trace_releasedir(), trace_removexattr(), trace_removexattr_cbk(), trace_rename_cbk(), trace_rmdir(), trace_rmdir_cbk(), trace_seek(), trace_seek_cbk(), trace_setattr(), trace_setattr_cbk(), trace_setxattr(), trace_setxattr_cbk(), trace_stat(), trace_stat_cbk(), trace_stat_to_str(), trace_statfs(), trace_symlink(), trace_symlink_cbk(), trace_truncate(), trace_truncate_cbk(), trace_unlink(), trace_unlink_cbk(), trace_writev(), trace_writev_cbk(), trace_xattrop(), trace_xattrop_cbk(), trash_dir_lookup_cbk(), and worm_create_cbk().

◆ uuid_utoa_r()

char* uuid_utoa_r ( uuid_t  uuid,
char *  dst 
)

Definition at line 2850 of file common-utils.c.

References gf_uuid_unparse().

Referenced by __afr_selfheal_name_expunge(), __ec_heal_name(), __glfs_active_subvol(), __glusterd_handle_cli_uuid_get(), __inode_link(), __inode_unlink(), __wb_fulfill_request(), __wb_handle_failed_conflict(), __wb_pick_unwinds(), __wb_pick_winds(), __wb_preprocess_winds(), __wb_request_unref(), afr_gfid_split_brain_source(), afr_selfheal_entry_delete(), afr_selfheal_recreate_entry(), br_stub_bad_objects_path(), br_stub_get_path_of_gfid(), cli_cmd_quota_handle_list_all(), dht_lock_asprintf(), dht_nonblocking_inodelk_cbk(), dht_order_rename_lock(), dht_rename_dir_lock1_cbk(), dht_rename_dir_lock2_cbk(), dht_rename_dir_unlock_dst(), dht_rename_file_lock1_cbk(), dht_rename_file_protect_namespace(), dht_rename_lock_cbk(), dht_rename_unlock(), dht_selfheal_layout_alloc_start(), dht_unlock_entrylk_cbk(), dht_unlock_inodelk_cbk(), ec_msg_str(), fuse_getxattr_resume(), fuse_invalidate_entry(), fuse_rename_cbk(), fuse_rename_resume(), gd_peer_uuid_str(), gf_defrag_should_i_migrate(), glfs_migrate_fd_locks_safe(), glfs_migrate_fd_safe(), glfsh_print_heal_status(), glfsh_print_spb_status(), glusterd_brick_connect(), glusterd_get_state(), glusterd_list_friends(), glusterd_lock(), glusterd_op_copy_file(), glusterd_op_gsync_create(), glusterd_op_stage_copy_file(), glusterd_op_stage_gsync_create(), glusterd_op_stage_gsync_set(), glusterd_op_stage_start_volume(), glusterd_start_gsync(), glusterd_unlock(), ioc_inode_dump(), main(), nfs3_fh_to_str(), nfs3_log_fh(), nlc_dump_inodectx(), nlm_priv(), posix_copy_file_range(), posix_create_unlink_dir(), posix_fetch_mdata_xattr(), posix_rename(), posix_set_ctime_cfr(), posix_store_mdata_xattr(), rda_fill_fd_cbk(), rda_mark_inode_dirty(), server4_copy_file_range_cbk(), server4_link_cbk(), server4_rename_cbk(), server_link_cbk(), server_rename_cbk(), shard_create_marker_file_under_remove_me(), svs_get_handle(), svs_revalidate(), trace_link(), trace_rename(), and wb_inode_dump().

◆ valid_host_name()

char valid_host_name ( char *  address,
int  length 
)

◆ valid_internet_address()

◆ valid_ipv4_address()

char valid_ipv4_address ( char *  address,
int  length,
bool  wildcard_acc 
)

◆ valid_ipv4_subnetwork()

bool valid_ipv4_subnetwork ( const char *  address)

valid_ipv4_subnetwork() takes the pattern and checks if it contains a valid ipv4 subnetwork pattern i.e. xx.xx.xx.xx/n. IPv4 address part (xx.xx.xx.xx) and mask bits length part (n). The mask bits length must be in 0-32 range (ipv4 addr is 32 bit). The pattern must be in this format.

Returns _gf_true if both IP addr and mask bits len are valid _gf_false otherwise.

Definition at line 2567 of file common-utils.c.

References _gf_false, _gf_true, gf_boolean_t, GF_FREE, GF_LOG_WARNING, gf_msg_callingfn, gf_strdup(), IPv4_ADDR_SIZE, LG_MSG_INVALID_ARG, LG_MSG_INVALID_IPV4_FORMAT, out, THIS, and valid_ipv4_address().

Referenced by valid_mount_auth_address().

◆ valid_ipv6_address()

char valid_ipv6_address ( char *  address,
int  length,
bool  wildcard_acc 
)

Definition at line 2628 of file common-utils.c.

References GF_FREE, gf_strdup(), and out.

Referenced by gf_get_hostname_from_ip(), valid_internet_address(), and valid_mount_auth_address().

◆ valid_mount_auth_address()

bool valid_mount_auth_address ( char *  address)

valid_mount_auth_address - Validate the rpc-auth.addr.allow/reject pattern

Parameters
address- Pattern to be validated
Returns
_gf_true if "address" is "*" (anonymous) 'OR' if "address" is valid FQDN or valid IPv4/6 address 'OR' if "address" contains wildcard chars e.g. "'*' or '?' or '['" if "address" is valid ipv4 subnet pattern (xx.xx.xx.xx/n) _gf_false otherwise

NB: If the user/admin set for wildcard pattern, then it does not have to be validated. Make it similar to the way exportfs (kNFS) works.

Definition at line 2737 of file common-utils.c.

References _gf_false, _gf_true, GF_LOG_WARNING, gf_msg_callingfn, LG_MSG_INVALID_ARG, THIS, valid_host_name(), valid_ipv4_address(), valid_ipv4_subnetwork(), and valid_ipv6_address().

Referenced by xlator_option_validate_mntauth().

◆ validate_brick_name()

Variable Documentation

◆ vol_type_str

char* vol_type_str[]
extern
dict_remove_foreach_fn
int dict_remove_foreach_fn(dict_t *d, char *k, data_t *v, void *_tmp)
Definition: dict.c:1267
gf_uuid_is_null
static int gf_uuid_is_null(uuid_t uuid)
Definition: compat-uuid.h:41
LG_MSG_INVALID_ARG
@ LG_MSG_INVALID_ARG
Definition: libglusterfs-messages.h:123
LG_MSG_ASSERTION_FAILED
@ LG_MSG_ASSERTION_FAILED
Definition: libglusterfs-messages.h:123
GF_CLIENT_PID_GSYNCD
@ GF_CLIENT_PID_GSYNCD
Definition: common-utils.h:159
sys_readdir
struct dirent * sys_readdir(DIR *dir, struct dirent *de)
Definition: syscall.c:161
LG_MSG_NO_PERM
@ LG_MSG_NO_PERM
Definition: libglusterfs-messages.h:123
GF_LOG_WARNING
@ GF_LOG_WARNING
Definition: logging.h:74
dict_null_foreach_fn
int dict_null_foreach_fn(dict_t *d, char *k, data_t *v, void *tmp)
Definition: dict.c:1261
LG_MSG_NO_KEY
@ LG_MSG_NO_KEY
Definition: libglusterfs-messages.h:123
GF_LOG_CRITICAL
@ GF_LOG_CRITICAL
Definition: logging.h:72
name
char * name
Definition: xdr-nfs3.h:948
LG_MSG_DICT_NULL
@ LG_MSG_DICT_NULL
Definition: libglusterfs-messages.h:123
GF_LOG_ERROR
@ GF_LOG_ERROR
Definition: logging.h:73
LG_MSG_NO_MEMORY
@ LG_MSG_NO_MEMORY
Definition: libglusterfs-messages.h:123
dict_foreach_fnmatch
int dict_foreach_fnmatch(dict_t *dict, char *pattern, int(*fn)(dict_t *this, char *key, data_t *value, void *data), void *data)
Definition: dict.c:1349