/* mdraid_linux.c - module to handle Linux Software RAID. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
GRUB_MOD_LICENSE ("GPLv3+");
/* Linux RAID on disk structures and constants,
/*
* The version-1 superblock :
* All numeric fields are little-endian.
*
* Total size: 256 bytes plus 2 per device.
* 1K allows 384 devices.
*/
struct grub_raid_super_1x
{
/* Constant array information - 128 bytes. */
* NOTE: signed, so bitmap can be before superblock
* only meaningful of feature_map[0] is set.
*/
/* These are only valid with feature bit '4'. */
/* Constant this-device information - 64 bytes. */
grub_uint64_t recovery_offset; /* Sectors before this offset (from data_offset) have been recovered. */
/* Array state information - 64 bytes. */
/* Device state information. Indexed by dev_number.
* 2 bytes per device.
* Note there are no per-device state flags. State information is rolled
* into the 'roles' value. If a device is spare or faulty, then it doesn't
* have a meaningful role.
*/
};
/* Could be __attribute__ ((packed)), but since all members in this struct
are already appropriately aligned, we can omit this and avoid suboptimal
assembly in some cases. */
static grub_err_t
{
/* Check for an 1.x superblock.
* It's always aligned to a 4K boundary
* and depending on the minor version it can be:
* 0: At least 8K, but less than 12K, from end of device
* 1: At start of device
* 2: 4K from start of device.
*/
{
continue;
switch (minor_version)
{
case 0:
break;
case 1:
sector = 0;
break;
case 2:
break;
}
&sb))
return grub_errno;
continue;
{
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported RAID version: %d",
/* Multipath. */
if ((int) level == -4)
level = 1;
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
/* 1.x superblocks don't have a fixed size on disk. So we have to
read it again now that we now the max device count. */
sb_size = sizeof (struct grub_raid_super_1x)
if (! real_sb)
return grub_errno;
{
return grub_errno;
}
{
return grub_errno;
}
else
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"spares aren't implemented");
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"spares aren't implemented");
{
return grub_errno;
}
return 0;
}
}
}
.name = "mdraid1x",
.next = 0
};
{
}
{
}