From: SunKe <sunke32@huawei.com>
To: <jlbec@evilplan.org>, <hch@lst.de>,
<linux-kernel@vger.kernel.org>, <sunke32@huawei.com>
Subject: [PATCH 2/2] sample_configfs: soft link creat and delete
Date: Tue, 18 Jun 2019 20:28:29 +0800 [thread overview]
Message-ID: <1560860909-51059-3-git-send-email-sunke32@huawei.com> (raw)
In-Reply-To: <1560860909-51059-1-git-send-email-sunke32@huawei.com>
Add soft link creation and deletion
Signed-off-by: SunKe <sunke32@huawei.com>
---
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
prev parent reply other threads:[~2019-06-18 12:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 12:28 [PATCH 0/2] two test samples for configfs SunKe
2019-06-18 12:28 ` [PATCH 1/2] sample_configfs: bin_file read and write SunKe
2019-06-18 12:28 ` SunKe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1560860909-51059-3-git-send-email-sunke32@huawei.com \
--to=sunke32@huawei.com \
--cc=hch@lst.de \
--cc=jlbec@evilplan.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®