chiark / gitweb /
[PATCH] add scsi_id "extra" program from Patrick Mansfield <patmans@us.ibm.com>
[elogind.git] / extras / multipath / main.h
1 /*
2  * Soft:        Description here...
3  *
4  * Version:     $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $
5  *
6  * Author:      Copyright (C) 2003 Christophe Varoqui
7  *
8  *              This program is distributed in the hope that it will be useful,
9  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  *              See the GNU General Public License for more details.
12  *
13  *              This program is free software; you can redistribute it and/or
14  *              modify it under the terms of the GNU General Public License
15  *              as published by the Free Software Foundation; either version
16  *              2 of the License, or (at your option) any later version.
17  */
18
19 #ifndef _MAIN_H
20 #define _MAIN_H
21
22 /* local includes */
23 #include "sg_include.h"
24 #include "sg_err.h"
25
26 /* global defs */
27 #define WWID_SIZE       33
28 #define MAX_DEVS        128
29 #define MAX_MP          MAX_DEVS / 2
30 #define MAX_MP_PATHS    MAX_DEVS / 4
31 #define FILE_NAME_SIZE  256
32 #define INQUIRY_CMDLEN  6
33 #define INQUIRY_CMD     0x12
34 #define SENSE_BUFF_LEN  32
35 #define DEF_TIMEOUT     60000
36 #define EBUFF_SZ        256
37 #define TUR_CMD_LEN     6
38 #define MX_ALLOC_LEN    255
39 #define BLKGETSIZE      _IO(0x12,96)
40 #define DM_TARGET       "striped"
41
42 #define PINDEX(x,y)     mp[(x)].pindex[(y)]
43
44 /* global types */
45 struct scsi_idlun {
46         int dev_id;
47         int host_unique_id;
48         int host_no;
49 };
50
51 struct sg_id {
52         int host_no;
53         int channel;
54         int scsi_id;
55         int lun;
56         int scsi_type;
57         short h_cmd_per_lun;
58         short d_queue_depth;
59         int unused1;
60         int unused2;
61 };
62
63 struct scsi_dev {
64         char dev[FILE_NAME_SIZE];
65         struct scsi_idlun scsi_id;
66         int host_no;
67 };
68
69 struct path {
70         char dev[FILE_NAME_SIZE];
71         char sg_dev[FILE_NAME_SIZE];
72         struct scsi_idlun scsi_id;
73         struct sg_id sg_id;
74         int state;
75         char wwid[WWID_SIZE];
76         char vendor_id[8];
77         char product_id[16];
78         char rev[4];
79 };
80
81 struct multipath {
82         char wwid[WWID_SIZE];
83         int npaths;
84         int pindex[MAX_MP_PATHS];
85 };
86
87 struct env {
88         int max_devs;
89         int verbose;
90         int quiet;
91         int dry_run;
92         int with_sysfs;
93         char sysfs_path[FILE_NAME_SIZE];
94 };
95
96 /* Build version */
97 #define PROG    "multipath"
98
99 #define VERSION_CODE 0x000005
100 #define DATE_CODE    0x120903
101
102 #define MULTIPATH_VERSION(version)      \
103         (version >> 16) & 0xFF,         \
104         (version >> 8) & 0xFF,          \
105         version & 0xFF
106
107 #define VERSION_STRING PROG" v%d.%d.%d (%.2d/%.2d, 20%.2d)\n",  \
108                 MULTIPATH_VERSION(VERSION_CODE),                \
109                 MULTIPATH_VERSION(DATE_CODE)
110
111 #endif