[RFC PATCH v1 2/6] badblocks: add helper routines for badblock ranges handling