comparison status.cpp @ 432:62a0515f59be api-inversion

Include track_lengths data structure in struct adb. Remove mapping of trackTable where I can...
author mas01cr
date Wed, 24 Dec 2008 10:55:44 +0000
parents 58b88ab69424
children
comparison
equal deleted inserted replaced
431:8632cd387e24 432:62a0515f59be
9 pointer valid", but at the moment we punt that to memory 9 pointer valid", but at the moment we punt that to memory
10 discipline. */ 10 discipline. */
11 11
12 unsigned dudCount = 0; 12 unsigned dudCount = 0;
13 unsigned nullCount = 0; 13 unsigned nullCount = 0;
14
15 size_t trackTableLength = ALIGN_PAGE_UP(adb->header->numFiles * O2_TRACKTABLE_ENTRY_SIZE);
16 unsigned *trackTable = 0;
17 void *tmp = 0;
18 if (adb->header->length > 0) {
19 tmp = mmap(0, trackTableLength, PROT_READ, MAP_SHARED, adb->fd, adb->header->trackTableOffset);
20 if (tmp == (void *) -1) {
21 return 1;
22 }
23 trackTable = (unsigned *) tmp;
24 }
25 14
26 for(unsigned k = 0; k < adb->header->numFiles; k++) { 15 for(unsigned k = 0; k < adb->header->numFiles; k++) {
27 /* FIXME: this bare "16" here reveals a problem (or maybe two). 16 /* FIXME: this bare "16" here reveals a problem (or maybe two).
28 * 16 here means the default value of the sequenceLength parameter 17 * 16 here means the default value of the sequenceLength parameter
29 * initializer (both in C++ and corresponding to the "-l" or 18 * initializer (both in C++ and corresponding to the "-l" or
36 * the command-line -- though that codepath is completely 25 * the command-line -- though that codepath is completely
37 * untested. I can see that it might be useful to provide this 26 * untested. I can see that it might be useful to provide this
38 * information, but at present it's probably completely unused, so 27 * information, but at present it's probably completely unused, so
39 * the compromise for now is to hardwire the 16. 28 * the compromise for now is to hardwire the 16.
40 */ 29 */
41 if(trackTable[k] < 16) { 30 if((*adb->track_lengths)[k] < 16) {
42 dudCount++; 31 dudCount++;
43 if(!trackTable[k]) { 32 if(!(*adb->track_lengths)[k]) {
44 nullCount++; 33 nullCount++;
45 } 34 }
46 }
47 }
48
49 if(adb->header->length > 0) {
50 if(munmap(trackTable, trackTableLength)) {
51 return 1;
52 } 35 }
53 } 36 }
54 37
55 status->numFiles = adb->header->numFiles; 38 status->numFiles = adb->header->numFiles;
56 status->dim = adb->header->dim; 39 status->dim = adb->header->dim;