.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "" "" "2023-05-26" "PMDK - " "PMDK Programmer's Manual" .hy .\" SPDX-License-Identifier: BSD-3-Clause .\" Copyright 2020, Intel Corporation .SH NAME .PP \f[B]pmem2_badblock_clear\f[R]() - clear the given bad block .SH SYNOPSIS .IP .nf \f[C] #include struct pmem2_badblock; struct pmem2_badblock_context; int pmem2_badblock_clear( struct pmem2_badblock_context *bbctx, struct pmem2_badblock *bb); \f[R] .fi .SH DESCRIPTION .PP The \f[B]pmem2_badblock_clear\f[R]() function clears the given \f[I]*bb\f[R] bad block. .PP It means that the \f[B]pmem2_badblock_clear\f[R]() function unmaps bad blocks and maps new, healthy, blocks in place of the bad ones. The new blocks are zeroed. The content of the bad blocks is lost. .PP It is not supported on Windows. .SH RETURN VALUE .PP The \f[B]pmem2_badblock_clear\f[R]() function clears the given \f[I]*bb\f[R] bad block and returns 0 on success or a negative error code on failure. .SH ERRORS .PP \f[B]pmem2_badblock_clear\f[R]() can fail with the following errors: .IP \[bu] 2 \f[B]PMEM2_E_OFFSET_OUT_OF_RANGE\f[R] - bad block\[cq]s offset is greater than INT64_MAX .IP \[bu] 2 \f[B]PMEM2_E_LENGTH_OUT_OF_RANGE\f[R] - bad block\[cq]s length is greater than INT64_MAX .IP \[bu] 2 \f[B]PMEM2_E_NOSUPP\f[R] - on Windows or when the OS does not support this functionality .IP \[bu] 2 \f[B]-errno\f[R] - set by failing \f[B]fallocate\f[R](2), while deallocating bad blocks or allocating new blocks .IP \[bu] 2 \f[B]-errno\f[R] - set by failing ndctl functions: \f[B]ndctl_bus_cmd_new_ars_cap\f[R], \f[B]ndctl_cmd_submit\f[R], \f[B]ndctl_cmd_ars_cap_get_range\f[R] or \f[B]ndctl_bus_cmd_new_clear_error\f[R] while trying to clear a bad block in a DAX device .IP \[bu] 2 \f[B]-ENXIO\f[R] - \f[B]ndctl_bus_cmd_new_clear_error\f[R] did not manage to clear all bad blocks .SH SEE ALSO .PP \f[B]pmem2_badblock_context_new\f[R](3), \f[B]pmem2_badblock_next\f[R](3), \f[B]libpmem2\f[R](7) and \f[B]\f[R]