diff -Naur anaconda-9.2/fsset.py anaconda-9.2-patched/fsset.py --- anaconda-9.2/fsset.py 2003-10-21 04:38:12.000000000 +0530 +++ anaconda-9.2-patched/fsset.py 2003-11-06 17:46:00.000000000 +0530 @@ -1335,7 +1335,7 @@ if not entry.mountpoint or entry.mountpoint == "swap": continue try: - label = isys.readExt2Label(dev) + label = isys.readFSLabel(dev) except: continue if label: @@ -1644,7 +1644,7 @@ def getLabel(self): try: - return isys.readExt2Label(self.setupDevice(), makeDevNode = 0) + return isys.readFSLabel(self.setupDevice(), makeDevNode = 0) except: return "" @@ -2213,6 +2213,23 @@ os.close(fd) return 0 +def isValidJFS(device): + fd = getDevFD(device) + if fd == -1: + return 0 + + try: + os.lseek(fd, 32768, 0) + buf = os.read(fd, 128) + except: + buf = "" + + if (buf[0:4] == "JFS1"): + os.close(fd) + return 1 + + os.close(fd) + return 0 # this will return a list of types of filesystems which device # looks like it could be to try mounting as @@ -2225,6 +2242,9 @@ if isValidReiserFS(device): rc.append("reiserfs") + if isValidJFS(device): + rc.append("jfs") + if isValidExt2(device): if os.access(device, os.O_RDONLY): create = 0 diff -Naur anaconda-9.2/isys/isys.py anaconda-9.2-patched/isys/isys.py --- anaconda-9.2/isys/isys.py 2003-10-17 05:08:19.000000000 +0530 +++ anaconda-9.2-patched/isys/isys.py 2003-11-07 07:11:35.000000000 +0530 @@ -473,6 +473,32 @@ # otherwise return _isys.pumpnetdevice(device) +def readXFSLabel_int(device): + try: + fd = os.open(device, os.O_RDONLY) + except: + return None + + buf = os.read(fd, 128) + os.close(fd) + + if len(buf) != 128: + xfslabel = None + + if buf[0:4] == "XFSB": + xfslabel = string.rstrip(buf[108:120],"\0x00") + + return xfslabel + +def readXFSLabel(device, makeDevNode = 1): + if makeDevNode: + makeDevInode(device, "/tmp/disk") + label = readXFSLabel_int("/tmp/disk") + os.unlink("/tmp/disk") + else: + label = readXFSLabel_int(device) + return label + def readExt2Label(device, makeDevNode = 1): if makeDevNode: makeDevInode(device, "/tmp/disk") @@ -482,6 +508,21 @@ label = _isys.e2fslabel(device) return label +def readFSLabel(device, makeDevNode = 1): + label = readXFSLabel(device, makeDevNode) + if (label == None): + label = readExt2Label(device, makeDevNode) + return label + +#def readFSLabel(device, makeDevNode = 1): +# fstype = partedUtils.sniffFilesystemType(device) +# if (fstype == "ext2" or fstype == "ext3") +# return readExt2Label(device, makeDevNode) +# elif (fstype == "xfs"): +# return readXFSLabel(device, makeDevNode) +# else: +# return "" + def ext2IsDirty(device): makeDevInode(device, "/tmp/disk") label = _isys.e2dirty("/tmp/disk"); diff -Naur anaconda-9.2/partedUtils.py anaconda-9.2-patched/partedUtils.py --- anaconda-9.2/partedUtils.py 2003-10-14 04:20:10.000000000 +0530 +++ anaconda-9.2-patched/partedUtils.py 2003-11-06 17:50:56.000000000 +0530 @@ -421,6 +421,9 @@ if fsset.isValidReiserFS(dev): return "reiserfs" + if fsset.isValidJFS(dev): + return "jfs" + # FIXME: we don't look for jfs, or vfat return None @@ -530,16 +533,17 @@ or part.get_flag(parted.PARTITION_LVM)) and part.fs_type and (part.fs_type.name == "ext2" - or part.fs_type.name == "ext3")) + or part.fs_type.name == "ext3" + or part.fs_type.name == "xfs")) parts = filter_partitions(disk, func) for part in parts: node = get_partition_name(part) - label = isys.readExt2Label(node) + label = isys.readFSLabel(node) if label: labels[node] = label for dev, devices, level, numActive in DiskSet.mdList: - label = isys.readExt2Label(dev) + label = isys.readFSLabel(dev) if label: labels[dev] = label