aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/can/can_host.c16
-rw-r--r--net/dump.c10
-rw-r--r--net/filter-buffer.c26
-rw-r--r--net/filter-mirror.c64
-rw-r--r--net/filter-rewriter.c7
-rw-r--r--net/filter.c24
6 files changed, 69 insertions, 78 deletions
diff --git a/net/can/can_host.c b/net/can/can_host.c
index ba7f163..a3c8402 100644
--- a/net/can/can_host.c
+++ b/net/can/can_host.c
@@ -77,21 +77,16 @@ static void can_host_complete(UserCreatable *uc, Error **errp)
can_host_connect(CAN_HOST(uc), errp);
}
-static void can_host_instance_init(Object *obj)
-{
- CanHostState *ch = CAN_HOST(obj);
-
- object_property_add_link(obj, "canbus", TYPE_CAN_BUS,
- (Object **)&ch->bus,
- object_property_allow_set_link,
- OBJ_PROP_LINK_STRONG);
-}
-
static void can_host_class_init(ObjectClass *klass,
void *class_data G_GNUC_UNUSED)
{
UserCreatableClass *uc_klass = USER_CREATABLE_CLASS(klass);
+ object_class_property_add_link(klass, "canbus", TYPE_CAN_BUS,
+ offsetof(CanHostState, bus),
+ object_property_allow_set_link,
+ OBJ_PROP_LINK_STRONG);
+
klass->unparent = can_host_unparent;
uc_klass->complete = can_host_complete;
}
@@ -102,7 +97,6 @@ static const TypeInfo can_host_info = {
.instance_size = sizeof(CanHostState),
.class_size = sizeof(CanHostClass),
.abstract = true,
- .instance_init = can_host_instance_init,
.class_init = can_host_class_init,
.interfaces = (InterfaceInfo[]) {
{ TYPE_USER_CREATABLE },
diff --git a/net/dump.c b/net/dump.c
index 7fd448d..4d538d8 100644
--- a/net/dump.c
+++ b/net/dump.c
@@ -224,11 +224,6 @@ static void filter_dump_instance_init(Object *obj)
NetFilterDumpState *nfds = FILTER_DUMP(obj);
nfds->maxlen = 65536;
-
- object_property_add(obj, "maxlen", "uint32", filter_dump_get_maxlen,
- filter_dump_set_maxlen, NULL, NULL);
- object_property_add_str(obj, "file", file_dump_get_filename,
- file_dump_set_filename);
}
static void filter_dump_instance_finalize(Object *obj)
@@ -242,6 +237,11 @@ static void filter_dump_class_init(ObjectClass *oc, void *data)
{
NetFilterClass *nfc = NETFILTER_CLASS(oc);
+ object_class_property_add(oc, "maxlen", "uint32", filter_dump_get_maxlen,
+ filter_dump_set_maxlen, NULL, NULL);
+ object_class_property_add_str(oc, "file", file_dump_get_filename,
+ file_dump_set_filename);
+
nfc->setup = filter_dump_setup;
nfc->cleanup = filter_dump_cleanup;
nfc->receive_iov = filter_dump_receive_iov;
diff --git a/net/filter-buffer.c b/net/filter-buffer.c
index d8392be..283dc9c 100644
--- a/net/filter-buffer.c
+++ b/net/filter-buffer.c
@@ -144,16 +144,6 @@ static void filter_buffer_status_changed(NetFilterState *nf, Error **errp)
}
}
-static void filter_buffer_class_init(ObjectClass *oc, void *data)
-{
- NetFilterClass *nfc = NETFILTER_CLASS(oc);
-
- nfc->setup = filter_buffer_setup;
- nfc->cleanup = filter_buffer_cleanup;
- nfc->receive_iov = filter_buffer_receive_iov;
- nfc->status_changed = filter_buffer_status_changed;
-}
-
static void filter_buffer_get_interval(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
@@ -182,18 +172,24 @@ static void filter_buffer_set_interval(Object *obj, Visitor *v,
s->interval = value;
}
-static void filter_buffer_init(Object *obj)
+static void filter_buffer_class_init(ObjectClass *oc, void *data)
{
- object_property_add(obj, "interval", "uint32",
- filter_buffer_get_interval,
- filter_buffer_set_interval, NULL, NULL);
+ NetFilterClass *nfc = NETFILTER_CLASS(oc);
+
+ object_class_property_add(oc, "interval", "uint32",
+ filter_buffer_get_interval,
+ filter_buffer_set_interval, NULL, NULL);
+
+ nfc->setup = filter_buffer_setup;
+ nfc->cleanup = filter_buffer_cleanup;
+ nfc->receive_iov = filter_buffer_receive_iov;
+ nfc->status_changed = filter_buffer_status_changed;
}
static const TypeInfo filter_buffer_info = {
.name = TYPE_FILTER_BUFFER,
.parent = TYPE_NETFILTER,
.class_init = filter_buffer_class_init,
- .instance_init = filter_buffer_init,
.instance_size = sizeof(FilterBufferState),
};
diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index 088d4dc..f8e6500 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -284,24 +284,6 @@ static void filter_redirector_setup(NetFilterState *nf, Error **errp)
}
}
-static void filter_mirror_class_init(ObjectClass *oc, void *data)
-{
- NetFilterClass *nfc = NETFILTER_CLASS(oc);
-
- nfc->setup = filter_mirror_setup;
- nfc->cleanup = filter_mirror_cleanup;
- nfc->receive_iov = filter_mirror_receive_iov;
-}
-
-static void filter_redirector_class_init(ObjectClass *oc, void *data)
-{
- NetFilterClass *nfc = NETFILTER_CLASS(oc);
-
- nfc->setup = filter_redirector_setup;
- nfc->cleanup = filter_redirector_cleanup;
- nfc->receive_iov = filter_redirector_receive_iov;
-}
-
static char *filter_redirector_get_indev(Object *obj, Error **errp)
{
MirrorState *s = FILTER_REDIRECTOR(obj);
@@ -388,32 +370,50 @@ static void filter_redirector_set_vnet_hdr(Object *obj,
s->vnet_hdr = value;
}
+static void filter_mirror_class_init(ObjectClass *oc, void *data)
+{
+ NetFilterClass *nfc = NETFILTER_CLASS(oc);
+
+ object_class_property_add_str(oc, "outdev", filter_mirror_get_outdev,
+ filter_mirror_set_outdev);
+ object_class_property_add_bool(oc, "vnet_hdr_support",
+ filter_mirror_get_vnet_hdr,
+ filter_mirror_set_vnet_hdr);
+
+ nfc->setup = filter_mirror_setup;
+ nfc->cleanup = filter_mirror_cleanup;
+ nfc->receive_iov = filter_mirror_receive_iov;
+}
+
+static void filter_redirector_class_init(ObjectClass *oc, void *data)
+{
+ NetFilterClass *nfc = NETFILTER_CLASS(oc);
+
+ object_class_property_add_str(oc, "indev", filter_redirector_get_indev,
+ filter_redirector_set_indev);
+ object_class_property_add_str(oc, "outdev", filter_redirector_get_outdev,
+ filter_redirector_set_outdev);
+ object_class_property_add_bool(oc, "vnet_hdr_support",
+ filter_redirector_get_vnet_hdr,
+ filter_redirector_set_vnet_hdr);
+
+ nfc->setup = filter_redirector_setup;
+ nfc->cleanup = filter_redirector_cleanup;
+ nfc->receive_iov = filter_redirector_receive_iov;
+}
+
static void filter_mirror_init(Object *obj)
{
MirrorState *s = FILTER_MIRROR(obj);
- object_property_add_str(obj, "outdev", filter_mirror_get_outdev,
- filter_mirror_set_outdev);
-
s->vnet_hdr = false;
- object_property_add_bool(obj, "vnet_hdr_support",
- filter_mirror_get_vnet_hdr,
- filter_mirror_set_vnet_hdr);
}
static void filter_redirector_init(Object *obj)
{
MirrorState *s = FILTER_REDIRECTOR(obj);
- object_property_add_str(obj, "indev", filter_redirector_get_indev,
- filter_redirector_set_indev);
- object_property_add_str(obj, "outdev", filter_redirector_get_outdev,
- filter_redirector_set_outdev);
-
s->vnet_hdr = false;
- object_property_add_bool(obj, "vnet_hdr_support",
- filter_redirector_get_vnet_hdr,
- filter_redirector_set_vnet_hdr);
}
static void filter_mirror_fini(Object *obj)
diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c
index e063a81..fc0e64c 100644
--- a/net/filter-rewriter.c
+++ b/net/filter-rewriter.c
@@ -418,15 +418,16 @@ static void filter_rewriter_init(Object *obj)
s->vnet_hdr = false;
s->failover_mode = FAILOVER_MODE_OFF;
- object_property_add_bool(obj, "vnet_hdr_support",
- filter_rewriter_get_vnet_hdr,
- filter_rewriter_set_vnet_hdr);
}
static void colo_rewriter_class_init(ObjectClass *oc, void *data)
{
NetFilterClass *nfc = NETFILTER_CLASS(oc);
+ object_class_property_add_bool(oc, "vnet_hdr_support",
+ filter_rewriter_get_vnet_hdr,
+ filter_rewriter_set_vnet_hdr);
+
nfc->setup = colo_rewriter_setup;
nfc->cleanup = colo_rewriter_cleanup;
nfc->receive_iov = colo_rewriter_receive_iov;
diff --git a/net/filter.c b/net/filter.c
index eac8ba1..3fe88fa 100644
--- a/net/filter.c
+++ b/net/filter.c
@@ -212,18 +212,6 @@ static void netfilter_init(Object *obj)
nf->on = true;
nf->insert_before_flag = false;
nf->position = g_strdup("tail");
-
- object_property_add_str(obj, "netdev",
- netfilter_get_netdev_id, netfilter_set_netdev_id);
- object_property_add_enum(obj, "queue", "NetFilterDirection",
- &NetFilterDirection_lookup,
- netfilter_get_direction, netfilter_set_direction);
- object_property_add_str(obj, "status",
- netfilter_get_status, netfilter_set_status);
- object_property_add_str(obj, "position",
- netfilter_get_position, netfilter_set_position);
- object_property_add_str(obj, "insert",
- netfilter_get_insert, netfilter_set_insert);
}
static void netfilter_complete(UserCreatable *uc, Error **errp)
@@ -350,6 +338,18 @@ static void netfilter_class_init(ObjectClass *oc, void *data)
UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
NetFilterClass *nfc = NETFILTER_CLASS(oc);
+ object_class_property_add_str(oc, "netdev",
+ netfilter_get_netdev_id, netfilter_set_netdev_id);
+ object_class_property_add_enum(oc, "queue", "NetFilterDirection",
+ &NetFilterDirection_lookup,
+ netfilter_get_direction, netfilter_set_direction);
+ object_class_property_add_str(oc, "status",
+ netfilter_get_status, netfilter_set_status);
+ object_class_property_add_str(oc, "position",
+ netfilter_get_position, netfilter_set_position);
+ object_class_property_add_str(oc, "insert",
+ netfilter_get_insert, netfilter_set_insert);
+
ucc->complete = netfilter_complete;
nfc->handle_event = default_handle_event;
}