swconfig: treat struct switch_attr as constant
SVN-Revision: 15302
This commit is contained in:
parent
cd80e16a80
commit
787e9fcf93
2 changed files with 13 additions and 13 deletions
|
@ -59,7 +59,7 @@ struct swconfig_callback
|
||||||
/* defaults */
|
/* defaults */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
swconfig_get_vlan_ports(struct switch_dev *dev, struct switch_attr *attr, struct switch_val *val)
|
swconfig_get_vlan_ports(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (val->port_vlan >= dev->vlans)
|
if (val->port_vlan >= dev->vlans)
|
||||||
|
@ -73,7 +73,7 @@ swconfig_get_vlan_ports(struct switch_dev *dev, struct switch_attr *attr, struct
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
swconfig_set_vlan_ports(struct switch_dev *dev, struct switch_attr *attr, struct switch_val *val)
|
swconfig_set_vlan_ports(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ swconfig_set_vlan_ports(struct switch_dev *dev, struct switch_attr *attr, struct
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
swconfig_apply_config(struct switch_dev *dev, struct switch_attr *attr, struct switch_val *val)
|
swconfig_apply_config(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
||||||
{
|
{
|
||||||
/* don't complain if not supported by the switch driver */
|
/* don't complain if not supported by the switch driver */
|
||||||
if (!dev->apply_config)
|
if (!dev->apply_config)
|
||||||
|
@ -350,7 +350,7 @@ swconfig_list_attrs(struct sk_buff *skb, struct genl_info *info)
|
||||||
if (alist->attr[i].disabled)
|
if (alist->attr[i].disabled)
|
||||||
continue;
|
continue;
|
||||||
cb.args[0] = i;
|
cb.args[0] = i;
|
||||||
err = swconfig_send_multipart(&cb, &alist->attr[i]);
|
err = swconfig_send_multipart(&cb, (void *) &alist->attr[i]);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ swconfig_list_attrs(struct sk_buff *skb, struct genl_info *info)
|
||||||
if (!test_bit(i, def_active))
|
if (!test_bit(i, def_active))
|
||||||
continue;
|
continue;
|
||||||
cb.args[0] = SWITCH_ATTR_DEFAULTS_OFFSET + i;
|
cb.args[0] = SWITCH_ATTR_DEFAULTS_OFFSET + i;
|
||||||
err = swconfig_send_multipart(&cb, &def_list[i]);
|
err = swconfig_send_multipart(&cb, (void *) &def_list[i]);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -379,13 +379,13 @@ out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct switch_attr *
|
static const struct switch_attr *
|
||||||
swconfig_lookup_attr(struct switch_dev *dev, struct genl_info *info,
|
swconfig_lookup_attr(struct switch_dev *dev, struct genl_info *info,
|
||||||
struct switch_val *val)
|
struct switch_val *val)
|
||||||
{
|
{
|
||||||
struct genlmsghdr *hdr = nlmsg_data(info->nlhdr);
|
struct genlmsghdr *hdr = nlmsg_data(info->nlhdr);
|
||||||
const struct switch_attrlist *alist;
|
const struct switch_attrlist *alist;
|
||||||
struct switch_attr *attr = NULL;
|
const struct switch_attr *attr = NULL;
|
||||||
int attr_id;
|
int attr_id;
|
||||||
|
|
||||||
/* defaults */
|
/* defaults */
|
||||||
|
@ -490,7 +490,7 @@ swconfig_parse_ports(struct sk_buff *msg, struct nlattr *head,
|
||||||
static int
|
static int
|
||||||
swconfig_set_attr(struct sk_buff *skb, struct genl_info *info)
|
swconfig_set_attr(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct switch_attr *attr;
|
const struct switch_attr *attr;
|
||||||
struct switch_dev *dev;
|
struct switch_dev *dev;
|
||||||
struct switch_val val;
|
struct switch_val val;
|
||||||
int err = -EINVAL;
|
int err = -EINVAL;
|
||||||
|
@ -620,7 +620,7 @@ static int
|
||||||
swconfig_get_attr(struct sk_buff *skb, struct genl_info *info)
|
swconfig_get_attr(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct genlmsghdr *hdr = nlmsg_data(info->nlhdr);
|
struct genlmsghdr *hdr = nlmsg_data(info->nlhdr);
|
||||||
struct switch_attr *attr;
|
const struct switch_attr *attr;
|
||||||
struct switch_dev *dev;
|
struct switch_dev *dev;
|
||||||
struct sk_buff *msg = NULL;
|
struct sk_buff *msg = NULL;
|
||||||
struct switch_val val;
|
struct switch_val val;
|
||||||
|
|
|
@ -104,7 +104,7 @@ void unregister_switch(struct switch_dev *dev);
|
||||||
struct switch_attrlist {
|
struct switch_attrlist {
|
||||||
/* filled in by the driver */
|
/* filled in by the driver */
|
||||||
int n_attr;
|
int n_attr;
|
||||||
struct switch_attr *attr;
|
const struct switch_attr *attr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ struct switch_port {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct switch_val {
|
struct switch_val {
|
||||||
struct switch_attr *attr;
|
const struct switch_attr *attr;
|
||||||
int port_vlan;
|
int port_vlan;
|
||||||
int len;
|
int len;
|
||||||
union {
|
union {
|
||||||
|
@ -154,8 +154,8 @@ struct switch_attr {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *description;
|
const char *description;
|
||||||
|
|
||||||
int (*set)(struct switch_dev *dev, struct switch_attr *attr, struct switch_val *val);
|
int (*set)(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val);
|
||||||
int (*get)(struct switch_dev *dev, struct switch_attr *attr, struct switch_val *val);
|
int (*get)(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val);
|
||||||
|
|
||||||
/* for driver internal use */
|
/* for driver internal use */
|
||||||
int id;
|
int id;
|
||||||
|
|
Loading…
Reference in a new issue