Revision 7706fdd4 tools/lvmstrap
b/tools/lvmstrap | ||
---|---|---|
430 | 430 |
if not compat.any([name.startswith(pfx) for pfx in SUPPORTED_TYPES]): |
431 | 431 |
continue |
432 | 432 |
|
433 |
size = ReadSize("/sys/block/%s" % name) |
|
433 |
disksysfsname = "/sys/block/%s" % name |
|
434 |
size = ReadSize(disksysfsname) |
|
434 | 435 |
|
435 | 436 |
f = open("/sys/block/%s/removable" % name) |
436 | 437 |
removable = int(f.read().strip()) |
... | ... | |
439 | 440 |
if removable and not opts.removable_ok: |
440 | 441 |
continue |
441 | 442 |
|
442 |
dev = ReadDev("/sys/block/%s" % name)
|
|
443 |
dev = ReadDev(disksysfsname)
|
|
443 | 444 |
CheckSysDev(name, dev) |
444 | 445 |
inuse = InUse(name) |
445 | 446 |
# Enumerate partitions of the block device |
446 | 447 |
partitions = [] |
447 |
for partname in os.listdir("/sys/block/%s" % name):
|
|
448 |
for partname in os.listdir(disksysfsname):
|
|
448 | 449 |
if not partname.startswith(name): |
449 | 450 |
continue |
450 |
partdev = ReadDev("/sys/block/%s/%s" % (name, partname)) |
|
451 |
partsize = ReadSize("/sys/block/%s/%s" % (name, partname)) |
|
451 |
partsysfsname = "%s/%s" % (disksysfsname, partname) |
|
452 |
partdev = ReadDev(partsysfsname) |
|
453 |
partsize = ReadSize(partsysfsname) |
|
452 | 454 |
if partsize >= PART_MINSIZE: |
453 | 455 |
CheckSysDev(partname, partdev) |
454 | 456 |
partitions.append((partname, partsize, partdev)) |
Also available in: Unified diff