hal/volume_id Makefile.am, 1.5, 1.6 highpoint.c, 1.3,
1.4 highpoint.h, 1.1, 1.2 isw_raid.c, NONE, 1.1 isw_raid.h,
NONE, 1.1 linux_raid.c, 1.3, 1.4 logging.h, 1.3,
1.4 lsi_raid.c, NONE, 1.1 lsi_raid.h, NONE, 1.1 ntfs.c, 1.3,
1.4 nvidia_raid.c, NONE, 1.1 nvidia_raid.h, NONE,
1.1 promise_raid.c, NONE, 1.1 promise_raid.h, NONE,
1.1 silicon_raid.c, NONE, 1.1 silicon_raid.h, NONE,
1.1 via_raid.c, NONE, 1.1 via_raid.h, NONE, 1.1 volume_id.c,
1.6, 1.7 volume_id.h, 1.7, 1.8
Kay Sievers
kay at freedesktop.org
Fri Mar 11 10:00:37 PST 2005
Update of /cvs/hal/hal/volume_id
In directory gabe:/tmp/cvs-serv13214/volume_id
Modified Files:
Makefile.am highpoint.c highpoint.h linux_raid.c logging.h
ntfs.c volume_id.c volume_id.h
Added Files:
isw_raid.c isw_raid.h lsi_raid.c lsi_raid.h nvidia_raid.c
nvidia_raid.h promise_raid.c promise_raid.h silicon_raid.c
silicon_raid.h via_raid.c via_raid.h
Log Message:
2005-03-11 Kay Sievers <kay.sievers at vrfy.org>
Add all the ATA raid signatures which are supported in the dmraid
library. volume_id will just recognize the raid signatures and set
the usage to raid, to prevent raid members to show up as mountable
volumes. Any detailed informatiuon about the raid set must be
queried with the original lib.
* volume_id/Makefile.am:
* volume_id/highpoint.c: (volume_id_probe_highpoint_37x_raid),
(volume_id_probe_highpoint_45x_raid):
* volume_id/highpoint.h:
* volume_id/isw_raid.c: (volume_id_probe_intel_software_raid):
* volume_id/isw_raid.h:
* volume_id/linux_raid.c: (volume_id_probe_linux_raid):
* volume_id/logging.h:
* volume_id/lsi_raid.c: (volume_id_probe_lsi_mega_raid):
* volume_id/lsi_raid.h:
* volume_id/ntfs.c: (volume_id_probe_ntfs):
* volume_id/nvidia_raid.c: (volume_id_probe_nvidia_raid):
* volume_id/nvidia_raid.h:
* volume_id/promise_raid.c:
(volume_id_probe_promise_fasttrack_raid):
* volume_id/promise_raid.h:
* volume_id/silicon_raid.c: (volume_id_probe_silicon_medley_raid):
* volume_id/silicon_raid.h:
* volume_id/via_raid.c: (volume_id_probe_via_raid):
* volume_id/via_raid.h:
* volume_id/volume_id.c: (volume_id_probe_all):
* volume_id/volume_id.h: Version 42.
Index: Makefile.am
===================================================================
RCS file: /cvs/hal/hal/volume_id/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Makefile.am 10 Mar 2005 23:18:33 -0000 1.5
+++ Makefile.am 11 Mar 2005 18:00:35 -0000 1.6
@@ -9,6 +9,12 @@
fat.h fat.c \
hfs.h hfs.c \
highpoint.h highpoint.c \
+ isw_raid.h isw_raid.c \
+ lsi_raid.h lsi_raid.c \
+ via_raid.h via_raid.c \
+ silicon_raid.h silicon_raid.c \
+ nvidia_raid.h nvidia_raid.c \
+ promise_raid.h promise_raid.c \
iso9660.h iso9660.c \
jfs.h jfs.c \
linux_raid.h linux_raid.c \
Index: highpoint.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/highpoint.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- highpoint.c 10 Mar 2005 23:18:33 -0000 1.3
+++ highpoint.c 11 Mar 2005 18:00:35 -0000 1.4
@@ -39,20 +39,28 @@
#include "util.h"
#include "highpoint.h"
-struct hpt37x {
+struct hpt37x_meta {
__u8 filler1[32];
__u32 magic;
- __u32 magic_0;
- __u32 magic_1;
-} __attribute__((packed)) *hpt;
+} __attribute__((packed));
+
+struct hpt45x_meta {
+ __u32 magic;
+} __attribute__((packed));
#define HPT37X_CONFIG_OFF 0x1200
#define HPT37X_MAGIC_OK 0x5a7816f0
#define HPT37X_MAGIC_BAD 0x5a7816fd
-int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off)
+#define HPT45X_MAGIC_OK 0x5a7816f3
+#define HPT45X_MAGIC_BAD 0x5a7816fd
+
+
+int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off)
{
const __u8 *buf;
+ struct hpt37x_meta *hpt;
+ __u32 magic;
dbg("probing at offset 0x%llx", (unsigned long long) off);
@@ -60,13 +68,42 @@
if (buf == NULL)
return -1;
- hpt = (struct hpt37x *) buf;
+ hpt = (struct hpt37x_meta *) buf;
+ magic = le32_to_cpu(hpt->magic);
+ if (magic != HPT37X_MAGIC_OK && magic != HPT37X_MAGIC_BAD)
+ return -1;
- if (hpt->magic != HPT37X_MAGIC_OK && hpt->magic != HPT37X_MAGIC_BAD)
+ volume_id_set_usage(id, VOLUME_ID_RAID);
+ id->type = "highpoint_raid_member";
+
+ return 0;
+}
+
+int volume_id_probe_highpoint_45x_raid(struct volume_id *id, __u64 off, __u64 size)
+{
+ const __u8 *buf;
+ struct hpt45x_meta *hpt;
+ __u64 meta_off;
+ __u32 magic;
+
+ dbg("probing at offset 0x%llx, size 0x%llx",
+ (unsigned long long) off, (unsigned long long) size);
+
+ if (size < 0x10000)
+ return -1;
+
+ meta_off = ((size / 0x200)-11) * 0x200;
+ buf = volume_id_get_buffer(id, off + meta_off, 0x200);
+ if (buf == NULL)
+ return -1;
+
+ hpt = (struct hpt45x_meta *) buf;
+ magic = le32_to_cpu(hpt->magic);
+ if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD)
return -1;
volume_id_set_usage(id, VOLUME_ID_RAID);
- id->type = "hpt_ataraid_member";
+ id->type = "highpoint_raid_member";
return 0;
}
Index: highpoint.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/highpoint.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- highpoint.h 7 Feb 2005 21:24:16 -0000 1.1
+++ highpoint.h 11 Mar 2005 18:00:35 -0000 1.2
@@ -21,6 +21,7 @@
#ifndef _VOLUME_ID_HIGHPOINT_
#define _VOLUME_ID_HIGHPOINT_
-extern int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off);
+extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off);
+extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, __u64 off, __u64 size);
#endif
--- NEW FILE: isw_raid.c ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <asm/types.h>
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "isw_raid.h"
struct isw_meta {
__u8 sig[32];
__u32 check_sum;
__u32 mpb_size;
__u32 family_num;
__u32 generation_num;
} __attribute__((packed));
#define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. "
int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 size)
{
const __u8 *buf;
__u64 meta_off;
struct isw_meta *isw;
dbg("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
if (size < 0x10000)
return -1;
meta_off = ((size / 0x200)-2) * 0x200;
buf = volume_id_get_buffer(id, off + meta_off, 0x200);
if (buf == NULL)
return -1;
isw = (struct isw_meta *) buf;
if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
return -1;
volume_id_set_usage(id, VOLUME_ID_RAID);
strncpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6);
id->type = "isw_raid_member";
return 0;
}
--- NEW FILE: isw_raid.h ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _VOLUME_ID_ISW_RAID_
#define _VOLUME_ID_ISW_RAID_
extern int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 size);
#endif
Index: linux_raid.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/linux_raid.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- linux_raid.c 10 Mar 2005 23:18:33 -0000 1.3
+++ linux_raid.c 11 Mar 2005 18:00:35 -0000 1.4
@@ -67,7 +67,8 @@
__u64 sboff;
__u8 uuid[16];
- dbg("probing at offset 0x%llx", (unsigned long long) off);
+ dbg("probing at offset 0x%llx, size 0x%llx",
+ (unsigned long long) off, (unsigned long long) size);
if (size < 0x10000)
return -1;
@@ -86,7 +87,7 @@
memcpy(&uuid[4], &mdp->set_uuid1, 12);
volume_id_set_uuid(id, uuid, UUID_DCE);
- snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u.%u.%u",
+ snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u",
le32_to_cpu(mdp->major_version),
le32_to_cpu(mdp->minor_version),
le32_to_cpu(mdp->patch_version));
Index: logging.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/logging.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- logging.h 25 Feb 2005 17:21:48 -0000 1.3
+++ logging.h 11 Mar 2005 18:00:35 -0000 1.4
@@ -21,12 +21,14 @@
extern void volume_id_log (const char *format, ...);
#ifdef DEBUG
+#ifndef dbg
#define dbg(format, arg...) \
do { \
volume_id_log("%s: " format "\n", __FUNCTION__ , ## arg); \
} while (0)
#else
#define dbg(format, arg...) do {} while (0)
-#endif
+#endif /* dbg */
+#endif /* DEBUG */
#endif /* _VOLUME_ID_LOGGING_H_ */
--- NEW FILE: lsi_raid.c ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <asm/types.h>
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "lsi_raid.h"
struct lsi_meta {
__u8 sig[6];
} __attribute__((packed));
#define LSI_SIGNATURE "$XIDE$"
int volume_id_probe_lsi_mega_raid(struct volume_id *id, __u64 off, __u64 size)
{
const __u8 *buf;
__u64 meta_off;
struct lsi_meta *lsi;
dbg("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
if (size < 0x10000)
return -1;
meta_off = ((size / 0x200)-1) * 0x200;
buf = volume_id_get_buffer(id, off + meta_off, 0x200);
if (buf == NULL)
return -1;
lsi = (struct lsi_meta *) buf;
if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0)
return -1;
volume_id_set_usage(id, VOLUME_ID_RAID);
id->type = "lsi_mega_raid_member";
return 0;
}
--- NEW FILE: lsi_raid.h ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _VOLUME_ID_LSI_RAID_
#define _VOLUME_ID_LSI_RAID_
extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, __u64 off, __u64 size);
#endif
Index: ntfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/ntfs.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ntfs.c 10 Mar 2005 23:18:33 -0000 1.3
+++ ntfs.c 11 Mar 2005 18:00:35 -0000 1.4
@@ -184,7 +184,7 @@
if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) {
dbg("found info, len %i", val_len);
info = (struct volume_info*) (((__u8 *) attr) + val_off);
- snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1,
+ snprintf(id->type_version, sizeof(id->type_version)-1,
"%u.%u", info->major_ver, info->minor_ver);
}
--- NEW FILE: nvidia_raid.c ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <asm/types.h>
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "nvidia_raid.h"
struct nvidia_meta {
__u8 vendor[8];
__u32 size;
__u32 chksum;
__u16 version;
} __attribute__((packed));
#define NVIDIA_SIGNATURE "NVIDIA"
int volume_id_probe_nvidia_raid(struct volume_id *id, __u64 off, __u64 size)
{
const __u8 *buf;
__u64 meta_off;
struct nvidia_meta *nv;
dbg("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
if (size < 0x10000)
return -1;
meta_off = ((size / 0x200)-2) * 0x200;
buf = volume_id_get_buffer(id, off + meta_off, 0x200);
if (buf == NULL)
return -1;
nv = (struct nvidia_meta *) buf;
if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0)
return -1;
volume_id_set_usage(id, VOLUME_ID_RAID);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le16_to_cpu(nv->version));
id->type = "nvidia_raid_member";
return 0;
}
--- NEW FILE: nvidia_raid.h ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _VOLUME_ID_NVIDIA_RAID_
#define _VOLUME_ID_NVIDIA_RAID_
extern int volume_id_probe_nvidia_raid(struct volume_id *id, __u64 off, __u64 size);
#endif
--- NEW FILE: promise_raid.c ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <asm/types.h>
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "promise_raid.h"
struct promise_meta {
__u8 sig[24];
} __attribute__((packed));
#define PDC_CONFIG_OFF 0x1200
#define PDC_SIGNATURE "Promise Technology, Inc."
int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u64 size)
{
const __u8 *buf;
struct promise_meta *pdc;
unsigned int i;
static unsigned int sectors[] = {
63, 255, 256, 16, 399, 0
};
dbg("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
if (size < 0x40000)
return -1;
for (i = 0; sectors[i] != 0; i++) {
__u64 meta_off;
meta_off = ((size / 0x200) - sectors[i]) * 0x200;
buf = volume_id_get_buffer(id, off + meta_off, 0x200);
if (buf == NULL)
return -1;
pdc = (struct promise_meta *) buf;
if (memcmp(pdc->sig, PDC_SIGNATURE, sizeof(PDC_SIGNATURE)-1) == 0)
goto found;
}
return -1;
found:
volume_id_set_usage(id, VOLUME_ID_RAID);
id->type = "promise_fasttrack_raid_member";
return 0;
}
--- NEW FILE: promise_raid.h ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _VOLUME_ID_PROMISE_RAID_
#define _VOLUME_ID_PROMISE_RAID_
extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u64 size);
#endif
--- NEW FILE: silicon_raid.c ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <asm/types.h>
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "silicon_raid.h"
struct silicon_meta {
__u8 unknown0[0x2E];
__u8 ascii_version[0x36 - 0x2E];
__u8 diskname[0x56 - 0x36];
__u8 unknown1[0x60 - 0x56];
__u32 magic;
__u32 unknown1a[0x6C - 0x64];
__u32 array_sectors_low;
__u32 array_sectors_high;
__u8 unknown2[0x78 - 0x74];
__u32 thisdisk_sectors;
__u8 unknown3[0x100 - 0x7C];
__u8 unknown4[0x104 - 0x100];
__u16 product_id;
__u16 vendor_id;
__u16 minor_ver;
__u16 major_ver;
} __attribute__((packed));
#define SILICON_MAGIC 0x2F000000
int volume_id_probe_silicon_medley_raid(struct volume_id *id, __u64 off, __u64 size)
{
const __u8 *buf;
__u64 meta_off;
struct silicon_meta *sil;
dbg("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
if (size < 0x10000)
return -1;
meta_off = ((size / 0x200)-1) * 0x200;
buf = volume_id_get_buffer(id, off + meta_off, 0x200);
if (buf == NULL)
return -1;
sil = (struct silicon_meta *) buf;
if (le32_to_cpu(sil->magic) != SILICON_MAGIC)
return -1;
volume_id_set_usage(id, VOLUME_ID_RAID);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u",
le16_to_cpu(sil->major_ver), le16_to_cpu(sil->minor_ver));
id->type = "silicon_medley_raid_member";
return 0;
}
--- NEW FILE: silicon_raid.h ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _VOLUME_ID_SILICON_RAID_
#define _VOLUME_ID_SILICON_RAID_
extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, __u64 off, __u64 size);
#endif
--- NEW FILE: via_raid.c ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <asm/types.h>
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "via_raid.h"
struct via_meta {
__u16 signature;
__u8 version_number;
struct via_array {
__u16 disk_bits;
__u8 disk_array_ex;
__u32 capacity_low;
__u32 capacity_high;
__u32 serial_checksum;
} __attribute((packed)) array;
__u32 serial_checksum[8];
__u8 checksum;
} __attribute__((packed));
#define VIA_SIGNATURE 0xAA55
int volume_id_probe_via_raid(struct volume_id *id, __u64 off, __u64 size)
{
const __u8 *buf;
__u64 meta_off;
struct via_meta *via;
dbg("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
if (size < 0x10000)
return -1;
meta_off = ((size / 0x200)-1) * 0x200;
buf = volume_id_get_buffer(id, off + meta_off, 0x200);
if (buf == NULL)
return -1;
via = (struct via_meta *) buf;
if (le16_to_cpu(via->signature) != VIA_SIGNATURE)
return -1;
if (via->version_number > 1)
return -1;
volume_id_set_usage(id, VOLUME_ID_RAID);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u", via->version_number);
id->type = "via_raid_member";
return 0;
}
--- NEW FILE: via_raid.h ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _VOLUME_ID_VIA_RAID_
#define _VOLUME_ID_VIA_RAID_
extern int volume_id_probe_via_raid(struct volume_id *id, __u64 off, __u64 size);
#endif
Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- volume_id.c 10 Mar 2005 23:18:33 -0000 1.6
+++ volume_id.c 11 Mar 2005 18:00:35 -0000 1.7
@@ -52,6 +52,12 @@
#include "iso9660.h"
#include "udf.h"
#include "highpoint.h"
+#include "isw_raid.h"
+#include "lsi_raid.h"
+#include "via_raid.h"
+#include "silicon_raid.h"
+#include "nvidia_raid.h"
+#include "promise_raid.h"
#include "luks.h"
#include "linux_swap.h"
#include "linux_raid.h"
@@ -70,8 +76,31 @@
return -EINVAL;
/* probe for raid first, cause fs probes may be successful on raid members */
- if (volume_id_probe_linux_raid(id, off, size) == 0)
- goto exit;
+ if (size) {
+ if (volume_id_probe_linux_raid(id, off, size) == 0)
+ goto exit;
+
+ if (volume_id_probe_intel_software_raid(id, off, size) == 0)
+ goto exit;
+
+ if (volume_id_probe_lsi_mega_raid(id, off, size) == 0)
+ goto exit;
+
+ if (volume_id_probe_via_raid(id, off, size) == 0)
+ goto exit;
+
+ if (volume_id_probe_silicon_medley_raid(id, off, size) == 0)
+ goto exit;
+
+ if (volume_id_probe_nvidia_raid(id, off, size) == 0)
+ goto exit;
+
+ if (volume_id_probe_promise_fasttrack_raid(id, off, size) == 0)
+ goto exit;
+
+ if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0)
+ goto exit;
+ }
if (volume_id_probe_lvm1(id, off) == 0)
goto exit;
@@ -79,7 +108,7 @@
if (volume_id_probe_lvm2(id, off) == 0)
goto exit;
- if (volume_id_probe_highpoint_ataraid(id, off) == 0)
+ if (volume_id_probe_highpoint_37x_raid(id, off) == 0)
goto exit;
if (volume_id_probe_luks(id, off) == 0)
Index: volume_id.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- volume_id.h 10 Mar 2005 23:18:33 -0000 1.7
+++ volume_id.h 11 Mar 2005 18:00:35 -0000 1.8
@@ -21,7 +21,7 @@
#ifndef _VOLUME_ID_H_
#define _VOLUME_ID_H_
-#define VOLUME_ID_VERSION 41
+#define VOLUME_ID_VERSION 42
#define VOLUME_ID_LABEL_SIZE 64
#define VOLUME_ID_UUID_SIZE 36
More information about the hal-commit
mailing list