* adfWriteLSEGblock * */
| 994 | * |
| 995 | */ |
| 996 | RETCODE |
| 997 | adfWriteLSEGblock(struct Device *dev, int32_t nSect, struct bLSEGblock* lseg) |
| 998 | { |
| 999 | uint8_t buf[LOGICAL_BLOCK_SIZE]; |
| 1000 | uint32_t newSum; |
| 1001 | struct nativeFunctions *nFct; |
| 1002 | RETCODE rc; |
| 1003 | |
| 1004 | if (dev->readOnly) { |
| 1005 | (*adfEnv.wFct)("adfWriteLSEGblock : can't write block, read only device"); |
| 1006 | return RC_ERROR; |
| 1007 | } |
| 1008 | |
| 1009 | memset(buf,0,LOGICAL_BLOCK_SIZE); |
| 1010 | |
| 1011 | strncpy(lseg->id,"LSEG",4); |
| 1012 | lseg->size = sizeof(struct bLSEGblock)/sizeof(int32_t); |
| 1013 | |
| 1014 | memcpy(buf, lseg, sizeof(struct bLSEGblock)); |
| 1015 | #ifdef LITT_ENDIAN |
| 1016 | swapEndian(buf, SWBL_LSEG); |
| 1017 | #endif |
| 1018 | |
| 1019 | newSum = adfNormalSum(buf, 8, LOGICAL_BLOCK_SIZE); |
| 1020 | swLong(buf+8,newSum); |
| 1021 | /* *(int32_t*)(buf+8) = swapLong((uint8_t*)&newSum);*/ |
| 1022 | |
| 1023 | nFct = adfEnv.nativeFct; |
| 1024 | if (dev->isNativeDev) |
| 1025 | rc=(*nFct->adfNativeWriteSector)(dev, nSect, LOGICAL_BLOCK_SIZE, buf); |
| 1026 | else |
| 1027 | rc=adfWriteDumpSector(dev, nSect, LOGICAL_BLOCK_SIZE, buf); |
| 1028 | |
| 1029 | if (rc!=RC_OK) |
| 1030 | return RC_ERROR; |
| 1031 | |
| 1032 | return RC_OK; |
| 1033 | } |
| 1034 | |
| 1035 | /*##########################################################################*/ |
no test coverage detected