summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-02-03 04:15:44 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-02-03 04:15:44 +0000
commit83d0abcbd63cc7ce6a73ff6cc22a8f55bf525757 (patch)
tree5dd0cac97fdc77e89eda35ffa20ae931e93b38a6
parent0ef9cc965384f62969d4b7dcceee7eb53a554f16 (diff)
downloadanaconda-83d0abcbd63cc7ce6a73ff6cc22a8f55bf525757.tar.gz
anaconda-83d0abcbd63cc7ce6a73ff6cc22a8f55bf525757.tar.xz
anaconda-83d0abcbd63cc7ce6a73ff6cc22a8f55bf525757.zip
* isys/isys.py (readReiserFSLabel): Support all valid reiserfs
block sizes.
-rw-r--r--ChangeLog5
-rw-r--r--isys/isys.py30
2 files changed, 21 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index e20597fda..ee8f1bcb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2006-02-02 David Cantrell <dcantrell@redhat.com>
+ * isys/isys.py (readReiserFSLabel): Support all valid reiserfs
+ block sizes.
+
+2006-02-02 David Cantrell <dcantrell@redhat.com>
+
* scripts/upd-instroot: Add reiserfstune.
* isys/isys.py: Added readReiserFSLabel() and related functions
diff --git a/isys/isys.py b/isys/isys.py
index d7b94d427..dad6f0583 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -693,22 +693,24 @@ def readReiserFSLabel_int(device):
log.debug("error opening device %s: %s" % (device, e))
return label
+ # valid block sizes in reiserfs are 512 - 8192, powers of 2
+ # we put 4096 first, since it's the default
# reiserfs superblock occupies either the 2nd or 16th block
- # blocks are apparently always 4096 bytes
- for start in (4096, (4096*16)):
- try:
- os.lseek(fd, start, 0)
- # read 120 bytes to get s_magic and s_label
- buf = os.read(fd, 120)
- except OSError, e:
- log.debug("error reading reiserfs label on %s: %s" %(device, e))
-
+ for blksize in (4096, 512, 1024, 2048, 8192):
+ for start in (blksize, (blksize*16)):
try:
- os.close(fd)
- except:
- pass
-
- return label
+ os.lseek(fd, start, 0)
+ # read 120 bytes to get s_magic and s_label
+ buf = os.read(fd, 120)
+ except OSError, e:
+ log.debug("error reading reiserfs label on %s: %s" %(device, e))
+
+ try:
+ os.close(fd)
+ except:
+ pass
+
+ return label
# see if this block is the superblock
# this reads reiserfs_super_block_v1.s_magic as defined