On Sunday 09 Nov 2003 10:25 am, you wrote: > > Sure, I haven't taken the time to look closely enough at JFS to figure > out it's labeling stuff, but if you have and want to send a patch, I'd > be glad to add it. I think that reiserfs also has some labeling > functionality, but I haven't looked at it either. > Jeremy I have come up with these bits to add JFS label support in anaconda please take a look at this. You will need to integrate 2 more changes one in partedUtils and the other in readFSLabel which was in my XFS patch. The second one would benefit if isys could do isValidwhatever otherwise I would have to do something like try: readsomefslabel except: continue try: someotherfslabel except: continue please advise as to which is better. Next I will go off and poke around with reiserfs. Thanks & regards Ajay
diff -Naur anaconda-9.2/fsset.py anaconda-9.2-jfs/fsset.py --- anaconda-9.2/fsset.py 2003-10-21 04:38:12.000000000 +0530 +++ anaconda-9.2-jfs/fsset.py 2003-11-10 09:08:04.000000000 +0530 @@ -435,6 +435,7 @@ self.formattable = 1 self.checked = 1 self.linuxnativefs = 1 + self.maxLabelChars = 16 # this is totally, 100% unsupported. Boot with "linux jfs" # at the boot: prompt will let you make new reiserfs filesystems # in the installer. Bugs filed when you use this will be closed @@ -457,6 +458,13 @@ self.maxSizeMB = 1024 * 1024 + def labelDevice(self, entry, chroot): + devicePath = entry.device.setupDevice(chroot) + label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars) + rc = iutil.execWithRedirect("/sbin/jfs_tune", + ["jfs_tune", "-L", label, devicePath], + stdout = "/dev/tty5", + stderr = "/dev/tty5") def formatDevice(self, entry, progress, chroot='/'): devicePath = entry.device.setupDevice(chroot) diff -Naur anaconda-9.2/isys/isys.py anaconda-9.2-jfs/isys/isys.py --- anaconda-9.2/isys/isys.py 2003-10-17 05:08:19.000000000 +0530 +++ anaconda-9.2-jfs/isys/isys.py 2003-11-10 09:48:46.000000000 +0530 @@ -473,6 +473,32 @@ # otherwise return _isys.pumpnetdevice(device) +def readJFSLabel_int(device): + jfslabel = None + try: + fd = os.open(device, os.O_RDONLY) + except: + return jfslabel + + os.lseek(fd,32768,0) + buf = os.read(fd, 180) + os.close(fd) + + if (len(buf) == 180 and buf[0:4] == "JFS1"): + jfslabel = string.rstrip(buf[152:168],"\0x00") + + return jfslabel + +def readJFSLabel(device, makeDevNode = 1): + if makeDevNode: + makeDevInode(device, "/tmp/disk") + label = readJFSLabel_int("/tmp/disk") + os.unlink("/tmp/disk") + else: + label = readJFSLabel_int(device) + return label + + def readExt2Label(device, makeDevNode = 1): if makeDevNode: makeDevInode(device, "/tmp/disk") diff -Naur anaconda-9.2/scripts/upd-instroot anaconda-9.2-jfs/scripts/upd-instroot --- anaconda-9.2/scripts/upd-instroot 2003-10-08 01:33:15.000000000 +0530 +++ anaconda-9.2-jfs/scripts/upd-instroot 2003-11-10 09:51:41.000000000 +0530 @@ -253,6 +253,7 @@ sbin/fdisk sbin/hdparm sbin/hwclock +sbin/jfs_tune sbin/ldconfig sbin/lvchange sbin/lvcreate
#!/usr/bin/python # # create testjfs with # dd if=/dev/zero of=testjfs bs=1M count=16 # # format with # mkfs.jfs -L testvolume -f testjfs # # change label with # jfs_tune -L newvol testjfs import os, string fd = os.open("testjfs", os.O_RDONLY) os.lseek(fd, 32768, 0) buf = os.read(fd, 180) os.close(fd) if (len(buf) == 180): print buf[0:4] l0 = buf[152:168] l1 = string.rstrip(l0, "\0x00") print l0, len(l0) print l1, len(l1)