From patchwork Sat Jan 14 14:14:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 9517047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D163B60762 for ; Sat, 14 Jan 2017 14:15:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C220128515 for ; Sat, 14 Jan 2017 14:15:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5B3028541; Sat, 14 Jan 2017 14:15:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7318428515 for ; Sat, 14 Jan 2017 14:15:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750900AbdANOO6 (ORCPT ); Sat, 14 Jan 2017 09:14:58 -0500 Received: from mail-eopbgr20117.outbound.protection.outlook.com ([40.107.2.117]:45367 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750782AbdANOO4 (ORCPT ); Sat, 14 Jan 2017 09:14:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=p5ReE/ocbRsLfJpxx45QbRPnnJSp+O1F8p71caMsURk=; b=VgosXFC7FnYfTKP/R1Vaxi1Rb64D2IWOUAUWYHT+mKFNLQt18ZCfX2DuwQjIgEtMkxgyFCYP+XgGR1AqPWEh0RVK13YuEq7XqRJoAtO1z2MFiQN4CeVsgdVLggF5WSFsDIubSlSDia3vCZ5j753K77GiVhy8zyaKTrmRVKF7UZ4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by DB6PR0802MB2277.eurprd08.prod.outlook.com (10.172.227.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Sat, 14 Jan 2017 14:14:51 +0000 Subject: [PATCH 1/2] ns: Allow ns_entries to have custom symlink content From: Kirill Tkhai To: , , , , , , Date: Sat, 14 Jan 2017 17:14:48 +0300 Message-ID: <148440326011.30622.12833059348082223242.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR0802CA0035.eurprd08.prod.outlook.com (10.172.252.149) To DB6PR0802MB2277.eurprd08.prod.outlook.com (10.172.227.150) X-MS-Office365-Filtering-Correlation-Id: eca9d5a5-35b5-4c82-3fb2-08d43c87b4e1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DB6PR0802MB2277; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2277; 3:5AZoStoRRMQyuNSIMnuKBGJlVWHaZiz9OyPkLxFU7Ktq0d+QHFHKR+PdiAO2FLmQPEOnnp1EqDJlntXBuaIvI30GRHf6SuCuGwlM8uWV4+Dwh9oJeMoc65BZW7yvGq5zYui6uqM7hG5bwl0mkZkVakYY+iPufCJsk8/YmuZ+nOTW+ZBTXzs9LawCIXVjqvwspqqxRSMj6gS7Agh6sCx2xq8J+UQdmiC8VmOp2qyKVJItPbW9j7U+aEEsJOI62nXIzlFDsvkf3jjd85N3e+IdFA==; 25:6PS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Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:DB6PR0802MB2277; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0802MB2277; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2277; 4:ieQyYvLqj1r2gDcVUcyhNKlAHBMZ1YionrRcL9Di+mw1yk0m9JeAeCFtTT/xzoKKVPgoVusTnyRLDVXo8fIIs+wWK9GRLQB1V6kkrdIwE1knxz2FRg9qkkxuSGrOlsgi7R6UUihZCu1vpyNNFTxpkozJcF6iVWHScmPo2casvP9F/W7halLtQIiTRanfy8WJ0wyRJhM0NE+vjnNU/25UxCF6m8A+Y+4ayv6cQdODqD95SNInGSQSAjp4Zdz2KLiwdQZ/nLTztYzrqD7dQhzRaF7zQqXKhFoH/fztUVTPTKXPD+f5Y199IuQT7YApzn5+p1q8CTblpc0esZ3aPvrgkGeiV/Ea8UuKURiR4X4GHhtuBlEhyQoSutcSb1Awx7sspo5rhByGFKyN4iuqkwy/sdESCSvEm2vx+yV3JuivDyKEeXz4XdHLIoovZ1Vt2C8+PWeubzqQwePBJmYf3fo29SB+OX8aMPGwcomXCAD+mgTYbgRC+NoypRYClAMgrhh21VwATQe/Y71cEHI+sitzVtOPMfu/QOyWZKrghCLIFu9SlwfguN8Ww9giOR1YCP5NstMH/Hq8FHaTQBc+F7XzHw== X-Forefront-PRVS: 0187F3EA14 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(189002)(199003)(5660300001)(8676002)(81166006)(105586002)(106356001)(81156014)(3846002)(83506001)(4001350100001)(5001770100001)(230700001)(97736004)(6116002)(68736007)(54356999)(50986999)(6666003)(103116003)(33646002)(50466002)(9686003)(101416001)(92566002)(107886002)(189998001)(42186005)(27001)(2906002)(23676002)(66066001)(55016002)(47776003)(6506006)(38730400001)(25786008)(305945005)(7736002)(2201001)(61506002)(86362001)(21314002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0802MB2277; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjA4MDJNQjIyNzc7MjM6bjcyR0JWNHFwbFNpV0lsbFIwWEtGaWxk?= =?utf-8?B?a2haeTMzVFRPbUIrRlp3L1B4VURWdHBBbWJheVAxdXliZXcyMDB4djNqQmdZ?= =?utf-8?B?dzNRMDFkQlR6MElZVDBvZE85YUVYcWdMbmFnTmpHVEhUY1JPcjExZXZjQ0JM?= =?utf-8?B?eTk4OUJBU2dXcnpabW5wRFducS90Mmg3N0NtRytiOCtpRjVNdVdGWWVjc1lw?= =?utf-8?B?VVdHeU5CenYxV3JUSXVRTEtVUWpKNEZjV2NaeWF1ODA2U3JTaHBBOWNKMnFl?= =?utf-8?B?MVZGYjQxZ0hIT2QzU0MrdnFybTM5SGhJS1dwUThjOUJXOHVETkQvaWNTTHhl?= =?utf-8?B?TDN3Sk5XTk04WFFXT2xkcENkZkpLZ0lRUFlEajFBYzVqWmFobmhaNm1QUURE?= =?utf-8?B?amNrRXowUld5aGx4bnZxbEZHb2h6dFp5L3dkZUF0T3Z5Mk53SzFVaFBScm1y?= =?utf-8?B?QTc2b1d3VXpPem1GSzllQVFqcFZJMnJyWDlMZDh2dUtRbitiOTRQVG9lc0xw?= =?utf-8?B?YlBjUUxPVFRuY3U5UHllMHVTQjdBa2pKU1Z0REVpVk12bXVPaGpKdisvdXcr?= =?utf-8?B?b2lGOHVVdFdmSXBDK2pvbFczSkxPRk5zYlBPVTFIdndXRnNGZ2xHMG85NFQ2?= =?utf-8?B?RjZnQ1N1a3lCdUNtNzl3YWh1T0hnNUFwUFF2Zm5HeFZpeWtCeTI0M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rwkgclRB9+mhyX2lLSSCM39yt13HjAQOxUj2JUz6q/ZZjBF5VtTcb26NoZ84PAR8Tstt3UiGDgt6MuZGkBt8AeViHpmbd9Mu/l6c9X6Tr/GmVaL+aysyw0m/ohXheREeOI36d94PmQhGoJb77icZXcpbUp/1SR/ZeJvgi+0iG98PIAY83aNZLtZu4wc26NChijBrTx9PWjRSfARo0RqmZ4TtNLU2Y2A3UO05vyFJoN7hKCFIz4Hmfx2emT0g==; 20:j1jTNuQbs2VaE73kBOQxAYd88UL0ztQid7riqKz7Wc1JTZbWIUhfd/rfOpb1LiKFzioy++9PF6GaLknw6KE8a3TC1llW1Y+RHloVjB5pQWY7wUfqvGUU3tpg7VL0/u92agpVysDZAel2qqIrK4A1sELC+RihTmxVJCymMiIB4gE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jan 2017 14:14:51.3220 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2277 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make possible to have link content prefix yyy different from the link name xxx: $ readlink /proc/[pid]/ns/xxx yyy:[4026531838] This will be used in next patch. Signed-off-by: Kirill Tkhai Reviewed-by: Cyrill Gorcunov --- fs/nsfs.c | 4 +++- include/linux/proc_ns.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nsfs.c b/fs/nsfs.c index 8c9fb29c6673..c2499c59bf51 100644 --- a/fs/nsfs.c +++ b/fs/nsfs.c @@ -182,9 +182,11 @@ int ns_get_name(char *buf, size_t size, struct task_struct *task, { struct ns_common *ns; int res = -ENOENT; + const char *name; ns = ns_ops->get(task); if (ns) { - res = snprintf(buf, size, "%s:[%u]", ns_ops->name, ns->inum); + name = ns_ops->real_ns_name ? : ns_ops->name; + res = snprintf(buf, size, "%s:[%u]", name, ns->inum); ns_ops->put(ns); } return res; diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h index 12cb8bd81d2d..88dba3b53375 100644 --- a/include/linux/proc_ns.h +++ b/include/linux/proc_ns.h @@ -14,6 +14,7 @@ struct inode; struct proc_ns_operations { const char *name; + const char *real_ns_name; int type; struct ns_common *(*get)(struct task_struct *task); void (*put)(struct ns_common *ns);