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

Function adfCreateDir

dep/adflib/src/adf_dir.c:885–928  ·  view source on GitHub ↗

* adfCreateDir * */

Source from the content-addressed store, hash-verified

883 *
884 */
885RETCODE adfCreateDir(struct Volume* vol, SECTNUM nParent, char* name)
886{
887 SECTNUM nSect;
888 struct bDirBlock dir;
889 struct bEntryBlock parent;
890
891 if (adfReadEntryBlock(vol, nParent, &parent)!=RC_OK)
892 return RC_ERROR;
893
894 /* -1 : do not use a specific, already allocated sector */
895 nSect = adfCreateEntry(vol, &parent, name, -1);
896 if (nSect==-1) {
897 (*adfEnv.wFct)("adfCreateDir : no sector available");
898 return RC_ERROR;
899 }
900 memset(&dir, 0, sizeof(struct bDirBlock));
901 dir.nameLen = min(MAXNAMELEN, strlen(name));
902 memcpy(dir.dirName,name,dir.nameLen);
903 dir.headerKey = nSect;
904
905 if (parent.secType==ST_ROOT)
906 dir.parent = vol->rootBlock;
907 else
908 dir.parent = parent.headerKey;
909 adfTime2AmigaTime(adfGiveCurrentTime(),&(dir.days),&(dir.mins),&(dir.ticks));
910
911 if (isDIRCACHE(vol->dosType)) {
912 /* for adfCreateEmptyCache, will be added by adfWriteDirBlock */
913 dir.secType = ST_DIR;
914 adfAddInCache(vol, &parent, (struct bEntryBlock *)&dir);
915 adfCreateEmptyCache(vol, (struct bEntryBlock *)&dir, -1);
916 }
917
918 /* writes the dirblock, with the possible dircache assiocated */
919 if (adfWriteDirBlock(vol, nSect, &dir)!=RC_OK)
920 return RC_ERROR;
921
922 adfUpdateBitmap(vol);
923
924 if (adfEnv.useNotify)
925 (*adfEnv.notifyFct)(nParent,ST_DIR);
926
927 return RC_OK;
928}
929
930
931/*

Callers 1

createDirectoryMethod · 0.85

Calls 8

adfReadEntryBlockFunction · 0.85
adfCreateEntryFunction · 0.85
adfTime2AmigaTimeFunction · 0.85
adfGiveCurrentTimeFunction · 0.85
adfAddInCacheFunction · 0.85
adfCreateEmptyCacheFunction · 0.85
adfWriteDirBlockFunction · 0.85
adfUpdateBitmapFunction · 0.85

Tested by

no test coverage detected