Esempio n. 1
0
 def _mknod_ide(self, devpath):
     ide_rdev = [lowlevel.makedev( 3,  0), lowlevel.makedev( 3, 64),
                 lowlevel.makedev(22,  0), lowlevel.makedev(22, 64),
                 lowlevel.makedev(33,  0), lowlevel.makedev(33, 64),
                 lowlevel.makedev(34,  0), lowlevel.makedev(34, 64),
                 lowlevel.makedev(56,  0), lowlevel.makedev(56, 64),
                 lowlevel.makedev(57,  0), lowlevel.makedev(57, 64),
                 lowlevel.makedev(88,  0), lowlevel.makedev(88, 64),
                 lowlevel.makedev(89,  0), lowlevel.makedev(89, 64),
                 lowlevel.makedev(90,  0), lowlevel.makedev(90, 64),
                 lowlevel.makedev(91,  0), lowlevel.makedev(91, 64)]
     devfn = os.path.basename(devpath)
     dev_t0 = ide_rdev[ord(devfn[2]) - ord('a')]
     if devfn[3:] == '':
         dev_t1 = 0
     else:
         dev_t1 = int(devfn[3:])
     lowlevel.mknod(devpath, 0600 | lowlevel.S_IFBLK, dev_t0 + dev_t1)
Esempio n. 2
0
 def _mknod_scsi(self, devpath):
     scsi_rdev = [lowlevel.makedev( 8,   0), lowlevel.makedev( 8,  16),
                  lowlevel.makedev( 8,  32), lowlevel.makedev( 8,  48),
                  lowlevel.makedev( 8,  64), lowlevel.makedev( 8,  80),
                  lowlevel.makedev( 8,  96), lowlevel.makedev( 8, 112),
                  lowlevel.makedev( 8, 128), lowlevel.makedev( 8, 144),
                  lowlevel.makedev( 8, 160), lowlevel.makedev( 8, 176),
                  lowlevel.makedev( 8, 192), lowlevel.makedev( 8, 208),
                  lowlevel.makedev( 8, 224), lowlevel.makedev( 8, 240),
                  lowlevel.makedev(65,   0), lowlevel.makedev(65,  16),
                  lowlevel.makedev(65,  32), lowlevel.makedev(65,  48),
                  lowlevel.makedev(65,  64), lowlevel.makedev(65,  80),
                  lowlevel.makedev(65,  96), lowlevel.makedev(65, 112),
                  lowlevel.makedev(65, 128), lowlevel.makedev(65, 144)]
     devfn = os.path.basename(devpath)
     dev_t0 = scsi_rdev[ord(devfn[2]) - ord('a')]
     if devfn[3:] == '':
         dev_t1 = 0
     else:
         dev_t1 = int(devfn[3:])
     lowlevel.mknod(devpath, 0600 | lowlevel.S_IFBLK, dev_t0 + dev_t1)
Esempio n. 3
0
#!/usr/bin/python

import string
import sys

import lowlevel

# Usage: python t-lowlevel.py hda:3:0

for dev in sys.argv[1:]:
    (devfn, devmajor, devminor) = string.split(dev, ':')
    print lowlevel.makedev(int(devmajor), int(devminor))
    lowlevel.mknod(devfn, 0600 | lowlevel.S_IFBLK,
                   lowlevel.makedev(int(devmajor), int(devminor)))