]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - LinuxGUI/Ventoy2Disk/Core/ventoy_disk.h
Fix the warning prompt for Ventoy2Disk.sh (#2593)
[Ventoy.git] / LinuxGUI / Ventoy2Disk / 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 typedef enum
24 {
25 VTOY_DEVICE_UNKNOWN = 0,
26 VTOY_DEVICE_SCSI,
27 VTOY_DEVICE_USB,
28 VTOY_DEVICE_IDE,
29 VTOY_DEVICE_DAC960,
30 VTOY_DEVICE_CPQARRAY,
31 VTOY_DEVICE_FILE,
32 VTOY_DEVICE_ATARAID,
33 VTOY_DEVICE_I2O,
34 VTOY_DEVICE_UBD,
35 VTOY_DEVICE_DASD,
36 VTOY_DEVICE_VIODASD,
37 VTOY_DEVICE_SX8,
38 VTOY_DEVICE_DM,
39 VTOY_DEVICE_XVD,
40 VTOY_DEVICE_SDMMC,
41 VTOY_DEVICE_VIRTBLK,
42 VTOY_DEVICE_AOE,
43 VTOY_DEVICE_MD,
44 VTOY_DEVICE_LOOP,
45 VTOY_DEVICE_NVME,
46 VTOY_DEVICE_RAM,
47 VTOY_DEVICE_PMEM,
48
49 VTOY_DEVICE_END
50 }ventoy_dev_type;
51
52 /* from <linux/major.h> */
53 #define IDE0_MAJOR 3
54 #define IDE1_MAJOR 22
55 #define IDE2_MAJOR 33
56 #define IDE3_MAJOR 34
57 #define IDE4_MAJOR 56
58 #define IDE5_MAJOR 57
59 #define SCSI_CDROM_MAJOR 11
60 #define SCSI_DISK0_MAJOR 8
61 #define SCSI_DISK1_MAJOR 65
62 #define SCSI_DISK2_MAJOR 66
63 #define SCSI_DISK3_MAJOR 67
64 #define SCSI_DISK4_MAJOR 68
65 #define SCSI_DISK5_MAJOR 69
66 #define SCSI_DISK6_MAJOR 70
67 #define SCSI_DISK7_MAJOR 71
68 #define SCSI_DISK8_MAJOR 128
69 #define SCSI_DISK9_MAJOR 129
70 #define SCSI_DISK10_MAJOR 130
71 #define SCSI_DISK11_MAJOR 131
72 #define SCSI_DISK12_MAJOR 132
73 #define SCSI_DISK13_MAJOR 133
74 #define SCSI_DISK14_MAJOR 134
75 #define SCSI_DISK15_MAJOR 135
76 #define COMPAQ_SMART2_MAJOR 72
77 #define COMPAQ_SMART2_MAJOR1 73
78 #define COMPAQ_SMART2_MAJOR2 74
79 #define COMPAQ_SMART2_MAJOR3 75
80 #define COMPAQ_SMART2_MAJOR4 76
81 #define COMPAQ_SMART2_MAJOR5 77
82 #define COMPAQ_SMART2_MAJOR6 78
83 #define COMPAQ_SMART2_MAJOR7 79
84 #define COMPAQ_SMART_MAJOR 104
85 #define COMPAQ_SMART_MAJOR1 105
86 #define COMPAQ_SMART_MAJOR2 106
87 #define COMPAQ_SMART_MAJOR3 107
88 #define COMPAQ_SMART_MAJOR4 108
89 #define COMPAQ_SMART_MAJOR5 109
90 #define COMPAQ_SMART_MAJOR6 110
91 #define COMPAQ_SMART_MAJOR7 111
92 #define DAC960_MAJOR 48
93 #define ATARAID_MAJOR 114
94 #define I2O_MAJOR1 80
95 #define I2O_MAJOR2 81
96 #define I2O_MAJOR3 82
97 #define I2O_MAJOR4 83
98 #define I2O_MAJOR5 84
99 #define I2O_MAJOR6 85
100 #define I2O_MAJOR7 86
101 #define I2O_MAJOR8 87
102 #define UBD_MAJOR 98
103 #define DASD_MAJOR 94
104 #define VIODASD_MAJOR 112
105 #define AOE_MAJOR 152
106 #define SX8_MAJOR1 160
107 #define SX8_MAJOR2 161
108 #define XVD_MAJOR 202
109 #define SDMMC_MAJOR 179
110 #define LOOP_MAJOR 7
111 #define MD_MAJOR 9
112 #define BLKEXT_MAJOR 259
113 #define RAM_MAJOR 1
114
115 #define SCSI_BLK_MAJOR(M) ( \
116 (M) == SCSI_DISK0_MAJOR \
117 || (M) == SCSI_CDROM_MAJOR \
118 || ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR) \
119 || ((M) >= SCSI_DISK8_MAJOR && (M) <= SCSI_DISK15_MAJOR))
120
121 #define IDE_BLK_MAJOR(M) \
122 ((M) == IDE0_MAJOR || \
123 (M) == IDE1_MAJOR || \
124 (M) == IDE2_MAJOR || \
125 (M) == IDE3_MAJOR || \
126 (M) == IDE4_MAJOR || \
127 (M) == IDE5_MAJOR)
128
129 #define SX8_BLK_MAJOR(M) ((M) >= SX8_MAJOR1 && (M) <= SX8_MAJOR2)
130 #define I2O_BLK_MAJOR(M) ((M) >= I2O_MAJOR1 && (M) <= I2O_MAJOR8)
131 #define CPQARRAY_BLK_MAJOR(M) \
132 (((M) >= COMPAQ_SMART2_MAJOR && (M) <= COMPAQ_SMART2_MAJOR7) || \
133 (COMPAQ_SMART_MAJOR <= (M) && (M) <= COMPAQ_SMART_MAJOR7))
134
135 #define VENTOY_FILE_STG1_IMG "boot/core.img.xz"
136 #define VENTOY_FILE_DISK_IMG "ventoy/ventoy.disk.img.xz"
137
138 extern int g_disk_num;
139 extern ventoy_disk *g_disk_list;
140 int ventoy_disk_enumerate_all(void);
141 int ventoy_disk_init(void);
142 void ventoy_disk_exit(void);
143
144 #endif /* __VENTOY_DISK_H__ */
145