From patchwork Thu Mar 30 10:27:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 9653649 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 D71D7602C8 for ; Thu, 30 Mar 2017 10:28:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEC8228552 for ; Thu, 30 Mar 2017 10:28:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B371A2856A; Thu, 30 Mar 2017 10:28:29 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable 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 6851328552 for ; Thu, 30 Mar 2017 10:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933259AbdC3K2J (ORCPT ); Thu, 30 Mar 2017 06:28:09 -0400 Received: from mail-he1eur01on0093.outbound.protection.outlook.com ([104.47.0.93]:32942 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933062AbdC3K15 (ORCPT ); Thu, 30 Mar 2017 06:27:57 -0400 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=PvLYUbVAZHGS3ilZyOj8omjoggzpt21wcl86nbbpYgE=; b=C4Xpf4mUztZF1zN6P7+byO5G0HXFSTRH2MfyGS55B75kyCTB+QgHnRaPj04P27+DGoiuyN245BXaqlJ0sRGjvyb97l2DUrCx3M6D65Gnc1j/JaKHFjeo7hgdWH0otYympu4cmkebVnFFH202IBR8wJguKSTLUz06gNymeeIwP2A= Authentication-Results: hallyn.com; dkim=none (message not signed) header.d=none; hallyn.com; dmarc=none action=none header.from=virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by HE1PR0802MB2284.eurprd08.prod.outlook.com (10.172.127.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14; Thu, 30 Mar 2017 10:27:52 +0000 Subject: [PATCH RESEND 1/2] ns: Allow ns_entries to have custom symlink content From: Kirill Tkhai To: , , , , , , , , , , , , , , Date: Thu, 30 Mar 2017 13:27:49 +0300 Message-ID: <149086966919.4388.10564546347286785860.stgit@localhost.localdomain> In-Reply-To: <149086931397.4388.9604947335273204415.stgit@localhost.localdomain> References: <149086931397.4388.9604947335273204415.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR0802CA0036.eurprd08.prod.outlook.com (10.172.252.150) To HE1PR0802MB2284.eurprd08.prod.outlook.com (10.172.127.14) X-MS-Office365-Filtering-Correlation-Id: 73e7a078-5a46-4de2-6050-08d477576d29 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:HE1PR0802MB2284; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2284; 3:pXRkn/9vMpu9ToLK/Zi2gatJ2SSSbfc8ESxtSrd3dyjoo+QosFTQ6vZhdAsSUYkgwN4VbohsKrw1QANuPDi9p9mBrxFmk4qOSUWItQl+e9CBtyXpgE9OxDxbKdLn8JL1aPMnf8VRkTxsmT8mM2TGL2dEiDJR2XtDpr4oBojvYX/+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zCkzlVOsi/B5uxncECw9GoOgAPfg2SqUf2hd/uYeTUx6b+38LkrwO7KyoL5Nqqe28jEJf01/NNNvI1oiwp65u47JqKAJA7QoiE4XnW0SELYJfi69gP8HeJh06sVH9N2vGg2Vx3Hi5rOBggGFp7MaoYAkYdTPS9h8l45ctyeDchjptAqnT9Eh0bCwXpJC9N1KBaca9InTFBMlQdsPoGhV5+NtCGmCwS1pO3jTH/QRv7LEJ5OGbJaxGkqI/WzlGXwmzk6UJ3IsaEFODbcT4SoH4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006067)(93001067)(3002001)(10201501046)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(20161123564025)(20161123562025)(20161123555025)(6072148); SRVR:HE1PR0802MB2284; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0802MB2284; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2284; 4:VOPX6XhbD31LbxavkA7yl3x7mul5ZCa2L8ionBPM7lEtaKBZa5qRORzD1bm/7/p1OUHjvDw5YyquVsJkbvlGhM4VCWXSW+dFNGt065FJEOXMexNvjEsR00IWWFlB4dnx7as/caoYY9X4p49ABlohsky/U+NGCl+PXX3xTztDcw9tj+IcQJZONTB9dKVCdlb2pYYJAU+GPki1C8Z3qK9k65ixc6vqeTn+kiQ+hs3Q4QbmhwoOidJ2p7FeBDss4ZKfJZ7PsPF7AJyYGhA3Sq9rze7ejMeJ3W4aEofZJUhokBMaf1U258UekROdsi5gaYAGyNeQJZ1wGuS+hDm8LspA8aJBC3TKHpzx0Ntt1OmnQKKuzS9MJsfIOIg+6ypHg8roL2xKdJDjdGP7U9g18usmWnYEw2esrzqDOd1juHbJpY1kH4QgJqgBMyZICq+3P2f0B+S4ogwJAnvFWp7olPTA5wAbQt/03ik6pZNPA4D/0AkgssMzKwgekSxV2tXAJIhNeacOXFBzHC8+es0EUfoBdFLhNKdztfFLRRa8dNhFVljwsEy4vviFmVA9XAJiX8DsRujnFAfZseIS2x5KuEshCBd/Q7oEPrEle8Q5OAHRD1fwIS/cxBE9lDIflnT7E92IBFNw1aFEvheF15L0G2F6xKbmMFmNzOwkxdl1F41FA3sj//VxAgOmdGb1xfMVm0ejuW2W1psVKt8TfLmPMd5dYw== X-Forefront-PRVS: 02622CEF0A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6069001)(6009001)(39450400003)(39840400002)(39400400002)(39410400002)(81166006)(33646002)(83506001)(8676002)(50466002)(5660300001)(7416002)(6666003)(2950100002)(305945005)(61506002)(6506006)(50986999)(76176999)(54356999)(7736002)(86362001)(2201001)(9686003)(38730400002)(53936002)(230700001)(4001350100001)(55016002)(23676002)(42186005)(66066001)(47776003)(103116003)(25786009)(189998001)(6116002)(3846002)(2906002)(21314002)(921003)(217873001)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0802MB2284; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA4MDJNQjIyODQ7MjM6YzhHdVBtV0tKMUtWZ2RHYjI3VmlKbnJC?= =?utf-8?B?T2o4T21GK3NNL2ZWYXJ6MGVPdnFzeDg0N2NtRXByZGpkVkIwU3dMc1BjYmNG?= =?utf-8?B?TWtMK2Rma3J3b1VwZGlPR20rT3R3K2lTVEdyVEJrTzQ2VlFSMG5RWTgwQmtj?= =?utf-8?B?ZHV4aUdYZHZ0NGNEc0NqWFVzR3Eya2xXUk9GZjJ6dGxXMHNmaVczYzN5VWl5?= =?utf-8?B?N25QTTN6enJJd0NnMzRpVHdQYlNzbVRkRXE4T0t3TjFIVlgyUlR2T0piVTNC?= =?utf-8?B?WmtxZUFES1FiM0ppZVJueENoNkI5YUk2WWV0YXZCTWFISmlxQXRXaHZDYVJr?= =?utf-8?B?SE5FNzNh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osticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2284; 7:zN98FajcB1/rKz4S+PIgPPPIM4y8h9vZ2c38y3Fs5iRLmKoJ406nLqb6TysuyBqmfPU/BOxDkiq2XDRnJ8d8UhineXzHEvybLgvkcd5CTxezGli0d637k8LmSd2dOmuJ69tNQ1ls/VlsjfzhXvS14mR0vTISluE1rKYUggvs/FqoE7RWUGW4pDU2jep+i09+SUqkze0p6YWwXh0yWykxxmJw8B/1QphfxD8y5D4leCSp/f/4iT1DBxk6FB2bj1MvQpl+tNGdJQv6GvWw02EsWCkC3YHLBMQ3NYrfXh+wLIVYEWzuVN2iggvXrEDG5zIsncHprWZPqfw3YRvEZpBQWA==; 20:vwiVQrvQEFkE5I3f8mLwhKcgxeYKhux7jDVAmCTt5vD3nWXubwH9K5Klz262q0kYMt7DwpCx3jMHiJFJYq5IYCSRdTNCNh6BwIaNoKWPsVMe1MWBwUelpT84vl8vp+9a7mQCSoJ8+Jr2AHAst/RzoamA83AfPInfkPe6b7MLfws= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2017 10:27:52.4084 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2284 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 Acked-by: Andrei Vagin --- fs/nsfs.c | 4 +++- include/linux/proc_ns.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nsfs.c b/fs/nsfs.c index 1656843e87d2..495f12b83a7b 100644 --- a/fs/nsfs.c +++ b/fs/nsfs.c @@ -195,9 +195,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);