How can userspace applications query the size of devdax character devices? stat(1) doesn't know how large the device is:
# stat /dev/dax0.0 File: /dev/dax0.0 Size: 0 Blocks: 0 IO Block: 4096 character special file Device: 6h/6d Inode: 56764 Links: 1 Device type: fa,d ndctl(1) finds out by digging in /sys: # ndctl list [ { "dev":"namespace0.0", "mode":"devdax", "map":"dev", "size":2111832064, "uuid":"235acf4d-503f-46be-bf64-f26faf9777ef", "chardev":"dax0.0" } ] I'm not sure how to do it without enumerating all nvdimms in /sys. Is there a mapping from devdax major/minor number to a /sys path? The use case I have in mind is that QEMU currently takes the size as a command-line parameter. The failure mode is ugly when users get this value wrong: the guest gets a softlockup and there is no error message on the host side. I'd like QEMU to detect the size or at least reject size values that are too large. In order to do that userspace needs a convenient way of querying the size. Any ideas? Stefan
signature.asc
Description: PGP signature