mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::fs: Support for finding the O_DIRECT alignments from system.
This commit is contained in:
parent
0f2dd85a47
commit
5dd9b7a3cf
2 changed files with 17 additions and 0 deletions
|
@ -16,6 +16,7 @@ namespace ircd::fs
|
|||
struct fd;
|
||||
|
||||
size_t size(const fd &);
|
||||
size_t block_size(const fd &);
|
||||
string_view uuid(const fd &, const mutable_buffer &);
|
||||
}
|
||||
|
||||
|
|
16
ircd/fs.cc
16
ircd/fs.cc
|
@ -556,6 +556,22 @@ namespace ircd::fs
|
|||
static uint posix_flags(const std::ios::open_mode &mode);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
size_t
|
||||
ircd::fs::block_size(const fd &fd)
|
||||
{
|
||||
struct stat stat;
|
||||
syscall(::fstat, fd, &stat);
|
||||
return stat.st_blksize;
|
||||
}
|
||||
#else
|
||||
size_t
|
||||
ircd::fs::block_size(const fd &fd)
|
||||
{
|
||||
return info::page_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// This is not a standard UUID of any sort; this is custom, and intended for
|
||||
/// rocksdb (though rocksdb has no requirement for its format specifically).
|
||||
/// The format is plain-text, fs major and minor number, inode number, and
|
||||
|
|
Loading…
Reference in a new issue