Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3708573ybi; Tue, 18 Jun 2019 05:24:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK6YiYFwlWAEKe2GlxcJtgyrSaNbXQdNRmClkSlZ1NrrQwGrmN1JXHY6xG+1gsSEtHekNt X-Received: by 2002:a17:90a:2343:: with SMTP id f61mr4940706pje.130.1560860665988; Tue, 18 Jun 2019 05:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560860665; cv=none; d=google.com; s=arc-20160816; b=JyJf+nO+SpROCuAsF1K6DPFNhaHv7OfTMF0s6Mb7DVyoxluhEn1aEgAvMidUnDmA0x Luq0QokK2CEj+sBNVYWnYZ52Jq2d0KSNf4yPiPOS4ETtZRItghHThkE2fqfSAwY9z3PT bzs6Z4c65xobxmH2kNYbpMlRwjJvb/peqFw7mU0MOT/KZ8XjRACTbId3JWpFGKGWj+Ga d5zibzIHJsZW3+E90wdobdj5bGQOboE0pBavR9+nJ0QqPajN00GH2TXRROJtRcRWy70c MaQQBxTmpxrfS8dJDTf3GXQPqqpaL4PfQgivmT50wYet5YybBQfC0ViW/ONBVmm9YQoC J9Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:to:from; bh=4wsqfzL/cHEuHuNuHspLoig7nALRrLNSC23hIGOKZow=; b=pKFpMtAv+eRo2uRlK2xbR4YuBSfa6K8aJnWe9vQtDi3HCtxzshjoTXVCeT/FeNrpUo weygWayOHCwXJ80Z2XoXescz9nuvK3bI5QeGBf3v64UR+UkPSdJEb+JvNDwe6+MIos46 z6YUzed1dOHo5VvTF92Pe3bQClCU4jcU7Y5vmbjMP7oBkqrsZPH3+816KIH+Iq2k4TfJ GJWC/wPPLpm8eP/QQiubJzdpuBE7t4K7u/qjXVgXTTQa9Ufefx/ULcHZhpkfeD7ccqNI iU+KJxdVGGOq3XdogTynuAEic4P3zsGjRSrhFb5bOxWRrWLJAjjMBOSQTQAGTaRNOYJb BhFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l10si89313pgq.226.2019.06.18.05.24.10; Tue, 18 Jun 2019 05:24:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727874AbfFRMXM (ORCPT + 99 others); Tue, 18 Jun 2019 08:23:12 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:18637 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725913AbfFRMXL (ORCPT ); Tue, 18 Jun 2019 08:23:11 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A76C98FF936F9BCDD3DB; Tue, 18 Jun 2019 20:23:08 +0800 (CST) Received: from RH5885H-V3.huawei.com (10.90.53.225) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Tue, 18 Jun 2019 20:23:01 +0800 From: SunKe To: , , , Subject: [PATCH 2/2] sample_configfs: soft link creat and delete Date: Tue, 18 Jun 2019 20:28:29 +0800 Message-ID: <1560860909-51059-3-git-send-email-sunke32@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560860909-51059-1-git-send-email-sunke32@huawei.com> References: <1560860909-51059-1-git-send-email-sunke32@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.90.53.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add soft link creation and deletion Signed-off-by: SunKe --- 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