Option to reduce FileOpen messages flood.

This commit is contained in:
sorgelig
2018-07-11 15:52:04 +08:00
parent fb016b4c1a
commit 5f954ddd2b
2 changed files with 7 additions and 7 deletions

View File

@@ -46,7 +46,7 @@ void FileClose(fileTYPE *file)
file->fd = -1;
}
int FileOpenEx(fileTYPE *file, const char *name, int mode)
int FileOpenEx(fileTYPE *file, const char *name, int mode, char mute)
{
sprintf(full_path, "%s/%s", (mode == -1) ? "" : getRootDir(), name);
@@ -60,7 +60,7 @@ int FileOpenEx(fileTYPE *file, const char *name, int mode)
file->fd = (mode == -1) ? shm_open("/vtrd", O_CREAT | O_RDWR | O_TRUNC, 0777) : open(full_path, mode);
if (file->fd <= 0)
{
printf("FileOpenEx(open) File:%s, error: %d.\n", full_path, file->fd);
if(!mute) printf("FileOpenEx(open) File:%s, error: %d.\n", full_path, file->fd);
file->fd = -1;
return 0;
}
@@ -78,7 +78,7 @@ int FileOpenEx(fileTYPE *file, const char *name, int mode)
int ret = fstat64(file->fd, &st);
if (ret < 0)
{
printf("FileOpenEx(fstat) File:%s, error: %d.\n", full_path, ret);
if (!mute) printf("FileOpenEx(fstat) File:%s, error: %d.\n", full_path, ret);
FileClose(file);
return 0;
}
@@ -92,9 +92,9 @@ int FileOpenEx(fileTYPE *file, const char *name, int mode)
return 1;
}
int FileOpen(fileTYPE *file, const char *name)
int FileOpen(fileTYPE *file, const char *name, char mute)
{
return FileOpenEx(file, name, O_RDONLY);
return FileOpenEx(file, name, O_RDONLY, mute);
}
int FileNextSector(fileTYPE *file)

View File

@@ -41,8 +41,8 @@ int getStorage(int from_setting);
void setStorage(int dev);
int isUSBMounted();
int FileOpenEx(fileTYPE *file, const char *name, int mode);
int FileOpen(fileTYPE *file, const char *name);
int FileOpenEx(fileTYPE *file, const char *name, int mode, char mute = 0);
int FileOpen(fileTYPE *file, const char *name, char mute = 0);
void FileClose(fileTYPE *file);
int FileSeek(fileTYPE *file, __off64_t offset, int origin);