Skip to content

KFunc bpf_real_data_inode

v7.2

Get the real inode hosting a file's data.

Definition

Resolve file to the inode that hosts its data. For a regular file on a union/overlay file system this is the underlying (upper or lower) inode that stores the data, not the overlay inode.

Data resolution only applies to regular files. For a non-regular file (e.g. a device node, FIFO or socket) on a union/overlay file system the overlay inode itself is returned; for any file on a non-union file system the inode attached to file is returned.

Parameters

file: file to resolve

Returns

The inode hosting files data, or NULL.

Signature

struct inode *bpf_real_data_inode(struct file *file)

Note

This function may sleep, and therefore can only be used from sleepable programs.

Note

The pointer returned by the kfunc may be NULL. Hence, it forces the user to do a NULL check on the pointer returned from the kfunc before making use of it (dereferencing or passing to another helper).

Usage

Docs could be improved

This part of the docs is incomplete, contributions are very welcome

Program types

The following program types can make use of this kfunc:

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome