* adfWriteRootBlock * * */
| 143 | * |
| 144 | */ |
| 145 | RETCODE adfWriteRootBlock(struct Volume* vol, int32_t nSect, struct bRootBlock* root) |
| 146 | { |
| 147 | uint8_t buf[LOGICAL_BLOCK_SIZE]; |
| 148 | uint32_t newSum; |
| 149 | |
| 150 | |
| 151 | root->type = T_HEADER; |
| 152 | root->headerKey = 0L; |
| 153 | root->highSeq = 0L; |
| 154 | root->hashTableSize = HT_SIZE; |
| 155 | root->firstData = 0L; |
| 156 | /* checkSum, hashTable */ |
| 157 | /* bmflag */ |
| 158 | /* bmPages, bmExt */ |
| 159 | root->nextSameHash = 0L; |
| 160 | root->parent = 0L; |
| 161 | root->secType = ST_ROOT; |
| 162 | |
| 163 | memcpy(buf, root, LOGICAL_BLOCK_SIZE); |
| 164 | #ifdef LITT_ENDIAN |
| 165 | swapEndian(buf, SWBL_ROOT); |
| 166 | #endif |
| 167 | |
| 168 | newSum = adfNormalSum(buf,20,LOGICAL_BLOCK_SIZE); |
| 169 | swLong(buf+20, newSum); |
| 170 | /* *(uint32_t*)(buf+20) = swapLong((uint8_t*)&newSum);*/ |
| 171 | |
| 172 | /* dumpBlock(buf);*/ |
| 173 | if (adfWriteBlock(vol, nSect, buf)!=RC_OK) |
| 174 | return RC_ERROR; |
| 175 | /*printf("adfWriteRootBlock %ld\n",nSect);*/ |
| 176 | return RC_OK; |
| 177 | } |
| 178 | |
| 179 | |
| 180 | /* |
no test coverage detected