mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cleanup: add braces in macro
This commit is contained in:
parent
b37e4e3f90
commit
0d0a3397c2
@ -65,11 +65,11 @@ struct config_source {
|
|||||||
* Map each ID to respective definition of the configuration item.
|
* Map each ID to respective definition of the configuration item.
|
||||||
*/
|
*/
|
||||||
static struct cfg_def_item _cfg_def_items[CFG_COUNT + 1] = {
|
static struct cfg_def_item _cfg_def_items[CFG_COUNT + 1] = {
|
||||||
#define cfg_section(id, name, parent, flags, since_version, deprecated_since_version, deprecation_comment, comment) {id, parent, name, CFG_TYPE_SECTION, {0}, flags, since_version, {0}, deprecated_since_version, deprecation_comment, comment},
|
#define cfg_section(id, name, parent, flags, since_version, deprecated_since_version, deprecation_comment, comment) {id, parent, name, CFG_TYPE_SECTION, {0}, (flags), since_version, {0}, deprecated_since_version, deprecation_comment, comment},
|
||||||
#define cfg(id, name, parent, flags, type, default_value, since_version, unconfigured_value, deprecated_since_version, deprecation_comment, comment) {id, parent, name, type, {.v_##type = default_value}, flags, since_version, {.v_UNCONFIGURED = unconfigured_value}, deprecated_since_version, deprecation_comment, comment},
|
#define cfg(id, name, parent, flags, type, default_value, since_version, unconfigured_value, deprecated_since_version, deprecation_comment, comment) {id, parent, name, type, {.v_##type = (default_value)}, (flags), since_version, {.v_UNCONFIGURED = (unconfigured_value)}, deprecated_since_version, deprecation_comment, comment},
|
||||||
#define cfg_runtime(id, name, parent, flags, type, since_version, deprecated_since_version, deprecation_comment, comment) {id, parent, name, type, {.fn_##type = get_default_##id}, flags | CFG_DEFAULT_RUN_TIME, since_version, {.fn_UNCONFIGURED = get_default_unconfigured_##id}, deprecated_since_version, deprecation_comment, comment},
|
#define cfg_runtime(id, name, parent, flags, type, since_version, deprecated_since_version, deprecation_comment, comment) {id, parent, name, type, {.fn_##type = get_default_##id}, (flags) | CFG_DEFAULT_RUN_TIME, since_version, {.fn_UNCONFIGURED = get_default_unconfigured_##id}, deprecated_since_version, (deprecation_comment), comment},
|
||||||
#define cfg_array(id, name, parent, flags, types, default_value, since_version, unconfigured_value, deprecated_since_version, deprecation_comment, comment) {id, parent, name, CFG_TYPE_ARRAY | types, {.v_CFG_TYPE_STRING = default_value}, flags, since_version, {.v_UNCONFIGURED = unconfigured_value}, deprecated_since_version, deprecation_comment, comment},
|
#define cfg_array(id, name, parent, flags, types, default_value, since_version, unconfigured_value, deprecated_since_version, deprecation_comment, comment) {id, parent, name, CFG_TYPE_ARRAY | (types), {.v_CFG_TYPE_STRING = (default_value)}, (flags), (since_version), {.v_UNCONFIGURED = (unconfigured_value)}, deprecated_since_version, deprecation_comment, comment},
|
||||||
#define cfg_array_runtime(id, name, parent, flags, types, since_version, deprecated_since_version, deprecation_comment, comment) {id, parent, name, CFG_TYPE_ARRAY | types, {.fn_CFG_TYPE_STRING = get_default_##id}, flags | CFG_DEFAULT_RUN_TIME, since_version, {.fn_UNCONFIGURED = get_default_unconfigured_##id}, deprecated_since_version, deprecation_comment, comment},
|
#define cfg_array_runtime(id, name, parent, flags, types, since_version, deprecated_since_version, deprecation_comment, comment) {id, parent, name, CFG_TYPE_ARRAY | (types), {.fn_CFG_TYPE_STRING = get_default_##id}, (flags) | CFG_DEFAULT_RUN_TIME, (since_version), {.fn_UNCONFIGURED = get_default_unconfigured_##id}, deprecated_since_version, deprecation_comment, comment},
|
||||||
#include "config_settings.h"
|
#include "config_settings.h"
|
||||||
#undef cfg_section
|
#undef cfg_section
|
||||||
#undef cfg
|
#undef cfg
|
||||||
@ -619,9 +619,9 @@ struct timespec config_file_timestamp(struct dm_config_tree *cft)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define cfg_def_get_item_p(id) (&_cfg_def_items[id])
|
#define cfg_def_get_item_p(id) (&_cfg_def_items[id])
|
||||||
#define cfg_def_get_default_unconfigured_value_hint(cmd,item) ((item->flags & CFG_DEFAULT_RUN_TIME) ? item->default_unconfigured_value.fn_UNCONFIGURED(cmd) : item->default_unconfigured_value.v_UNCONFIGURED)
|
#define cfg_def_get_default_unconfigured_value_hint(cmd,item) (((item)->flags & CFG_DEFAULT_RUN_TIME) ? (item)->default_unconfigured_value.fn_UNCONFIGURED(cmd) : (item)->default_unconfigured_value.v_UNCONFIGURED)
|
||||||
#define cfg_def_get_default_value_hint(cmd,item,type,profile) ((item->flags & CFG_DEFAULT_RUN_TIME) ? item->default_value.fn_##type(cmd,profile) : item->default_value.v_##type)
|
#define cfg_def_get_default_value_hint(cmd,item,type,profile) (((item)->flags & CFG_DEFAULT_RUN_TIME) ? (item)->default_value.fn_##type(cmd,profile) : (item)->default_value.v_##type)
|
||||||
#define cfg_def_get_default_value(cmd,item,type,profile) (item->flags & CFG_DEFAULT_UNDEFINED ? 0 : cfg_def_get_default_value_hint(cmd,item,type,profile))
|
#define cfg_def_get_default_value(cmd,item,type,profile) ((item)->flags & CFG_DEFAULT_UNDEFINED ? 0 : cfg_def_get_default_value_hint(cmd,item,type,profile))
|
||||||
|
|
||||||
static int _cfg_def_make_path(char *buf, size_t buf_size, int id, cfg_def_item_t *item, int xlate)
|
static int _cfg_def_make_path(char *buf, size_t buf_size, int id, cfg_def_item_t *item, int xlate)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#define MD_SB_MAGIC 0xa92b4efc
|
#define MD_SB_MAGIC 0xa92b4efc
|
||||||
#define MD_RESERVED_BYTES (64 * 1024ULL)
|
#define MD_RESERVED_BYTES (64 * 1024ULL)
|
||||||
#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)
|
#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)
|
||||||
#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) \
|
#define MD_NEW_SIZE_SECTORS(x) (((x) & ~(MD_RESERVED_SECTORS - 1)) \
|
||||||
- MD_RESERVED_SECTORS)
|
- MD_RESERVED_SECTORS)
|
||||||
#define MD_MAX_SYSFS_SIZE 64
|
#define MD_MAX_SYSFS_SIZE 64
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ typedef int (*nl_fn) (struct formatter * f);
|
|||||||
#define _out_with_comment(f, buffer, fmt, ap) \
|
#define _out_with_comment(f, buffer, fmt, ap) \
|
||||||
do { \
|
do { \
|
||||||
va_start(ap, fmt); \
|
va_start(ap, fmt); \
|
||||||
r = f->out_with_comment(f, buffer, fmt, ap); \
|
r = (f)->out_with_comment((f), (buffer), (fmt), ap); \
|
||||||
va_end(ap); \
|
va_end(ap); \
|
||||||
} while (r == -1)
|
} while (r == -1)
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ typedef int (*section_fn) (struct format_instance * fid,
|
|||||||
unsigned report_missing_devices);
|
unsigned report_missing_devices);
|
||||||
|
|
||||||
#define _read_int32(root, path, result) \
|
#define _read_int32(root, path, result) \
|
||||||
dm_config_get_uint32(root, path, (uint32_t *) result)
|
dm_config_get_uint32(root, path, (uint32_t *) (result))
|
||||||
|
|
||||||
#define _read_uint32(root, path, result) \
|
#define _read_uint32(root, path, result) \
|
||||||
dm_config_get_uint32(root, path, result)
|
dm_config_get_uint32(root, path, (result))
|
||||||
|
|
||||||
#define _read_uint64(root, path, result) \
|
#define _read_uint64(root, path, result) \
|
||||||
dm_config_get_uint64(root, path, result)
|
dm_config_get_uint64(root, path, (result))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Logs an attempt to read an invalid format file.
|
* Logs an attempt to read an invalid format file.
|
||||||
|
@ -134,7 +134,7 @@ static void _flags_str_to_lockd_flags(const char *flags_str, uint32_t *lockd_fla
|
|||||||
* will not return. daemon_reply_int reverts to this
|
* will not return. daemon_reply_int reverts to this
|
||||||
* value if it finds no result value.
|
* value if it finds no result value.
|
||||||
*/
|
*/
|
||||||
#define NO_LOCKD_RESULT -1000
|
#define NO_LOCKD_RESULT (-1000)
|
||||||
|
|
||||||
static int _lockd_result(daemon_reply reply, int *result, uint32_t *lockd_flags)
|
static int _lockd_result(daemon_reply reply, int *result, uint32_t *lockd_flags)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ typedef int (*fn_on_lv_t)(struct logical_volume *lv, void *data);
|
|||||||
static int _eliminate_extracted_lvs_optional_write_vg(struct volume_group *vg,
|
static int _eliminate_extracted_lvs_optional_write_vg(struct volume_group *vg,
|
||||||
struct dm_list *removal_lvs,
|
struct dm_list *removal_lvs,
|
||||||
int vg_write_requested);
|
int vg_write_requested);
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
|
||||||
|
|
||||||
static int _check_restriping(uint32_t new_stripes, struct logical_volume *lv)
|
static int _check_restriping(uint32_t new_stripes, struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,7 @@ struct time_prop {
|
|||||||
time_id_t granularity;
|
time_id_t granularity;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ADD_TIME_PROP(id, flags, granularity) [id] = {id, flags, granularity},
|
#define ADD_TIME_PROP(id, flags, granularity) [(id)] = {(id), (flags), (granularity)},
|
||||||
|
|
||||||
static const struct time_prop _time_props[] = {
|
static const struct time_prop _time_props[] = {
|
||||||
ADD_TIME_PROP(TIME_NULL, 0, TIME_NULL)
|
ADD_TIME_PROP(TIME_NULL, 0, TIME_NULL)
|
||||||
@ -228,7 +228,7 @@ struct time_reg {
|
|||||||
uint32_t reg_flags;
|
uint32_t reg_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TIME_PROP(id) (_time_props + id)
|
#define TIME_PROP(id) (_time_props + (id))
|
||||||
|
|
||||||
static const struct time_reg _time_reg[] = {
|
static const struct time_reg _time_reg[] = {
|
||||||
/*
|
/*
|
||||||
@ -3915,7 +3915,7 @@ static const struct dm_report_object_type _devtypes_report_types[] = {
|
|||||||
#define STR_LIST DM_REPORT_FIELD_TYPE_STRING_LIST
|
#define STR_LIST DM_REPORT_FIELD_TYPE_STRING_LIST
|
||||||
#define SNUM DM_REPORT_FIELD_TYPE_NUMBER
|
#define SNUM DM_REPORT_FIELD_TYPE_NUMBER
|
||||||
#define FIELD(type, strct, sorttype, head, field, width, func, id, desc, writeable) \
|
#define FIELD(type, strct, sorttype, head, field, width, func, id, desc, writeable) \
|
||||||
{type, sorttype, offsetof(type_ ## strct, field), width ? : sizeof(head) - 1, \
|
{type, sorttype, offsetof(type_ ## strct, field), (width) ? : sizeof(head) - 1, \
|
||||||
#id, head, &_ ## func ## _disp, desc},
|
#id, head, &_ ## func ## _disp, desc},
|
||||||
|
|
||||||
typedef struct cmd_log_item type_cmd_log_item;
|
typedef struct cmd_log_item type_cmd_log_item;
|
||||||
|
@ -1426,10 +1426,10 @@ static int _dbl_less_or_equal(double d1, double d2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define _uint64 *(const uint64_t *)
|
#define _uint64 *(const uint64_t *)
|
||||||
#define _uint64arr(var,index) ((const uint64_t *)var)[index]
|
#define _uint64arr(var,index) ((const uint64_t *)(var))[(index)]
|
||||||
#define _str (const char *)
|
#define _str (const char *)
|
||||||
#define _dbl *(const double *)
|
#define _dbl *(const double *)
|
||||||
#define _dblarr(var,index) ((const double *)var)[index]
|
#define _dblarr(var,index) ((const double *)(var))[(index)]
|
||||||
|
|
||||||
static int _do_check_value_is_strictly_reserved(unsigned type, const void *res_val, int res_range,
|
static int _do_check_value_is_strictly_reserved(unsigned type, const void *res_val, int res_range,
|
||||||
const void *val, struct field_selection *fs)
|
const void *val, struct field_selection *fs)
|
||||||
|
@ -284,7 +284,7 @@ static struct oo_line oo_lines[MAX_OO_LINES];
|
|||||||
|
|
||||||
#define REQUIRED 1 /* required option */
|
#define REQUIRED 1 /* required option */
|
||||||
#define OPTIONAL 0 /* optional option */
|
#define OPTIONAL 0 /* optional option */
|
||||||
#define IGNORE -1 /* ignore option */
|
#define IGNORE (-1) /* ignore option */
|
||||||
|
|
||||||
#define MAX_LINE 1024
|
#define MAX_LINE 1024
|
||||||
#define MAX_LINE_ARGC 256
|
#define MAX_LINE_ARGC 256
|
||||||
|
@ -296,7 +296,7 @@ static uint64_t _new_interval = 0; /* flag top-of-interval */
|
|||||||
static uint64_t _last_interval = 0; /* approx. measured interval in nsecs */
|
static uint64_t _last_interval = 0; /* approx. measured interval in nsecs */
|
||||||
|
|
||||||
/* Invalid fd value used to signal end-of-reporting. */
|
/* Invalid fd value used to signal end-of-reporting. */
|
||||||
#define TIMER_STOPPED -2
|
#define TIMER_STOPPED (-2)
|
||||||
|
|
||||||
#define NSEC_PER_USEC UINT64_C(1000)
|
#define NSEC_PER_USEC UINT64_C(1000)
|
||||||
#define NSEC_PER_MSEC UINT64_C(1000000)
|
#define NSEC_PER_MSEC UINT64_C(1000000)
|
||||||
|
@ -780,7 +780,7 @@ static void _del_option_from_list(struct dm_list *sll, const char *prefix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define _get_report_idx(report_type,single_report_type) \
|
#define _get_report_idx(report_type,single_report_type) \
|
||||||
(((report_type != FULL) && (report_type == single_report_type)) ? REPORT_IDX_SINGLE : REPORT_IDX_FULL_ ## single_report_type)
|
((((report_type) != FULL) && ((report_type) == single_report_type)) ? REPORT_IDX_SINGLE : REPORT_IDX_FULL_ ## single_report_type)
|
||||||
|
|
||||||
static report_idx_t _get_report_idx_from_name(report_type_t report_type, const char *name)
|
static report_idx_t _get_report_idx_from_name(report_type_t report_type, const char *name)
|
||||||
{
|
{
|
||||||
@ -1262,10 +1262,10 @@ out:
|
|||||||
|
|
||||||
#define _set_full_report_single(cmd,args,type,name) \
|
#define _set_full_report_single(cmd,args,type,name) \
|
||||||
do { \
|
do { \
|
||||||
args->single_args[REPORT_IDX_FULL_ ## type].report_type = type; \
|
(args)->single_args[REPORT_IDX_FULL_ ## type].report_type = type; \
|
||||||
args->single_args[REPORT_IDX_FULL_ ## type].keys = find_config_tree_str(cmd, report_ ## name ## _sort_full_CFG, NULL); \
|
(args)->single_args[REPORT_IDX_FULL_ ## type].keys = find_config_tree_str(cmd, report_ ## name ## _sort_full_CFG, NULL); \
|
||||||
args->single_args[REPORT_IDX_FULL_ ## type].options = find_config_tree_str(cmd, report_ ## name ## _cols_full_CFG, NULL); \
|
(args)->single_args[REPORT_IDX_FULL_ ## type].options = find_config_tree_str(cmd, report_ ## name ## _cols_full_CFG, NULL); \
|
||||||
if (!_set_report_prefix_and_name(args, &args->single_args[REPORT_IDX_FULL_ ## type])) \
|
if (!_set_report_prefix_and_name((args), &(args)->single_args[REPORT_IDX_FULL_ ## type])) \
|
||||||
return_0; \
|
return_0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
#define report_log_ret_code(ret_code) report_current_object_cmdlog(REPORT_OBJECT_CMDLOG_NAME, \
|
#define report_log_ret_code(ret_code) report_current_object_cmdlog(REPORT_OBJECT_CMDLOG_NAME, \
|
||||||
ret_code == ECMD_PROCESSED ? REPORT_OBJECT_CMDLOG_SUCCESS \
|
((ret_code) == ECMD_PROCESSED) ? REPORT_OBJECT_CMDLOG_SUCCESS \
|
||||||
: REPORT_OBJECT_CMDLOG_FAILURE, ret_code)
|
: REPORT_OBJECT_CMDLOG_FAILURE, (ret_code))
|
||||||
|
|
||||||
struct device_id_list {
|
struct device_id_list {
|
||||||
struct dm_list list;
|
struct dm_list list;
|
||||||
|
Loading…
Reference in New Issue
Block a user