}
-static void xor_blocks(char *target, char **sources, int disks, int size)
+void xor_blocks(char *target, char **sources, int disks, int size)
{
int i, j;
/* Amazingly inefficient... */
uint8_t *zero;
int zero_size;
+
+void ensure_zero_has_size(int chunk_size)
+{
+ if (zero == NULL || chunk_size > zero_size) {
+ if (zero)
+ free(zero);
+ zero = xcalloc(1, chunk_size);
+ zero_size = chunk_size;
+ }
+}
+
/* Following was taken from linux/drivers/md/raid6recov.c */
/* Recover two failed data blocks. */
if (!tables_ready)
make_tables();
-
- if (zero == NULL || chunk_size > zero_size) {
- if (zero)
- free(zero);
- zero = xcalloc(1, chunk_size);
- zero_size = chunk_size;
- }
+ ensure_zero_has_size(chunk_size);
len = data_disks * chunk_size;
length_test = length / len;