mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] block: follow links before check if cdev_is_block_partition
@ 2025-07-23 15:55 Marco Felsch
  2025-07-24 11:28 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Marco Felsch @ 2025-07-23 15:55 UTC (permalink / raw)
  To: barebox

cdev_is_block_partition() fails if a cdev is passed which is a
parition-link. Most of our barebox code is link-aware by resolving the
links first.

Make it more user-friendly and resolve the possible cdev parttion link
first before performing the actual check.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 include/block.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/block.h b/include/block.h
index 5ce3eb7d7838..a5a2dcf58995 100644
--- a/include/block.h
+++ b/include/block.h
@@ -107,6 +107,7 @@ static inline bool cdev_is_block_device(const struct cdev *cdev)
 
 static inline bool cdev_is_block_partition(const struct cdev *cdev)
 {
+	cdev = cdev_readlink(cdev);
 	return cdev_is_block_device(cdev) && cdev_is_partition(cdev);
 }
 
-- 
2.39.5




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: follow links before check if cdev_is_block_partition
  2025-07-23 15:55 [PATCH] block: follow links before check if cdev_is_block_partition Marco Felsch
@ 2025-07-24 11:28 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2025-07-24 11:28 UTC (permalink / raw)
  To: Marco Felsch, barebox

On 7/23/25 17:55, Marco Felsch wrote:
> cdev_is_block_partition() fails if a cdev is passed which is a
> parition-link. Most of our barebox code is link-aware by resolving the
> links first.
> 
> Make it more user-friendly and resolve the possible cdev parttion link
> first before performing the actual check.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

Acked-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  include/block.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/block.h b/include/block.h
> index 5ce3eb7d7838..a5a2dcf58995 100644
> --- a/include/block.h
> +++ b/include/block.h
> @@ -107,6 +107,7 @@ static inline bool cdev_is_block_device(const struct cdev *cdev)
>  
>  static inline bool cdev_is_block_partition(const struct cdev *cdev)
>  {
> +	cdev = cdev_readlink(cdev);
>  	return cdev_is_block_device(cdev) && cdev_is_partition(cdev);
>  }
>  

-- 
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] 2+ messages in thread

end of thread, other threads:[~2025-07-24 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-23 15:55 [PATCH] block: follow links before check if cdev_is_block_partition Marco Felsch
2025-07-24 11:28 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox