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:
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
|
||||
#include "attr.h"
|
||||
|
||||
#include "../log.h"
|
||||
#include "linux.h"
|
||||
|
||||
void LinuxFileAttributes(const char* path)
|
||||
@@ -50,7 +51,7 @@ void LinuxFileAttributes(const char* path)
|
||||
|
||||
if(ret)
|
||||
{
|
||||
printf("Error %d changing to specified path.\n", errno);
|
||||
log_write("Error %d changing to specified path.\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +59,7 @@ void LinuxFileAttributes(const char* path)
|
||||
|
||||
if(ret)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", errno);
|
||||
log_write("Error %d creating working directory.\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,11 +67,11 @@ void LinuxFileAttributes(const char* path)
|
||||
|
||||
if(ret)
|
||||
{
|
||||
printf("Error %d changing to working directory.\n", errno);
|
||||
log_write("Error %d changing to working directory.\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating files with different flags (attributes).\n");
|
||||
log_write("Creating files with different flags (attributes).\n");
|
||||
|
||||
for(i = 0; i < KNOWN_LINUX_ATTRS; i++)
|
||||
{
|
||||
@@ -105,6 +106,6 @@ void LinuxFileAttributes(const char* path)
|
||||
ret = fclose(h);
|
||||
if(ret) { cRc = errno; }
|
||||
}
|
||||
printf("\t%s, rc = %d, wRc = %d, sRc = %d, cRc = %d\n", linux_attrs[i].description, rc, wRc, sRc, cRc);
|
||||
log_write("\t%s, rc = %d, wRc = %d, sRc = %d, cRc = %d\n", linux_attrs[i].description, rc, wRc, sRc, cRc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../log.h"
|
||||
#include "linux.h"
|
||||
|
||||
void LinuxSparse(const char* path)
|
||||
@@ -47,7 +48,7 @@ void LinuxSparse(const char* path)
|
||||
|
||||
if(ret)
|
||||
{
|
||||
printf("Error %d changing to specified path.\n", errno);
|
||||
log_write("Error %d changing to specified path.\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ void LinuxSparse(const char* path)
|
||||
|
||||
if(ret)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", errno);
|
||||
log_write("Error %d creating working directory.\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,11 +64,11 @@ void LinuxSparse(const char* path)
|
||||
|
||||
if(ret)
|
||||
{
|
||||
printf("Error %d changing to working directory.\n", errno);
|
||||
log_write("Error %d changing to working directory.\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating sparse files.\n");
|
||||
log_write("Creating sparse files.\n");
|
||||
|
||||
h = fopen("SMALL", "w+");
|
||||
rc = 0;
|
||||
@@ -99,13 +100,13 @@ void LinuxSparse(const char* path)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d, sRc = %d\n",
|
||||
"SMALL",
|
||||
4096 * 3,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
zRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d, sRc = %d\n",
|
||||
"SMALL",
|
||||
4096 * 3,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
zRc);
|
||||
|
||||
h = fopen("BIG", "w+");
|
||||
rc = 0;
|
||||
@@ -137,11 +138,11 @@ void LinuxSparse(const char* path)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d, sRc = %d\n",
|
||||
"BIG",
|
||||
4096 * 30,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
zRc);
|
||||
log_write("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d, sRc = %d\n",
|
||||
"BIG",
|
||||
4096 * 30,
|
||||
rc,
|
||||
wRc,
|
||||
cRc,
|
||||
zRc);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../log.h"
|
||||
#include "linux.h"
|
||||
|
||||
#if((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 3)) || (__GLIBC__ > 2)
|
||||
@@ -47,7 +48,7 @@ void LinuxExtendedAttributes(const char* path)
|
||||
|
||||
if(ret)
|
||||
{
|
||||
printf("Error %d changing to specified path.\n", errno);
|
||||
log_write("Error %d changing to specified path.\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ void LinuxExtendedAttributes(const char* path)
|
||||
|
||||
if(ret)
|
||||
{
|
||||
printf("Error %d creating working directory.\n", errno);
|
||||
log_write("Error %d creating working directory.\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,11 +64,11 @@ void LinuxExtendedAttributes(const char* path)
|
||||
|
||||
if(ret)
|
||||
{
|
||||
printf("Error %d changing to working directory.\n", errno);
|
||||
log_write("Error %d changing to working directory.\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Creating files with extended attributes.\n");
|
||||
log_write("Creating files with extended attributes.\n");
|
||||
|
||||
rc = 0;
|
||||
cRc = 0;
|
||||
@@ -81,7 +82,7 @@ void LinuxExtendedAttributes(const char* path)
|
||||
|
||||
if(ret) cRc = errno;
|
||||
}
|
||||
printf("\tFile with an extended attribute called \"com.ibm.os2.comment\", rc = %d, cRc = %d\n", rc, cRc);
|
||||
log_write("\tFile with an extended attribute called \"com.ibm.os2.comment\", rc = %d, cRc = %d\n", rc, cRc);
|
||||
|
||||
rc = 0;
|
||||
cRc = 0;
|
||||
@@ -95,6 +96,6 @@ void LinuxExtendedAttributes(const char* path)
|
||||
|
||||
if(ret) cRc = errno;
|
||||
}
|
||||
printf("\tFile with an extended attribute called \"com.ibm.os2.icon\", rc = %d, cRc = %d\n", rc, cRc);
|
||||
log_write("\tFile with an extended attribute called \"com.ibm.os2.icon\", rc = %d, cRc = %d\n", rc, cRc);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user