* Re: How to detect if ubi volume is empty
[not found] <CAOuPNLhN2pxa5KPpxiCBZMEGTgqaNddB6DZeB17tanp2gQgX1w@mail.gmail.com>
@ 2024-05-20 10:22 ` Pintu Agarwal
2024-05-21 11:08 ` Zhihao Cheng
0 siblings, 1 reply; 2+ messages in thread
From: Pintu Agarwal @ 2024-05-20 10:22 UTC (permalink / raw)
To: linux-mtd, linux-fsdevel, linux-fsdevel, Ezequiel Garcia,
Bjørn Mork
Hi,
In Linux Kernel 5.15 is there a way to detect in runtime, if UBI
volume (squashfs based, ubiblock, dynamic) is empty or not ?
Based on this we need to make some decisions at runtime.
Currently, we are using a crude way to detect volume empty by reading
the first 1K block using the "dd" command and checking if the contents
are all FF.
Is this good enough, or is there some other better way ?
Thanks.
Pintu
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to detect if ubi volume is empty
2024-05-20 10:22 ` How to detect if ubi volume is empty Pintu Agarwal
@ 2024-05-21 11:08 ` Zhihao Cheng
0 siblings, 0 replies; 2+ messages in thread
From: Zhihao Cheng @ 2024-05-21 11:08 UTC (permalink / raw)
To: Pintu Agarwal, linux-mtd, linux-fsdevel, linux-fsdevel,
Ezequiel Garcia, Bjørn Mork
在 2024/5/20 18:22, Pintu Agarwal 写道:
> Hi,
>
> In Linux Kernel 5.15 is there a way to detect in runtime, if UBI
> volume (squashfs based, ubiblock, dynamic) is empty or not ?
There is a way to get the empty state of UBI volume by ioctl
UBI_IOCEBUNMAP, for example:
fd = open(UBI_VOLUME, O_EXCL)
check_volume_empty [1]
close(fd)
[1]
https://www.linux-mtd.infradead.org/?p=mtd-utils.git;a=blob;f=ubifs-utils/mkfs.ubifs/mkfs.ubifs.c;h=42a47f839e115567de58e8cdfcc50c4202fc7af1;hb=refs/heads/master#l2804
> Based on this we need to make some decisions at runtime.
>
> Currently, we are using a crude way to detect volume empty by reading
> the first 1K block using the "dd" command and checking if the contents
> are all FF.
>
> Is this good enough, or is there some other better way ?
>
> Thanks.
> Pintu
>
> .
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-21 11:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAOuPNLhN2pxa5KPpxiCBZMEGTgqaNddB6DZeB17tanp2gQgX1w@mail.gmail.com>
2024-05-20 10:22 ` How to detect if ubi volume is empty Pintu Agarwal
2024-05-21 11:08 ` Zhihao Cheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).