- for disc in listdir("/dev/discs"):
- path = readlink('/dev/discs/'+disc)
- devidex = '/dev/discs/'+disc+'/'
- devidex2 = '/dev'+path[2:]+'/'
- disc = devidex2+'disc'
- ret = stat(disc).st_rdev
- if s_major == major(ret) and s_minor == minor(ret):
- self.devidex = devidex
- self.devidex2 = devidex2
- print "new Harddisk", device, '->', self.devidex, '->', self.devidex2
- self.startIdle()
- break
+
+ self.dev_path = ''
+ self.disk_path = ''
+ self.phys_path = path.realpath(self.sysfsPath('device'))
+
+ if self.type == self.DEVTYPE_UDEV:
+ self.dev_path = '/dev/' + self.device
+ self.disk_path = self.dev_path
+
+ elif self.type == self.DEVTYPE_DEVFS:
+ tmp = readFile(self.sysfsPath('dev')).split(':')
+ s_major = int(tmp[0])
+ s_minor = int(tmp[1])
+ for disc in listdir("/dev/discs"):
+ dev_path = path.realpath('/dev/discs/' + disc)
+ disk_path = dev_path + '/disc'
+ try:
+ rdev = stat(disk_path).st_rdev
+ except OSError:
+ continue
+ if s_major == major(rdev) and s_minor == minor(rdev):
+ self.dev_path = dev_path
+ self.disk_path = disk_path
+ break
+
+ print "new Harddisk", self.device, '->', self.dev_path, '->', self.disk_path
+ self.startIdle()