Skip to contentSkip to conversation

blkdev: make struct block_device_operations.devnode() take a const *

PATCH In review Greg Kroah-Hartman 3 participants 6 messages Nov 9, 2022 – Dec 2, 2022 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blkdev: make struct block_device_operations.devnode() take a const *

The devnode() callback in struct block_device_operations should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into the one subsystem that actually uses this callback.

---

Jens, I have some dependent kobject/driver core changes that require this change in the works. Can I take this through the driver core tree for 6.2-rc1?

 drivers/block/pktcdvd.c | 2 +-
 include/linux/blkdev.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/block/pktcdvd.c +1 -1
index 4cea3b08087e..8dc15be95962 100644
@@ -2632,7 +2632,7 @@ static unsigned int pkt_check_events(struct gendisk *disk,
 	return attached_disk->fops->check_events(attached_disk, clearing);
 }
 
-static char *pkt_devnode(struct gendisk *disk, umode_t *mode)
+static char *pkt_devnode(const struct gendisk *disk, umode_t *mode)
 {
 	return kasprintf(GFP_KERNEL, "pktcdvd/%s", disk->disk_name);
 }
include/linux/blkdev.h +1 -1
index 50e358a19d98..2a455793462b 100644
@@ -1413,7 +1413,7 @@ struct block_device_operations {
 	void (*swap_slot_free_notify) (struct block_device *, unsigned long);
 	int (*report_zones)(struct gendisk *, sector_t sector,
 			unsigned int nr_zones, report_zones_cb cb, void *data);
-	char *(*devnode)(struct gendisk *disk, umode_t *mode);
+	char *(*devnode)(const struct gendisk *disk, umode_t *mode);
 	/* returns the length of the identifier or a negative errno: */
 	int (*get_unique_id)(struct gendisk *disk, u8 id[16],
 			enum blk_unique_id id_type);
Signature · 1 line
2.38.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Greg Kroah-Hartman

The devnode() callback in struct block_device_operations should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into the one subsystem that actually uses this callback.

Quoted 8 lines

---

Jens, I have some dependent kobject/driver core changes that require this change in the works. Can I take this through the driver core tree for 6.2-rc1?

Yeah go ahead, you can add my:

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 11 lines · Jens Axboe
Quoted 10 lines · Greg Kroah-Hartman

The devnode() callback in struct block_device_operations should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into the one subsystem that actually uses this callback.

---

Quoted 7 lines
Quoted 3 lines

Jens, I have some dependent kobject/driver core changes that require this change in the works. Can I take this through the driver core tree for 6.2-rc1?

Yeah go ahead, you can add my:

Thanks!

#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 4 lines · Greg Kroah-Hartman

The devnode() callback in struct block_device_operations should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into the one subsystem that actually uses this callback.

Yes. In fact it really shouldn't exist at all. I wonder if we can do another attempt at dropping pktcdvd?

#4 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Greg Kroah-Hartman

The devnode() callback in struct block_device_operations should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into the one subsystem that actually uses this callback.

Yes. In fact it really shouldn't exist at all. I wonder if we can do another attempt at dropping pktcdvd?

I'll gladly send a patch to delete it. Who objected last time? Let me dig in the archives...

#5 lore raw
In reply to Christoph Hellwig
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Greg Kroah-Hartman

The devnode() callback in struct block_device_operations should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into the one subsystem that actually uses this callback.

Yes. In fact it really shouldn't exist at all. I wonder if we can do another attempt at dropping pktcdvd?

Patch removing it now sent.