diff options
author | Chris Lumens <clumens@redhat.com> | 2005-06-27 21:17:43 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2005-06-27 21:17:43 +0000 |
commit | 66e26cbfe6b118a8536bb1b72874865e75ebbcbf (patch) | |
tree | 98d2f661762518ff37535dc2f74e1e4256a2bf5d /fsset.py | |
parent | fb4043fed810b52570db5c698e3e260ff20e5ab8 (diff) | |
download | anaconda-66e26cbfe6b118a8536bb1b72874865e75ebbcbf.tar.gz anaconda-66e26cbfe6b118a8536bb1b72874865e75ebbcbf.tar.xz anaconda-66e26cbfe6b118a8536bb1b72874865e75ebbcbf.zip |
Added a clobberDevice method that is used before formatting a device to
get rid of any identifying information (such as labels).
Diffstat (limited to 'fsset.py')
-rw-r--r-- | fsset.py | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -285,6 +285,9 @@ class FileSystemType: def labelDevice(self, entry, chroot): pass + + def clobberDevice(self, entry, chroot): + pass def isFormattable(self): return self.formattable @@ -557,6 +560,10 @@ class extFileSystem(FileSystemType): if rc: raise SystemError + def clobberDevice(self, entry, chroot): + device = entry.device.setupDevice(chroot) + isys.ext2Clobber(device) + # this is only for ext3 filesystems, but migration is a method # of the ext2 fstype, so it needs to be here. FIXME should be moved def setExt3Options(self, entry, message, chroot='/'): @@ -766,6 +773,17 @@ class swapFileSystem(FileSystemType): raise SystemError entry.setLabel(label) + def clobberDevice(self, entry, chroot): + pagesize = isys.getpagesize() + dev = entry.device.setupDevice(chroot) + try: + fd = os.open(dev, os.O_RDWR) + buf = "\0x00" * pagesize + os.write(fd, buf) + os.close(fd) + except: + pass + fileSystemTypeRegister(swapFileSystem()) class FATFileSystem(FileSystemType): @@ -1439,6 +1457,7 @@ MAILADDR root def formatEntry(self, entry, chroot): log("formatting %s as %s" %(entry.mountpoint, entry.fsystem.name)) + entry.fsystem.clobberDevice(entry, chroot) entry.fsystem.formatDevice(entry, self.progressWindow, chroot) def badblocksEntry(self, entry, chroot): |