summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2022-06-02 21:59:16 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-06-10 09:50:46 +0200
commit84173bf3d0ccc4036a16c4b074642aea59648063 (patch)
tree3ca5e91b8891798f038a8f408224f8ff301822b0 /include
parent7cceef54a045ca8b9b33145b708d843b371718ba (diff)
downloadbarebox-84173bf3d0ccc4036a16c4b074642aea59648063.tar.gz
barebox-84173bf3d0ccc4036a16c4b074642aea59648063.tar.xz
block: set S_IFBLK for block devices instead of S_IFCHR
In barebox, block devices are a special case of character devices. Nevertheless, differentiation can be useful to allow scripts iterating over all block devices without accounting for naming, e.g. for dev in /dev/*; do test -b $dev && echo $dev: blockdevice done Add the necessary support. This will break scripts that assume test -c blockdevice to be true, but that's a quite improbable check. Tested-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20220602195916.9061-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/block.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/block.h b/include/block.h
index d3a154bf73..1fb40e942f 100644
--- a/include/block.h
+++ b/include/block.h
@@ -49,4 +49,13 @@ static inline int block_flush(struct block_device *blk)
return cdev_flush(&blk->cdev);
}
+#ifdef CONFIG_BLOCK
+struct block_device *cdev_get_block_device(struct cdev *cdev);
+#else
+static inline struct block_device *cdev_get_block_device(struct cdev *cdev)
+{
+ return NULL;
+}
+#endif
+
#endif /* __BLOCK_H */