1
/* raid5_recover.c - module to recover from faulty RAID4/5 arrays. */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
6
* GRUB is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* GRUB is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
21
#include <grub/disk.h>
24
#include <grub/misc.h>
25
#include <grub/raid.h>
28
grub_raid5_recover (struct grub_raid_array *array, int disknr,
29
char *buf, grub_disk_addr_t sector, int size)
34
size <<= GRUB_DISK_SECTOR_BITS;
35
buf2 = grub_malloc (size);
39
grub_memset (buf, 0, size);
41
for (i = 0; i < (int) array->total_devs; i++)
48
err = grub_disk_read (array->device[i], sector, 0, size, buf2);
56
grub_raid_block_xor (buf, buf2, size);
64
GRUB_MOD_INIT(raid5rec)
66
grub_raid5_recover_func = grub_raid5_recover;
69
GRUB_MOD_FINI(raid5rec)
71
grub_raid5_recover_func = 0;