mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Add options to write to a log and be quiet.
This commit is contained in:
@@ -72,4 +72,4 @@ set(EXECUTABLE_NAME "fssetter-macos-${PROCESSOR}")
|
||||
|
||||
#target_link_libraries(${EXECUTABLE_NAME} core)
|
||||
|
||||
add_application(${EXECUTABLE_NAME} ../main.c ${PLATFORM_SOURCES})
|
||||
add_application(${EXECUTABLE_NAME} ../main.c ../log.c ${PLATFORM_SOURCES})
|
||||
@@ -33,6 +33,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <string.h>
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "attr.h"
|
||||
#include "macos.h"
|
||||
|
||||
@@ -57,7 +58,7 @@ void FileAttributes(const char* path)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
refNum = hpb.ioVRefNum;
|
||||
@@ -73,13 +74,13 @@ void FileAttributes(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", rc);
|
||||
log_write("Error %d creating working directory.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
dirId = dirPB.fileParam.ioDirID;
|
||||
|
||||
printf("Creating attribute files.\n");
|
||||
log_write("Creating attribute files.\n");
|
||||
|
||||
for(i = 0; i < KNOWN_MAC_ATTRS; i++)
|
||||
{
|
||||
@@ -115,11 +116,11 @@ void FileAttributes(const char* path)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\t%s: name = \"%s\", rc = %d, wRc = %d, cRc = %d\n",
|
||||
mac_attrs[i].description,
|
||||
mac_attrs[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\t%s: name = \"%s\", rc = %d, wRc = %d, cRc = %d\n",
|
||||
mac_attrs[i].description,
|
||||
mac_attrs[i].filename,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <string.h>
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "macos.h"
|
||||
|
||||
void DeleteFiles(const char* path)
|
||||
@@ -53,7 +54,7 @@ void DeleteFiles(const char* path)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
refNum = hpb.ioVRefNum;
|
||||
@@ -69,13 +70,13 @@ void DeleteFiles(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", rc);
|
||||
log_write("Error %d creating working directory.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
dirId = dirPB.fileParam.ioDirID;
|
||||
|
||||
printf("Creating and deleting files.\n");
|
||||
log_write("Creating and deleting files.\n");
|
||||
|
||||
for(pos = 0; pos < 64; pos++)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <string.h>
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "macos.h"
|
||||
|
||||
void DirectoryDepth(const char* path)
|
||||
@@ -49,7 +50,7 @@ void DirectoryDepth(const char* path)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
refNum = hpb.ioVRefNum;
|
||||
@@ -65,11 +66,11 @@ void DirectoryDepth(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", rc);
|
||||
log_write("Error %d creating working directory.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating deepest directory tree.\n");
|
||||
log_write("Creating deepest directory tree.\n");
|
||||
|
||||
while(!rc)
|
||||
{
|
||||
@@ -94,5 +95,5 @@ void DirectoryDepth(const char* path)
|
||||
if(pos == 500) break;
|
||||
}
|
||||
|
||||
printf("\tCreated %d levels of directory hierarchy\n", pos);
|
||||
log_write("\tCreated %d levels of directory hierarchy\n", pos);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "macos.h"
|
||||
|
||||
void Filenames(const char* path)
|
||||
@@ -56,7 +57,7 @@ void Filenames(const char* path)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
refNum = hpb.ioVRefNum;
|
||||
@@ -72,13 +73,13 @@ void Filenames(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", rc);
|
||||
log_write("Error %d creating working directory.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
dirId = dirPB.fileParam.ioDirID;
|
||||
|
||||
printf("Creating files with different filenames.\n");
|
||||
log_write("Creating files with different filenames.\n");
|
||||
|
||||
for(pos = 0; filenames[pos]; pos++)
|
||||
{
|
||||
@@ -102,6 +103,6 @@ void Filenames(const char* path)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d\n", filenames[pos], rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d\n", filenames[pos], rc, wRc, cRc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "macos.h"
|
||||
|
||||
void MillionFiles(const char* path)
|
||||
@@ -54,7 +55,7 @@ void MillionFiles(const char* path)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
refNum = hpb.ioVRefNum;
|
||||
@@ -72,11 +73,11 @@ void MillionFiles(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", rc);
|
||||
log_write("Error %d creating working directory.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating lots of files.\n");
|
||||
log_write("Creating lots of files.\n");
|
||||
|
||||
for(pos = 0; pos < 5000; pos++)
|
||||
{
|
||||
@@ -90,5 +91,5 @@ void MillionFiles(const char* path)
|
||||
if(rc) break;
|
||||
}
|
||||
|
||||
printf("\tCreated %d files\n", pos);
|
||||
log_write("\tCreated %d files\n", pos);
|
||||
}
|
||||
|
||||
@@ -35,15 +35,16 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "../include/consts.h"
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "macos.h"
|
||||
|
||||
void Fragmentation(const char* path, size_t clusterSize)
|
||||
{
|
||||
int32_t halfCluster = (int32_t)clusterSize / 2;
|
||||
int32_t quarterCluster = (int32_t)clusterSize / 4;
|
||||
int32_t twoCluster = (int32_t)clusterSize * 2;
|
||||
int32_t threeQuartersCluster = halfCluster + quarterCluster;
|
||||
int32_t twoAndThreeQuartCluster = threeQuartersCluster + twoCluster;
|
||||
int32_t halfCluster = (int32_t)clusterSize / 2;
|
||||
int32_t quarterCluster = (int32_t)clusterSize / 4;
|
||||
int32_t twoCluster = (int32_t)clusterSize * 2;
|
||||
int32_t threeQuartersCluster = halfCluster + quarterCluster;
|
||||
int32_t twoAndThreeQuartCluster = threeQuartersCluster + twoCluster;
|
||||
unsigned char* buffer;
|
||||
OSErr rc, wRc, cRc;
|
||||
Str255 str255;
|
||||
@@ -62,7 +63,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
refNum = hpb.ioVRefNum;
|
||||
@@ -80,7 +81,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", rc);
|
||||
log_write("Error %d creating working directory.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "HALFCLST", halfCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "HALFCLST", halfCluster, rc, wRc, cRc);
|
||||
|
||||
rc = HCreate(refNum, dirId, "\pQUARCLST", ostUnknown, ftGenericDocumentPC);
|
||||
if(!rc)
|
||||
@@ -122,7 +123,8 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
|
||||
log_write(
|
||||
"\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
|
||||
|
||||
rc = HCreate(refNum, dirId, "\pTWOCLST", ostUnknown, ftGenericDocumentPC);
|
||||
if(!rc)
|
||||
@@ -142,7 +144,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWOCLST", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWOCLST", twoCluster, rc, wRc, cRc);
|
||||
|
||||
rc = HCreate(refNum, dirId, "\pTRQTCLST", ostUnknown, ftGenericDocumentPC);
|
||||
if(!rc)
|
||||
@@ -162,12 +164,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"TRQTCLST",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"TRQTCLST",
|
||||
threeQuartersCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
rc = HCreate(refNum, dirId, "\pTWOQCLST", ostUnknown, ftGenericDocumentPC);
|
||||
if(!rc)
|
||||
@@ -187,12 +189,12 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"TWTQCLST",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"TWTQCLST",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
|
||||
rc = HCreate(refNum, dirId, "\pTWO1", ostUnknown, ftGenericDocumentPC);
|
||||
if(!rc)
|
||||
@@ -212,7 +214,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWO1", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWO1", twoCluster, rc, wRc, cRc);
|
||||
|
||||
rc = HCreate(refNum, dirId, "\pTWO2", ostUnknown, ftGenericDocumentPC);
|
||||
if(!rc)
|
||||
@@ -232,7 +234,7 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWO2", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWO2", twoCluster, rc, wRc, cRc);
|
||||
|
||||
rc = HCreate(refNum, dirId, "\pTWO3", ostUnknown, ftGenericDocumentPC);
|
||||
if(!rc)
|
||||
@@ -252,10 +254,10 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tDeleting \"TWO2\".\n");
|
||||
log_write("\tDeleting \"TWO2\".\n");
|
||||
rc = HDelete(refNum, dirId, "\pTWO2");
|
||||
|
||||
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWO3", twoCluster, rc, wRc, cRc);
|
||||
log_write("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWO3", twoCluster, rc, wRc, cRc);
|
||||
|
||||
rc = HCreate(refNum, dirId, "\pFRAGTHRQ", ostUnknown, ftGenericDocumentPC);
|
||||
if(!rc)
|
||||
@@ -275,9 +277,9 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tDeleting \"TWO1\".\n");
|
||||
log_write("\tDeleting \"TWO1\".\n");
|
||||
rc = HDelete(refNum, dirId, "\pTWO1");
|
||||
printf("\tDeleting \"TWO3\".\n");
|
||||
log_write("\tDeleting \"TWO3\".\n");
|
||||
rc = HDelete(refNum, dirId, "\pTWO3");
|
||||
|
||||
rc = HCreate(refNum, dirId, "\pFRAGSIXQ", ostUnknown, ftGenericDocumentPC);
|
||||
@@ -298,10 +300,10 @@ void Fragmentation(const char* path, size_t clusterSize)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"FRAGSIXQ",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
log_write("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n",
|
||||
"FRAGSIXQ",
|
||||
twoAndThreeQuartCluster,
|
||||
rc,
|
||||
wRc,
|
||||
cRc);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <string.h>
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "links.h"
|
||||
#include "macos.h"
|
||||
|
||||
@@ -94,7 +95,7 @@ void Links(const char* path)
|
||||
rc = Gestalt(gestaltAliasMgrAttr, &gestaltResponse);
|
||||
if(rc || !(gestaltResponse & (1 << gestaltAliasMgrPresent)))
|
||||
{
|
||||
printf("Alias Manager not present, cannot create aliases.\n");
|
||||
log_write("Alias Manager not present, cannot create aliases.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ void Links(const char* path)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
refNum = hpb.ioVRefNum;
|
||||
@@ -121,13 +122,13 @@ void Links(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", rc);
|
||||
log_write("Error %d creating working directory.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
dirId = dirPB.fileParam.ioDirID;
|
||||
|
||||
printf("Creating aliases.\n");
|
||||
log_write("Creating aliases.\n");
|
||||
|
||||
for(pos = 0; pos < 64; pos++)
|
||||
{
|
||||
@@ -166,5 +167,5 @@ void Links(const char* path)
|
||||
if(aRc) break;
|
||||
}
|
||||
|
||||
printf("pos = %d, rc = %d, wRc = %d, cRc = %d, oRc = %d, aRc = %d\n", pos, rc, wRc, cRc, oRc, aRc);
|
||||
log_write("pos = %d, rc = %d, wRc = %d, cRc = %d, oRc = %d, aRc = %d\n", pos, rc, wRc, cRc, oRc, aRc);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "macos.h"
|
||||
|
||||
void GetOsInfo()
|
||||
@@ -35,35 +36,35 @@ void GetOsInfo()
|
||||
int32_t gestaltResponse;
|
||||
OSErr rc;
|
||||
|
||||
printf("OS information:\n");
|
||||
log_write("OS information:\n");
|
||||
|
||||
rc = Gestalt(gestaltAUXVersion, &gestaltResponse);
|
||||
if(!rc) { printf("Running under A/UX version 0x%08lX\n", gestaltResponse); }
|
||||
if(!rc) { log_write("Running under A/UX version 0x%08lX\n", gestaltResponse); }
|
||||
else
|
||||
{
|
||||
rc = Gestalt(gestaltSystemVersion, &gestaltResponse);
|
||||
if(rc) { printf("Could not get Mac OS version.\n"); }
|
||||
if(rc) { log_write("Could not get Mac OS version.\n"); }
|
||||
else
|
||||
{
|
||||
printf("Running under Mac OS version %ld.%ld.%ld",
|
||||
(gestaltResponse & 0xF00) >> 8,
|
||||
(gestaltResponse & 0xF0) >> 4,
|
||||
gestaltResponse & 0xF);
|
||||
log_write("Running under Mac OS version %ld.%ld.%ld",
|
||||
(gestaltResponse & 0xF00) >> 8,
|
||||
(gestaltResponse & 0xF0) >> 4,
|
||||
gestaltResponse & 0xF);
|
||||
rc = Gestalt(gestaltSysArchitecture, &gestaltResponse);
|
||||
if(!rc)
|
||||
{
|
||||
printf(" for ");
|
||||
log_write(" for ");
|
||||
switch(gestaltResponse)
|
||||
{
|
||||
case 1: printf("Motorola 68k architecture."); break;
|
||||
case 2: printf("PowerPC architecture."); break;
|
||||
case 3: printf("x86 architecture."); break;
|
||||
default: printf("unknown architecture code %ld.", gestaltResponse); break;
|
||||
case 1: log_write("Motorola 68k architecture."); break;
|
||||
case 2: log_write("PowerPC architecture."); break;
|
||||
case 3: log_write("x86 architecture."); break;
|
||||
default: log_write("unknown architecture code %ld.", gestaltResponse); break;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
log_write("\n");
|
||||
}
|
||||
rc = Gestalt(gestaltMacOSCompatibilityBoxAttr, &gestaltResponse);
|
||||
if(!rc) { printf("Running under Classic.\n"); }
|
||||
if(!rc) { log_write("Running under Classic.\n"); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <string.h>
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "macos.h"
|
||||
#include "rsrcfork.h"
|
||||
|
||||
@@ -95,7 +96,7 @@ void ResourceFork(const char* path)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
refNum = hpb.ioVRefNum;
|
||||
@@ -111,13 +112,13 @@ void ResourceFork(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", rc);
|
||||
log_write("Error %d creating working directory.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
dirId = dirPB.fileParam.ioDirID;
|
||||
|
||||
printf("Creating resource forks.\n");
|
||||
log_write("Creating resource forks.\n");
|
||||
|
||||
memset(&finderInfo, 0, sizeof(FInfo));
|
||||
rc = HCreate(refNum, dirId, "\pICON", ostUnknown, ftGenericDocumentPC);
|
||||
@@ -150,12 +151,12 @@ void ResourceFork(const char* path)
|
||||
rc = PBHSetFInfoSync(&fpb);
|
||||
}
|
||||
}
|
||||
printf("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d\n",
|
||||
"ICON",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc);
|
||||
log_write("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d\n",
|
||||
"ICON",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc);
|
||||
|
||||
memset(&finderInfo, 0, sizeof(FInfo));
|
||||
rc = HCreate(refNum, dirId, "\pPICT", ostUnknown, ftGenericDocumentPC);
|
||||
@@ -189,12 +190,12 @@ void ResourceFork(const char* path)
|
||||
rc = PBHSetFInfoSync(&fpb);
|
||||
}
|
||||
}
|
||||
printf("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d\n",
|
||||
"PICT",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc);
|
||||
log_write("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d\n",
|
||||
"PICT",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc);
|
||||
|
||||
memset(&finderInfo, 0, sizeof(FInfo));
|
||||
rc = HCreate(refNum, dirId, "\pVERSION", ostUnknown, ftGenericDocumentPC);
|
||||
@@ -226,12 +227,12 @@ void ResourceFork(const char* path)
|
||||
rc = PBHSetFInfoSync(&fpb);
|
||||
}
|
||||
}
|
||||
printf("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d\n",
|
||||
"VERSION",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc);
|
||||
log_write("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d\n",
|
||||
"VERSION",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc);
|
||||
|
||||
memset(&finderInfo, 0, sizeof(FInfo));
|
||||
rc = HCreate(refNum, dirId, "\pALL", ostUnknown, ftGenericDocumentPC);
|
||||
@@ -280,13 +281,14 @@ void ResourceFork(const char* path)
|
||||
rc = PBHSetFInfoSync(&fpb);
|
||||
}
|
||||
}
|
||||
printf("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d, rRc2 = "
|
||||
"%d, rRc3 = %d\n",
|
||||
"ALL",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc,
|
||||
rRc2,
|
||||
rRc3);
|
||||
log_write(
|
||||
"\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d, rRc2 = "
|
||||
"%d, rRc3 = %d\n",
|
||||
"ALL",
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
rRc,
|
||||
rRc2,
|
||||
rRc3);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <string.h>
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "macos.h"
|
||||
#include "time.h"
|
||||
|
||||
@@ -57,7 +58,7 @@ void Timestamps(const char* path)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
refNum = hpb.ioVRefNum;
|
||||
@@ -73,13 +74,13 @@ void Timestamps(const char* path)
|
||||
|
||||
if(rc)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", rc);
|
||||
log_write("Error %d creating working directory.\n", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
dirId = dirPB.fileParam.ioDirID;
|
||||
|
||||
printf("Creating timestamped files.\n");
|
||||
log_write("Creating timestamped files.\n");
|
||||
|
||||
for(i = 0; i < KNOWN_MAC_TIMES; i++)
|
||||
{
|
||||
@@ -116,6 +117,6 @@ void Timestamps(const char* path)
|
||||
tRc = PBSetCatInfoSync(&cipbr);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", str255, rc, wRc, cRc, tRc);
|
||||
log_write("\tFile name = \"%s\", rc = %d, wRc = %d, cRc = %d, tRc = %d\n", str255, rc, wRc, cRc, tRc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../include/defs.h"
|
||||
#include "../log.h"
|
||||
#include "macos.h"
|
||||
|
||||
void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
@@ -57,8 +58,8 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
rc = Gestalt(gestaltFSAttr, &gestaltResponse);
|
||||
if(!rc)
|
||||
{
|
||||
hfsPlusApis = (gestaltResponse & (1 << gestaltHasHFSPlusAPIs))!= 0;
|
||||
bigVol = (gestaltResponse & (1 << gestaltFSSupports2TBVols))!=0;
|
||||
hfsPlusApis = (gestaltResponse & (1 << gestaltHasHFSPlusAPIs)) != 0;
|
||||
bigVol = (gestaltResponse & (1 << gestaltFSSupports2TBVols)) != 0;
|
||||
}
|
||||
|
||||
if(!bigVol)
|
||||
@@ -69,7 +70,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
rc = PBHGetVInfoSync((HParmBlkPtr)&hpb);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
drvInfo = hpb.ioVDrvInfo;
|
||||
@@ -93,7 +94,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
rc = PBXGetVolInfo((XVolumeParamPtr)&xpb, 0);
|
||||
if(rc)
|
||||
{
|
||||
printf("Could not get volume information.\n");
|
||||
log_write("Could not get volume information.\n");
|
||||
return;
|
||||
}
|
||||
drvInfo = xpb.ioVDrvInfo;
|
||||
@@ -110,31 +111,31 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
if(xpb.ioVFSID != 0) { fsId = xpb.ioVFSID; }
|
||||
}
|
||||
|
||||
printf("Volume information:\n");
|
||||
printf("\tPath: %s\n", path);
|
||||
if(bigVol) { printf("\tVolume supports up to 2Tb disks.\n"); }
|
||||
if(hfsPlusApis) { printf("\tVolume supports HFS Plus APIs.\n"); }
|
||||
printf("\tDrive number: %d\n", drvInfo);
|
||||
printf("\tVolume number: %d\n", refNum);
|
||||
printf("\tVolume name: %#s\n", str255);
|
||||
printf("\t%llu allocation blocks in volume, %llu free\n", totalBlocks, freeBlocks);
|
||||
printf("\t%llu bytes in volume, %llu free\n", totalBytes, freeBytes);
|
||||
printf("\t%lu bytes per allocation block.\n", *clusterSize);
|
||||
printf("\tVolume created on 0x%08lX\n", crDate);
|
||||
printf("\tVolume last written on 0x%08lX\n", lwDate);
|
||||
printf("\tVolume last backed up on 0x%08lX\n", bkDate);
|
||||
printf("\tFilesystem type: ");
|
||||
log_write("Volume information:\n");
|
||||
log_write("\tPath: %s\n", path);
|
||||
if(bigVol) { log_write("\tVolume supports up to 2Tb disks.\n"); }
|
||||
if(hfsPlusApis) { log_write("\tVolume supports HFS Plus APIs.\n"); }
|
||||
log_write("\tDrive number: %d\n", drvInfo);
|
||||
log_write("\tVolume number: %d\n", refNum);
|
||||
log_write("\tVolume name: %#s\n", str255);
|
||||
log_write("\t%llu allocation blocks in volume, %llu free\n", totalBlocks, freeBlocks);
|
||||
log_write("\t%llu bytes in volume, %llu free\n", totalBytes, freeBytes);
|
||||
log_write("\t%lu bytes per allocation block.\n", *clusterSize);
|
||||
log_write("\tVolume created on 0x%08lX\n", crDate);
|
||||
log_write("\tVolume last written on 0x%08lX\n", lwDate);
|
||||
log_write("\tVolume last backed up on 0x%08lX\n", bkDate);
|
||||
log_write("\tFilesystem type: ");
|
||||
switch(fsId)
|
||||
{
|
||||
case 0xD2D7: printf("MFS\n"); break;
|
||||
case 0x4244: printf("HFS\n"); break;
|
||||
case 0x482B: printf("HFS Plus\n"); break;
|
||||
case 0x4147: printf("ISO9660\n"); break;
|
||||
case 0x55DF: printf("UDF\n"); break;
|
||||
case 0x4242: printf("High Sierra\n"); break;
|
||||
case 0x4A48: printf("Audio CD\n"); break;
|
||||
case 0x0100: printf("ProDOS\n"); break;
|
||||
case 0x4953: printf("FAT\n"); break;
|
||||
default: printf("unknown id 0x%04X\n", fsId); break;
|
||||
case 0xD2D7: log_write("MFS\n"); break;
|
||||
case 0x4244: log_write("HFS\n"); break;
|
||||
case 0x482B: log_write("HFS Plus\n"); break;
|
||||
case 0x4147: log_write("ISO9660\n"); break;
|
||||
case 0x55DF: log_write("UDF\n"); break;
|
||||
case 0x4242: log_write("High Sierra\n"); break;
|
||||
case 0x4A48: log_write("Audio CD\n"); break;
|
||||
case 0x0100: log_write("ProDOS\n"); break;
|
||||
case 0x4953: log_write("FAT\n"); break;
|
||||
default: log_write("unknown id 0x%04X\n", fsId); break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user