new file mode 100644
@@ -0,0 +1,31 @@
+/*
+ * QOM link property
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QOM_LINK_PROPERTY_H
+#define QOM_LINK_PROPERTY_H
+
+#include "qom/object.h"
+
+typedef struct {
+ Object **child;
+ void (*check)(Object *, const char *, Object *, Error **);
+ ObjectPropertyLinkFlags flags;
+} LinkProperty;
+
+void object_get_link_property(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp);
+void object_set_link_property(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp);
+#endif
@@ -28,6 +28,7 @@
#include "qapi/qmp/qobject.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/qstring.h"
+#include "qom/link-property.h"
#define MAX_INTERFACES 32
@@ -1434,15 +1435,9 @@ void object_property_allow_set_link(Object *obj, const char *name,
/* Allow the link to be set, always */
}
-typedef struct {
- Object **child;
- void (*check)(Object *, const char *, Object *, Error **);
- ObjectPropertyLinkFlags flags;
-} LinkProperty;
-
-static void object_get_link_property(Object *obj, Visitor *v,
- const char *name, void *opaque,
- Error **errp)
+void object_get_link_property(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
{
LinkProperty *lprop = opaque;
Object **child = lprop->child;
@@ -1498,9 +1493,9 @@ static Object *object_resolve_link(Object *obj, const char *name,
return target;
}
-static void object_set_link_property(Object *obj, Visitor *v,
- const char *name, void *opaque,
- Error **errp)
+void object_set_link_property(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
{
Error *local_err = NULL;
LinkProperty *prop = opaque;
The get/set pair and the struct will be reused by qdev link prop, make them public. Signed-off-by: Fam Zheng <famz@redhat.com> --- include/qom/link-property.h | 31 +++++++++++++++++++++++++++++++ qom/object.c | 19 +++++++------------ 2 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 include/qom/link-property.h