[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] use less things in /tmp



This switches various things to use /dev for device nodes instead of /tmp.

Tested by installing on a box with both raid and LVM. I suppose long-term
we'd switch to udev and just assume the device nodes are there.

Bill
Index: dmraid.py
===================================================================
RCS file: /usr/local/CVS/anaconda/dmraid.py,v
retrieving revision 1.21
diff -u -r1.21 dmraid.py
--- dmraid.py	6 Jul 2007 15:38:08 -0000	1.21
+++ dmraid.py	28 Sep 2007 14:30:05 -0000
@@ -122,11 +122,8 @@
 
     probeDrives = []
     for d in drives:
-        dp = "/dev/" + d
-        isys.makeDevInode(d, dp)
+        dp = isys.makeDevInode(d)
         probeDrives.append(dp)
-        dp = "/tmp/" + d
-        isys.makeDevInode(d, dp)
     
     dmsets = []
     def nonDegraded(rs):
@@ -240,11 +237,8 @@
 
     probeDrives = []
     for d in drives:
-        dp = "/dev/" + d
-        isys.makeDevInode(d, dp)
+        dp = isys.makeDevInode(d)
         probeDrives.append(dp)
-        dp = "/tmp/" + d
-        isys.makeDevInode(d, dp)
 
     import block as _block
     oldPath = _block.getBdevidPath()
Index: fsset.py
===================================================================
RCS file: /usr/local/CVS/anaconda/fsset.py,v
retrieving revision 1.338
diff -u -r1.338 fsset.py
--- fsset.py	20 Sep 2007 14:59:27 -0000	1.338
+++ fsset.py	28 Sep 2007 14:30:05 -0000
@@ -1812,7 +1812,7 @@
         self.format = format
         self.bytesPerInode = bytesPerInode
 
-    def mount(self, chroot='/', devPrefix='/tmp', readOnly = 0):
+    def mount(self, chroot='/', devPrefix='/dev', readOnly = 0):
         device = self.device.setupDevice(chroot, devPrefix=devPrefix)
 
         # FIXME: we really should migrate before turnOnFilesystems.
@@ -1910,10 +1910,10 @@
     def getDevice (self, asBoot = 0):
         return self.device
 
-    def setupDevice (self, chroot='/', devPrefix='/tmp'):
+    def setupDevice (self, chroot='/', devPrefix='/dev/'):
         return self.device
 
-    def cleanupDevice (self, chroot, devPrefix='/tmp'):
+    def cleanupDevice (self, chroot, devPrefix='/dev/'):
         pass
 
     def solidify (self):
@@ -2133,7 +2133,7 @@
 
         self.physicalextentsize = pesize
 
-    def setupDevice (self, chroot="/", devPrefix='/tmp'):
+    def setupDevice (self, chroot="/", devPrefix='/dev/'):
         nodes = []
         for volume in self.physicalVolumes:
             # XXX the lvm tools are broken and will only work for /dev
@@ -2177,7 +2177,7 @@
         # self.extents
         # self.readaheadsectors
 
-    def setupDevice(self, chroot="/", devPrefix='/tmp', vgdevice = None):
+    def setupDevice(self, chroot="/", devPrefix='/dev', vgdevice = None):
         if not self.isSetup:
             lvm.lvcreate(self.name, self.vgname, self.size)
             self.isSetup = 1
@@ -2205,7 +2205,7 @@
         if isys.driveIsIscsi(disk):
             self.setAsNetdev()
 
-    def setupDevice(self, chroot="/", devPrefix='/tmp'):
+    def setupDevice(self, chroot="/", devPrefix='/dev'):
         path = '%s/%s' % (devPrefix, self.getDevice(),)
         isys.makeDevInode(self.getDevice(), path)
         return path
@@ -2247,7 +2247,7 @@
     def setSize (self, size):
         self.size = size
 
-    def setupDevice (self, chroot="/", devPrefix='/tmp'):
+    def setupDevice (self, chroot="/", devPrefix='/dev'):
         file = os.path.normpath(chroot + self.getDevice())
         if not os.access(file, os.R_OK):
             if self.size:
@@ -2269,7 +2269,7 @@
         SwapFileDevice.__init__(self, file)
         self.piggypath = piggypath
         
-    def setupDevice(self, chroot="/", devPrefix='/tmp'):
+    def setupDevice(self, chroot="/", devPrefix='/dev'):
         return SwapFileDevice.setupDevice(self, self.piggypath, devPrefix)
 
 class LoopbackDevice(Device):
@@ -2279,7 +2279,7 @@
         self.hostfs = hostFs
         self.device = "loop1"
 
-    def setupDevice(self, chroot="/", devPrefix='/tmp/'):
+    def setupDevice(self, chroot="/", devPrefix='/dev/'):
         if not self.isSetup:
             isys.mount(self.host[5:], "/mnt/loophost", fstype = "vfat")
             self.device = allocateLoopback("/mnt/loophost/redhat.img")
@@ -2465,9 +2465,8 @@
     try:
         fd = os.open(device, os.O_RDONLY)
     except:
-        file = '/tmp/' + device
         try:
-            isys.makeDevInode(device, file)
+            file = isys.makeDevInode(device)
             fd = os.open(file, os.O_RDONLY)
         except:
             return -1
Index: partedUtils.py
===================================================================
RCS file: /usr/local/CVS/anaconda/partedUtils.py,v
retrieving revision 1.137
diff -u -r1.137 partedUtils.py
--- partedUtils.py	19 Sep 2007 20:32:59 -0000	1.137
+++ partedUtils.py	28 Sep 2007 14:30:05 -0000
@@ -444,12 +444,7 @@
     if os.access(device, os.O_RDONLY):
         dev = device
     else:
-        dev = "/tmp/" + device
-        if not os.access(dev, os.O_RDONLY):
-            try:
-                isys.makeDevInode(device, dev)
-            except:
-                pass
+        dev = isys.makeDevInode(device)
 
     pagesize = resource.getpagesize()
     if pagesize > 2048:
@@ -970,7 +965,7 @@
                              _("Please wait while formatting drive %s...\n"
                                ) % (drive,), 100)
         try:
-            isys.makeDevInode(drive, '/tmp/' + drive)
+            dev = isys.makeDevInode(drive)
         except:
             pass
 
@@ -980,7 +975,7 @@
                     "-d", "cdl",
                     "-F",
                     "-f",
-                    "/tmp/%s" % drive]
+                    dev]
         
         fd = os.open("/dev/null", os.O_RDWR | os.O_CREAT | os.O_APPEND)
         p = os.pipe()
Index: raid.py
===================================================================
RCS file: /usr/local/CVS/anaconda/raid.py,v
retrieving revision 1.34
diff -u -r1.34 raid.py
--- raid.py	27 Mar 2007 18:56:52 -0000	1.34
+++ raid.py	28 Sep 2007 14:30:05 -0000
@@ -65,9 +65,9 @@
 
     for d in drives:
         parts = []
-	isys.makeDevInode(d, "/tmp/" + d)
+	dp = isys.makeDevInode(d)
         try:
-            dev = parted.PedDevice.get("/tmp/" + d)
+            dev = parted.PedDevice.get(dp)
             disk = parted.PedDisk.new(dev)
 
             raidParts = partedUtils.get_raid_partitions(disk)
@@ -76,7 +76,6 @@
         except:
             pass
 
-	os.remove("/tmp/" + d)
         for dev in parts:
             try:
                 (major, minor, raidSet, level, nrDisks, totalDisks, mdMinor) =\
Index: isys/isys.py
===================================================================
RCS file: /usr/local/CVS/anaconda/isys/isys.py,v
retrieving revision 1.215
diff -u -r1.215 isys.py
--- isys/isys.py	17 Sep 2007 16:23:40 -0000	1.215
+++ isys/isys.py	28 Sep 2007 14:30:05 -0000
@@ -615,7 +615,7 @@
     try:
         os.stat(path)
     except OSError:
-        path = '/tmp/%s' % (name,)
+        path = '/dev/%s' % (name,)
         _isys.mkdevinode(name, path)
     return path
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]