sector from the /sys/block/.../start file. The file exists only for
partitions, for wholedisk is the start of the device always zero.
References: https://bugzilla.redhat.com/show_bug.cgi?id=
1202443
Signed-off-by: Karel Zak <kzak@redhat.com>
long ra;
unsigned long long bytes;
uint64_t start = 0;
- struct sysfs_cxt cxt;
struct stat st;
fd = open(device, O_RDONLY | O_NONBLOCK);
ro = ssz = bsz = 0;
ra = 0;
- if (fstat(fd, &st) == 0) {
+ if (fstat(fd, &st) == 0 && !sysfs_devno_is_wholedisk(st.st_rdev)) {
+ struct sysfs_cxt cxt;
+
if (sysfs_init(&cxt, st.st_rdev, NULL))
err(EXIT_FAILURE,
_("%s: failed to initialize sysfs handler"),