pub fn inherit_rights_for_clone(parent_flags: u32, mut flags: u32) -> Result<u32, Status> {
    if (flags & CLONE_FLAG_SAME_RIGHTS != 0) && (flags & FS_RIGHTS != 0) {
        return Err(Status::INVALID_ARGS);
    }

    // We preserve OPEN_FLAG_APPEND as this is what is the most convenient for the POSIX emulation.
    //
    // OPEN_FLAG_NODE_REFERENCE is enforced, according to our current FS permissions design.
    flags |= parent_flags & (OPEN_FLAG_APPEND | OPEN_FLAG_NODE_REFERENCE);

    // If CLONE_FLAG_SAME_RIGHTS is requested, cloned connection will inherit the same rights
    // as those from the originating connection.  We have ensured that no FS_RIGHTS flags are set
    // above.
    if flags & CLONE_FLAG_SAME_RIGHTS != 0 {
        flags &= !CLONE_FLAG_SAME_RIGHTS;
        flags |= parent_flags & FS_RIGHTS;
    }

    if !stricter_or_same_rights(parent_flags, flags) {
        return Err(Status::ACCESS_DENIED);
    }

    Ok(flags)
}
/// Common logic for rights processing during cloning a node, shared by both file and directory
/// implementations.
Common logic for rights processing during cloning a node, shared by both file and directory
implementations.
Common logic for rights processing during cloning a node shared by both file and directory implementations .
pub fn inherit_rights_for_clone(parent_flags: u32, mut flags: u32) -> Result<u32, Status> {
    if (flags & CLONE_FLAG_SAME_RIGHTS != 0) && (flags & FS_RIGHTS != 0) {
        return Err(Status::INVALID_ARGS);
    }
    // We preserve OPEN_FLAG_APPEND as this is what is the most convenient for the POSIX emulation.
    //
    // OPEN_FLAG_NODE_REFERENCE is enforced, according to our current FS permissions design.
    flags |= parent_flags & (OPEN_FLAG_APPEND | OPEN_FLAG_NODE_REFERENCE);
    // If CLONE_FLAG_SAME_RIGHTS is requested, cloned connection will inherit the same rights
    // as those from the originating connection.  We have ensured that no FS_RIGHTS flags are set
    // above.
    if flags & CLONE_FLAG_SAME_RIGHTS != 0 {
        flags &= !CLONE_FLAG_SAME_RIGHTS;
        flags |= parent_flags & FS_RIGHTS;
    }
    if !stricter_or_same_rights(parent_flags, flags) {
        return Err(Status::ACCESS_DENIED);
    }
    Ok(flags)
}
pub fn inherit_rights_for_clone ( parent_flags : u32 , mut flags : u32 ) -> Result < u32 , Status > { if ( flags & CLONE_FLAG_SAME_RIGHTS != 0 ) && ( flags & FS_RIGHTS != 0 ) { return Err ( Status :: INVALID_ARGS ) ; } // We preserve OPEN_FLAG_APPEND as this is what is the most convenient for the POSIX emulation. // // OPEN_FLAG_NODE_REFERENCE is enforced, according to our current FS permissions design. flags |= parent_flags & ( OPEN_FLAG_APPEND | OPEN_FLAG_NODE_REFERENCE ) ; // If CLONE_FLAG_SAME_RIGHTS is requested, cloned connection will inherit the same rights // as those from the originating connection.  We have ensured that no FS_RIGHTS flags are set // above. if flags & CLONE_FLAG_SAME_RIGHTS != 0 { flags &= ! CLONE_FLAG_SAME_RIGHTS ; flags |= parent_flags & FS_RIGHTS ; } if ! stricter_or_same_rights ( parent_flags , flags ) { return Err ( Status :: ACCESS_DENIED ) ; } Ok ( flags ) }
Common logic for rights processing during cloning a node, shared by both file and directory
implementations.
Common logic for rights processing during cloning a node shared by both file and directory implementations .
parent_flags
u32
flags
u32
parent_flags
u32
flags
u32