diff options
author | Ahmad Fatoum <ahmad@a3f.at> | 2022-06-02 21:59:16 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-06-10 09:50:46 +0200 |
commit | 84173bf3d0ccc4036a16c4b074642aea59648063 (patch) | |
tree | 3ca5e91b8891798f038a8f408224f8ff301822b0 /commands/memtester | |
parent | 7cceef54a045ca8b9b33145b708d843b371718ba (diff) | |
download | barebox-84173bf3d0ccc4036a16c4b074642aea59648063.tar.gz |
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 'commands/memtester')
-rw-r--r-- | commands/memtester/memtester.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/commands/memtester/memtester.c b/commands/memtester/memtester.c index 130dc97c83..f4adbfc855 100644 --- a/commands/memtester/memtester.c +++ b/commands/memtester/memtester.c @@ -113,7 +113,7 @@ static int do_memtester(int argc, char **argv) { strerror(errno)); return COMMAND_ERROR_USAGE; } else { - if (!S_ISCHR(statbuf.st_mode)) { + if (!S_ISCHR(statbuf.st_mode) && !S_ISBLK(statbuf.st_mode)) { printf("can not mmap non-char device %s\n", optarg); return COMMAND_ERROR_USAGE; |