diff --git a/home/nipa/nipa_out/900604/ynl/old-code/ethtool-user.c b/home/nipa/nipa_out/900604/ynl/new-code/ethtool-user.c index 9007305c8cbd..2228d998b7f9 100644 --- a/home/nipa/nipa_out/900604/ynl/old-code/ethtool-user.c +++ b/home/nipa/nipa_out/900604/ynl/new-code/ethtool-user.c @@ -341,6 +341,8 @@ const struct ynl_policy_attr ethtool_bitset_policy[ETHTOOL_A_BITSET_MAX + 1] = { [ETHTOOL_A_BITSET_NOMASK] = { .name = "nomask", .type = YNL_PT_FLAG, }, [ETHTOOL_A_BITSET_SIZE] = { .name = "size", .type = YNL_PT_U32, }, [ETHTOOL_A_BITSET_BITS] = { .name = "bits", .type = YNL_PT_NEST, .nest = ðtool_bitset_bits_nest, }, + [ETHTOOL_A_BITSET_VALUE] = { .name = "value", .type = YNL_PT_BINARY,}, + [ETHTOOL_A_BITSET_MASK] = { .name = "mask", .type = YNL_PT_BINARY,}, }; const struct ynl_policy_nest ethtool_bitset_nest = { @@ -1598,6 +1600,8 @@ int ethtool_strings_parse(struct ynl_parse_arg *yarg, void ethtool_bitset_free(struct ethtool_bitset *obj) { ethtool_bitset_bits_free(&obj->bits); + free(obj->value); + free(obj->mask); } int ethtool_bitset_put(struct nlmsghdr *nlh, unsigned int attr_type, @@ -1612,6 +1616,10 @@ int ethtool_bitset_put(struct nlmsghdr *nlh, unsigned int attr_type, ynl_attr_put_u32(nlh, ETHTOOL_A_BITSET_SIZE, obj->size); if (obj->_present.bits) ethtool_bitset_bits_put(nlh, ETHTOOL_A_BITSET_BITS, &obj->bits); + if (obj->_present.value_len) + ynl_attr_put(nlh, ETHTOOL_A_BITSET_VALUE, obj->value, obj->_present.value_len); + if (obj->_present.mask_len) + ynl_attr_put(nlh, ETHTOOL_A_BITSET_MASK, obj->mask, obj->_present.mask_len); ynl_attr_nest_end(nlh, nest); return 0; @@ -1647,6 +1655,26 @@ int ethtool_bitset_parse(struct ynl_parse_arg *yarg, parg.data = &dst->bits; if (ethtool_bitset_bits_parse(&parg, attr)) return YNL_PARSE_CB_ERROR; + } else if (type == ETHTOOL_A_BITSET_VALUE) { + unsigned int len; + + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + + len = ynl_attr_data_len(attr); + dst->_present.value_len = len; + dst->value = malloc(len); + memcpy(dst->value, ynl_attr_data(attr), len); + } else if (type == ETHTOOL_A_BITSET_MASK) { + unsigned int len; + + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + + len = ynl_attr_data_len(attr); + dst->_present.mask_len = len; + dst->mask = malloc(len); + memcpy(dst->mask, ynl_attr_data(attr), len); } } diff --git a/home/nipa/nipa_out/900604/ynl/old-code/ethtool-user.h b/home/nipa/nipa_out/900604/ynl/new-code/ethtool-user.h index 8cdc5a3bbf24..76c8c7d2562b 100644 --- a/home/nipa/nipa_out/900604/ynl/old-code/ethtool-user.h +++ b/home/nipa/nipa_out/900604/ynl/new-code/ethtool-user.h @@ -214,10 +214,14 @@ struct ethtool_bitset { __u32 nomask:1; __u32 size:1; __u32 bits:1; + __u32 value_len; + __u32 mask_len; } _present; __u32 size; struct ethtool_bitset_bits bits; + void *value; + void *mask; }; struct ethtool_stringset_ { @@ -950,6 +954,26 @@ __ethtool_linkmodes_set_req_set_ours_bits_bit(struct ethtool_linkmodes_set_req * req->ours.bits.n_bit = n_bit; } static inline void +ethtool_linkmodes_set_req_set_ours_value(struct ethtool_linkmodes_set_req *req, + const void *value, size_t len) +{ + req->_present.ours = 1; + free(req->ours.value); + req->ours._present.value_len = len; + req->ours.value = malloc(req->ours._present.value_len); + memcpy(req->ours.value, value, req->ours._present.value_len); +} +static inline void +ethtool_linkmodes_set_req_set_ours_mask(struct ethtool_linkmodes_set_req *req, + const void *mask, size_t len) +{ + req->_present.ours = 1; + free(req->ours.mask); + req->ours._present.mask_len = len; + req->ours.mask = malloc(req->ours._present.mask_len); + memcpy(req->ours.mask, mask, req->ours._present.mask_len); +} +static inline void ethtool_linkmodes_set_req_set_peer_nomask(struct ethtool_linkmodes_set_req *req) { req->_present.peer = 1; @@ -975,6 +999,26 @@ __ethtool_linkmodes_set_req_set_peer_bits_bit(struct ethtool_linkmodes_set_req * req->peer.bits.n_bit = n_bit; } static inline void +ethtool_linkmodes_set_req_set_peer_value(struct ethtool_linkmodes_set_req *req, + const void *value, size_t len) +{ + req->_present.peer = 1; + free(req->peer.value); + req->peer._present.value_len = len; + req->peer.value = malloc(req->peer._present.value_len); + memcpy(req->peer.value, value, req->peer._present.value_len); +} +static inline void +ethtool_linkmodes_set_req_set_peer_mask(struct ethtool_linkmodes_set_req *req, + const void *mask, size_t len) +{ + req->_present.peer = 1; + free(req->peer.mask); + req->peer._present.mask_len = len; + req->peer.mask = malloc(req->peer._present.mask_len); + memcpy(req->peer.mask, mask, req->peer._present.mask_len); +} +static inline void ethtool_linkmodes_set_req_set_speed(struct ethtool_linkmodes_set_req *req, __u32 speed) { @@ -1391,6 +1435,26 @@ __ethtool_debug_set_req_set_msgmask_bits_bit(struct ethtool_debug_set_req *req, req->msgmask.bits.bit = bit; req->msgmask.bits.n_bit = n_bit; } +static inline void +ethtool_debug_set_req_set_msgmask_value(struct ethtool_debug_set_req *req, + const void *value, size_t len) +{ + req->_present.msgmask = 1; + free(req->msgmask.value); + req->msgmask._present.value_len = len; + req->msgmask.value = malloc(req->msgmask._present.value_len); + memcpy(req->msgmask.value, value, req->msgmask._present.value_len); +} +static inline void +ethtool_debug_set_req_set_msgmask_mask(struct ethtool_debug_set_req *req, + const void *mask, size_t len) +{ + req->_present.msgmask = 1; + free(req->msgmask.mask); + req->msgmask._present.mask_len = len; + req->msgmask.mask = malloc(req->msgmask._present.mask_len); + memcpy(req->msgmask.mask, mask, req->msgmask._present.mask_len); +} /* * Set debug message mask. @@ -1622,6 +1686,26 @@ __ethtool_wol_set_req_set_modes_bits_bit(struct ethtool_wol_set_req *req, req->modes.bits.n_bit = n_bit; } static inline void +ethtool_wol_set_req_set_modes_value(struct ethtool_wol_set_req *req, + const void *value, size_t len) +{ + req->_present.modes = 1; + free(req->modes.value); + req->modes._present.value_len = len; + req->modes.value = malloc(req->modes._present.value_len); + memcpy(req->modes.value, value, req->modes._present.value_len); +} +static inline void +ethtool_wol_set_req_set_modes_mask(struct ethtool_wol_set_req *req, + const void *mask, size_t len) +{ + req->_present.modes = 1; + free(req->modes.mask); + req->modes._present.mask_len = len; + req->modes.mask = malloc(req->modes._present.mask_len); + memcpy(req->modes.mask, mask, req->modes._present.mask_len); +} +static inline void ethtool_wol_set_req_set_sopass(struct ethtool_wol_set_req *req, const void *sopass, size_t len) { @@ -1874,6 +1958,26 @@ __ethtool_features_set_req_set_hw_bits_bit(struct ethtool_features_set_req *req, req->hw.bits.n_bit = n_bit; } static inline void +ethtool_features_set_req_set_hw_value(struct ethtool_features_set_req *req, + const void *value, size_t len) +{ + req->_present.hw = 1; + free(req->hw.value); + req->hw._present.value_len = len; + req->hw.value = malloc(req->hw._present.value_len); + memcpy(req->hw.value, value, req->hw._present.value_len); +} +static inline void +ethtool_features_set_req_set_hw_mask(struct ethtool_features_set_req *req, + const void *mask, size_t len) +{ + req->_present.hw = 1; + free(req->hw.mask); + req->hw._present.mask_len = len; + req->hw.mask = malloc(req->hw._present.mask_len); + memcpy(req->hw.mask, mask, req->hw._present.mask_len); +} +static inline void ethtool_features_set_req_set_wanted_nomask(struct ethtool_features_set_req *req) { req->_present.wanted = 1; @@ -1899,6 +2003,26 @@ __ethtool_features_set_req_set_wanted_bits_bit(struct ethtool_features_set_req * req->wanted.bits.n_bit = n_bit; } static inline void +ethtool_features_set_req_set_wanted_value(struct ethtool_features_set_req *req, + const void *value, size_t len) +{ + req->_present.wanted = 1; + free(req->wanted.value); + req->wanted._present.value_len = len; + req->wanted.value = malloc(req->wanted._present.value_len); + memcpy(req->wanted.value, value, req->wanted._present.value_len); +} +static inline void +ethtool_features_set_req_set_wanted_mask(struct ethtool_features_set_req *req, + const void *mask, size_t len) +{ + req->_present.wanted = 1; + free(req->wanted.mask); + req->wanted._present.mask_len = len; + req->wanted.mask = malloc(req->wanted._present.mask_len); + memcpy(req->wanted.mask, mask, req->wanted._present.mask_len); +} +static inline void ethtool_features_set_req_set_active_nomask(struct ethtool_features_set_req *req) { req->_present.active = 1; @@ -1924,6 +2048,26 @@ __ethtool_features_set_req_set_active_bits_bit(struct ethtool_features_set_req * req->active.bits.n_bit = n_bit; } static inline void +ethtool_features_set_req_set_active_value(struct ethtool_features_set_req *req, + const void *value, size_t len) +{ + req->_present.active = 1; + free(req->active.value); + req->active._present.value_len = len; + req->active.value = malloc(req->active._present.value_len); + memcpy(req->active.value, value, req->active._present.value_len); +} +static inline void +ethtool_features_set_req_set_active_mask(struct ethtool_features_set_req *req, + const void *mask, size_t len) +{ + req->_present.active = 1; + free(req->active.mask); + req->active._present.mask_len = len; + req->active.mask = malloc(req->active._present.mask_len); + memcpy(req->active.mask, mask, req->active._present.mask_len); +} +static inline void ethtool_features_set_req_set_nochange_nomask(struct ethtool_features_set_req *req) { req->_present.nochange = 1; @@ -1948,6 +2092,26 @@ __ethtool_features_set_req_set_nochange_bits_bit(struct ethtool_features_set_req req->nochange.bits.bit = bit; req->nochange.bits.n_bit = n_bit; } +static inline void +ethtool_features_set_req_set_nochange_value(struct ethtool_features_set_req *req, + const void *value, size_t len) +{ + req->_present.nochange = 1; + free(req->nochange.value); + req->nochange._present.value_len = len; + req->nochange.value = malloc(req->nochange._present.value_len); + memcpy(req->nochange.value, value, req->nochange._present.value_len); +} +static inline void +ethtool_features_set_req_set_nochange_mask(struct ethtool_features_set_req *req, + const void *mask, size_t len) +{ + req->_present.nochange = 1; + free(req->nochange.mask); + req->nochange._present.mask_len = len; + req->nochange.mask = malloc(req->nochange._present.mask_len); + memcpy(req->nochange.mask, mask, req->nochange._present.mask_len); +} struct ethtool_features_set_rsp { struct { @@ -2199,6 +2363,26 @@ __ethtool_privflags_set_req_set_flags_bits_bit(struct ethtool_privflags_set_req req->flags.bits.bit = bit; req->flags.bits.n_bit = n_bit; } +static inline void +ethtool_privflags_set_req_set_flags_value(struct ethtool_privflags_set_req *req, + const void *value, size_t len) +{ + req->_present.flags = 1; + free(req->flags.value); + req->flags._present.value_len = len; + req->flags.value = malloc(req->flags._present.value_len); + memcpy(req->flags.value, value, req->flags._present.value_len); +} +static inline void +ethtool_privflags_set_req_set_flags_mask(struct ethtool_privflags_set_req *req, + const void *mask, size_t len) +{ + req->_present.flags = 1; + free(req->flags.mask); + req->flags._present.mask_len = len; + req->flags.mask = malloc(req->flags._present.mask_len); + memcpy(req->flags.mask, mask, req->flags._present.mask_len); +} /* * Set device private flags. @@ -3890,6 +4074,26 @@ __ethtool_eee_set_req_set_modes_ours_bits_bit(struct ethtool_eee_set_req *req, req->modes_ours.bits.n_bit = n_bit; } static inline void +ethtool_eee_set_req_set_modes_ours_value(struct ethtool_eee_set_req *req, + const void *value, size_t len) +{ + req->_present.modes_ours = 1; + free(req->modes_ours.value); + req->modes_ours._present.value_len = len; + req->modes_ours.value = malloc(req->modes_ours._present.value_len); + memcpy(req->modes_ours.value, value, req->modes_ours._present.value_len); +} +static inline void +ethtool_eee_set_req_set_modes_ours_mask(struct ethtool_eee_set_req *req, + const void *mask, size_t len) +{ + req->_present.modes_ours = 1; + free(req->modes_ours.mask); + req->modes_ours._present.mask_len = len; + req->modes_ours.mask = malloc(req->modes_ours._present.mask_len); + memcpy(req->modes_ours.mask, mask, req->modes_ours._present.mask_len); +} +static inline void ethtool_eee_set_req_set_modes_peer_nomask(struct ethtool_eee_set_req *req) { req->_present.modes_peer = 1; @@ -3915,6 +4119,26 @@ __ethtool_eee_set_req_set_modes_peer_bits_bit(struct ethtool_eee_set_req *req, req->modes_peer.bits.n_bit = n_bit; } static inline void +ethtool_eee_set_req_set_modes_peer_value(struct ethtool_eee_set_req *req, + const void *value, size_t len) +{ + req->_present.modes_peer = 1; + free(req->modes_peer.value); + req->modes_peer._present.value_len = len; + req->modes_peer.value = malloc(req->modes_peer._present.value_len); + memcpy(req->modes_peer.value, value, req->modes_peer._present.value_len); +} +static inline void +ethtool_eee_set_req_set_modes_peer_mask(struct ethtool_eee_set_req *req, + const void *mask, size_t len) +{ + req->_present.modes_peer = 1; + free(req->modes_peer.mask); + req->modes_peer._present.mask_len = len; + req->modes_peer.mask = malloc(req->modes_peer._present.mask_len); + memcpy(req->modes_peer.mask, mask, req->modes_peer._present.mask_len); +} +static inline void ethtool_eee_set_req_set_active(struct ethtool_eee_set_req *req, __u8 active) { req->_present.active = 1; @@ -4576,6 +4800,26 @@ __ethtool_fec_set_req_set_modes_bits_bit(struct ethtool_fec_set_req *req, req->modes.bits.n_bit = n_bit; } static inline void +ethtool_fec_set_req_set_modes_value(struct ethtool_fec_set_req *req, + const void *value, size_t len) +{ + req->_present.modes = 1; + free(req->modes.value); + req->modes._present.value_len = len; + req->modes.value = malloc(req->modes._present.value_len); + memcpy(req->modes.value, value, req->modes._present.value_len); +} +static inline void +ethtool_fec_set_req_set_modes_mask(struct ethtool_fec_set_req *req, + const void *mask, size_t len) +{ + req->_present.modes = 1; + free(req->modes.mask); + req->modes._present.mask_len = len; + req->modes.mask = malloc(req->modes._present.mask_len); + memcpy(req->modes.mask, mask, req->modes._present.mask_len); +} +static inline void ethtool_fec_set_req_set_auto_(struct ethtool_fec_set_req *req, __u8 auto_) { req->_present.auto_ = 1;