mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-14 16:45:27 +00:00
vhost_user_fs: Add support for FOPEN_CACHE_DIR
Add support for FOPEN_CACHE_DIR, a flag that allows us to tell the guest that it's safe to cache a directory, introduced in FUSE 7.28. Signed-off-by: Sergio Lopez <slp@redhat.com>
This commit is contained in:
parent
97e2d5d266
commit
5eb903a509
vhost_user_fs/src
@ -55,6 +55,9 @@ const FOPEN_KEEP_CACHE: u32 = 2;
|
||||
/// The file is not seekable.
|
||||
const FOPEN_NONSEEKABLE: u32 = 4;
|
||||
|
||||
/// Allow caching this directory.
|
||||
const FOPEN_CACHE_DIR: u32 = 8;
|
||||
|
||||
bitflags! {
|
||||
/// Options controlling the behavior of files opened by the server in response
|
||||
/// to an open or create request.
|
||||
@ -62,6 +65,7 @@ bitflags! {
|
||||
const DIRECT_IO = FOPEN_DIRECT_IO;
|
||||
const KEEP_CACHE = FOPEN_KEEP_CACHE;
|
||||
const NONSEEKABLE = FOPEN_NONSEEKABLE;
|
||||
const CACHE_DIR = FOPEN_CACHE_DIR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -558,7 +558,13 @@ impl PassthroughFs {
|
||||
OpenOptions::DIRECT_IO,
|
||||
flags & (libc::O_DIRECTORY as u32) == 0,
|
||||
),
|
||||
CachePolicy::Always => opts |= OpenOptions::KEEP_CACHE,
|
||||
CachePolicy::Always => {
|
||||
if flags & (libc::O_DIRECTORY as u32) == 0 {
|
||||
opts |= OpenOptions::KEEP_CACHE;
|
||||
} else {
|
||||
opts |= OpenOptions::CACHE_DIR;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user