pub fn open<P: AsRef<Path>>(path: P, mode: Mode, fa: FileAccess, alignment: usize) -> io::Result<DirectFile> {
        let flags = O_DIRECT | match mode {
            Open => 0,
            Append => libc::O_APPEND,
            Truncate => libc::O_TRUNC,
        };
        // Opening with a write permission must silently create the file.
        let (flags, mode) = match fa {
            Read => (flags | libc::O_RDONLY, 0),
            Write => (flags | libc::O_WRONLY | libc::O_CREAT,
                      libc::S_IRUSR | libc::S_IWUSR),
            ReadWrite => (flags | libc::O_RDWR | libc::O_CREAT,
                          libc::S_IRUSR | libc::S_IWUSR),
        };

        let path = path.as_ref().as_os_str().to_bytes().unwrap();
        match retry(|| unsafe { libc::open(path.as_ptr() as *const i8, flags, mode) as isize }) {
            -1 => Err(io::Error::last_os_error()),
            fd => Ok(DirectFile { fd: FD(fd as i32), alignment: alignment }),
        }
    }
// XXX auto-query directio alignment
XXX auto-query directio alignment
XXX auto - query directio alignment
pub fn open<P: AsRef<Path>>(path: P, mode: Mode, fa: FileAccess, alignment: usize) -> io::Result<DirectFile> {
        let flags = O_DIRECT | match mode {
            Open => 0,
            Append => libc::O_APPEND,
            Truncate => libc::O_TRUNC,
        };
        // Opening with a write permission must silently create the file.
        let (flags, mode) = match fa {
            Read => (flags | libc::O_RDONLY, 0),
            Write => (flags | libc::O_WRONLY | libc::O_CREAT,
                      libc::S_IRUSR | libc::S_IWUSR),
            ReadWrite => (flags | libc::O_RDWR | libc::O_CREAT,
                          libc::S_IRUSR | libc::S_IWUSR),
        };
        let path = path.as_ref().as_os_str().to_bytes().unwrap();
        match retry(|| unsafe { libc::open(path.as_ptr() as *const i8, flags, mode) as isize }) {
            -1 => Err(io::Error::last_os_error()),
            fd => Ok(DirectFile { fd: FD(fd as i32), alignment: alignment }),
        }
    }
pub fn open < P : AsRef < Path > > ( path : P , mode : Mode , fa : FileAccess , alignment : usize ) -> io :: Result < DirectFile > { let flags = O_DIRECT | match mode { Open => 0 , Append => libc :: O_APPEND , Truncate => libc :: O_TRUNC , } ; // Opening with a write permission must silently create the file. let ( flags , mode ) = match fa { Read => ( flags | libc :: O_RDONLY , 0 ) , Write => ( flags | libc :: O_WRONLY | libc :: O_CREAT , libc :: S_IRUSR | libc :: S_IWUSR ) , ReadWrite => ( flags | libc :: O_RDWR | libc :: O_CREAT , libc :: S_IRUSR | libc :: S_IWUSR ) , } ; let path = path . as_ref ( ) . as_os_str ( ) . to_bytes ( ) . unwrap ( ) ; match retry ( | | unsafe { libc :: open ( path . as_ptr ( ) as * const i8 , flags , mode ) as isize } ) { - 1 => Err ( io :: Error :: last_os_error ( ) ) , fd => Ok ( DirectFile { fd : FD ( fd as i32 ) , alignment : alignment } ) , } }
XXX auto-query directio alignment
XXX auto - query directio alignment
path
P
mode
Mode
fa
FileAccess
alignment
usize
path
P
mode
Mode
fa
FileAccess
alignment
usize