block: annotate bdev_disk_changed() deprecation with a symbol namespace
Subsystems (3)
PATCH 1/1 block: annotate bdev_disk_changed() deprecation with a symbol namespace
Instead of relying on fragile documentation which can easily let us slip, use a symbol namespace to annotate which symbols should not be used by others.
This ensures no other users pop up by mistake easily and provides us a with an easy vehicle to do the same with other routines should we need it later.
--- block/partitions/core.c | 6 +----- drivers/block/loop.c | 2 ++ drivers/s390/block/dasd_genhd.c | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-)
block/partitions/core.c +1 -5
@@ -698,11 +698,7 @@ int bdev_disk_changed(struct gendisk *disk, bool invalidate)return ret; } -/* -* Only exported for loop and dasd for historic reasons. Don't use in new -* code! -*/ -EXPORT_SYMBOL_GPL (bdev_disk_changed); +EXPORT_SYMBOL_NS_GPL (bdev_disk_changed,BLOCK_DEPRECATED );void *read_part_sector (struct parsed_partitions *state,sector_t n,Sector *p) {
drivers/block/loop.c +2 -0
@@ -37,6 +37,8 @@#include <linux/spinlock.h> #include <uapi/linux/loop.h> +MODULE_IMPORT_NS (BLOCK_DEPRECATED ); +/* Possible states of device */ enum { Lo_unbound,
drivers/s390/block/dasd_genhd.c +2 -0
@@ -25,6 +25,8 @@#include "dasd_int.h" +MODULE_IMPORT_NS (BLOCK_DEPRECATED ); +static unsigned int queue_depth =32 ;static unsigned int nr_hw_queues =4 ;
Signature · 1 line
2.39.2
Quoted 7 lines · Luis Chamberlain
Instead of relying on fragile documentation which can easily let us slip, use a symbol namespace to annotate which symbols should not be used by others.
This ensures no other users pop up by mistake easily and provides us a with an easy vehicle to do the same with other routines should we need it later.
I don't think deprecated really cuts it. For these two drivers we can't really get rid of the calls as it is part of their ABI.
What I'd really want is something like an
EXPORT_SYMBOL_FOR(bdev_disk_changed, loop, CONFIG_BLK_DEV_LOOP); EXPORT_SYMBOL_FOR(bdev_disk_changed, dasd_kmod, CONFIG_DASD);
Which ensures that the symbol lookup only succeeds for loop.ko and dasd_kmod.ko, and that the export only happens if the relevant symbols are set.
Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · Luis Chamberlain
Instead of relying on fragile documentation which can easily let us slip, use a symbol namespace to annotate which symbols should not be used by others.
This ensures no other users pop up by mistake easily and provides us a with an easy vehicle to do the same with other routines should we need it later.
I don't think deprecated really cuts it. For these two drivers we can't really get rid of the calls as it is part of their ABI.
Ah yes.
Quoted 8 lines
What I'd really want is something like an
EXPORT_SYMBOL_FOR(bdev_disk_changed, loop, CONFIG_BLK_DEV_LOOP);EXPORT_SYMBOL_FOR(bdev_disk_changed, dasd_kmod, CONFIG_DASD);Which ensures that the symbol lookup only succeeds for loop.ko and dasd_kmod.ko, and that the export only happens if the relevant symbols are set.
I think that could be done, sure.
Luis
Quoted 11 lines · Luis Chamberlain
Quoted 8 lines · Christoph Hellwig
What I'd really want is something like an
EXPORT_SYMBOL_FOR(bdev_disk_changed, loop, CONFIG_BLK_DEV_LOOP);EXPORT_SYMBOL_FOR(bdev_disk_changed, dasd_kmod, CONFIG_DASD);Which ensures that the symbol lookup only succeeds for loop.ko and dasd_kmod.ko, and that the export only happens if the relevant symbols are set.
I think that could be done, sure.
BTW is anyone aware of similar exports which are stuck in this way?
Luis
Quoted 1 line · Luis Chamberlain
BTW is anyone aware of similar exports which are stuck in this way?
We have a few in fs code. And there's thing like all kinds of very
low-level code exported that absolutely should only be used by kvm.