summaryrefslogtreecommitdiff
path: root/src/file_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_list.c')
-rw-r--r--src/file_list.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/file_list.c b/src/file_list.c
index deb6337..cd7e697 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -63,7 +63,7 @@ void file_list_clear(file_list_t* list)
g_mutex_unlock(&(list->mutex_));
}
-file_t* file_list_add(file_list_t* list, struct tm* time, const char* type, const char* format, const char* dir, mode_t mode)
+file_t* file_list_add(file_list_t* list, struct tm* time, const char* type, const char* format, const char* dir, mode_t mode, int nocache)
{
if(!list || !(&(list->mutex_)))
return NULL;
@@ -85,6 +85,7 @@ file_t* file_list_add(file_list_t* list, struct tm* time, const char* type, cons
log_printf(INFO, "%s filename is: %s(.?)", type, tmp->path_);
tmp->fd_ = FILE_CLOSED;
tmp->mode_ = mode;
+ tmp->nocache_ = nocache;
tmp->pp_child_ = NULL;
g_mutex_lock(&(list->mutex_));
@@ -177,7 +178,10 @@ int open_file(file_t* file)
char* orig_path = file->path_;
int cnt = 0;
do {
- file->fd_ = open(file->path_, O_WRONLY | O_CREAT | O_EXCL, file->mode_);
+ int flags = O_WRONLY | O_CREAT | O_EXCL;
+ if(file->nocache_)
+ flags |= O_DIRECT;
+ file->fd_ = open(file->path_, flags, file->mode_);
if(file->fd_ < 0) {
if(errno != EEXIST) {
// TODO: thread safe strerror