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

Function adfWriteDataBlock

dep/adflib/src/adf_file.c:691–717  ·  view source on GitHub ↗

* adfWriteDataBlock * */

Source from the content-addressed store, hash-verified

689 *
690 */
691RETCODE adfWriteDataBlock(struct Volume *vol, SECTNUM nSect, void *data)
692{
693 uint8_t buf[512];
694 uint32_t newSum;
695 struct bOFSDataBlock *dataB;
696 RETCODE rc = RC_OK;
697
698 newSum = 0L;
699 if (isOFS(vol->dosType)) {
700 dataB = (struct bOFSDataBlock *)data;
701 dataB->type = T_DATA;
702 memcpy(buf,dataB,512);
703#ifdef LITT_ENDIAN
704 swapEndian(buf, SWBL_DATA);
705#endif
706 newSum = adfNormalSum(buf,20,512);
707 swLong(buf+20,newSum);
708/* *(int32_t*)(buf+20) = swapLong((uint8_t*)&newSum);*/
709 adfWriteBlock(vol,nSect,buf);
710 }
711 else {
712 adfWriteBlock(vol,nSect,data);
713 }
714/*printf("adfWriteDataBlock %ld\n",nSect);*/
715
716 return rc;
717}
718
719
720/*

Callers 2

adfFlushFileFunction · 0.85
adfCreateNextFileBlockFunction · 0.85

Calls 4

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

Tested by

no test coverage detected