mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Change directory creation API call for MacOS.
This commit is contained in:
@@ -63,7 +63,8 @@ void FileAttributes(const char* path)
|
|||||||
FInfo finderInfo;
|
FInfo finderInfo;
|
||||||
int32_t count;
|
int32_t count;
|
||||||
HFileInfo* fpb;
|
HFileInfo* fpb;
|
||||||
CInfoPBRec cipbr;
|
CInfoPBRec cipbr;
|
||||||
|
HParamBlockRec dirPB;
|
||||||
|
|
||||||
snprintf((char*)str255, 255, "%s", path);
|
snprintf((char*)str255, 255, "%s", path);
|
||||||
hpb.ioNamePtr = str255;
|
hpb.ioNamePtr = str255;
|
||||||
@@ -77,13 +78,23 @@ void FileAttributes(const char* path)
|
|||||||
}
|
}
|
||||||
refNum = hpb.ioVRefNum;
|
refNum = hpb.ioVRefNum;
|
||||||
|
|
||||||
rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pATTRS", &dirId);
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = (StringPtr) "\pATTRS"; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = 0; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
printf("Error %d creating working directory.\n", rc);
|
printf("Error %d creating working directory.\n", rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
printf("Creating attribute files.\n");
|
printf("Creating attribute files.\n");
|
||||||
|
|
||||||
memset(&finderInfo, 0, sizeof(FInfo));
|
memset(&finderInfo, 0, sizeof(FInfo));
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ void DeleteFiles(const char* path)
|
|||||||
FInfo finderInfo;
|
FInfo finderInfo;
|
||||||
int32_t count;
|
int32_t count;
|
||||||
char filename[9];
|
char filename[9];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
HParamBlockRec dirPB;
|
||||||
|
|
||||||
snprintf((char*)str255, 255, "%s", path);
|
snprintf((char*)str255, 255, "%s", path);
|
||||||
hpb.ioNamePtr = str255;
|
hpb.ioNamePtr = str255;
|
||||||
@@ -76,13 +77,23 @@ void DeleteFiles(const char* path)
|
|||||||
}
|
}
|
||||||
refNum = hpb.ioVRefNum;
|
refNum = hpb.ioVRefNum;
|
||||||
|
|
||||||
rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pDELETED", &dirId);
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = (StringPtr) "\pDELETED"; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = 0; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
printf("Error %d creating working directory.\n", rc);
|
printf("Error %d creating working directory.\n", rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
printf("Creating and deleting files.\n");
|
printf("Creating and deleting files.\n");
|
||||||
|
|
||||||
for(pos = 0; pos < 64; pos++)
|
for(pos = 0; pos < 64; pos++)
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ void DirectoryDepth(const char* path)
|
|||||||
FInfo finderInfo;
|
FInfo finderInfo;
|
||||||
int32_t count;
|
int32_t count;
|
||||||
char filename[9];
|
char filename[9];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
HParamBlockRec dirPB;
|
||||||
|
|
||||||
snprintf((char*)str255, 255, "%s", path);
|
snprintf((char*)str255, 255, "%s", path);
|
||||||
hpb.ioNamePtr = str255;
|
hpb.ioNamePtr = str255;
|
||||||
@@ -76,13 +77,23 @@ void DirectoryDepth(const char* path)
|
|||||||
}
|
}
|
||||||
refNum = hpb.ioVRefNum;
|
refNum = hpb.ioVRefNum;
|
||||||
|
|
||||||
rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pDEPTH", &dirId);
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = (StringPtr) "\pDEPTH"; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = 0; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
printf("Error %d creating working directory.\n", rc);
|
printf("Error %d creating working directory.\n", rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
printf("Creating deepest directory tree.\n");
|
printf("Creating deepest directory tree.\n");
|
||||||
|
|
||||||
while(!rc)
|
while(!rc)
|
||||||
@@ -92,7 +103,16 @@ void DirectoryDepth(const char* path)
|
|||||||
str255[0] = 8;
|
str255[0] = 8;
|
||||||
memcpy(str255 + 1, filename, 8);
|
memcpy(str255 + 1, filename, 8);
|
||||||
|
|
||||||
rc = DirCreate(refNum, dirId, str255, &dirId);
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = str255; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = dirId; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
pos++;
|
pos++;
|
||||||
/* Mac OS has no limit, but it will crash because the catalog is single threaded */
|
/* Mac OS has no limit, but it will crash because the catalog is single threaded */
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ void Filenames(const char* path)
|
|||||||
FInfo finderInfo;
|
FInfo finderInfo;
|
||||||
int32_t count;
|
int32_t count;
|
||||||
char message[300];
|
char message[300];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
HParamBlockRec dirPB;
|
||||||
|
|
||||||
snprintf((char*)str255, 255, "%s", path);
|
snprintf((char*)str255, 255, "%s", path);
|
||||||
hpb.ioNamePtr = str255;
|
hpb.ioNamePtr = str255;
|
||||||
@@ -76,13 +77,23 @@ void Filenames(const char* path)
|
|||||||
}
|
}
|
||||||
refNum = hpb.ioVRefNum;
|
refNum = hpb.ioVRefNum;
|
||||||
|
|
||||||
rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pFILENAME", &dirId);
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = (StringPtr) "\pFILENAME"; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = 0; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
printf("Error %d creating working directory.\n", rc);
|
printf("Error %d creating working directory.\n", rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
printf("Creating files with different filenames.\n");
|
printf("Creating files with different filenames.\n");
|
||||||
|
|
||||||
for(pos = 0; filenames[pos]; pos++)
|
for(pos = 0; filenames[pos]; pos++)
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ void MillionFiles(const char* path)
|
|||||||
FInfo finderInfo;
|
FInfo finderInfo;
|
||||||
int32_t count;
|
int32_t count;
|
||||||
char filename[9];
|
char filename[9];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
HParamBlockRec dirPB;
|
||||||
|
|
||||||
snprintf((char*)str255, 255, "%s", path);
|
snprintf((char*)str255, 255, "%s", path);
|
||||||
hpb.ioNamePtr = str255;
|
hpb.ioNamePtr = str255;
|
||||||
@@ -76,7 +77,17 @@ void MillionFiles(const char* path)
|
|||||||
}
|
}
|
||||||
refNum = hpb.ioVRefNum;
|
refNum = hpb.ioVRefNum;
|
||||||
|
|
||||||
rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pMILLION", &dirId);
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = (StringPtr) "\pMILLION"; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = 0; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
printf("Error %d creating working directory.\n", rc);
|
printf("Error %d creating working directory.\n", rc);
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
|||||||
int32_t dirId;
|
int32_t dirId;
|
||||||
int32_t count;
|
int32_t count;
|
||||||
long i;
|
long i;
|
||||||
|
HParamBlockRec dirPB;
|
||||||
|
|
||||||
snprintf((char*)str255, 255, "%s", path);
|
snprintf((char*)str255, 255, "%s", path);
|
||||||
hpb.ioNamePtr = str255;
|
hpb.ioNamePtr = str255;
|
||||||
@@ -80,7 +81,17 @@ void Fragmentation(const char* path, size_t clusterSize)
|
|||||||
}
|
}
|
||||||
refNum = hpb.ioVRefNum;
|
refNum = hpb.ioVRefNum;
|
||||||
|
|
||||||
rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pFRAGS", &dirId);
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = (StringPtr) "\pFRAGS"; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = 0; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
printf("Error %d creating working directory.\n", rc);
|
printf("Error %d creating working directory.\n", rc);
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ void Links(const char* path)
|
|||||||
char filename[9];
|
char filename[9];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
FSSpec targetSpec, aliasSpec;
|
FSSpec targetSpec, aliasSpec;
|
||||||
int32_t count;
|
int32_t count;
|
||||||
|
HParamBlockRec dirPB;
|
||||||
|
|
||||||
rc = Gestalt(gestaltAliasMgrAttr, &gestaltResponse);
|
rc = Gestalt(gestaltAliasMgrAttr, &gestaltResponse);
|
||||||
if(rc || !(gestaltResponse & (1 << gestaltAliasMgrPresent)))
|
if(rc || !(gestaltResponse & (1 << gestaltAliasMgrPresent)))
|
||||||
@@ -120,13 +121,23 @@ void Links(const char* path)
|
|||||||
}
|
}
|
||||||
refNum = hpb.ioVRefNum;
|
refNum = hpb.ioVRefNum;
|
||||||
|
|
||||||
rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pLINKS", &dirId);
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = (StringPtr) "\pLINKS"; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = 0; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
printf("Error %d creating working directory.\n", rc);
|
printf("Error %d creating working directory.\n", rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
printf("Creating aliases.\n");
|
printf("Creating aliases.\n");
|
||||||
|
|
||||||
for(pos = 0; pos < 64; pos++)
|
for(pos = 0; pos < 64; pos++)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define PBHGetVInfo(pb, async) ((async) ? PBHGetVInfoAsync(pb) : PBHGetVInfoSync(pb))
|
#define PBHGetVInfo(pb, async) ((async) ? PBHGetVInfoAsync(pb) : PBHGetVInfoSync(pb))
|
||||||
|
#define PBDirCreate(pb, async) ((async) ? PBDirCreateAsync(pb) : PBDirCreateSync(pb))
|
||||||
|
|
||||||
#define FOUR_CHAR_CODE(x) (x)
|
#define FOUR_CHAR_CODE(x) (x)
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ void ResourceFork(const char* path)
|
|||||||
FInfo finderInfo;
|
FInfo finderInfo;
|
||||||
int32_t count;
|
int32_t count;
|
||||||
HFileInfo* fpb;
|
HFileInfo* fpb;
|
||||||
CInfoPBRec cipbr;
|
CInfoPBRec cipbr;
|
||||||
|
HParamBlockRec dirPB;
|
||||||
|
|
||||||
snprintf((char*)str255, 255, "%s", path);
|
snprintf((char*)str255, 255, "%s", path);
|
||||||
hpb.ioNamePtr = str255;
|
hpb.ioNamePtr = str255;
|
||||||
@@ -115,13 +116,23 @@ void ResourceFork(const char* path)
|
|||||||
}
|
}
|
||||||
refNum = hpb.ioVRefNum;
|
refNum = hpb.ioVRefNum;
|
||||||
|
|
||||||
rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pRSRC", &dirId);
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = (StringPtr) "\pRSRC"; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = 0; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
printf("Error %d creating working directory.\n", rc);
|
printf("Error %d creating working directory.\n", rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
printf("Creating resource forks.\n");
|
printf("Creating resource forks.\n");
|
||||||
|
|
||||||
memset(&finderInfo, 0, sizeof(FInfo));
|
memset(&finderInfo, 0, sizeof(FInfo));
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ void Timestamps(const char* path)
|
|||||||
int32_t count;
|
int32_t count;
|
||||||
HFileInfo* fpb;
|
HFileInfo* fpb;
|
||||||
CInfoPBRec cipbr;
|
CInfoPBRec cipbr;
|
||||||
char message[300];
|
char message[300];
|
||||||
|
HParamBlockRec dirPB;
|
||||||
|
|
||||||
snprintf((char*)str255, 255, "%s", path);
|
snprintf((char*)str255, 255, "%s", path);
|
||||||
hpb.ioNamePtr = str255;
|
hpb.ioNamePtr = str255;
|
||||||
@@ -78,13 +79,23 @@ void Timestamps(const char* path)
|
|||||||
}
|
}
|
||||||
refNum = hpb.ioVRefNum;
|
refNum = hpb.ioVRefNum;
|
||||||
|
|
||||||
rc = DirCreate(refNum, fsRtDirID, (unsigned char*)"\pTIMES", &dirId);
|
memset(&dirPB, 0, sizeof(HParamBlockRec));
|
||||||
|
|
||||||
|
dirPB.fileParam.ioCompletion = 0; // Nothing, sync
|
||||||
|
dirPB.fileParam.ioVRefNum = refNum; // Volume specification
|
||||||
|
dirPB.fileParam.ioNamePtr = (StringPtr) "\pTIMES"; // Directory name to create
|
||||||
|
dirPB.fileParam.ioDirID = 0; // ID of parent directory, 0 for root of volume
|
||||||
|
|
||||||
|
rc = PBDirCreate(&dirPB, 0);
|
||||||
|
|
||||||
if(rc)
|
if(rc)
|
||||||
{
|
{
|
||||||
printf("Error %d creating working directory.\n", rc);
|
printf("Error %d creating working directory.\n", rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirId = dirPB.fileParam.ioDirID;
|
||||||
|
|
||||||
printf("Creating timestamped files.\n");
|
printf("Creating timestamped files.\n");
|
||||||
|
|
||||||
rc = HCreate(refNum, dirId, "\pMAXCTIME", ostUnknown, ftGenericDocumentPC);
|
rc = HCreate(refNum, dirId, "\pMAXCTIME", ostUnknown, ftGenericDocumentPC);
|
||||||
|
|||||||
Reference in New Issue
Block a user