imsm: initial Intel(R) Matrix Storage Manager support

From: Dan Williams <dan.j.williams@intel.com>

The following now work:
--examine
--examine --brief

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2008-05-15 16:48:22 +10:00 committed by Neil Brown
parent 2f6079dc96
commit cdddbdbca0
5 changed files with 1083 additions and 6 deletions

View File

@ -69,19 +69,19 @@ MAN8DIR = $(MANDIR)/man8
OBJS = mdadm.o config.o mdstat.o ReadMe.o util.o Manage.o Assemble.o Build.o \
Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \
Incremental.o \
mdopen.o super0.o super1.o super-ddf.o bitmap.o restripe.o sysfs.o \
sha1.o mapfile.o crc32.o
mdopen.o super0.o super1.o super-ddf.o super-intel.o bitmap.o \
restripe.o sysfs.o sha1.o mapfile.o crc32.o sg_io.o
SRCS = mdadm.c config.c mdstat.c ReadMe.c util.c Manage.c Assemble.c Build.c \
Create.c Detail.c Examine.c Grow.c Monitor.c dlink.c Kill.c Query.c \
Incremental.c \
mdopen.c super0.c super1.c super-ddf.c bitmap.c restripe.c sysfs.c \
sha1.c mapfile.c crc32.c
mdopen.c super0.c super1.c super-ddf.c super-intel.c bitmap.c \
restripe.c sysfs.c sha1.c mapfile.c crc32.c sg_io.c
STATICSRC = pwgr.c
STATICOBJS = pwgr.o
ASSEMBLE_SRCS := mdassemble.c Assemble.c Manage.c config.c dlink.c util.c \
super0.c super1.c super-ddf.c sha1.c crc32.c
super0.c super1.c super-ddf.c super-intel.c sha1.c crc32.c sg_io.c
ASSEMBLE_FLAGS:= $(CFLAGS) -DMDASSEMBLE
ifdef MDASSEMBLE_AUTO
ASSEMBLE_SRCS += mdopen.c mdstat.c

View File

@ -393,6 +393,8 @@ extern struct superswitch {
int external;
} super0, super1, super_ddf, super_ddf_bvd, super_ddf_svd, *superlist[];
extern struct superswitch super_imsm, super_imsm_raid;
struct supertype {
struct superswitch *ss;
int minor_version;

42
sg_io.c Normal file
View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2007 Intel Corporation
*
* Retrieve drive serial numbers for scsi disks
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <string.h>
#include <scsi/scsi.h>
#include <scsi/sg.h>
#include <sys/ioctl.h>
int scsi_get_serial(int fd, void *buf, size_t buf_len)
{
unsigned char inq_cmd[] = {INQUIRY, 1, 0x80, 0, buf_len, 0};
unsigned char sense[32];
struct sg_io_hdr io_hdr;
memset(&io_hdr, 0, sizeof(io_hdr));
io_hdr.interface_id = 'S';
io_hdr.cmdp = inq_cmd;
io_hdr.cmd_len = sizeof(inq_cmd);
io_hdr.dxferp = buf;
io_hdr.dxfer_len = buf_len;
io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
io_hdr.sbp = sense;
io_hdr.mx_sb_len = sizeof(sense);
io_hdr.timeout = 5000;
return ioctl(fd, SG_IO, &io_hdr);
}

1033
super-intel.c Normal file

File diff suppressed because it is too large Load Diff

2
util.c
View File

@ -780,7 +780,7 @@ int dev_open(char *dev, int flags)
return fd;
}
struct superswitch *superlist[] = { &super0, &super1, &super_ddf, NULL };
struct superswitch *superlist[] = { &super0, &super1, &super_ddf, &super_imsm, NULL };
#if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)
struct supertype *super_by_fd(int fd)