Skip to main content

ubi_rpeb

Function ubi_rpeb 

pub fn ubi_rpeb<Fd: AsFd>(fd: Fd, pnum: i32) -> Result<bool, Errno>
Expand description

UBI_IOCRPEB: reads physical eraseblock pnum of the UBI device of the file, /dev/ubi<n>, and scrubs it if it has bit flips.

Returns true if the read found bit flips and the kernel scheduled a scrub. The kernel reports that as EUCLEAN. A failed read, including an uncorrectable ECC error, returns false, so this can’t detect bad data.

Needs CAP_SYS_RESOURCE. Added in Linux 5.1. Older kernels return ENOTTY.

§Errors

Returns the error of the ioctl. A pnum outside the device returns EINVAL, and a physical eraseblock that UBI doesn’t use returns ENOENT. A physical eraseblock that is already scheduled for a scrub, marked as erroneous or being moved returns EBUSY.