]>
Commit | Line | Data |
---|---|---|
04a091d4 GKH |
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" | |
359618cd CV |
24 | |
25 | /* exerpt from "sg_err.h" */ | |
26 | #define SCSI_CHECK_CONDITION 0x2 | |
27 | #define SCSI_COMMAND_TERMINATED 0x22 | |
28 | #define SG_ERR_DRIVER_SENSE 0x08 | |
29 | ||
30 | /* exerpt from "scsi.h" */ | |
31 | #define RECOVERED_ERROR 0x01 | |
32 | #define SCSI_IOCTL_GET_IDLUN 0x5382 | |
33 | #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 | |
04a091d4 GKH |
34 | |
35 | /* global defs */ | |
36 | #define WWID_SIZE 33 | |
37 | #define MAX_DEVS 128 | |
38 | #define MAX_MP MAX_DEVS / 2 | |
39 | #define MAX_MP_PATHS MAX_DEVS / 4 | |
40 | #define FILE_NAME_SIZE 256 | |
41 | #define INQUIRY_CMDLEN 6 | |
42 | #define INQUIRY_CMD 0x12 | |
43 | #define SENSE_BUFF_LEN 32 | |
44 | #define DEF_TIMEOUT 60000 | |
45 | #define EBUFF_SZ 256 | |
46 | #define TUR_CMD_LEN 6 | |
47 | #define MX_ALLOC_LEN 255 | |
48 | #define BLKGETSIZE _IO(0x12,96) | |
61f76f5c | 49 | #define DM_TARGET "multipath" |
04a091d4 | 50 | |
4081da7f CV |
51 | /* Storage controlers cpabilities */ |
52 | #define FAILOVER 0 | |
53 | #define MULTIBUS 1 | |
54 | ||
04a091d4 GKH |
55 | #define PINDEX(x,y) mp[(x)].pindex[(y)] |
56 | ||
57 | /* global types */ | |
58 | struct scsi_idlun { | |
59 | int dev_id; | |
60 | int host_unique_id; | |
61 | int host_no; | |
62 | }; | |
63 | ||
64 | struct sg_id { | |
65 | int host_no; | |
66 | int channel; | |
67 | int scsi_id; | |
68 | int lun; | |
69 | int scsi_type; | |
70 | short h_cmd_per_lun; | |
71 | short d_queue_depth; | |
72 | int unused1; | |
73 | int unused2; | |
74 | }; | |
75 | ||
76 | struct scsi_dev { | |
77 | char dev[FILE_NAME_SIZE]; | |
78 | struct scsi_idlun scsi_id; | |
79 | int host_no; | |
80 | }; | |
81 | ||
82 | struct path { | |
83 | char dev[FILE_NAME_SIZE]; | |
84 | char sg_dev[FILE_NAME_SIZE]; | |
85 | struct scsi_idlun scsi_id; | |
86 | struct sg_id sg_id; | |
04a091d4 GKH |
87 | char wwid[WWID_SIZE]; |
88 | char vendor_id[8]; | |
89 | char product_id[16]; | |
90 | char rev[4]; | |
4081da7f | 91 | int iopolicy; |
04a091d4 GKH |
92 | }; |
93 | ||
94 | struct multipath { | |
95 | char wwid[WWID_SIZE]; | |
96 | int npaths; | |
4081da7f | 97 | long size; |
04a091d4 GKH |
98 | int pindex[MAX_MP_PATHS]; |
99 | }; | |
100 | ||
101 | struct env { | |
102 | int max_devs; | |
103 | int verbose; | |
104 | int quiet; | |
105 | int dry_run; | |
4081da7f | 106 | int forcedfailover; |
04a091d4 | 107 | int with_sysfs; |
17685711 | 108 | int dm_path_test_int; |
04a091d4 | 109 | char sysfs_path[FILE_NAME_SIZE]; |
17685711 | 110 | char hotplugdev[FILE_NAME_SIZE]; |
04a091d4 GKH |
111 | }; |
112 | ||
113 | /* Build version */ | |
114 | #define PROG "multipath" | |
115 | ||
17685711 CV |
116 | #define VERSION_CODE 0x000010 |
117 | #define DATE_CODE 0x0C1503 | |
04a091d4 GKH |
118 | |
119 | #define MULTIPATH_VERSION(version) \ | |
120 | (version >> 16) & 0xFF, \ | |
121 | (version >> 8) & 0xFF, \ | |
122 | version & 0xFF | |
123 | ||
124 | #define VERSION_STRING PROG" v%d.%d.%d (%.2d/%.2d, 20%.2d)\n", \ | |
125 | MULTIPATH_VERSION(VERSION_CODE), \ | |
126 | MULTIPATH_VERSION(DATE_CODE) | |
127 | ||
128 | #endif |