/// Opens a file and verifies the result of GetFlags() and NodeGetFlags().
Opens a file and verifies the result of GetFlags() and NodeGetFlags().
Opens a file and verifies the result of GetFlags () and NodeGetFlags () .
async fn assert_get_flags(
    root_dir: &DirectoryProxy,
    path: &str,
    open_flag: u32,
    status_flags: u32,
    right_flags: u32,
) {
    let file = open_file(&root_dir, path, open_flag).await.unwrap();
    // The flags returned by GetFlags() do NOT always match the flags the file is opened with
    // because File servers each AND the open flag with some other flags. The `status_flags` and
    // `right_flags` parameters are meant to account for these implementation differences.
    let expected_flags = open_flag & (status_flags | right_flags);
    // Verify GetFlags() produces the expected result.
    let (status, flags) = file.get_flags().await.unwrap();
    let () = zx::Status::ok(status).unwrap();
    assert_eq!(flags, expected_flags);
    // NodeGetFlags() and GetFlags() should have the same result.
    let (status, flags) = file.node_get_flags().await.unwrap();
    let () = zx::Status::ok(status).unwrap();
    assert_eq!(flags, expected_flags);
}
async fn assert_get_flags ( root_dir : & DirectoryProxy , path : & str , open_flag : u32 , status_flags : u32 , right_flags : u32 , ) { let file = open_file ( & root_dir , path , open_flag ) . await . unwrap ( ) ; // The flags returned by GetFlags() do NOT always match the flags the file is opened with // because File servers each AND the open flag with some other flags. The `status_flags` and // `right_flags` parameters are meant to account for these implementation differences. let expected_flags = open_flag & ( status_flags | right_flags ) ; // Verify GetFlags() produces the expected result. let ( status , flags ) = file . get_flags ( ) . await . unwrap ( ) ; let ( ) = zx :: Status :: ok ( status ) . unwrap ( ) ; assert_eq ! ( flags expected_flags ) ; // NodeGetFlags() and GetFlags() should have the same result. let ( status , flags ) = file . node_get_flags ( ) . await . unwrap ( ) ; let ( ) = zx :: Status :: ok ( status ) . unwrap ( ) ; assert_eq ! ( flags expected_flags ) ; }
Opens a file and verifies the result of GetFlags() and NodeGetFlags().
Opens a file and verifies the result of GetFlags () and NodeGetFlags () .
root_dir
&DirectoryProxy
path
&str
open_flag
u32
status_flags
u32
right_flags
u32