[PATCH 2/2] sample_configfs: soft link creat and delete

From: SunKe
Date: Tue Jun 18 2019 - 08:28:13 EST


Add soft link creation and deletion

Signed-off-by: SunKe <sunke32@xxxxxxxxxx>
---
samples/configfs/configfs_sample.c | 41 ++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)

diff --git a/samples/configfs/configfs_sample.c b/samples/configfs/configfs_sample.c
index c76b784..58915b8 100644
--- a/samples/configfs/configfs_sample.c
+++ b/samples/configfs/configfs_sample.c
@@ -392,6 +392,46 @@ static struct configfs_subsystem group_children_subsys = {
/* ----------------------------------------------------------------- */

/*
+ * 04-link-children
+ *
+ */
+static int link_children_allow_link(struct config_item *parent,
+ struct config_item *target)
+{
+ return 0;
+}
+
+static void link_children_drop_link(struct config_item *parent,
+ struct config_item *target)
+{
+
+}
+
+
+static struct configfs_item_operations link_children_item_ops = {
+ .allow_link = link_children_allow_link,
+ .drop_link = link_children_drop_link,
+};
+
+
+static const struct config_item_type link_children_type = {
+ .ct_item_ops = &link_children_item_ops,
+ .ct_owner = THIS_MODULE,
+
+};
+
+static struct configfs_subsystem link_children_subsys = {
+ .su_group = {
+ .cg_item = {
+ .ci_namebuf = "04-link-children",
+ .ci_type = &link_children_type,
+ },
+ },
+};
+
+/* ----------------------------------------------------------------- */
+
+/*
* We're now done with our subsystem definitions.
* For convenience in this module, here's a list of them all. It
* allows the init function to easily register them. Most modules
@@ -402,6 +442,7 @@ static struct configfs_subsystem *example_subsys[] = {
&childless_subsys.subsys,
&simple_children_subsys,
&group_children_subsys,
+ &link_children_subsys,
NULL,
};

--
2.7.4