fs_node_init_on_create

Function fs_node_init_on_create 

Source
pub fn fs_node_init_on_create(
    current_task: &CurrentTask,
    new_node: &FsNode,
    parent: &FsNode,
    name: &FsStr,
) -> Result<Option<FsNodeSecurityXattr>, Errno>
Expand description

Called by file-system implementations when creating the FsNode for a new file, to determine the correct label based on the CurrentTask and parent node, and the policy-defined transition rules, and to initialize the FsNode’s security state accordingly. If no policy has yet been loaded then this is a no-op; if the FsNode corresponds to an xattr- labeled file then it will receive the file-system’s “default” label once a policy is loaded. Returns an extended attribute value to set on the newly-created file if the labeling scheme is fs_use_xattr. For other labeling schemes (e.g. fs_use_trans, mountpoint-labeling) a label is set on the FsNode security state, but no extended attribute is set nor returned. The name with which the new node is being created allows name-conditional type_transition rules to be applied when determining the label for the new_node. Corresponds to the inode_init_security() LSM hook.