lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221005050027.39591-3-kch@nvidia.com>
Date:   Tue, 4 Oct 2022 22:00:11 -0700
From:   Chaitanya Kulkarni <kch@...dia.com>
To:     <ogeert@...ux-m68k.org>, <linux-block@...r.kernel.org>,
        <linux-m68k@...ts.linux-m68k.org>, <linux-kernel@...r.kernel.org>,
        <drbd-dev@...ts.linbit.com>, <nbd@...er.debian.org>,
        <linux-mtd@...ts.infradead.org>
CC:     <axboe@...nel.dk>, <philipp.reisner@...bit.com>,
        <lars.ellenberg@...bit.com>, <christoph.boehmwalder@...bit.com>,
        <efremov@...ux.com>, <josef@...icpanda.com>, <tim@...erelk.net>,
        <haris.iqbal@...os.com>, <jinpu.wang@...os.com>, <richard@....at>,
        <miquel.raynal@...tlin.com>, <vigneshr@...com>, <kch@...dia.com>,
        <mcgrof@...nel.org>, <hare@...e.de>,
        <damien.lemoal@...nsource.wdc.com>, <johannes.thumshirn@....com>,
        <bvanassche@....org>, <ming.lei@...hat.com>,
        <vincent.fu@...sung.com>, <shinichiro.kawasaki@....com>
Subject: [RFC PATCH 02/18] nfblock: use init disk helper

Add and use the helper to initialize the common fields of struct gendisk
such as major, first_minor, minors, disk_name, private_data, and ops.
This initialization is spread all over the block drivers. This avoids
code repetation of inialization code of gendisk in current block drivers
and any future ones.

Signed-off-by: Chaitanya Kulkarni <kch@...dia.com>
---
 arch/m68k/emu/nfblock.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
index a708fbd5a844..81d3d3edace6 100644
--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -121,13 +121,9 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
 	if (!dev->disk)
 		goto free_dev;
 
-	dev->disk->major = major_num;
-	dev->disk->first_minor = dev_id * 16;
-	dev->disk->minors = 16;
-	dev->disk->fops = &nfhd_ops;
-	dev->disk->private_data = dev;
+	init_disk(dev->disk, major_num, dev_id * 16, 16,
+			(sector_t)blocks * (bsize / 512), dev, &nfhd_ops);
 	sprintf(dev->disk->disk_name, "nfhd%u", dev_id);
-	set_capacity(dev->disk, (sector_t)blocks * (bsize / 512));
 	blk_queue_logical_block_size(dev->disk->queue, bsize);
 	err = add_disk(dev->disk);
 	if (err)
-- 
2.29.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ