[PATCH 2/6] libxfs/linux.c: Replace use of ustat by stat

Christoph Hellwig hch at infradead.org
Wed Jan 13 01:55:01 CST 2016


On Tue, Jan 12, 2016 at 08:59:45PM +0100, Felix Janda wrote:
> ustat has been used to check whether a device file is mounted.
> The function is deprecated and not supported by uclibc and musl.
> Now do the check using the *mntent functions.
> 
> Based on patch by Natanael Copa <ncopa at alpinelinux.org>.
> 
> Signed-off-by: Felix Janda <felix.janda at posteo.de>

ustat is a lot more efficient in checking for the mountedness
than this loop, so I'd really prefer not to do this unconditionally.

As far as Linux is concerned the best thing we could do is to use
O_EXCL for any open of a device file, as Linux overloadds O_EXCL
behavior for block devices so that any other O_EXCL open will
be rejected if one has the file open.

But that might be a major pain to find into the cross platform
framework..



More information about the xfs mailing list