cli: add objlist property type and implement get_fcn() for all types
This commit is contained in:
@@ -2892,103 +2892,107 @@ _get_fcn_infiniband_p_key (ARGS_GET_FCN)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gconstpointer
|
static gconstpointer
|
||||||
_get_fcn_ip_config_addresses (ARGS_GET_FCN)
|
_get_fcn_objlist (ARGS_GET_FCN)
|
||||||
{
|
{
|
||||||
NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting);
|
GString *str = NULL;
|
||||||
GString *printable;
|
guint num;
|
||||||
guint num_addresses, i;
|
guint idx;
|
||||||
NMIPAddress *addr;
|
|
||||||
|
|
||||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
RETURN_UNSUPPORTED_GET_TYPE ();
|
||||||
|
|
||||||
printable = g_string_new (NULL);
|
num = property_info->property_typ_data->subtype.objlist.get_num_fcn (setting);
|
||||||
|
|
||||||
num_addresses = NM_MIN ((guint) G_MAXINT, nm_setting_ip_config_get_num_addresses (s_ip));
|
for (idx = 0; idx < num; idx++) {
|
||||||
for (i = 0; i < num_addresses; i++) {
|
if (!str)
|
||||||
addr = nm_setting_ip_config_get_address (s_ip, i);
|
str = g_string_new (NULL);
|
||||||
|
else if (str->len > 0) {
|
||||||
|
if ( get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY
|
||||||
|
&& property_info->property_typ_data->subtype.objlist.delimit_pretty_with_semicolon)
|
||||||
|
g_string_append (str, "; ");
|
||||||
|
else
|
||||||
|
g_string_append (str, ", ");
|
||||||
|
}
|
||||||
|
|
||||||
if (printable->len > 0)
|
property_info->property_typ_data->subtype.objlist.obj_to_str_fcn (get_type,
|
||||||
g_string_append (printable, ", ");
|
setting,
|
||||||
|
idx,
|
||||||
g_string_append_printf (printable, "%s/%u",
|
str);
|
||||||
nm_ip_address_get_address (addr),
|
|
||||||
nm_ip_address_get_prefix (addr));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_SET_OUT (out_is_default, num_addresses == 0);
|
NM_SET_OUT (out_is_default, num == 0);
|
||||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
if (str)
|
||||||
|
RETURN_STR_TO_FREE (g_string_free (str, FALSE));
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gconstpointer
|
static void
|
||||||
_get_fcn_ip_config_routes (ARGS_GET_FCN)
|
_objlist_obj_to_str_fcn_ip_config_addresses (NMMetaAccessorGetType get_type,
|
||||||
|
NMSetting *setting,
|
||||||
|
guint idx,
|
||||||
|
GString *str)
|
||||||
|
{
|
||||||
|
NMIPAddress *obj;
|
||||||
|
|
||||||
|
obj = nm_setting_ip_config_get_address (NM_SETTING_IP_CONFIG (setting),
|
||||||
|
idx);
|
||||||
|
g_string_append_printf (str,
|
||||||
|
"%s/%u",
|
||||||
|
nm_ip_address_get_address (obj),
|
||||||
|
nm_ip_address_get_prefix (obj));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_objlist_obj_to_str_fcn_ip_config_routes (NMMetaAccessorGetType get_type,
|
||||||
|
NMSetting *setting,
|
||||||
|
guint idx,
|
||||||
|
GString *str)
|
||||||
{
|
{
|
||||||
NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting);
|
|
||||||
GString *printable;
|
|
||||||
guint num_routes, i;
|
|
||||||
NMIPRoute *route;
|
NMIPRoute *route;
|
||||||
|
gs_free char *attr_str = NULL;
|
||||||
|
gs_strfreev char **attr_names = NULL;
|
||||||
|
gs_unref_hashtable GHashTable *hash = g_hash_table_new (nm_str_hash, g_str_equal);
|
||||||
|
int j;
|
||||||
|
|
||||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
route = nm_setting_ip_config_get_route (NM_SETTING_IP_CONFIG (setting), idx);
|
||||||
|
|
||||||
printable = g_string_new (NULL);
|
attr_names = nm_ip_route_get_attribute_names (route);
|
||||||
|
for (j = 0; attr_names && attr_names[j]; j++) {
|
||||||
num_routes = NM_MIN ((guint) G_MAXINT, nm_setting_ip_config_get_num_routes (s_ip));
|
g_hash_table_insert (hash, attr_names[j],
|
||||||
for (i = 0; i < num_routes; i++) {
|
nm_ip_route_get_attribute (route, attr_names[j]));
|
||||||
gs_free char *attr_str = NULL;
|
|
||||||
gs_strfreev char **attr_names = NULL;
|
|
||||||
gs_unref_hashtable GHashTable *hash = g_hash_table_new (nm_str_hash, g_str_equal);
|
|
||||||
int j;
|
|
||||||
|
|
||||||
route = nm_setting_ip_config_get_route (s_ip, i);
|
|
||||||
|
|
||||||
attr_names = nm_ip_route_get_attribute_names (route);
|
|
||||||
for (j = 0; attr_names && attr_names[j]; j++) {
|
|
||||||
g_hash_table_insert (hash, attr_names[j],
|
|
||||||
nm_ip_route_get_attribute (route, attr_names[j]));
|
|
||||||
}
|
|
||||||
|
|
||||||
attr_str = nm_utils_format_variant_attributes (hash, ' ', '=');
|
|
||||||
|
|
||||||
if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) {
|
|
||||||
if (printable->len > 0)
|
|
||||||
g_string_append (printable, ", ");
|
|
||||||
|
|
||||||
g_string_append_printf (printable, "%s/%u",
|
|
||||||
nm_ip_route_get_dest (route),
|
|
||||||
nm_ip_route_get_prefix (route));
|
|
||||||
|
|
||||||
if (nm_ip_route_get_next_hop (route))
|
|
||||||
g_string_append_printf (printable, " %s", nm_ip_route_get_next_hop (route));
|
|
||||||
if (nm_ip_route_get_metric (route) != -1)
|
|
||||||
g_string_append_printf (printable, " %u", (guint32) nm_ip_route_get_metric (route));
|
|
||||||
if (attr_str)
|
|
||||||
g_string_append_printf (printable, " %s", attr_str);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (printable->len > 0)
|
|
||||||
g_string_append (printable, "; ");
|
|
||||||
|
|
||||||
g_string_append (printable, "{ ");
|
|
||||||
|
|
||||||
g_string_append_printf (printable, "ip = %s/%u",
|
|
||||||
nm_ip_route_get_dest (route),
|
|
||||||
nm_ip_route_get_prefix (route));
|
|
||||||
|
|
||||||
if (nm_ip_route_get_next_hop (route)) {
|
|
||||||
g_string_append_printf (printable, ", nh = %s",
|
|
||||||
nm_ip_route_get_next_hop (route));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nm_ip_route_get_metric (route) != -1)
|
|
||||||
g_string_append_printf (printable, ", mt = %u", (guint32) nm_ip_route_get_metric (route));
|
|
||||||
if (attr_str)
|
|
||||||
g_string_append_printf (printable, " %s", attr_str);
|
|
||||||
|
|
||||||
g_string_append (printable, " }");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_SET_OUT (out_is_default, num_routes == 0);
|
attr_str = nm_utils_format_variant_attributes (hash, ' ', '=');
|
||||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
|
||||||
|
if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) {
|
||||||
|
g_string_append_printf (str, "%s/%u",
|
||||||
|
nm_ip_route_get_dest (route),
|
||||||
|
nm_ip_route_get_prefix (route));
|
||||||
|
|
||||||
|
if (nm_ip_route_get_next_hop (route))
|
||||||
|
g_string_append_printf (str, " %s", nm_ip_route_get_next_hop (route));
|
||||||
|
if (nm_ip_route_get_metric (route) != -1)
|
||||||
|
g_string_append_printf (str, " %u", (guint32) nm_ip_route_get_metric (route));
|
||||||
|
if (attr_str)
|
||||||
|
g_string_append_printf (str, " %s", attr_str);
|
||||||
|
} else {
|
||||||
|
g_string_append (str, "{ ");
|
||||||
|
|
||||||
|
g_string_append_printf (str, "ip = %s/%u",
|
||||||
|
nm_ip_route_get_dest (route),
|
||||||
|
nm_ip_route_get_prefix (route));
|
||||||
|
|
||||||
|
if (nm_ip_route_get_next_hop (route)) {
|
||||||
|
g_string_append_printf (str, ", nh = %s",
|
||||||
|
nm_ip_route_get_next_hop (route));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nm_ip_route_get_metric (route) != -1)
|
||||||
|
g_string_append_printf (str, ", mt = %u", (guint32) nm_ip_route_get_metric (route));
|
||||||
|
if (attr_str)
|
||||||
|
g_string_append_printf (str, " %s", attr_str);
|
||||||
|
|
||||||
|
g_string_append (str, " }");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -3249,65 +3253,34 @@ _validate_fcn_proxy_pac_script (const char *value, char **out_to_free, GError **
|
|||||||
RETURN_STR_TO_FREE (script);
|
RETURN_STR_TO_FREE (script);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gconstpointer
|
static void
|
||||||
_get_fcn_sriov_vfs (ARGS_GET_FCN)
|
_objlist_obj_to_str_fcn_sriov_vfs (NMMetaAccessorGetType get_type,
|
||||||
|
NMSetting *setting,
|
||||||
|
guint idx,
|
||||||
|
GString *str)
|
||||||
{
|
{
|
||||||
NMSettingSriov *s_sriov = NM_SETTING_SRIOV (setting);
|
gs_free char *s = NULL;
|
||||||
GString *printable;
|
NMSriovVF *vf;
|
||||||
guint num_vfs, i;
|
|
||||||
|
|
||||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
vf = nm_setting_sriov_get_vf (NM_SETTING_SRIOV (setting), idx);
|
||||||
|
s = nm_utils_sriov_vf_to_str (vf, FALSE, NULL);
|
||||||
printable = g_string_new (NULL);
|
if (s)
|
||||||
|
g_string_append (str, s);
|
||||||
num_vfs = nm_setting_sriov_get_num_vfs (s_sriov);
|
|
||||||
for (i = 0; i < num_vfs; i++) {
|
|
||||||
gs_free char *str = NULL;
|
|
||||||
NMSriovVF *vf;
|
|
||||||
|
|
||||||
vf = nm_setting_sriov_get_vf (s_sriov, i);
|
|
||||||
str = nm_utils_sriov_vf_to_str (vf, FALSE, NULL);
|
|
||||||
if (!str)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (printable->len > 0)
|
|
||||||
g_string_append (printable, ", ");
|
|
||||||
g_string_append (printable, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
NM_SET_OUT (out_is_default, num_vfs == 0);
|
|
||||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gconstpointer
|
static void
|
||||||
_get_fcn_tc_config_qdiscs (ARGS_GET_FCN)
|
_objlist_obj_to_str_fcn_tc_config_qdiscs (NMMetaAccessorGetType get_type,
|
||||||
|
NMSetting *setting,
|
||||||
|
guint idx,
|
||||||
|
GString *str)
|
||||||
{
|
{
|
||||||
NMSettingTCConfig *s_tc = NM_SETTING_TC_CONFIG (setting);
|
gs_free char *s = NULL;
|
||||||
GString *printable;
|
NMTCQdisc *qdisc;
|
||||||
guint num_qdiscs, i;
|
|
||||||
|
|
||||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
qdisc = nm_setting_tc_config_get_qdisc (NM_SETTING_TC_CONFIG (setting), idx);
|
||||||
|
s = nm_utils_tc_qdisc_to_str (qdisc, NULL);
|
||||||
printable = g_string_new (NULL);
|
if (s)
|
||||||
|
g_string_append (str, s);
|
||||||
num_qdiscs = nm_setting_tc_config_get_num_qdiscs (s_tc);
|
|
||||||
for (i = 0; i < num_qdiscs; i++) {
|
|
||||||
gs_free char *str = NULL;
|
|
||||||
NMTCQdisc *qdisc;
|
|
||||||
|
|
||||||
qdisc = nm_setting_tc_config_get_qdisc (s_tc, i);
|
|
||||||
|
|
||||||
str = nm_utils_tc_qdisc_to_str (qdisc, NULL);
|
|
||||||
if (!str)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (printable->len > 0)
|
|
||||||
g_string_append (printable, ", ");
|
|
||||||
g_string_append (printable, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
NM_SET_OUT (out_is_default, num_qdiscs == 0);
|
|
||||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -3402,35 +3375,19 @@ DEFINE_REMOVER_INDEX_OR_VALUE_COMPLEX (_remove_fcn_tc_config_qdiscs,
|
|||||||
nm_setting_tc_config_remove_qdisc,
|
nm_setting_tc_config_remove_qdisc,
|
||||||
_validate_and_remove_tc_qdisc)
|
_validate_and_remove_tc_qdisc)
|
||||||
|
|
||||||
static gconstpointer
|
static void
|
||||||
_get_fcn_tc_config_tfilters (ARGS_GET_FCN)
|
_objlist_obj_to_str_fcn_tc_config_tfilters (NMMetaAccessorGetType get_type,
|
||||||
|
NMSetting *setting,
|
||||||
|
guint idx,
|
||||||
|
GString *str)
|
||||||
{
|
{
|
||||||
NMSettingTCConfig *s_tc = NM_SETTING_TC_CONFIG (setting);
|
NMTCTfilter *tfilter;
|
||||||
GString *printable;
|
gs_free char *s = NULL;
|
||||||
guint num_tfilters, i;
|
|
||||||
|
|
||||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
tfilter = nm_setting_tc_config_get_tfilter (NM_SETTING_TC_CONFIG (setting), idx);
|
||||||
|
s = nm_utils_tc_tfilter_to_str (tfilter, NULL);
|
||||||
printable = g_string_new (NULL);
|
if (s)
|
||||||
|
g_string_append (str, s);
|
||||||
num_tfilters = nm_setting_tc_config_get_num_tfilters (s_tc);
|
|
||||||
for (i = 0; i < num_tfilters; i++) {
|
|
||||||
NMTCTfilter *tfilter;
|
|
||||||
gs_free char *str = NULL;
|
|
||||||
|
|
||||||
tfilter = nm_setting_tc_config_get_tfilter (s_tc, i);
|
|
||||||
|
|
||||||
str = nm_utils_tc_tfilter_to_str (tfilter, NULL);
|
|
||||||
if (!str)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (printable->len > 0)
|
|
||||||
g_string_append (printable, ", ");
|
|
||||||
g_string_append (printable, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
NM_SET_OUT (out_is_default, num_tfilters == 0);
|
|
||||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -3490,35 +3447,35 @@ _validate_fcn_team_config (const char *value, char **out_to_free, GError **error
|
|||||||
RETURN_STR_TO_FREE (json);
|
RETURN_STR_TO_FREE (json);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gconstpointer
|
static void
|
||||||
_get_fcn_team_link_watchers (ARGS_GET_FCN)
|
_team_link_watcher_obj_to_str (NMTeamLinkWatcher *watcher,
|
||||||
|
GString *str)
|
||||||
{
|
{
|
||||||
NMSettingTeam *s_team = NM_SETTING_TEAM (setting);
|
gs_free char *s = NULL;
|
||||||
GString *printable;
|
|
||||||
guint num_watchers, i;
|
|
||||||
|
|
||||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
s = _dump_team_link_watcher (watcher);
|
||||||
|
if (s)
|
||||||
|
g_string_append (str, s);
|
||||||
|
}
|
||||||
|
|
||||||
printable = g_string_new (NULL);
|
static void
|
||||||
|
_objlist_obj_to_str_fcn_team_link_watchers (NMMetaAccessorGetType get_type,
|
||||||
|
NMSetting *setting,
|
||||||
|
guint idx,
|
||||||
|
GString *str)
|
||||||
|
{
|
||||||
|
_team_link_watcher_obj_to_str (nm_setting_team_get_link_watcher (NM_SETTING_TEAM (setting), idx),
|
||||||
|
str);
|
||||||
|
}
|
||||||
|
|
||||||
num_watchers = nm_setting_team_get_num_link_watchers (s_team);
|
static void
|
||||||
for (i = 0; i < num_watchers; i++) {
|
_objlist_obj_to_str_fcn_team_port_link_watchers (NMMetaAccessorGetType get_type,
|
||||||
NMTeamLinkWatcher *watcher;
|
NMSetting *setting,
|
||||||
gs_free char *str = NULL;
|
guint idx,
|
||||||
|
GString *str)
|
||||||
watcher = nm_setting_team_get_link_watcher (s_team, i);
|
{
|
||||||
|
_team_link_watcher_obj_to_str (nm_setting_team_port_get_link_watcher (NM_SETTING_TEAM_PORT (setting), idx),
|
||||||
str = _dump_team_link_watcher (watcher);
|
str);
|
||||||
if (!str)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (printable->len > 0)
|
|
||||||
g_string_append (printable, ", ");
|
|
||||||
g_string_append (printable, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
NM_SET_OUT (out_is_default, num_watchers == 0);
|
|
||||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -3562,36 +3519,6 @@ DEFINE_REMOVER_INDEX_OR_VALUE_COMPLEX (_remove_fcn_team_link_watchers,
|
|||||||
nm_setting_team_remove_link_watcher,
|
nm_setting_team_remove_link_watcher,
|
||||||
_validate_and_remove_team_link_watcher)
|
_validate_and_remove_team_link_watcher)
|
||||||
|
|
||||||
static gconstpointer
|
|
||||||
_get_fcn_team_port_link_watchers (ARGS_GET_FCN)
|
|
||||||
{
|
|
||||||
NMSettingTeamPort *s_team_port = NM_SETTING_TEAM_PORT (setting);
|
|
||||||
GString *printable;
|
|
||||||
guint num_watchers, i;
|
|
||||||
|
|
||||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
|
||||||
|
|
||||||
printable = g_string_new (NULL);
|
|
||||||
|
|
||||||
num_watchers = nm_setting_team_port_get_num_link_watchers (s_team_port);
|
|
||||||
for (i = 0; i < num_watchers; i++) {
|
|
||||||
NMTeamLinkWatcher *watcher;
|
|
||||||
gs_free char *str = NULL;
|
|
||||||
|
|
||||||
watcher = nm_setting_team_port_get_link_watcher (s_team_port, i);
|
|
||||||
str = _dump_team_link_watcher (watcher);
|
|
||||||
if (!str)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (printable->len > 0)
|
|
||||||
g_string_append (printable, ", ");
|
|
||||||
g_string_append (printable, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
NM_SET_OUT (out_is_default, num_watchers == 0);
|
|
||||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_set_fcn_team_port_link_watchers (ARGS_SET_FCN)
|
_set_fcn_team_port_link_watchers (ARGS_SET_FCN)
|
||||||
{
|
{
|
||||||
@@ -4286,6 +4213,8 @@ static const NMMetaPropertyType _pt_ethtool = {
|
|||||||
#define MULTILIST_REMOVE_BY_IDX_FCN_U(type, func) (((func) == ((void (*) (type *, guint )) (func))) ? ((void (*) (NMSetting *, guint )) (func)) : NULL)
|
#define MULTILIST_REMOVE_BY_IDX_FCN_U(type, func) (((func) == ((void (*) (type *, guint )) (func))) ? ((void (*) (NMSetting *, guint )) (func)) : NULL)
|
||||||
#define MULTILIST_REMOVE_BY_VALUE_FCN(type, func) (((func) == ((gboolean (*) (type *, const char *)) (func))) ? ((gboolean (*) (NMSetting *, const char *)) (func)) : NULL)
|
#define MULTILIST_REMOVE_BY_VALUE_FCN(type, func) (((func) == ((gboolean (*) (type *, const char *)) (func))) ? ((gboolean (*) (NMSetting *, const char *)) (func)) : NULL)
|
||||||
|
|
||||||
|
#define OBJLIST_GET_NUM_FCN(type, func) (((func) == ((guint (*) (type * )) (func))) ? ((guint (*) (NMSetting * )) (func)) : NULL)
|
||||||
|
|
||||||
static const NMMetaPropertyType _pt_multilist = {
|
static const NMMetaPropertyType _pt_multilist = {
|
||||||
.get_fcn = _get_fcn_gobject,
|
.get_fcn = _get_fcn_gobject,
|
||||||
.set_fcn = _set_fcn_multilist,
|
.set_fcn = _set_fcn_multilist,
|
||||||
@@ -5384,10 +5313,16 @@ static const NMMetaPropertyInfo *const property_infos_IP4_CONFIG[] = {
|
|||||||
"Missing prefix is regarded as prefix of 32.\n\n"
|
"Missing prefix is regarded as prefix of 32.\n\n"
|
||||||
"Example: 192.168.1.5/24, 10.0.0.11/24\n"),
|
"Example: 192.168.1.5/24, 10.0.0.11/24\n"),
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = DEFINE_PROPERTY_TYPE (
|
||||||
.get_fcn = _get_fcn_ip_config_addresses,
|
.get_fcn = _get_fcn_objlist,
|
||||||
.set_fcn = _set_fcn_ip_config_addresses,
|
.set_fcn = _set_fcn_ip_config_addresses,
|
||||||
.remove_fcn = _remove_fcn_ip_config_addresses,
|
.remove_fcn = _remove_fcn_ip_config_addresses,
|
||||||
),
|
),
|
||||||
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||||
|
PROPERTY_TYP_DATA_SUBTYPE (objlist,
|
||||||
|
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_addresses),
|
||||||
|
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_addresses,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
PROPERTY_INFO (NM_SETTING_IP_CONFIG_GATEWAY, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_GATEWAY,
|
PROPERTY_INFO (NM_SETTING_IP_CONFIG_GATEWAY, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_GATEWAY,
|
||||||
.is_cli_option = TRUE,
|
.is_cli_option = TRUE,
|
||||||
@@ -5408,10 +5343,17 @@ static const NMMetaPropertyInfo *const property_infos_IP4_CONFIG[] = {
|
|||||||
"Examples: 192.168.2.0/24 192.168.2.1 3, 10.1.0.0/16 10.0.0.254\n"
|
"Examples: 192.168.2.0/24 192.168.2.1 3, 10.1.0.0/16 10.0.0.254\n"
|
||||||
" 10.1.2.0/24\n"),
|
" 10.1.2.0/24\n"),
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = DEFINE_PROPERTY_TYPE (
|
||||||
.get_fcn = _get_fcn_ip_config_routes,
|
.get_fcn = _get_fcn_objlist,
|
||||||
.set_fcn = _set_fcn_ip_config_routes,
|
.set_fcn = _set_fcn_ip_config_routes,
|
||||||
.remove_fcn = _remove_fcn_ip_config_routes,
|
.remove_fcn = _remove_fcn_ip_config_routes,
|
||||||
),
|
),
|
||||||
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||||
|
PROPERTY_TYP_DATA_SUBTYPE (objlist,
|
||||||
|
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_routes),
|
||||||
|
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_routes,
|
||||||
|
.delimit_pretty_with_semicolon = TRUE,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_METRIC, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_METRIC,
|
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_METRIC, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_METRIC,
|
||||||
.property_type = &_pt_gobject_int,
|
.property_type = &_pt_gobject_int,
|
||||||
@@ -5565,10 +5507,16 @@ static const NMMetaPropertyInfo *const property_infos_IP6_CONFIG[] = {
|
|||||||
"Missing prefix is regarded as prefix of 128.\n\n"
|
"Missing prefix is regarded as prefix of 128.\n\n"
|
||||||
"Example: 2607:f0d0:1002:51::4/64, 1050:0:0:0:5:600:300c:326b\n"),
|
"Example: 2607:f0d0:1002:51::4/64, 1050:0:0:0:5:600:300c:326b\n"),
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = DEFINE_PROPERTY_TYPE (
|
||||||
.get_fcn = _get_fcn_ip_config_addresses,
|
.get_fcn = _get_fcn_objlist,
|
||||||
.set_fcn = _set_fcn_ip_config_addresses,
|
.set_fcn = _set_fcn_ip_config_addresses,
|
||||||
.remove_fcn = _remove_fcn_ip_config_addresses,
|
.remove_fcn = _remove_fcn_ip_config_addresses,
|
||||||
),
|
),
|
||||||
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||||
|
PROPERTY_TYP_DATA_SUBTYPE (objlist,
|
||||||
|
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_addresses),
|
||||||
|
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_addresses,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
PROPERTY_INFO (NM_SETTING_IP_CONFIG_GATEWAY, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_GATEWAY,
|
PROPERTY_INFO (NM_SETTING_IP_CONFIG_GATEWAY, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_GATEWAY,
|
||||||
.is_cli_option = TRUE,
|
.is_cli_option = TRUE,
|
||||||
@@ -5589,10 +5537,17 @@ static const NMMetaPropertyInfo *const property_infos_IP6_CONFIG[] = {
|
|||||||
"Examples: 2001:db8:beef:2::/64 2001:db8:beef::2, 2001:db8:beef:3::/64 2001:db8:beef::3 2\n"
|
"Examples: 2001:db8:beef:2::/64 2001:db8:beef::2, 2001:db8:beef:3::/64 2001:db8:beef::3 2\n"
|
||||||
" abbe::/64 55\n"),
|
" abbe::/64 55\n"),
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = DEFINE_PROPERTY_TYPE (
|
||||||
.get_fcn = _get_fcn_ip_config_routes,
|
.get_fcn = _get_fcn_objlist,
|
||||||
.set_fcn = _set_fcn_ip_config_routes,
|
.set_fcn = _set_fcn_ip_config_routes,
|
||||||
.remove_fcn = _remove_fcn_ip_config_routes,
|
.remove_fcn = _remove_fcn_ip_config_routes,
|
||||||
),
|
),
|
||||||
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||||
|
PROPERTY_TYP_DATA_SUBTYPE (objlist,
|
||||||
|
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_routes),
|
||||||
|
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_routes,
|
||||||
|
.delimit_pretty_with_semicolon = TRUE,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_METRIC, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_METRIC,
|
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_METRIC, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_METRIC,
|
||||||
.property_type = &_pt_gobject_int,
|
.property_type = &_pt_gobject_int,
|
||||||
@@ -6168,10 +6123,16 @@ static const NMMetaPropertyInfo *const property_infos_SRIOV[] = {
|
|||||||
),
|
),
|
||||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_VFS,
|
PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_VFS,
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = DEFINE_PROPERTY_TYPE (
|
||||||
.get_fcn = _get_fcn_sriov_vfs,
|
.get_fcn = _get_fcn_objlist,
|
||||||
.set_fcn = _set_fcn_sriov_vfs,
|
.set_fcn = _set_fcn_sriov_vfs,
|
||||||
.remove_fcn = _remove_fcn_sriov_vfs,
|
.remove_fcn = _remove_fcn_sriov_vfs,
|
||||||
),
|
),
|
||||||
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||||
|
PROPERTY_TYP_DATA_SUBTYPE (objlist,
|
||||||
|
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingSriov, nm_setting_sriov_get_num_vfs),
|
||||||
|
.obj_to_str_fcn = _objlist_obj_to_str_fcn_sriov_vfs,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_AUTOPROBE_DRIVERS,
|
PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_AUTOPROBE_DRIVERS,
|
||||||
.property_type = &_pt_gobject_enum,
|
.property_type = &_pt_gobject_enum,
|
||||||
@@ -6184,17 +6145,29 @@ static const NMMetaPropertyInfo *const property_infos_SRIOV[] = {
|
|||||||
static const NMMetaPropertyInfo *const property_infos_TC_CONFIG[] = {
|
static const NMMetaPropertyInfo *const property_infos_TC_CONFIG[] = {
|
||||||
PROPERTY_INFO (NM_SETTING_TC_CONFIG_QDISCS, DESCRIBE_DOC_NM_SETTING_TC_CONFIG_QDISCS,
|
PROPERTY_INFO (NM_SETTING_TC_CONFIG_QDISCS, DESCRIBE_DOC_NM_SETTING_TC_CONFIG_QDISCS,
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = DEFINE_PROPERTY_TYPE (
|
||||||
.get_fcn = _get_fcn_tc_config_qdiscs,
|
.get_fcn = _get_fcn_objlist,
|
||||||
.set_fcn = _set_fcn_tc_config_qdiscs,
|
.set_fcn = _set_fcn_tc_config_qdiscs,
|
||||||
.remove_fcn = _remove_fcn_tc_config_qdiscs,
|
.remove_fcn = _remove_fcn_tc_config_qdiscs,
|
||||||
),
|
),
|
||||||
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||||
|
PROPERTY_TYP_DATA_SUBTYPE (objlist,
|
||||||
|
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingTCConfig, nm_setting_tc_config_get_num_qdiscs),
|
||||||
|
.obj_to_str_fcn = _objlist_obj_to_str_fcn_tc_config_qdiscs,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
PROPERTY_INFO (NM_SETTING_TC_CONFIG_TFILTERS, DESCRIBE_DOC_NM_SETTING_TC_CONFIG_TFILTERS,
|
PROPERTY_INFO (NM_SETTING_TC_CONFIG_TFILTERS, DESCRIBE_DOC_NM_SETTING_TC_CONFIG_TFILTERS,
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = DEFINE_PROPERTY_TYPE (
|
||||||
.get_fcn = _get_fcn_tc_config_tfilters,
|
.get_fcn = _get_fcn_objlist,
|
||||||
.set_fcn = _set_fcn_tc_config_tfilters,
|
.set_fcn = _set_fcn_tc_config_tfilters,
|
||||||
.remove_fcn = _remove_fcn_tc_config_tfilters,
|
.remove_fcn = _remove_fcn_tc_config_tfilters,
|
||||||
),
|
),
|
||||||
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||||
|
PROPERTY_TYP_DATA_SUBTYPE (objlist,
|
||||||
|
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingTCConfig, nm_setting_tc_config_get_num_tfilters),
|
||||||
|
.obj_to_str_fcn = _objlist_obj_to_str_fcn_tc_config_tfilters,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
@@ -6347,10 +6320,16 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
|
|||||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_LINK_WATCHERS,
|
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_LINK_WATCHERS,
|
||||||
.describe_message = TEAM_LINK_WATCHERS_DESCRIBE_MESSAGE,
|
.describe_message = TEAM_LINK_WATCHERS_DESCRIBE_MESSAGE,
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = DEFINE_PROPERTY_TYPE (
|
||||||
.get_fcn = _get_fcn_team_link_watchers,
|
.get_fcn = _get_fcn_objlist,
|
||||||
.set_fcn = _set_fcn_team_link_watchers,
|
.set_fcn = _set_fcn_team_link_watchers,
|
||||||
.remove_fcn = _remove_fcn_team_link_watchers,
|
.remove_fcn = _remove_fcn_team_link_watchers,
|
||||||
),
|
),
|
||||||
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||||
|
PROPERTY_TYP_DATA_SUBTYPE (objlist,
|
||||||
|
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingTeam, nm_setting_team_get_num_link_watchers),
|
||||||
|
.obj_to_str_fcn = _objlist_obj_to_str_fcn_team_link_watchers,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
@@ -6418,10 +6397,16 @@ static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = {
|
|||||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_LINK_WATCHERS,
|
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_LINK_WATCHERS,
|
||||||
.describe_message = TEAM_LINK_WATCHERS_DESCRIBE_MESSAGE,
|
.describe_message = TEAM_LINK_WATCHERS_DESCRIBE_MESSAGE,
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = DEFINE_PROPERTY_TYPE (
|
||||||
.get_fcn = _get_fcn_team_port_link_watchers,
|
.get_fcn = _get_fcn_objlist,
|
||||||
.set_fcn = _set_fcn_team_port_link_watchers,
|
.set_fcn = _set_fcn_team_port_link_watchers,
|
||||||
.remove_fcn = _remove_fcn_team_port_link_watchers,
|
.remove_fcn = _remove_fcn_team_port_link_watchers,
|
||||||
),
|
),
|
||||||
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||||
|
PROPERTY_TYP_DATA_SUBTYPE (objlist,
|
||||||
|
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingTeamPort, nm_setting_team_port_get_num_link_watchers),
|
||||||
|
.obj_to_str_fcn = _objlist_obj_to_str_fcn_team_port_link_watchers,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@@ -290,6 +290,14 @@ struct _NMMetaPropertyTypData {
|
|||||||
/* if true, separate the list by space and allow backslash escaping. */
|
/* if true, separate the list by space and allow backslash escaping. */
|
||||||
bool with_escaped_spaces:1;
|
bool with_escaped_spaces:1;
|
||||||
} multilist;
|
} multilist;
|
||||||
|
struct {
|
||||||
|
guint (*get_num_fcn) (NMSetting *setting);
|
||||||
|
void (*obj_to_str_fcn) (NMMetaAccessorGetType get_type,
|
||||||
|
NMSetting *setting,
|
||||||
|
guint idx,
|
||||||
|
GString *str);
|
||||||
|
bool delimit_pretty_with_semicolon:1;
|
||||||
|
} objlist;
|
||||||
struct {
|
struct {
|
||||||
gboolean (*add_fcn) (NMSetting *setting,
|
gboolean (*add_fcn) (NMSetting *setting,
|
||||||
const char *option,
|
const char *option,
|
||||||
|
Reference in New Issue
Block a user