Refactor carveout manipulating code

This commit refactors the code pertaining to the carveout
manipulation. Since implementation wise both carveout and infoblock
are identical it would stand to reason to generalize code for
manipulating carveout and make provisions for infoblock manipulations.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>