* adfReadEntryBlock * */
| 978 | * |
| 979 | */ |
| 980 | RETCODE adfReadEntryBlock(struct Volume* vol, SECTNUM nSect, struct bEntryBlock *ent) |
| 981 | { |
| 982 | uint8_t buf[512]; |
| 983 | |
| 984 | if (adfReadBlock(vol, nSect, buf)!=RC_OK) |
| 985 | return RC_ERROR; |
| 986 | |
| 987 | memcpy(ent, buf, 512); |
| 988 | #ifdef LITT_ENDIAN |
| 989 | swapEndian((uint8_t*)ent, SWBL_ENTRY); |
| 990 | #endif |
| 991 | /*printf("readentry=%d\n",nSect);*/ |
| 992 | if (ent->checkSum!=adfNormalSum((uint8_t*)buf,20,512)) { |
| 993 | (*adfEnv.wFct)("adfReadEntryBlock : invalid checksum"); |
| 994 | return RC_ERROR; |
| 995 | } |
| 996 | if (ent->type!=T_HEADER) { |
| 997 | (*adfEnv.wFct)("adfReadEntryBlock : T_HEADER id not found"); |
| 998 | return RC_ERROR; |
| 999 | } |
| 1000 | if (ent->nameLen<0 || ent->nameLen>MAXNAMELEN || ent->commLen>MAXCMMTLEN) { |
| 1001 | (*adfEnv.wFct)("adfReadEntryBlock : nameLen or commLen incorrect"); |
| 1002 | printf("nameLen=%d, commLen=%d, name=%s sector%d\n", |
| 1003 | ent->nameLen,ent->commLen,ent->name, ent->headerKey); |
| 1004 | } |
| 1005 | |
| 1006 | return RC_OK; |
| 1007 | } |
| 1008 | |
| 1009 | |
| 1010 | /* |
no test coverage detected