From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B325CC43464 for ; Mon, 20 Jul 2020 07:53:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 45F6520709 for ; Mon, 20 Jul 2020 07:53:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cxkQH6o2"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="R6OsUSxk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45F6520709 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Vr+U8L3LxTTSkPeTqZ43uAzcboATCW0XasR+j8AtLmI=; b=cxkQH6o2fWXxKORg31tO7GdQe fSJgbQYG5KTc/cYomoaLWkF6y3khAe0nsxsEXHLtbifuuXshRQFDn3W50J2fbeRGEwbSpQONPBZm2 231v/JFfki8VV+7iLAhpdhwPGJ3DlqQr7g65wHuAhD992aKGBKDKrb5nq/XxEXpIn8KYQLvET9e8s na5idpRHHlhYOKOMhyRTeDszEtcComq/hZdKDryoyGMV0gszs5I3h5+Czcj9LGTzw8rgQkwyokKu9 KZM3c1DY0wzkoGjVCVlrpTpr1jk1oUAP/cJlJNFP3cOE7S0LazZMFl8MOKPniRuQsCSCmlYy2ZX/4 O93EjV8pA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxQbB-0006Bs-BT; Mon, 20 Jul 2020 07:52:33 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxQai-0005wJ-3J for linux-mtd@merlin.infradead.org; Mon, 20 Jul 2020 07:52:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=UaxK9i4Mki9lVWLBCoh/BWGT2dspFfc4dGG4K3OkffY=; b=R6OsUSxkp5x6W991243/6zzLTz uCt4Vfakh2gcksb/nlks10bjRsnek2/VGUkw4ETEjBN3hUPcjLEBvT6+ybN+SjRHlwg1ZVIwwSeIl YfivaWzU80xjqeJ6jLgjK4uMJiwuC+b8R/HBWvG/18JFbDf4Z+1i9FVzuFAnwo03AXF7JgMzyYwAH YD+XONxAKf5S4Yj9/x2YBp/QNn38hGRsl+pFW3MooMNxsiFuk1q4V8e+Ewqi4ENWQOYFrfP6VP53e TAGj8ulu8jjjNzq525xZnm5QWbEJqsI76LH4o+v/E2NYFdRezBQR0lJQr78I8Zf2uuMPtceNYQGIz 2VwEdTag==; Received: from [2001:4bb8:105:4a81:5185:88fc:94bb:f8bf] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxQag-00041a-64; Mon, 20 Jul 2020 07:52:02 +0000 From: Christoph Hellwig To: Jens Axboe Subject: [PATCH 07/14] block: make QUEUE_SYSFS_BIT_FNS a little more useful Date: Mon, 20 Jul 2020 09:51:41 +0200 Message-Id: <20200720075148.172156-8-hch@lst.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200720075148.172156-1-hch@lst.de> References: <20200720075148.172156-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-raid@vger.kernel.org, Hans de Goede , Richard Weinberger , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Song Liu , dm-devel@redhat.com, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, drbd-dev@lists.linbit.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org Generate the queue_sysfs_entry given that we have all the required information for it, and rename the generated show and store methods to match the other ones in the file. Signed-off-by: Christoph Hellwig --- block/blk-sysfs.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index d7cf560efa92e5..358268bb88b700 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -257,16 +257,16 @@ static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page) return queue_var_show(max_hw_sectors_kb, (page)); } -#define QUEUE_SYSFS_BIT_FNS(name, flag, neg) \ +#define QUEUE_SYSFS_BIT_FNS(_name, flag, neg) \ static ssize_t \ -queue_show_##name(struct request_queue *q, char *page) \ +queue_##_name##_show(struct request_queue *q, char *page) \ { \ int bit; \ bit = test_bit(QUEUE_FLAG_##flag, &q->queue_flags); \ return queue_var_show(neg ? !bit : bit, page); \ } \ static ssize_t \ -queue_store_##name(struct request_queue *q, const char *page, size_t count) \ +queue_##_name##_store(struct request_queue *q, const char *page, size_t count) \ { \ unsigned long val; \ ssize_t ret; \ @@ -281,7 +281,12 @@ queue_store_##name(struct request_queue *q, const char *page, size_t count) \ else \ blk_queue_flag_clear(QUEUE_FLAG_##flag, q); \ return ret; \ -} +} \ +static struct queue_sysfs_entry queue_##_name##_entry = { \ + .attr = { .name = __stringify(_name), .mode = 0644 }, \ + .show = queue_##_name##_show, \ + .store = queue_##_name##_store, \ +}; QUEUE_SYSFS_BIT_FNS(nonrot, NONROT, 1); QUEUE_SYSFS_BIT_FNS(random, ADD_RANDOM, 0); @@ -651,12 +656,6 @@ static struct queue_sysfs_entry queue_zone_append_max_entry = { .show = queue_zone_append_max_show, }; -static struct queue_sysfs_entry queue_nonrot_entry = { - .attr = {.name = "rotational", .mode = 0644 }, - .show = queue_show_nonrot, - .store = queue_store_nonrot, -}; - static struct queue_sysfs_entry queue_zoned_entry = { .attr = {.name = "zoned", .mode = 0444 }, .show = queue_zoned_show, @@ -679,18 +678,6 @@ static struct queue_sysfs_entry queue_rq_affinity_entry = { .store = queue_rq_affinity_store, }; -static struct queue_sysfs_entry queue_iostats_entry = { - .attr = {.name = "iostats", .mode = 0644 }, - .show = queue_show_iostats, - .store = queue_store_iostats, -}; - -static struct queue_sysfs_entry queue_random_entry = { - .attr = {.name = "add_random", .mode = 0644 }, - .show = queue_show_random, - .store = queue_store_random, -}; - static struct queue_sysfs_entry queue_poll_entry = { .attr = {.name = "io_poll", .mode = 0644 }, .show = queue_poll_show, -- 2.27.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/