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

Function adfWriteRootBlock

dep/adflib/src/adf_raw.c:145–177  ·  view source on GitHub ↗

* adfWriteRootBlock * * */

Source from the content-addressed store, hash-verified

143 *
144 */
145RETCODE 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/*

Callers 5

adfCreateVolFunction · 0.85
adfRenameEntryFunction · 0.85
adfCreateEntryFunction · 0.85
adfUpdateBitmapFunction · 0.85
adfWriteNewBitmapFunction · 0.85

Calls 4

swapEndianFunction · 0.85
adfNormalSumFunction · 0.85
swLongFunction · 0.85
adfWriteBlockFunction · 0.85

Tested by

no test coverage detected