/[gli]/trunk/src/GLIStorageDevice.py
Gentoo

Diff of /trunk/src/GLIStorageDevice.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 211 Revision 212
10 _total_sectors = 0 10 _total_sectors = 0
11 _cylinder_bytes = 0 11 _cylinder_bytes = 0
12 _sectors_in_cylinder = 0 12 _sectors_in_cylinder = 0
13 _parted_dev = None 13 _parted_dev = None
14 _parted_disk = None 14 _parted_disk = None
15 _fdiskcall = "fdisk -l " 15 _sector_bytes = 0
16 16
17 def __init__(self, device): 17 def __init__(self, device):
18 self._device = device 18 self._device = device
19 self._partitions = {} 19 self._partitions = {}
20 self._geometry = {'cylinders': 0, 'heads': 0, 'sectors': 0, 'sectorsize': 512} 20 self._geometry = {'cylinders': 0, 'heads': 0, 'sectors': 0, 'sectorsize': 512}
35# cylinders = int(total_sectors) / (int(heads) * int(sectors)) 35# cylinders = int(total_sectors) / (int(heads) * int(sectors))
36# self._geometry['heads'], self._geometry['sectors'], self._geometry['cylinders'] = int(heads), int(sectors), int(cylinders) 36# self._geometry['heads'], self._geometry['sectors'], self._geometry['cylinders'] = int(heads), int(sectors), int(cylinders)
37# else: #SCSI 37# else: #SCSI
38 self._geometry['heads'], self._geometry['sectors'], self._geometry['cylinders'] = self._parted_dev.heads, self._parted_dev.sectors, self._parted_dev.cylinders 38 self._geometry['heads'], self._geometry['sectors'], self._geometry['cylinders'] = self._parted_dev.heads, self._parted_dev.sectors, self._parted_dev.cylinders
39 39
40 self._sector_bytes = self._parted_dev.sector_size
40 self._cylinder_bytes = self._geometry['heads'] * self._geometry['sectors'] * self._parted_dev.sector_size 41 self._cylinder_bytes = self._geometry['heads'] * self._geometry['sectors'] * self._sector_bytes
41 self._total_sectors = self._geometry['cylinders'] * self._geometry['heads'] * self._geometry['sectors'] 42# self._total_sectors = self._geometry['cylinders'] * self._geometry['heads'] * self._geometry['sectors']
43 self._total_sectors = self._parted_dev.length
42 self._sectors_in_cylinder = self._geometry['heads'] * self._geometry['sectors'] 44 self._sectors_in_cylinder = self._geometry['heads'] * self._geometry['sectors']
43 45
44 def set_partitions_from_disk(self): 46 def set_partitions_from_disk(self):
45 parted_part = self._parted_disk.next_partition() 47 parted_part = self._parted_disk.next_partition()
46 while parted_part != None: 48 while parted_part != None:
226 def get_num_sectors(self): 228 def get_num_sectors(self):
227 return int(self._total_sectors) 229 return int(self._total_sectors)
228 230
229 def get_cylinder_size(self): 231 def get_cylinder_size(self):
230 return int(self._cylinder_bytes) 232 return int(self._cylinder_bytes)
233
234 def get_sector_size(self):
235 return int(self._sector_bytes)
231 236
232 def get_num_cylinders(self): 237 def get_num_cylinders(self):
233 return int(self._geometry['cylinders']) 238 return int(self._geometry['cylinders'])
234 239
235 def get_drive_bytes(self): 240 def get_drive_bytes(self):

Legend:
Removed from v.211  
changed lines
  Added in v.212

  ViewVC Help
Powered by ViewVC 1.1.20