diff mbox series

[RFC,1/2] block: export block_class and disk_type symbols

Message ID 20210430183216.27458-2-ematsumiya@suse.de
State New
Headers show
Series [RFC,1/2] block: export block_class and disk_type symbols | expand

Commit Message

Enzo Matsumiya April 30, 2021, 6:32 p.m. UTC
Export symbols to be used by _for_each_blk() helper in LED block
trigger.

Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
 block/genhd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Greg Kroah-Hartman May 1, 2021, 6:24 a.m. UTC | #1
On Fri, Apr 30, 2021 at 03:32:10PM -0300, Enzo Matsumiya wrote:
> Export symbols to be used by _for_each_blk() helper in LED block

> trigger.

> 

> Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>

> ---

>  block/genhd.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/block/genhd.c b/block/genhd.c

> index 8c8f543572e6..516495179230 100644

> --- a/block/genhd.c

> +++ b/block/genhd.c

> @@ -1218,6 +1218,7 @@ static void disk_release(struct device *dev)

>  struct class block_class = {

>  	.name		= "block",

>  };

> +EXPORT_SYMBOL(block_class);

>  

>  static char *block_devnode(struct device *dev, umode_t *mode,

>  			   kuid_t *uid, kgid_t *gid)

> @@ -1235,6 +1236,7 @@ const struct device_type disk_type = {

>  	.release	= disk_release,

>  	.devnode	= block_devnode,

>  };

> +EXPORT_SYMBOL(disk_type);

>  

>  #ifdef CONFIG_PROC_FS

>  /*


Please please no.  These should not be needed by anything.

And if they really do, they must be EXPORT_SYMBOL_GPL().

thanks,

greg k-h
Enzo Matsumiya May 3, 2021, 2:37 a.m. UTC | #2
On 05/01, Greg Kroah-Hartman wrote:
>On Fri, Apr 30, 2021 at 03:32:10PM -0300, Enzo Matsumiya wrote:

>> Export symbols to be used by _for_each_blk() helper in LED block

>> trigger.

>>

>> Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>

>> ---

>>  block/genhd.c | 2 ++

>>  1 file changed, 2 insertions(+)

>>

>> diff --git a/block/genhd.c b/block/genhd.c

>> index 8c8f543572e6..516495179230 100644

>> --- a/block/genhd.c

>> +++ b/block/genhd.c

>> @@ -1218,6 +1218,7 @@ static void disk_release(struct device *dev)

>>  struct class block_class = {

>>  	.name		= "block",

>>  };

>> +EXPORT_SYMBOL(block_class);

>>

>>  static char *block_devnode(struct device *dev, umode_t *mode,

>>  			   kuid_t *uid, kgid_t *gid)

>> @@ -1235,6 +1236,7 @@ const struct device_type disk_type = {

>>  	.release	= disk_release,

>>  	.devnode	= block_devnode,

>>  };

>> +EXPORT_SYMBOL(disk_type);

>>

>>  #ifdef CONFIG_PROC_FS

>>  /*

>

>Please please no.  These should not be needed by anything.

>

>And if they really do, they must be EXPORT_SYMBOL_GPL().

>

>thanks,

>

>greg k-h


Thanks. I was indeed skeptical about submitting this particular change.

Do you think it's more acceptable if I implement a for_each_blk() helper
(cf. patch 2 on this series) on block code?

I couldn't find any other way to do this (get all block devices on the
system), so please let me know if I missed something.


Cheers,

Enzo
Greg Kroah-Hartman May 3, 2021, 4:48 a.m. UTC | #3
On Sun, May 02, 2021 at 11:37:35PM -0300, Enzo Matsumiya wrote:
> On 05/01, Greg Kroah-Hartman wrote:

> > On Fri, Apr 30, 2021 at 03:32:10PM -0300, Enzo Matsumiya wrote:

> > > Export symbols to be used by _for_each_blk() helper in LED block

> > > trigger.

> > > 

> > > Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>

> > > ---

> > >  block/genhd.c | 2 ++

> > >  1 file changed, 2 insertions(+)

> > > 

> > > diff --git a/block/genhd.c b/block/genhd.c

> > > index 8c8f543572e6..516495179230 100644

> > > --- a/block/genhd.c

> > > +++ b/block/genhd.c

> > > @@ -1218,6 +1218,7 @@ static void disk_release(struct device *dev)

> > >  struct class block_class = {

> > >  	.name		= "block",

> > >  };

> > > +EXPORT_SYMBOL(block_class);

> > > 

> > >  static char *block_devnode(struct device *dev, umode_t *mode,

> > >  			   kuid_t *uid, kgid_t *gid)

> > > @@ -1235,6 +1236,7 @@ const struct device_type disk_type = {

> > >  	.release	= disk_release,

> > >  	.devnode	= block_devnode,

> > >  };

> > > +EXPORT_SYMBOL(disk_type);

> > > 

> > >  #ifdef CONFIG_PROC_FS

> > >  /*

> > 

> > Please please no.  These should not be needed by anything.

> > 

> > And if they really do, they must be EXPORT_SYMBOL_GPL().

> > 

> > thanks,

> > 

> > greg k-h

> 

> Thanks. I was indeed skeptical about submitting this particular change.

> 

> Do you think it's more acceptable if I implement a for_each_blk() helper

> (cf. patch 2 on this series) on block code?

> 

> I couldn't find any other way to do this (get all block devices on the

> system), so please let me know if I missed something.


Why would you want a list of all block devices in the system?  What are
you going to do with such a thing?  How does the block core handle other
random drivers getting references to the things it thinks it controls?

thanks,

greg k-h
Christoph Hellwig May 3, 2021, 7:04 a.m. UTC | #4
On Fri, Apr 30, 2021 at 03:32:10PM -0300, Enzo Matsumiya wrote:
> Export symbols to be used by _for_each_blk() helper in LED block

> trigger.


No way.
Enzo Matsumiya May 3, 2021, 4:50 p.m. UTC | #5
On 05/03, Christoph Hellwig wrote:
>On Fri, Apr 30, 2021 at 03:32:10PM -0300, Enzo Matsumiya wrote:

>> Export symbols to be used by _for_each_blk() helper in LED block

>> trigger.

>

>No way.


Thanks everyone, I'll fix this in the next patch version.


Cheers,

Enzo
diff mbox series

Patch

diff --git a/block/genhd.c b/block/genhd.c
index 8c8f543572e6..516495179230 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1218,6 +1218,7 @@  static void disk_release(struct device *dev)
 struct class block_class = {
 	.name		= "block",
 };
+EXPORT_SYMBOL(block_class);
 
 static char *block_devnode(struct device *dev, umode_t *mode,
 			   kuid_t *uid, kgid_t *gid)
@@ -1235,6 +1236,7 @@  const struct device_type disk_type = {
 	.release	= disk_release,
 	.devnode	= block_devnode,
 };
+EXPORT_SYMBOL(disk_type);
 
 #ifdef CONFIG_PROC_FS
 /*