Changeset 2850 for box/trunk/lib
- Timestamp:
- 12/01/2011 00:14:06 (17 months ago)
- File:
-
- 1 edited
-
box/trunk/lib/raidfile/RaidFileRead.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/lib/raidfile/RaidFileRead.cpp
r2465 r2850 1087 1087 stripe2errno = errno; 1088 1088 } 1089 if(stripe1errno != 0 || stripe2errno != 0) 1090 { 1091 THROW_EXCEPTION(RaidFileException, ErrorOpeningFileForRead) 1089 1090 if(stripe1errno != 0) 1091 { 1092 THROW_SYS_FILE_ERRNO("Failed to open RaidFile", 1093 stripe1Filename, stripe1errno, 1094 RaidFileException, ErrorOpeningFileForRead); 1095 } 1096 1097 if(stripe2errno != 0) 1098 { 1099 THROW_SYS_FILE_ERRNO("Failed to open RaidFile", 1100 stripe2Filename, stripe2errno, 1101 RaidFileException, ErrorOpeningFileForRead); 1092 1102 } 1093 1103 … … 1108 1118 1109 1119 // Handle errors 1110 if(stripe1errno != 0 || stripe2errno != 0) 1111 { 1112 THROW_EXCEPTION(RaidFileException, OSError) 1113 } 1114 1120 if(stripe1errno != 0) 1121 { 1122 THROW_SYS_FILE_ERRNO("Failed to stat RaidFile", 1123 stripe1Filename, stripe1errno, 1124 RaidFileException, OSError); 1125 } 1126 1127 if(stripe2errno != 0) 1128 { 1129 THROW_SYS_FILE_ERRNO("Failed to stat RaidFile", 1130 stripe2Filename, stripe2errno, 1131 RaidFileException, OSError); 1132 } 1133 1115 1134 // Make a nice object to represent this file 1116 1135 return std::auto_ptr<RaidFileRead>(new RaidFileRead_Raid(SetNumber, Filename, stripe1, stripe2, -1, length, rdiscSet.GetBlockSize(), false /* actually we don't know */)); … … 1239 1258 if(::lseek(parity, -8 /*(0 - sizeof(FileSizeType))*/, SEEK_END) == -1) 1240 1259 { 1241 THROW_EXCEPTION(RaidFileException, OSError) 1260 THROW_SYS_FILE_ERROR("Failed to seek " 1261 "in parity RaidFile", 1262 parityFilename, 1263 RaidFileException, OSError); 1242 1264 } 1243 1265 // Read it in 1244 1266 if(::read(parity, &parityLastData, sizeof(parityLastData)) != sizeof(parityLastData)) 1245 1267 { 1246 THROW_EXCEPTION(RaidFileException, OSError) 1247 } 1268 THROW_SYS_FILE_ERROR("Failed to read " 1269 "parity RaidFile", 1270 parityFilename, 1271 RaidFileException, OSError); 1272 } 1273 1248 1274 // Set back to beginning of file 1249 1275 if(::lseek(parity, 0, SEEK_SET) == -1) 1250 1276 { 1251 THROW_EXCEPTION(RaidFileException, OSError) 1277 THROW_SYS_FILE_ERROR("Failed to seek " 1278 "in parity RaidFile", 1279 parityFilename, 1280 RaidFileException, OSError); 1252 1281 } 1253 1282 } … … 1272 1301 if(::fstat(stripe1, &st) != 0) 1273 1302 { 1274 THROW_EXCEPTION(RaidFileException, OSError) 1303 THROW_SYS_FILE_ERROR("Failed to " 1304 "stat RaidFile stripe 1", 1305 stripe1Filename, 1306 RaidFileException, OSError); 1275 1307 } 1276 1308 pos_type stripe1Size = st.st_size; … … 1306 1338 if(::lseek(stripe1, 0 - btr, SEEK_END) == -1) 1307 1339 { 1308 THROW_EXCEPTION(RaidFileException, OSError) 1340 THROW_SYS_FILE_ERROR("Failed to " 1341 "seek in RaidFile stripe 1", 1342 stripe1Filename, 1343 RaidFileException, OSError); 1309 1344 } 1310 1345 // Read it in 1311 1346 if(::read(stripe1, &stripe1LastData, btr) != btr) 1312 1347 { 1313 THROW_EXCEPTION(RaidFileException, OSError) 1348 THROW_SYS_FILE_ERROR("Failed to " 1349 "read RaidFile stripe 1", 1350 stripe1Filename, 1351 RaidFileException, OSError); 1314 1352 } 1315 1353 // Set back to beginning of file 1316 1354 if(::lseek(stripe1, 0, SEEK_SET) == -1) 1317 1355 { 1318 THROW_EXCEPTION(RaidFileException, OSError) 1356 THROW_SYS_FILE_ERROR("Failed to " 1357 "seek in RaidFile stripe 1", 1358 stripe1Filename, 1359 RaidFileException, OSError); 1319 1360 } 1320 1361 } … … 1338 1379 if(::fstat(stripe2, &st) != 0) 1339 1380 { 1340 THROW_EXCEPTION(RaidFileException, OSError) 1381 THROW_SYS_FILE_ERROR("Failed to " 1382 "stat RaidFile stripe 2", 1383 stripe2Filename, 1384 RaidFileException, OSError); 1341 1385 } 1342 1386 pos_type stripe2Size = st.st_size; … … 1407 1451 } 1408 1452 1409 THROW_EXCEPTION(RaidFileException, FileIsDamagedNotRecoverable) 1453 THROW_FILE_ERROR("Failed to recover RaidFile", Filename, 1454 RaidFileException, FileIsDamagedNotRecoverable); 1410 1455 1411 1456 // Avoid compiler warning -- it'll never get here...
Note: See TracChangeset
for help on using the changeset viewer.
