From patchwork Mon Nov 28 21:38:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 9450523 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 74EA760756 for ; Mon, 28 Nov 2016 21:41:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 668FD27BFF for ; Mon, 28 Nov 2016 21:41:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B6D427E3E; Mon, 28 Nov 2016 21:41:03 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 A4D8627EE9 for ; Mon, 28 Nov 2016 21:41:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755574AbcK1Vkz (ORCPT ); Mon, 28 Nov 2016 16:40:55 -0500 Received: from mail-wj0-f193.google.com ([209.85.210.193]:32951 "EHLO mail-wj0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755287AbcK1Vjp (ORCPT ); Mon, 28 Nov 2016 16:39:45 -0500 Received: by mail-wj0-f193.google.com with SMTP id kp2so15789083wjc.0 for ; Mon, 28 Nov 2016 13:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tEVKV2jHDck+OS8K0FTcv7RCA0+RZYZmOxfIr3Ox5x8=; b=k7CLfO6F5WGPDnIznuOeAETbm1e8MkIPJXQTsa8EaAqDI4eJYcbe+Q6I75Zy0DPVaY pbKUc0Hzbmj7jKf720JUEpBiu48s/7y3DMNYEBNsVoiBQHnKQJNDI25tH7FeJ+46ZONz yX0PX0u62kmS/HLpVeuqu+mUjQFGznTwtlYSI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tEVKV2jHDck+OS8K0FTcv7RCA0+RZYZmOxfIr3Ox5x8=; b=kD+pohH1EAs+8Lx6OGleTqWrga54SmMQVsAySYCE8OGH6+b153Q601ay9gFouQ7ryt tW83mqKDrhE3+lF0ewWEEu1yhCEVKhK3HQFdA6jZlnxAJNdb9k7jEKn+Z5I2lJibCs5Z 03IDQVCNZPawBXPCbiVsZUJF8TERPkjGjKjanBkm0qIgRDg3Z08Zy+FwcE1MpcwNvfxr N9QIThatCvQyrxHifXpyEyQUpWItO3E7NU3vEkNeeicbwn8pUO+bgNE2HS9/pyEIHj7h jdae2GOH4AHObzhtHPjk2h3yDktbz6iVx3PvGinyMh+eVvfcr8Ik54X5TUD5qROxLqcK YknA== X-Gm-Message-State: AKaTC00ggEN2fTGC4dOgXrgvItFr6LMrATMH+MO0kZ5JU+s1DFs3WFBeJc9zX0gp8S2J5A== X-Received: by 10.194.121.6 with SMTP id lg6mr24046722wjb.105.1480369183993; Mon, 28 Nov 2016 13:39:43 -0800 (PST) Received: from Macroninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id w79sm30825843wmw.0.2016.11.28.13.39.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2016 13:39:43 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: axboe@fb.com, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 08/23] lightnvm: remove sysfs configuration interface Date: Mon, 28 Nov 2016 22:38:59 +0100 Message-Id: <20161128213914.12516-9-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161128213914.12516-1-m@bjorling.me> References: <20161128213914.12516-1-m@bjorling.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Javier González LightNVM used to be managed and configured through sysfs. Since the introduction of management ioctls this interface is redundant and outdated. Get rid of it. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/core.c | 134 ------------------------------------------------ 1 file changed, 134 deletions(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 6527cf6..d4433d3 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -780,140 +780,6 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create) return dev->mt->create_tgt(dev, create); } -#ifdef CONFIG_NVM_DEBUG -static int nvm_configure_show(const char *val) -{ - struct nvm_dev *dev; - char opcode, devname[DISK_NAME_LEN]; - int ret; - - ret = sscanf(val, "%c %32s", &opcode, devname); - if (ret != 2) { - pr_err("nvm: invalid command. Use \"opcode devicename\".\n"); - return -EINVAL; - } - - down_write(&nvm_lock); - dev = nvm_find_nvm_dev(devname); - up_write(&nvm_lock); - if (!dev) { - pr_err("nvm: device not found\n"); - return -EINVAL; - } - - if (!dev->mt) - return 0; - - dev->mt->lun_info_print(dev); - - return 0; -} - -static int nvm_configure_remove(const char *val) -{ - struct nvm_ioctl_remove remove; - struct nvm_dev *dev; - char opcode; - int ret = 0; - - ret = sscanf(val, "%c %256s", &opcode, remove.tgtname); - if (ret != 2) { - pr_err("nvm: invalid command. Use \"d targetname\".\n"); - return -EINVAL; - } - - remove.flags = 0; - - list_for_each_entry(dev, &nvm_devices, devices) { - ret = dev->mt->remove_tgt(dev, &remove); - if (!ret) - break; - } - - return ret; -} - -static int nvm_configure_create(const char *val) -{ - struct nvm_ioctl_create create; - char opcode; - int lun_begin, lun_end, ret; - - ret = sscanf(val, "%c %256s %256s %48s %u:%u", &opcode, create.dev, - create.tgtname, create.tgttype, - &lun_begin, &lun_end); - if (ret != 6) { - pr_err("nvm: invalid command. Use \"opcode device name tgttype lun_begin:lun_end\".\n"); - return -EINVAL; - } - - create.flags = 0; - create.conf.type = NVM_CONFIG_TYPE_SIMPLE; - create.conf.s.lun_begin = lun_begin; - create.conf.s.lun_end = lun_end; - - return __nvm_configure_create(&create); -} - - -/* Exposes administrative interface through /sys/module/lnvm/configure_by_str */ -static int nvm_configure_by_str_event(const char *val, - const struct kernel_param *kp) -{ - char opcode; - int ret; - - ret = sscanf(val, "%c", &opcode); - if (ret != 1) { - pr_err("nvm: string must have the format of \"cmd ...\"\n"); - return -EINVAL; - } - - switch (opcode) { - case 'a': - return nvm_configure_create(val); - case 'd': - return nvm_configure_remove(val); - case 's': - return nvm_configure_show(val); - default: - pr_err("nvm: invalid command\n"); - return -EINVAL; - } - - return 0; -} - -static int nvm_configure_get(char *buf, const struct kernel_param *kp) -{ - int sz; - struct nvm_dev *dev; - - sz = sprintf(buf, "available devices:\n"); - down_write(&nvm_lock); - list_for_each_entry(dev, &nvm_devices, devices) { - if (sz > 4095 - DISK_NAME_LEN - 2) - break; - sz += sprintf(buf + sz, " %32s\n", dev->name); - } - up_write(&nvm_lock); - - return sz; -} - -static const struct kernel_param_ops nvm_configure_by_str_event_param_ops = { - .set = nvm_configure_by_str_event, - .get = nvm_configure_get, -}; - -#undef MODULE_PARAM_PREFIX -#define MODULE_PARAM_PREFIX "lnvm." - -module_param_cb(configure_debug, &nvm_configure_by_str_event_param_ops, NULL, - 0644); - -#endif /* CONFIG_NVM_DEBUG */ - static long nvm_ioctl_info(struct file *file, void __user *arg) { struct nvm_ioctl_info *info;