Getting the FLAG from the winapi module.

This commit is contained in:
Paul Masurel
2017-03-19 11:09:15 +09:00
parent 7c114b602d
commit ebcea0128c
3 changed files with 11 additions and 6 deletions

View File

@@ -24,8 +24,6 @@ rustc-serialize = "0.3"
log = "0.3.6"
combine = "2.2"
tempdir = "0.3"
bincode = "0.5"
libc = {version = "0.2.20", optional=true}
num_cpus = "1.2"
@@ -37,10 +35,12 @@ uuid = { version = "0.4", features = ["v4", "rustc-serialize"] }
chan = "0.1"
version = "2"
crossbeam = "0.2"
futures = "0.1.9"
futures-cpupool = "0.1.2"
[target.'cfg(windows)'.dependencies]
winapi = "*"
[dev-dependencies]
rand = "0.3"

View File

@@ -23,6 +23,10 @@ use std::sync::RwLock;
use std::sync::Weak;
use tempdir::TempDir;
#[cfg(windows)]
use winapi::winbase::FILE_FLAG_BACKUP_SEMANTICS;
fn open_mmap(full_path: &PathBuf) -> result::Result<Option<Arc<Mmap>>, FileError> {
let convert_file_error = |err: io::Error| {
@@ -231,11 +235,9 @@ impl MmapDirectory {
#[cfg(windows)]
{
use std::os::windows::fs::OpenOptionsExt;
const FILE_FLAG_BACKUP_SEMANTICS: u32 = 0x02000000;
open_opts.write(true)
.custom_flags(FILE_FLAG_BACKUP_SEMANTICS);
};
}
let fd = try!(open_opts.open(&self.root_path));
try!(fd.sync_all());

View File

@@ -51,6 +51,9 @@ extern crate futures_cpupool;
#[cfg(feature="simdcompression")]
extern crate libc;
#[cfg(windows)]
extern crate winapi;
#[cfg(test)] extern crate test;
#[cfg(test)] extern crate rand;