|
|
@ -18,6 +18,7 @@ |
|
|
|
|
|
|
|
|
#pragma once
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include "assert.hpp"
|
|
|
#include "branch.hpp"
|
|
|
#include "branch.hpp"
|
|
|
#include "fh.hpp"
|
|
|
#include "fh.hpp"
|
|
|
#include "fs_path.hpp"
|
|
|
#include "fs_path.hpp"
|
|
|
@ -42,7 +43,6 @@ public: |
|
|
branch(*branch_), |
|
|
branch(*branch_), |
|
|
direct_io(direct_io_) |
|
|
direct_io(direct_io_) |
|
|
{ |
|
|
{ |
|
|
mutex_init(mutex); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
FileInfo(const int fd_, |
|
|
FileInfo(const int fd_, |
|
|
@ -54,7 +54,6 @@ public: |
|
|
branch(branch_), |
|
|
branch(branch_), |
|
|
direct_io(direct_io_) |
|
|
direct_io(direct_io_) |
|
|
{ |
|
|
{ |
|
|
mutex_init(mutex); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
FileInfo(const FileInfo *fi_) |
|
|
FileInfo(const FileInfo *fi_) |
|
|
@ -63,7 +62,6 @@ public: |
|
|
branch(fi_->branch), |
|
|
branch(fi_->branch), |
|
|
direct_io(fi_->direct_io) |
|
|
direct_io(fi_->direct_io) |
|
|
{ |
|
|
{ |
|
|
mutex_init(mutex); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public: |
|
|
public: |
|
|
@ -73,13 +71,14 @@ public: |
|
|
int fd; |
|
|
int fd; |
|
|
Branch branch; |
|
|
Branch branch; |
|
|
u32 direct_io:1; |
|
|
u32 direct_io:1; |
|
|
mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; |
|
|
|
|
|
|
|
|
Mutex mutex; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
inline |
|
|
inline |
|
|
u64 |
|
|
u64 |
|
|
FileInfo::to_fh() const |
|
|
FileInfo::to_fh() const |
|
|
{ |
|
|
{ |
|
|
|
|
|
ASSERT_NOT_NULL(this); |
|
|
return reinterpret_cast<u64>(this); |
|
|
return reinterpret_cast<u64>(this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -87,5 +86,11 @@ inline |
|
|
FileInfo* |
|
|
FileInfo* |
|
|
FileInfo::from_fh(const u64 fh_) |
|
|
FileInfo::from_fh(const u64 fh_) |
|
|
{ |
|
|
{ |
|
|
return reinterpret_cast<FileInfo*>(fh_); |
|
|
|
|
|
|
|
|
FileInfo *rv; |
|
|
|
|
|
|
|
|
|
|
|
rv = reinterpret_cast<FileInfo*>(fh_); |
|
|
|
|
|
|
|
|
|
|
|
ASSERT_NOT_NULL(rv); |
|
|
|
|
|
|
|
|
|
|
|
return rv; |
|
|
} |
|
|
} |