MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / expandSectorList

Function expandSectorList

lib/data/layout.cc:104–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104static std::vector<unsigned> expandSectorList(
105 const SectorListProto& sectorsProto)
106{
107 std::vector<unsigned> sectors;
108
109 if (sectorsProto.has_count())
110 {
111 if (sectorsProto.sector_size() != 0)
112 error(
113 "LAYOUT: if you use a sector count, you can't use an "
114 "explicit sector list");
115
116 std::set<unsigned> sectorset;
117 int id = sectorsProto.start_sector();
118 for (int i = 0; i < sectorsProto.count(); i++)
119 {
120 while (sectorset.find(id) != sectorset.end())
121 {
122 id++;
123 if (id >= (sectorsProto.start_sector() + sectorsProto.count()))
124 id -= sectorsProto.count();
125 }
126
127 sectorset.insert(id);
128 sectors.push_back(id);
129
130 id += sectorsProto.skew();
131 if (id >= (sectorsProto.start_sector() + sectorsProto.count()))
132 id -= sectorsProto.count();
133 }
134 }
135 else if (sectorsProto.sector_size() > 0)
136 {
137 for (int sectorId : sectorsProto.sector())
138 sectors.push_back(sectorId);
139 }
140 else
141 error("LAYOUT: no sectors in sector definition!");
142
143 return sectors;
144}
145
146static const LayoutProto::LayoutdataProto getLayoutData(
147 unsigned logicalCylinder, unsigned logicalHead, const ConfigProto& config)

Callers 1

DiskLayoutMethod · 0.85

Calls 6

errorFunction · 0.85
skewMethod · 0.80
countMethod · 0.45
findMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected