* [PATCH] usb: storage: make disk cdev name configurable via Kconfig
@ 2026-06-23 14:26 chalianis1
2026-06-30 12:41 ` Sascha Hauer
0 siblings, 1 reply; 8+ messages in thread
From: chalianis1 @ 2026-06-23 14:26 UTC (permalink / raw)
To: s.hauer; +Cc: barebox, Anis Chali
From: Anis Chali <anis.chali@ro-main.com>
Add USBDISK_NAME string option to allow customizing the USB storage
device name, defaulting to "disk" to preserve existing behaviour.
Signed-off-by: Anis Chali <anis.chali@ro-main.com>
---
drivers/usb/storage/Kconfig | 5 +++++
drivers/usb/storage/usb.c | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index efca9874d5..90a62a9d24 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -2,3 +2,8 @@
config USB_STORAGE
tristate "USB Mass Storage support"
select DISK
+
+config USBDISK_NAME
+ string "USB storage disk name"
+ depends on USB_STORAGE
+ default "disk"
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index b3116dc6e6..b6944f531d 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -414,12 +414,12 @@ static int usb_stor_add_blkdev(struct us_data *us, unsigned char lun)
if (result < 0)
goto BadDevice;
- result = cdev_find_free_index("disk");
+ result = cdev_find_free_index(CONFIG_USBDISK_NAME);
if (result == -1)
pr_err("Cannot find a free number for the disk node\n");
- dev_info(dev, "registering as disk%d\n", result);
+ dev_info(dev, "registering as %s%d\n", CONFIG_USBDISK_NAME, result);
- pblk_dev->blk.cdev.name = basprintf("disk%d", result);
+ pblk_dev->blk.cdev.name = basprintf("%s%d", CONFIG_USBDISK_NAME, result);
pblk_dev->blk.blockbits = SECTOR_SHIFT;
pblk_dev->blk.type = BLK_TYPE_USB;
pblk_dev->blk.removable = true;
--
2.54.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: storage: make disk cdev name configurable via Kconfig
2026-06-23 14:26 [PATCH] usb: storage: make disk cdev name configurable via Kconfig chalianis1
@ 2026-06-30 12:41 ` Sascha Hauer
2026-07-07 5:57 ` [PATCH] USB: make storage device name configurable chalianis1
2026-08-27 12:01 ` [PATCH] usb: storage: make disk cdev name configurable via Kconfig chalianis1
0 siblings, 2 replies; 8+ messages in thread
From: Sascha Hauer @ 2026-06-30 12:41 UTC (permalink / raw)
To: chalianis1; +Cc: barebox, Anis Chali
Hi,
On 2026-06-23 10:26, chalianis1 wrote:
> From: Anis Chali <anis.chali@ro-main.com>
>
> Add USBDISK_NAME string option to allow customizing the USB storage
> device name, defaulting to "disk" to preserve existing behaviour.
I just sent a patch which registers USB storage devices with usbdiskx
which doesn't require compile time changes. I hope that suits your needs
as well.
Sascha
>
> Signed-off-by: Anis Chali <anis.chali@ro-main.com>
> ---
> drivers/usb/storage/Kconfig | 5 +++++
> drivers/usb/storage/usb.c | 6 +++---
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
> index efca9874d5..90a62a9d24 100644
> --- a/drivers/usb/storage/Kconfig
> +++ b/drivers/usb/storage/Kconfig
> @@ -2,3 +2,8 @@
> config USB_STORAGE
> tristate "USB Mass Storage support"
> select DISK
> +
> +config USBDISK_NAME
> + string "USB storage disk name"
> + depends on USB_STORAGE
> + default "disk"
> diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
> index b3116dc6e6..b6944f531d 100644
> --- a/drivers/usb/storage/usb.c
> +++ b/drivers/usb/storage/usb.c
> @@ -414,12 +414,12 @@ static int usb_stor_add_blkdev(struct us_data *us, unsigned char lun)
> if (result < 0)
> goto BadDevice;
>
> - result = cdev_find_free_index("disk");
> + result = cdev_find_free_index(CONFIG_USBDISK_NAME);
> if (result == -1)
> pr_err("Cannot find a free number for the disk node\n");
> - dev_info(dev, "registering as disk%d\n", result);
> + dev_info(dev, "registering as %s%d\n", CONFIG_USBDISK_NAME, result);
>
> - pblk_dev->blk.cdev.name = basprintf("disk%d", result);
> + pblk_dev->blk.cdev.name = basprintf("%s%d", CONFIG_USBDISK_NAME, result);
> pblk_dev->blk.blockbits = SECTOR_SHIFT;
> pblk_dev->blk.type = BLK_TYPE_USB;
> pblk_dev->blk.removable = true;
> --
> 2.54.0
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] USB: make storage device name configurable
2026-06-30 12:41 ` Sascha Hauer
@ 2026-07-07 5:57 ` chalianis1
2026-08-27 12:01 ` [PATCH] usb: storage: make disk cdev name configurable via Kconfig chalianis1
1 sibling, 0 replies; 8+ messages in thread
From: chalianis1 @ 2026-07-07 5:57 UTC (permalink / raw)
To: s.hauer; +Cc: anis.chali, barebox, chalianis1
On Tue, Jun 30, 2026 at 12:41:33PM +0000, Sascha Hauer wrote:
> Hi,
>
> On 2026-06-23 10:26, chalianis1 wrote:
> > From: Anis Chali <anis.chali@ro-main.com>
> >
> > Add USBDISK_NAME string option to allow customizing the USB storage
> > device name, defaulting to "disk" to preserve existing behaviour.
>
> I just sent a patch which registers USB storage devices with usbdiskx
> which doesn't require compile time changes. I hope that suits your needs
> as well.
Yes, it works for me, it does the job more cleanly, thank you.
Anis.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: storage: make disk cdev name configurable via Kconfig
2026-06-30 12:41 ` Sascha Hauer
2026-07-07 5:57 ` [PATCH] USB: make storage device name configurable chalianis1
@ 2026-08-27 12:01 ` chalianis1
2026-08-28 14:39 ` Sascha Hauer
1 sibling, 1 reply; 8+ messages in thread
From: chalianis1 @ 2026-08-27 12:01 UTC (permalink / raw)
To: Sascha Hauer; +Cc: chalianis1, barebox, Anis Chali
On 2026-06-30 12:41 +0000, Sascha Hauer wrote:
> Hi,
>
> On 2026-06-23 10:26, chalianis1 wrote:
> > From: Anis Chali <anis.chali@ro-main.com>
> >
> > Add USBDISK_NAME string option to allow customizing the USB storage
> > device name, defaulting to "disk" to preserve existing behaviour.
>
> I just sent a patch which registers USB storage devices with usbdiskx
> which doesn't require compile time changes. I hope that suits your needs
> as well.
>
> Sascha
>
Hi,
In my side I am migrating to master so removed my patch for this and
I noticed that alias is not mounted to be used as /mnt/usbdiskX, I am
just asking to know if it the expected behaviour in which case I will
for an other way to get it mounted as /mnt/usbdisk0
Best regards.
Anis
> >
> > Signed-off-by: Anis Chali <anis.chali@ro-main.com>
> > ---
> > drivers/usb/storage/Kconfig | 5 +++++
> > drivers/usb/storage/usb.c | 6 +++---
> > 2 files changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
> > index efca9874d5..90a62a9d24 100644
> > --- a/drivers/usb/storage/Kconfig
> > +++ b/drivers/usb/storage/Kconfig
> > @@ -2,3 +2,8 @@
> > config USB_STORAGE
> > tristate "USB Mass Storage support"
> > select DISK
> > +
> > +config USBDISK_NAME
> > + string "USB storage disk name"
> > + depends on USB_STORAGE
> > + default "disk"
> > diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
> > index b3116dc6e6..b6944f531d 100644
> > --- a/drivers/usb/storage/usb.c
> > +++ b/drivers/usb/storage/usb.c
> > @@ -414,12 +414,12 @@ static int usb_stor_add_blkdev(struct us_data *us, unsigned char lun)
> > if (result < 0)
> > goto BadDevice;
> >
> > - result = cdev_find_free_index("disk");
> > + result = cdev_find_free_index(CONFIG_USBDISK_NAME);
> > if (result == -1)
> > pr_err("Cannot find a free number for the disk node\n");
> > - dev_info(dev, "registering as disk%d\n", result);
> > + dev_info(dev, "registering as %s%d\n", CONFIG_USBDISK_NAME, result);
> >
> > - pblk_dev->blk.cdev.name = basprintf("disk%d", result);
> > + pblk_dev->blk.cdev.name = basprintf("%s%d", CONFIG_USBDISK_NAME, result);
> > pblk_dev->blk.blockbits = SECTOR_SHIFT;
> > pblk_dev->blk.type = BLK_TYPE_USB;
> > pblk_dev->blk.removable = true;
> > --
> > 2.54.0
> >
> >
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: storage: make disk cdev name configurable via Kconfig
2026-08-27 12:01 ` [PATCH] usb: storage: make disk cdev name configurable via Kconfig chalianis1
@ 2026-08-28 14:39 ` Sascha Hauer
2026-08-28 16:28 ` chalianis1
0 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2026-08-28 14:39 UTC (permalink / raw)
To: chalianis1; +Cc: chalianis1, barebox, Anis Chali
On 2026-08-27 14:01, chalianis1 wrote:
> On 2026-06-30 12:41 +0000, Sascha Hauer wrote:
> > Hi,
> >
> > On 2026-06-23 10:26, chalianis1 wrote:
> > > From: Anis Chali <anis.chali@ro-main.com>
> > >
> > > Add USBDISK_NAME string option to allow customizing the USB storage
> > > device name, defaulting to "disk" to preserve existing behaviour.
> >
> > I just sent a patch which registers USB storage devices with usbdiskx
> > which doesn't require compile time changes. I hope that suits your needs
> > as well.
> >
> > Sascha
> >
> Hi,
>
> In my side I am migrating to master so removed my patch for this and
> I noticed that alias is not mounted to be used as /mnt/usbdiskX, I am
> just asking to know if it the expected behaviour in which case I will
> for an other way to get it mounted as /mnt/usbdisk0
But it still is automounted via /mnt/disk0, right? I just had a look
into it and yes, my patch doesn't add the automount for the aliases.
I'll look into it next week. I hope we get away to just create a
symbolic link from the alias to the real cdev, i.e. from /mnt/usbdisk0 to
/mnt/disk0. That would have to be done in
cdev_create_default_automount().
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: storage: make disk cdev name configurable via Kconfig
2026-08-28 14:39 ` Sascha Hauer
@ 2026-08-28 16:28 ` chalianis1
2026-08-31 11:04 ` Sascha Hauer
0 siblings, 1 reply; 8+ messages in thread
From: chalianis1 @ 2026-08-28 16:28 UTC (permalink / raw)
To: Sascha Hauer; +Cc: chalianis1, barebox, Anis Chali
On 2026-08-28 14:39 +0000, Sascha Hauer wrote:
> On 2026-08-27 14:01, chalianis1 wrote:
> > On 2026-06-30 12:41 +0000, Sascha Hauer wrote:
> > > Hi,
> > >
> > > On 2026-06-23 10:26, chalianis1 wrote:
> > > > From: Anis Chali <anis.chali@ro-main.com>
> > > >
> > > > Add USBDISK_NAME string option to allow customizing the USB storage
> > > > device name, defaulting to "disk" to preserve existing behaviour.
> > >
> > > I just sent a patch which registers USB storage devices with usbdiskx
> > > which doesn't require compile time changes. I hope that suits your needs
> > > as well.
> > >
> > > Sascha
> > >
> > Hi,
> >
> > In my side I am migrating to master so removed my patch for this and
> > I noticed that alias is not mounted to be used as /mnt/usbdiskX, I am
> > just asking to know if it the expected behaviour in which case I will
> > for an other way to get it mounted as /mnt/usbdisk0
>
> But it still is automounted via /mnt/disk0, right? I just had a look
> into it and yes, my patch doesn't add the automount for the aliases.
Yes exact it is mounted as /mnt/diskX
> I'll look into it next week. I hope we get away to just create a
> symbolic link from the alias to the real cdev, i.e. from /mnt/usbdisk0 to
> /mnt/disk0. That would have to be done in
> cdev_create_default_automount().
Thank you
> Sascha
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
>
>
>
>
Best regards
Anis
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: storage: make disk cdev name configurable via Kconfig
2026-08-28 16:28 ` chalianis1
@ 2026-08-31 11:04 ` Sascha Hauer
2026-08-31 11:17 ` chalianis1
0 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2026-08-31 11:04 UTC (permalink / raw)
To: chalianis1; +Cc: chalianis1, barebox, Anis Chali
On 2026-08-28 18:28, chalianis1 wrote:
> On 2026-08-28 14:39 +0000, Sascha Hauer wrote:
> > On 2026-08-27 14:01, chalianis1 wrote:
> > > On 2026-06-30 12:41 +0000, Sascha Hauer wrote:
> > > > Hi,
> > > >
> > > > On 2026-06-23 10:26, chalianis1 wrote:
> > > > > From: Anis Chali <anis.chali@ro-main.com>
> > > > >
> > > > > Add USBDISK_NAME string option to allow customizing the USB storage
> > > > > device name, defaulting to "disk" to preserve existing behaviour.
> > > >
> > > > I just sent a patch which registers USB storage devices with usbdiskx
> > > > which doesn't require compile time changes. I hope that suits your needs
> > > > as well.
> > > >
> > > > Sascha
> > > >
> > > Hi,
> > >
> > > In my side I am migrating to master so removed my patch for this and
> > > I noticed that alias is not mounted to be used as /mnt/usbdiskX, I am
> > > just asking to know if it the expected behaviour in which case I will
> > > for an other way to get it mounted as /mnt/usbdisk0
> >
> > But it still is automounted via /mnt/disk0, right? I just had a look
> > into it and yes, my patch doesn't add the automount for the aliases.
> Yes exact it is mounted as /mnt/diskX
> > I'll look into it next week. I hope we get away to just create a
> > symbolic link from the alias to the real cdev, i.e. from /mnt/usbdisk0 to
> > /mnt/disk0. That would have to be done in
> > cdev_create_default_automount().
> Thank you
See https://lore.barebox.org/barebox/20260831-usbdisk-aliases-v1-0-0a2e40a35f3d@pengutronix.de/T/#t
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: storage: make disk cdev name configurable via Kconfig
2026-08-31 11:04 ` Sascha Hauer
@ 2026-08-31 11:17 ` chalianis1
0 siblings, 0 replies; 8+ messages in thread
From: chalianis1 @ 2026-08-31 11:17 UTC (permalink / raw)
To: Sascha Hauer; +Cc: chalianis1, barebox, Anis Chali
On 2026-08-31 11:04 +0000, Sascha Hauer wrote:
> On 2026-08-28 18:28, chalianis1 wrote:
> > On 2026-08-28 14:39 +0000, Sascha Hauer wrote:
> > > On 2026-08-27 14:01, chalianis1 wrote:
> > > > On 2026-06-30 12:41 +0000, Sascha Hauer wrote:
> > > > > Hi,
> > > > >
> > > > > On 2026-06-23 10:26, chalianis1 wrote:
> > > > > > From: Anis Chali <anis.chali@ro-main.com>
> > > > > >
> > > > > > Add USBDISK_NAME string option to allow customizing the USB storage
> > > > > > device name, defaulting to "disk" to preserve existing behaviour.
> > > > >
> > > > > I just sent a patch which registers USB storage devices with usbdiskx
> > > > > which doesn't require compile time changes. I hope that suits your needs
> > > > > as well.
> > > > >
> > > > > Sascha
> > > > >
> > > > Hi,
> > > >
> > > > In my side I am migrating to master so removed my patch for this and
> > > > I noticed that alias is not mounted to be used as /mnt/usbdiskX, I am
> > > > just asking to know if it the expected behaviour in which case I will
> > > > for an other way to get it mounted as /mnt/usbdisk0
> > >
> > > But it still is automounted via /mnt/disk0, right? I just had a look
> > > into it and yes, my patch doesn't add the automount for the aliases.
> > Yes exact it is mounted as /mnt/diskX
> > > I'll look into it next week. I hope we get away to just create a
> > > symbolic link from the alias to the real cdev, i.e. from /mnt/usbdisk0 to
> > > /mnt/disk0. That would have to be done in
> > > cdev_create_default_automount().
> > Thank you
>
> See https://lore.barebox.org/barebox/20260831-usbdisk-aliases-v1-0-0a2e40a35f3d@pengutronix.de/T/#t
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
>
>
>
Thank's
best regards,
Anis
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-08-31 11:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-23 14:26 [PATCH] usb: storage: make disk cdev name configurable via Kconfig chalianis1
2026-06-30 12:41 ` Sascha Hauer
2026-07-07 5:57 ` [PATCH] USB: make storage device name configurable chalianis1
2026-08-27 12:01 ` [PATCH] usb: storage: make disk cdev name configurable via Kconfig chalianis1
2026-08-28 14:39 ` Sascha Hauer
2026-08-28 16:28 ` chalianis1
2026-08-31 11:04 ` Sascha Hauer
2026-08-31 11:17 ` chalianis1
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox