Make 64-byte block alignment an explicit requirement in RAID API
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-win (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2026-08-20 10:11:14 +02:00
parent ee4e3175c8
commit bcaabd6dc0
2 changed files with 22 additions and 13 deletions

View file

@ -133,6 +133,8 @@ int raid_mode(int mode);
* Before calling raid_rec() and raid_data() you must provide a memory
* buffer filled with zeros of the same size as the blocks to recover.
*
* The buffer pointed to by @zero must be aligned to a 64-byte boundary.
*
* This buffer is only read and never written.
*/
void raid_zero(void *zero);
@ -152,7 +154,7 @@ void raid_zero(void *zero);
* It has (@nd + @np) elements. The starting elements are the blocks for
* data, following with the parity blocks.
* Data blocks are only read and not modified. Parity blocks are written.
* Each block has @size bytes.
* Each block has @size bytes and must be aligned to a 64-byte boundary.
*/
void raid_gen(int nd, int np, size_t size, void **v);
@ -187,7 +189,7 @@ void raid_gen(int nd, int np, size_t size, void **v);
* @v Vector of pointers to the blocks of data and parity.
* It has (@nd + @np) elements. The starting elements are the blocks
* for data, following with the parity blocks.
* Each block has @size bytes.
* Each block has @size bytes and must be aligned to a 64-byte boundary.
*/
void raid_rec(int nr, int *ir, int nd, int np, size_t size, void **v);
@ -207,7 +209,7 @@ void raid_rec(int nr, int *ir, int nd, int np, size_t size, void **v);
* @v Vector of pointers to the blocks of data and parity.
* It has (@nd + @ip[@nr - 1] + 1) elements. The starting elements are the
* blocks for data, following with the parity blocks.
* Each block has @size bytes.
* Each block has @size bytes and must be aligned to a 64-byte boundary.
*/
void raid_data(int nr, int *id, int *ip, int nd, size_t size, void **v);
@ -234,7 +236,7 @@ void raid_data(int nr, int *id, int *ip, int nd, size_t size, void **v);
* @v Vector of pointers to the blocks of data and parity.
* It has (@nd + @np) elements. The starting elements are the blocks
* for data, following with the parity blocks.
* Each block has @size bytes.
* Each block has @size bytes and must be aligned to a 64-byte boundary.
* @return 0 if the check is satisfied. -1 otherwise.
*/
int raid_check(int nr, int *ir, int nd, int np, size_t size, void **v);
@ -271,7 +273,7 @@ int raid_check(int nr, int *ir, int nd, int np, size_t size, void **v);
* @v Vector of pointers to the blocks of data and parity.
* It has (@nd + @np) elements. The starting elements are the blocks
* for data, following with the parity blocks.
* Each block has @size bytes.
* Each block has @size bytes and must be aligned to a 64-byte boundary.
* @return Number of block indexes returned in the @ir vector.
* 0 if no error is detected.
* -1 if it's not possible to identify the failed disks.