def _initDevClasses(self):
self._devClassTree = {}<EOL>self._partitionTree = {}<EOL>self._mapDevType = {}<EOL>basedevs = []<EOL>otherdevs = []<EOL>if self._mapMajorDevclass is None:<EOL><INDENT>self._initBlockMajorMap()<EOL><DEDENT>for dev in self._diskStats:<EOL><INDENT>stats = self._diskStats[dev]<EOL>devclass = self._mapMajorDevclass.get(stats['<STR_LIT>'])<EOL>if devclass is not None:<EOL><INDENT>devdir = os.path.join(sysfsBlockdevDir, dev)<EOL>if os.path.isdir(devdir):<EOL><INDENT>if devclass not in self._devClassTree:<EOL><INDENT>self._devClassTree[devclass] = []<EOL><DEDENT>self._devClassTree[devclass].append(dev)<EOL>self._mapDevType[dev] = devclass<EOL>basedevs.append(dev)<EOL><DEDENT>else:<EOL><INDENT>otherdevs.append(dev)<EOL><DEDENT><DEDENT><DEDENT>basedevs.sort(key=len, reverse=True)<EOL>otherdevs.sort(key=len, reverse=True)<EOL>idx = <NUM_LIT:0><EOL>for partdev in otherdevs:<EOL><INDENT>while len(basedevs[idx]) > partdev:<EOL><INDENT>idx += <NUM_LIT:1> <EOL><DEDENT>for dev in basedevs[idx:]:<EOL><INDENT>if re.match("<STR_LIT>" % dev, partdev):<EOL><INDENT>if dev not in self._partitionTree:<EOL><INDENT>self._partitionTree[dev] = []<EOL><DEDENT>self._partitionTree[dev].append(partdev)<EOL>self._mapDevType[partdev] = '<STR_LIT>'<EOL><DEDENT><DEDENT><DEDENT>
Sort block devices into lists depending on device class and 
        initialize device type map and partition map.