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=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 50124C43463 for ; Sun, 26 Jul 2020 15:36:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1175B2070B for ; Sun, 26 Jul 2020 15:36:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ZlUbIgvz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1175B2070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B16B88D0005; Sun, 26 Jul 2020 11:36:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AEC956B0010; Sun, 26 Jul 2020 11:36:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A03DA8D0005; Sun, 26 Jul 2020 11:36:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0119.hostedemail.com [216.40.44.119]) by kanga.kvack.org (Postfix) with ESMTP id 8BBFF6B000E for ; Sun, 26 Jul 2020 11:36:02 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4EAA41856B6E8 for ; Sun, 26 Jul 2020 15:36:02 +0000 (UTC) X-FDA: 77080627764.19.cave96_4b01ef226f59 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id E31773044D6 for ; Sun, 26 Jul 2020 15:03:57 +0000 (UTC) X-HE-Tag: cave96_4b01ef226f59 X-Filterd-Recvd-Size: 5042 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Sun, 26 Jul 2020 15:03:57 +0000 (UTC) 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=kdnG/8uKQIMddLsDA/8BZYPUgnH5s1kSDlqsFlCYesw=; b=ZlUbIgvz5W+wNZyXR6smJAUXas evPOz6Ja3vFXE9UY2uAmviOobnai2PzHbDI+ijvPBexgfsz1flsWVkMK3mMsjPeRfpzTtILWc4olD Hj+/WaWcA6UhlhC80A+lhxePrJn4C44YMiZhGd8QAKQ/i8EthVTqcPNN7UqDnUR30qrdZ4fG1iudN XBDssURerbKMOfZhaB0z0cjf41fJx8gqw/53CntsqtJiJrZfYmDDcMm+ieudAv5pwN/pd9KDuNkal CXpWl6zKdMFN2J37a8Slp+8TFWLMHjB6LAwa0cpEDl/bTu+fjIb9lz5Fe0cBbaueULO6dV+eNfOr8 cPAkBGvw==; Received: from [2001:4bb8:18c:2acc:2375:88ff:9f84:118d] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jziBn-0005h0-2s; Sun, 26 Jul 2020 15:03:47 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , Hans de Goede , Richard Weinberger , Minchan Kim , linux-mtd@lists.infradead.org, dm-devel@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, drbd-dev@lists.linbit.com, linux-raid@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Johannes Thumshirn Subject: [PATCH 07/14] block: make QUEUE_SYSFS_BIT_FNS a little more useful Date: Sun, 26 Jul 2020 17:03:26 +0200 Message-Id: <20200726150333.305527-8-hch@lst.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200726150333.305527-1-hch@lst.de> References: <20200726150333.305527-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-Rspamd-Queue-Id: E31773044D6 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Johannes Thumshirn --- 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 ce418d9128a0b2..cfbb039da8751f 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -257,16 +257,16 @@ static ssize_t queue_max_hw_sectors_show(struct req= uest_queue *q, char *page) return queue_var_show(max_hw_sectors_kb, (page)); } =20 -#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 =3D 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 cou= nt) \ +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 ch= ar *page, size_t count) \ else \ blk_queue_flag_clear(QUEUE_FLAG_##flag, q); \ return ret; \ -} +} \ +static struct queue_sysfs_entry queue_##_name##_entry =3D { \ + .attr =3D { .name =3D __stringify(_name), .mode =3D 0644 }, \ + .show =3D queue_##_name##_show, \ + .store =3D queue_##_name##_store, \ +}; =20 QUEUE_SYSFS_BIT_FNS(nonrot, NONROT, 1); QUEUE_SYSFS_BIT_FNS(random, ADD_RANDOM, 0); @@ -661,12 +666,6 @@ static struct queue_sysfs_entry queue_zone_append_ma= x_entry =3D { .show =3D queue_zone_append_max_show, }; =20 -static struct queue_sysfs_entry queue_nonrot_entry =3D { - .attr =3D {.name =3D "rotational", .mode =3D 0644 }, - .show =3D queue_show_nonrot, - .store =3D queue_store_nonrot, -}; - static struct queue_sysfs_entry queue_zoned_entry =3D { .attr =3D {.name =3D "zoned", .mode =3D 0444 }, .show =3D queue_zoned_show, @@ -699,18 +698,6 @@ static struct queue_sysfs_entry queue_rq_affinity_en= try =3D { .store =3D queue_rq_affinity_store, }; =20 -static struct queue_sysfs_entry queue_iostats_entry =3D { - .attr =3D {.name =3D "iostats", .mode =3D 0644 }, - .show =3D queue_show_iostats, - .store =3D queue_store_iostats, -}; - -static struct queue_sysfs_entry queue_random_entry =3D { - .attr =3D {.name =3D "add_random", .mode =3D 0644 }, - .show =3D queue_show_random, - .store =3D queue_store_random, -}; - static struct queue_sysfs_entry queue_poll_entry =3D { .attr =3D {.name =3D "io_poll", .mode =3D 0644 }, .show =3D queue_poll_show, --=20 2.27.0