]> git.ipfire.org Git - thirdparty/systemd.git/blob - extras/multipath/main.h
[PATCH] and more extras/multipath updates
[thirdparty/systemd.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
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
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)
49 #define DM_TARGET "multipath"
50
51 #define PINDEX(x,y) mp[(x)].pindex[(y)]
52
53 /* global types */
54 struct scsi_idlun {
55 int dev_id;
56 int host_unique_id;
57 int host_no;
58 };
59
60 struct sg_id {
61 int host_no;
62 int channel;
63 int scsi_id;
64 int lun;
65 int scsi_type;
66 short h_cmd_per_lun;
67 short d_queue_depth;
68 int unused1;
69 int unused2;
70 };
71
72 struct scsi_dev {
73 char dev[FILE_NAME_SIZE];
74 struct scsi_idlun scsi_id;
75 int host_no;
76 };
77
78 struct path {
79 char dev[FILE_NAME_SIZE];
80 char sg_dev[FILE_NAME_SIZE];
81 struct scsi_idlun scsi_id;
82 struct sg_id sg_id;
83 int state;
84 char wwid[WWID_SIZE];
85 char vendor_id[8];
86 char product_id[16];
87 char rev[4];
88 };
89
90 struct multipath {
91 char wwid[WWID_SIZE];
92 int npaths;
93 int pindex[MAX_MP_PATHS];
94 };
95
96 struct env {
97 int max_devs;
98 int verbose;
99 int quiet;
100 int dry_run;
101 int with_sysfs;
102 char sysfs_path[FILE_NAME_SIZE];
103 };
104
105 /* Build version */
106 #define PROG "multipath"
107
108 #define VERSION_CODE 0x000009
109 #define DATE_CODE 0x0C0503
110
111 #define MULTIPATH_VERSION(version) \
112 (version >> 16) & 0xFF, \
113 (version >> 8) & 0xFF, \
114 version & 0xFF
115
116 #define VERSION_STRING PROG" v%d.%d.%d (%.2d/%.2d, 20%.2d)\n", \
117 MULTIPATH_VERSION(VERSION_CODE), \
118 MULTIPATH_VERSION(DATE_CODE)
119
120 #endif