/// 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 try_inherit_rights_for_clone(source_flags: u32, mut flags: u32) -> Result<u32, Status> {
    if (flags & CLONE_FLAG_SAME_RIGHTS != 0) && (flags & FS_RIGHTS != 0) {
        return Err(Status::INVALID_ARGS);
    }
    flags |= source_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.
    if flags & CLONE_FLAG_SAME_RIGHTS != 0 {
        flags &= !FS_RIGHTS;
        flags |= source_flags & FS_RIGHTS;
        flags &= !CLONE_FLAG_SAME_RIGHTS
    }
    if !stricter_or_same_rights(flags, source_flags) {
        return Err(Status::ACCESS_DENIED);
    }
    Ok(flags)
}
pub fn try_inherit_rights_for_clone ( source_flags : u32 , mut flags : u32 ) -> Result < u32 , Status > { if ( flags & CLONE_FLAG_SAME_RIGHTS != 0 ) && ( flags & FS_RIGHTS != 0 ) { return Err ( Status :: INVALID_ARGS ) ; } flags |= source_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. if flags & CLONE_FLAG_SAME_RIGHTS != 0 { flags &= ! FS_RIGHTS ; flags |= source_flags & FS_RIGHTS ; flags &= ! CLONE_FLAG_SAME_RIGHTS } if ! stricter_or_same_rights ( flags , source_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 .
source_flags
u32
flags
u32