]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - Plugson/src/Core/ventoy_disk.h
Support veket_24
[Ventoy.git] / Plugson / src / Core / ventoy_disk.h
1 /******************************************************************************
2 * ventoy_disk.h
3 *
4 * Copyright (c) 2021, longpanda <admin@ventoy.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20 #ifndef __VENTOY_DISK_H__
21 #define __VENTOY_DISK_H__
22
23 #define MAX_DISK 256
24 typedef struct ventoy_disk
25 {
26 char devname[64];
27
28 int pathcase;
29 char cur_fsname[64];
30 char cur_capacity[64];
31 char cur_model[256];
32 char cur_ventoy_ver[64];
33 int cur_secureboot;
34 int cur_part_style;
35
36 }ventoy_disk;
37
38 #if defined(_MSC_VER) || defined(WIN32)
39
40
41
42 #else
43
44 typedef enum
45 {
46 VTOY_DEVICE_UNKNOWN = 0,
47 VTOY_DEVICE_SCSI,
48 VTOY_DEVICE_USB,
49 VTOY_DEVICE_IDE,
50 VTOY_DEVICE_DAC960,
51 VTOY_DEVICE_CPQARRAY,
52 VTOY_DEVICE_FILE,
53 VTOY_DEVICE_ATARAID,
54 VTOY_DEVICE_I2O,
55 VTOY_DEVICE_UBD,
56 VTOY_DEVICE_DASD,
57 VTOY_DEVICE_VIODASD,
58 VTOY_DEVICE_SX8,
59 VTOY_DEVICE_DM,
60 VTOY_DEVICE_XVD,
61 VTOY_DEVICE_SDMMC,
62 VTOY_DEVICE_VIRTBLK,
63 VTOY_DEVICE_AOE,
64 VTOY_DEVICE_MD,
65 VTOY_DEVICE_LOOP,
66 VTOY_DEVICE_NVME,
67 VTOY_DEVICE_RAM,
68 VTOY_DEVICE_PMEM,
69
70 VTOY_DEVICE_END
71 }ventoy_dev_type;
72
73 /* from <linux/major.h> */
74 #define IDE0_MAJOR 3
75 #define IDE1_MAJOR 22
76 #define IDE2_MAJOR 33
77 #define IDE3_MAJOR 34
78 #define IDE4_MAJOR 56
79 #define IDE5_MAJOR 57
80 #define SCSI_CDROM_MAJOR 11
81 #define SCSI_DISK0_MAJOR 8
82 #define SCSI_DISK1_MAJOR 65
83 #define SCSI_DISK2_MAJOR 66
84 #define SCSI_DISK3_MAJOR 67
85 #define SCSI_DISK4_MAJOR 68
86 #define SCSI_DISK5_MAJOR 69
87 #define SCSI_DISK6_MAJOR 70
88 #define SCSI_DISK7_MAJOR 71
89 #define SCSI_DISK8_MAJOR 128
90 #define SCSI_DISK9_MAJOR 129
91 #define SCSI_DISK10_MAJOR 130
92 #define SCSI_DISK11_MAJOR 131
93 #define SCSI_DISK12_MAJOR 132
94 #define SCSI_DISK13_MAJOR 133
95 #define SCSI_DISK14_MAJOR 134
96 #define SCSI_DISK15_MAJOR 135
97 #define COMPAQ_SMART2_MAJOR 72
98 #define COMPAQ_SMART2_MAJOR1 73
99 #define COMPAQ_SMART2_MAJOR2 74
100 #define COMPAQ_SMART2_MAJOR3 75
101 #define COMPAQ_SMART2_MAJOR4 76
102 #define COMPAQ_SMART2_MAJOR5 77
103 #define COMPAQ_SMART2_MAJOR6 78
104 #define COMPAQ_SMART2_MAJOR7 79
105 #define COMPAQ_SMART_MAJOR 104
106 #define COMPAQ_SMART_MAJOR1 105
107 #define COMPAQ_SMART_MAJOR2 106
108 #define COMPAQ_SMART_MAJOR3 107
109 #define COMPAQ_SMART_MAJOR4 108
110 #define COMPAQ_SMART_MAJOR5 109
111 #define COMPAQ_SMART_MAJOR6 110
112 #define COMPAQ_SMART_MAJOR7 111
113 #define DAC960_MAJOR 48
114 #define ATARAID_MAJOR 114
115 #define I2O_MAJOR1 80
116 #define I2O_MAJOR2 81
117 #define I2O_MAJOR3 82
118 #define I2O_MAJOR4 83
119 #define I2O_MAJOR5 84
120 #define I2O_MAJOR6 85
121 #define I2O_MAJOR7 86
122 #define I2O_MAJOR8 87
123 #define UBD_MAJOR 98
124 #define DASD_MAJOR 94
125 #define VIODASD_MAJOR 112
126 #define AOE_MAJOR 152
127 #define SX8_MAJOR1 160
128 #define SX8_MAJOR2 161
129 #define XVD_MAJOR 202
130 #define SDMMC_MAJOR 179
131 #define LOOP_MAJOR 7
132 #define MD_MAJOR 9
133 #define BLKEXT_MAJOR 259
134 #define RAM_MAJOR 1
135
136 #define SCSI_BLK_MAJOR(M) ( \
137 (M) == SCSI_DISK0_MAJOR \
138 || (M) == SCSI_CDROM_MAJOR \
139 || ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR) \
140 || ((M) >= SCSI_DISK8_MAJOR && (M) <= SCSI_DISK15_MAJOR))
141
142 #define IDE_BLK_MAJOR(M) \
143 ((M) == IDE0_MAJOR || \
144 (M) == IDE1_MAJOR || \
145 (M) == IDE2_MAJOR || \
146 (M) == IDE3_MAJOR || \
147 (M) == IDE4_MAJOR || \
148 (M) == IDE5_MAJOR)
149
150 #define SX8_BLK_MAJOR(M) ((M) >= SX8_MAJOR1 && (M) <= SX8_MAJOR2)
151 #define I2O_BLK_MAJOR(M) ((M) >= I2O_MAJOR1 && (M) <= I2O_MAJOR8)
152 #define CPQARRAY_BLK_MAJOR(M) \
153 (((M) >= COMPAQ_SMART2_MAJOR && (M) <= COMPAQ_SMART2_MAJOR7) || \
154 (COMPAQ_SMART_MAJOR <= (M) && (M) <= COMPAQ_SMART_MAJOR7))
155
156 #endif
157
158 int ventoy_disk_init(void);
159 void ventoy_disk_exit(void);
160 int ventoy_get_disk_info(char **argv);
161 const ventoy_disk * ventoy_get_disk_list(int *num);
162 const ventoy_disk * ventoy_get_disk_node(int id);
163 int CheckRuntimeEnvironment(char Letter, ventoy_disk *disk);
164
165 #endif /* __VENTOY_DISK_H__ */
166