* adfCreateEmptyCache * */
| 520 | * |
| 521 | */ |
| 522 | RETCODE adfCreateEmptyCache(struct Volume *vol, struct bEntryBlock *parent, SECTNUM nSect) |
| 523 | { |
| 524 | struct bDirCacheBlock dirc; |
| 525 | SECTNUM nCache; |
| 526 | |
| 527 | if (nSect==-1) { |
| 528 | nCache = adfGet1FreeBlock(vol); |
| 529 | if (nCache==-1) { |
| 530 | (*adfEnv.wFct)("adfCreateDir : nCache==-1"); |
| 531 | return RC_VOLFULL; |
| 532 | } |
| 533 | } |
| 534 | else |
| 535 | nCache = nSect; |
| 536 | |
| 537 | if (parent->extension==0) |
| 538 | parent->extension = nCache; |
| 539 | |
| 540 | memset(&dirc,0, sizeof(struct bDirCacheBlock)); |
| 541 | |
| 542 | if (parent->secType==ST_ROOT) |
| 543 | dirc.parent = vol->rootBlock; |
| 544 | else if (parent->secType==ST_DIR) |
| 545 | dirc.parent = parent->headerKey; |
| 546 | else { |
| 547 | (*adfEnv.wFct)("adfCreateEmptyCache : unknown secType"); |
| 548 | /*printf("secType=%ld\n",parent->secType);*/ |
| 549 | } |
| 550 | |
| 551 | dirc.recordsNb = 0; |
| 552 | dirc.nextDirC = 0; |
| 553 | |
| 554 | if (adfWriteDirCBlock(vol, nCache, &dirc)!=RC_OK) |
| 555 | return RC_ERROR; |
| 556 | |
| 557 | return RC_OK; |
| 558 | } |
| 559 | |
| 560 | |
| 561 | /* |
no test coverage detected