]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
a514f6b5605bf5035ddd518773d7b02293550c57
[Ventoy.git] / GRUB2 / MOD_SRC / grub-2.04 / grub-core / ventoy / ventoy_def.h
1 /******************************************************************************
2 * ventoy_def.h
3 *
4 * Copyright (c) 2020, 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
21 #ifndef __VENTOY_DEF_H__
22 #define __VENTOY_DEF_H__
23
24 #define VTOY_MAX_SCRIPT_BUF (4 * 1024 * 1024)
25
26 #define VTOY_FILT_MIN_FILE_SIZE 32768
27
28 #define VTOY_SIZE_1GB 1073741824
29 #define VTOY_SIZE_512KB (512 * 1024)
30
31 #define JSON_SUCCESS 0
32 #define JSON_FAILED 1
33 #define JSON_NOT_FOUND 2
34
35 #define ulong unsigned long
36 #define ulonglong unsigned long long
37
38 #define vtoy_to_upper(c) (((char)(c) >= 'a' && (char)(c) <= 'z') ? ((char)(c) - 'a' + 'A') : (char)(c))
39
40 #define VENTOY_CMD_RETURN(err) grub_errno = (err); return (err)
41 #define VENTOY_FILE_TYPE (GRUB_FILE_TYPE_NO_DECOMPRESS | GRUB_FILE_TYPE_LINUX_INITRD)
42
43 #define ventoy_env_op1(op, a) grub_env_##op(a)
44 #define ventoy_env_op2(op, a, b) grub_env_##op((a), (b))
45
46 #define ventoy_get_env(key) ventoy_env_op1(get, key)
47 #define ventoy_set_env(key, val) ventoy_env_op2(set, key, val)
48
49 typedef struct ventoy_initrd_ctx
50 {
51 const char *path_prefix;
52 const char *dir_prefix;
53 }ventoy_initrd_ctx;
54
55 typedef struct cmd_para
56 {
57 const char *name;
58 grub_extcmd_func_t func;
59 grub_command_flags_t flags;
60 const struct grub_arg_option *parser;
61
62 const char *summary;
63 const char *description;
64
65 grub_extcmd_t cmd;
66 }cmd_para;
67
68 #define ventoy_align_2k(value) ((value + 2047) / 2048 * 2048)
69 #define ventoy_align(value, align) (((value) + ((align) - 1)) & (~((align) - 1)))
70
71 #pragma pack(1)
72 typedef struct cpio_newc_header
73 {
74 char c_magic[6];
75 char c_ino[8];
76 char c_mode[8];
77 char c_uid[8];
78 char c_gid[8];
79 char c_nlink[8];
80 char c_mtime[8];
81 char c_filesize[8];
82 char c_devmajor[8];
83 char c_devminor[8];
84 char c_rdevmajor[8];
85 char c_rdevminor[8];
86 char c_namesize[8];
87 char c_check[8];
88 }cpio_newc_header;
89 #pragma pack()
90
91
92 #define cmd_raw_name ctxt->extcmd->cmd->name
93 #define check_free(p, func) if (p) { func(p); p = NULL; }
94 #define grub_check_free(p) if (p) { grub_free(p); p = NULL; }
95
96 typedef int (*grub_char_check_func)(int c);
97 #define ventoy_is_decimal(str) ventoy_string_check(str, grub_isdigit)
98
99
100 // El Torito Boot Record Volume Descriptor
101 #pragma pack(1)
102 typedef struct eltorito_descriptor
103 {
104 grub_uint8_t type;
105 grub_uint8_t id[5];
106 grub_uint8_t version;
107 grub_uint8_t system_id[32];
108 grub_uint8_t reserved[32];
109 grub_uint32_t sector;
110 }eltorito_descriptor;
111
112 typedef struct ventoy_iso9660_override
113 {
114 grub_uint32_t first_sector;
115 grub_uint32_t first_sector_be;
116 grub_uint32_t size;
117 grub_uint32_t size_be;
118 }ventoy_iso9660_override;
119
120 typedef struct ventoy_udf_override
121 {
122 grub_uint32_t length;
123 grub_uint32_t position;
124 }ventoy_udf_override;
125
126 typedef struct ventoy_iso9660_vd
127 {
128 grub_uint8_t type;
129 grub_uint8_t id[5];
130 grub_uint8_t ver;
131 grub_uint8_t res;
132 char sys[32];
133 char vol[32];
134 }ventoy_iso9660_vd;
135
136 #pragma pack()
137
138 #define img_type_iso 0
139 #define img_type_wim 1
140 #define img_type_efi 2
141 #define img_type_img 3
142
143 typedef struct img_info
144 {
145 int pathlen;
146 char path[512];
147 char name[256];
148
149 const char *alias;
150 const char *class;
151 const char *menu_prefix;
152
153 int id;
154 int type;
155 grub_uint64_t size;
156 int select;
157 int unsupport;
158
159 void *parent;
160
161 struct img_info *next;
162 struct img_info *prev;
163 }img_info;
164
165 typedef struct img_iterator_node
166 {
167 struct img_iterator_node *next;
168 img_info **tail;
169 char dir[400];
170 int dirlen;
171 int isocnt;
172 int done;
173 int select;
174
175 struct img_iterator_node *parent;
176 struct img_iterator_node *firstchild;
177
178 void *firstiso;
179 }img_iterator_node;
180
181
182
183 typedef struct initrd_info
184 {
185 char name[256];
186
187 grub_uint64_t offset;
188 grub_uint64_t size;
189
190 grub_uint8_t iso_type; // 0: iso9660 1:udf
191 grub_uint32_t udf_start_block;
192
193 grub_uint64_t override_offset;
194 grub_uint32_t override_length;
195 char override_data[32];
196
197 struct initrd_info *next;
198 struct initrd_info *prev;
199 }initrd_info;
200
201 extern initrd_info *g_initrd_img_list;
202 extern initrd_info *g_initrd_img_tail;
203 extern int g_initrd_img_count;
204 extern int g_valid_initrd_count;
205
206 extern img_info *g_ventoy_img_list;
207 extern int g_ventoy_img_count;
208
209 extern grub_uint8_t *g_ventoy_cpio_buf;
210 extern grub_uint32_t g_ventoy_cpio_size;
211 extern cpio_newc_header *g_ventoy_initrd_head;
212 extern grub_uint8_t *g_ventoy_runtime_buf;
213
214 extern ventoy_guid g_ventoy_guid;
215
216 extern ventoy_img_chunk_list g_img_chunk_list;
217 extern ventoy_img_chunk_list g_wimiso_chunk_list;
218 extern char *g_wimiso_path;
219
220 extern int g_ventoy_debug;
221 void ventoy_debug(const char *fmt, ...);
222 #define debug(fmt, ...) if (g_ventoy_debug) ventoy_debug("[VTOY]: "fmt, __VA_ARGS__)
223
224 #define vtoy_ssprintf(buf, pos, fmt, ...) \
225 pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, __VA_ARGS__)
226
227 #define FLAG_HEADER_RESERVED 0x00000001
228 #define FLAG_HEADER_COMPRESSION 0x00000002
229 #define FLAG_HEADER_READONLY 0x00000004
230 #define FLAG_HEADER_SPANNED 0x00000008
231 #define FLAG_HEADER_RESOURCE_ONLY 0x00000010
232 #define FLAG_HEADER_METADATA_ONLY 0x00000020
233 #define FLAG_HEADER_WRITE_IN_PROGRESS 0x00000040
234 #define FLAG_HEADER_RP_FIX 0x00000080 // reparse point fixup
235 #define FLAG_HEADER_COMPRESS_RESERVED 0x00010000
236 #define FLAG_HEADER_COMPRESS_XPRESS 0x00020000
237 #define FLAG_HEADER_COMPRESS_LZX 0x00040000
238 #define FLAG_HEADER_COMPRESS_LZMS 0x00080000
239
240 #define RESHDR_FLAG_FREE 0x01
241 #define RESHDR_FLAG_METADATA 0x02
242 #define RESHDR_FLAG_COMPRESSED 0x04
243 #define RESHDR_FLAG_SPANNED 0x08
244
245 #pragma pack(1)
246
247 /* A WIM resource header */
248 typedef struct wim_resource_header
249 {
250 grub_uint64_t size_in_wim:56; /* Compressed length */
251 grub_uint64_t flags:8; /* flags */
252 grub_uint64_t offset; /* Offset */
253 grub_uint64_t raw_size; /* Uncompressed length */
254 }wim_resource_header;
255
256 /* WIM resource header length mask */
257 #define WIM_RESHDR_ZLEN_MASK 0x00ffffffffffffffULL
258
259 /* WIM resource header flags */
260 typedef enum wim_resource_header_flags
261 {
262 WIM_RESHDR_METADATA = ( 0x02ULL << 56 ), /* Resource contains metadata */
263 WIM_RESHDR_COMPRESSED = ( 0x04ULL << 56 ), /* Resource is compressed */
264 WIM_RESHDR_PACKED_STREAMS = ( 0x10ULL << 56 ), /* Resource is compressed using packed streams */
265 }wim_resource_header_flags;
266
267 #define WIM_HEAD_SIGNATURE "MSWIM\0\0"
268
269 /* WIM header */
270 typedef struct wim_header
271 {
272 grub_uint8_t signature[8]; /* Signature */
273 grub_uint32_t header_len; /* Header length */
274 grub_uint32_t version; /* Verson */
275 grub_uint32_t flags; /* Flags */
276 grub_uint32_t chunk_len; /* Chunk length */
277 grub_uint8_t guid[16]; /* GUID */
278 grub_uint16_t part; /* Part number */
279 grub_uint16_t parts; /* Total number of parts */
280 grub_uint32_t images; /* number of images */
281 wim_resource_header lookup; /* Lookup table */
282 wim_resource_header xml; /* XML data */
283 wim_resource_header metadata; /* Boot metadata */
284 grub_uint32_t boot_index; /* Boot index */
285 wim_resource_header integrity; /* Integrity table */
286 grub_uint8_t reserved[60]; /* Reserved */
287 } wim_header;
288
289 /* WIM header flags */
290 typedef enum wim_header_flags
291 {
292 WIM_HDR_XPRESS = 0x00020000, /* WIM uses Xpress compresson */
293 WIM_HDR_LZX = 0x00040000, /* WIM uses LZX compression */
294 }wim_header_flags;
295
296 /* A WIM file hash */
297 typedef struct wim_hash
298 {
299 /* SHA-1 hash */
300 grub_uint8_t sha1[20];
301 }wim_hash;
302
303 /* A WIM lookup table entry */
304 typedef struct wim_lookup_entry
305 {
306 wim_resource_header resource; /* Resource header */
307 grub_uint16_t part; /* Part number */
308 grub_uint32_t refcnt; /* Reference count */
309 wim_hash hash; /* Hash */
310 }wim_lookup_entry;
311
312 /* WIM chunk length */
313 #define WIM_CHUNK_LEN 32768
314
315 /* A WIM chunk buffer */
316 typedef struct wim_chunk_buffer
317 {
318 grub_uint8_t data[WIM_CHUNK_LEN]; /*Data */
319 }wim_chunk_buffer;
320
321 /* Security data */
322 typedef struct wim_security_header
323 {
324 grub_uint32_t len; /* Length */
325 grub_uint32_t count; /* Number of entries */
326 }wim_security_header;
327
328 /* Directory entry */
329 typedef struct wim_directory_entry
330 {
331 grub_uint64_t len; /* Length */
332 grub_uint32_t attributes; /* Attributes */
333 grub_uint32_t security; /* Security ID */
334 grub_uint64_t subdir; /* Subdirectory offset */
335 grub_uint8_t reserved1[16]; /* Reserved */
336 grub_uint64_t created; /* Creation time */
337 grub_uint64_t accessed; /* Last access time */
338 grub_uint64_t written; /* Last written time */
339 wim_hash hash; /* Hash */
340 grub_uint8_t reserved2[12]; /* Reserved */
341 grub_uint16_t streams; /* Streams */
342 grub_uint16_t short_name_len; /* Short name length */
343 grub_uint16_t name_len; /* Name length */
344 }wim_directory_entry;
345
346 /** Normal file */
347 #define WIM_ATTR_NORMAL 0x00000080UL
348
349 /** No security information exists for this file */
350 #define WIM_NO_SECURITY 0xffffffffUL
351
352 #pragma pack()
353
354
355 typedef struct wim_tail
356 {
357 grub_uint32_t wim_raw_size;
358 grub_uint32_t wim_align_size;
359
360 grub_uint8_t iso_type;
361 grub_uint64_t file_offset;
362 grub_uint32_t udf_start_block;
363 grub_uint64_t fe_entry_size_offset;
364 grub_uint64_t override_offset;
365 grub_uint32_t override_len;
366 grub_uint8_t override_data[32];
367
368 wim_header wim_header;
369
370 wim_hash bin_hash;
371 grub_uint32_t jump_exe_len;
372 grub_uint8_t *jump_bin_data;
373 grub_uint32_t bin_raw_len;
374 grub_uint32_t bin_align_len;
375
376 grub_uint8_t *new_meta_data;
377 grub_uint32_t new_meta_len;
378 grub_uint32_t new_meta_align_len;
379
380 grub_uint8_t *new_lookup_data;
381 grub_uint32_t new_lookup_len;
382 grub_uint32_t new_lookup_align_len;
383 }wim_tail;
384
385 typedef struct wim_patch
386 {
387 int pathlen;
388 char path[256];
389
390 wim_hash old_hash;
391 wim_tail wim_data;
392 wim_lookup_entry *replace_look;
393
394 int valid;
395
396 struct wim_patch *next;
397 }wim_patch;
398
399
400 typedef enum _JSON_TYPE
401 {
402 JSON_TYPE_NUMBER = 0,
403 JSON_TYPE_STRING,
404 JSON_TYPE_BOOL,
405 JSON_TYPE_ARRAY,
406 JSON_TYPE_OBJECT,
407 JSON_TYPE_NULL,
408 JSON_TYPE_BUTT
409 }JSON_TYPE;
410
411
412 typedef struct _VTOY_JSON
413 {
414 struct _VTOY_JSON *pstPrev;
415 struct _VTOY_JSON *pstNext;
416 struct _VTOY_JSON *pstChild;
417
418 JSON_TYPE enDataType;
419 union
420 {
421 char *pcStrVal;
422 int iNumVal;
423 grub_uint64_t lValue;
424 }unData;
425
426 char *pcName;
427 }VTOY_JSON;
428
429 typedef struct _JSON_PARSE
430 {
431 char *pcKey;
432 void *pDataBuf;
433 grub_uint32_t uiBufSize;
434 }JSON_PARSE;
435
436 #define JSON_NEW_ITEM(pstJson, ret) \
437 { \
438 (pstJson) = (VTOY_JSON *)grub_zalloc(sizeof(VTOY_JSON)); \
439 if (NULL == (pstJson)) \
440 { \
441 json_debug("Failed to alloc memory for json.\n"); \
442 return (ret); \
443 } \
444 }
445
446 typedef int (*ventoy_plugin_entry_pf)(VTOY_JSON *json, const char *isodisk);
447 typedef int (*ventoy_plugin_check_pf)(VTOY_JSON *json, const char *isodisk);
448
449 typedef struct plugin_entry
450 {
451 const char *key;
452 ventoy_plugin_entry_pf entryfunc;
453 ventoy_plugin_check_pf checkfunc;
454 }plugin_entry;
455
456
457 void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param);
458 grub_err_t ventoy_cmd_isolinux_initrd_collect(grub_extcmd_context_t ctxt, int argc, char **args);
459 grub_err_t ventoy_cmd_grub_initrd_collect(grub_extcmd_context_t ctxt, int argc, char **args);
460 grub_err_t ventoy_cmd_specify_initrd_file(grub_extcmd_context_t ctxt, int argc, char **args);
461 grub_err_t ventoy_cmd_dump_initrd_list(grub_extcmd_context_t ctxt, int argc, char **args);
462 grub_err_t ventoy_cmd_clear_initrd_list(grub_extcmd_context_t ctxt, int argc, char **args);
463 grub_uint32_t ventoy_get_iso_boot_catlog(grub_file_t file);
464 int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector);
465 grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
466 grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
467 grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
468 grub_err_t ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
469 grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **args);
470 grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **args);
471 int ventoy_cpio_newc_fill_head(void *buf, int filesize, const void *filedata, const char *name);
472 grub_file_t ventoy_grub_file_open(enum grub_file_type type, const char *fmt, ...);
473 grub_uint64_t ventoy_grub_get_file_size(const char *fmt, ...);
474 int ventoy_is_file_exist(const char *fmt, ...);
475 int ventoy_is_dir_exist(const char *fmt, ...);
476 int ventoy_fill_data(grub_uint32_t buflen, char *buffer);
477 grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **args);
478 grub_err_t ventoy_cmd_wimdows_reset(grub_extcmd_context_t ctxt, int argc, char **args);
479 grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
480 grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
481 grub_err_t ventoy_cmd_dump_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
482
483 VTOY_JSON *vtoy_json_find_item
484 (
485 VTOY_JSON *pstJson,
486 JSON_TYPE enDataType,
487 const char *szKey
488 );
489 int vtoy_json_parse_value
490 (
491 char *pcNewStart,
492 char *pcRawStart,
493 VTOY_JSON *pstJson,
494 const char *pcData,
495 const char **ppcEnd
496 );
497 VTOY_JSON * vtoy_json_create(void);
498 int vtoy_json_parse(VTOY_JSON *pstJson, const char *szJsonData);
499
500 int vtoy_json_scan_parse
501 (
502 const VTOY_JSON *pstJson,
503 grub_uint32_t uiParseNum,
504 JSON_PARSE *pstJsonParse
505 );
506
507 int vtoy_json_scan_array
508 (
509 VTOY_JSON *pstJson,
510 const char *szKey,
511 VTOY_JSON **ppstArrayItem
512 );
513
514 int vtoy_json_scan_array_ex
515 (
516 VTOY_JSON *pstJson,
517 const char *szKey,
518 VTOY_JSON **ppstArrayItem
519 );
520 int vtoy_json_scan_object
521 (
522 VTOY_JSON *pstJson,
523 const char *szKey,
524 VTOY_JSON **ppstObjectItem
525 );
526 int vtoy_json_get_int
527 (
528 VTOY_JSON *pstJson,
529 const char *szKey,
530 int *piValue
531 );
532 int vtoy_json_get_uint
533 (
534 VTOY_JSON *pstJson,
535 const char *szKey,
536 grub_uint32_t *puiValue
537 );
538 int vtoy_json_get_uint64
539 (
540 VTOY_JSON *pstJson,
541 const char *szKey,
542 grub_uint64_t *pui64Value
543 );
544 int vtoy_json_get_bool
545 (
546 VTOY_JSON *pstJson,
547 const char *szKey,
548 grub_uint8_t *pbValue
549 );
550 int vtoy_json_get_string
551 (
552 VTOY_JSON *pstJson,
553 const char *szKey,
554 grub_uint32_t uiBufLen,
555 char *pcBuf
556 );
557 const char * vtoy_json_get_string_ex(VTOY_JSON *pstJson, const char *szKey);
558 int vtoy_json_destroy(VTOY_JSON *pstJson);
559
560
561 grub_uint32_t CalculateCrc32
562 (
563 const void *Buffer,
564 grub_uint32_t Length,
565 grub_uint32_t InitValue
566 );
567
568 static inline int ventoy_isspace (int c)
569 {
570 return (c == '\n' || c == '\r' || c == ' ' || c == '\t');
571 }
572
573 static inline int ventoy_is_word_end(int c)
574 {
575 return (c == 0 || c == ',' || ventoy_isspace(c));
576 }
577
578 #pragma pack(1)
579 typedef struct ventoy_part_table
580 {
581 grub_uint8_t Active; // 0x00 0x80
582
583 grub_uint8_t StartHead;
584 grub_uint16_t StartSector : 6;
585 grub_uint16_t StartCylinder : 10;
586
587 grub_uint8_t FsFlag;
588
589 grub_uint8_t EndHead;
590 grub_uint16_t EndSector : 6;
591 grub_uint16_t EndCylinder : 10;
592
593 grub_uint32_t StartSectorId;
594 grub_uint32_t SectorCount;
595 }ventoy_part_table;
596
597 typedef struct ventoy_mbr_head
598 {
599 grub_uint8_t BootCode[446];
600 ventoy_part_table PartTbl[4];
601 grub_uint8_t Byte55;
602 grub_uint8_t ByteAA;
603 }ventoy_mbr_head;
604 #pragma pack()
605
606 typedef struct file_fullpath
607 {
608 char path[256];
609 }file_fullpath;
610
611 typedef struct install_template
612 {
613 int pathlen;
614 char isopath[256];
615
616 int autosel;
617 int cursel;
618 int templatenum;
619 file_fullpath *templatepath;
620
621 struct install_template *next;
622 }install_template;
623
624 typedef struct persistence_config
625 {
626 int pathlen;
627 char isopath[256];
628
629 int autosel;
630 int cursel;
631 int backendnum;
632 file_fullpath *backendpath;
633
634 struct persistence_config *next;
635 }persistence_config;
636
637 #define vtoy_alias_image_file 0
638 #define vtoy_alias_directory 1
639
640 typedef struct menu_alias
641 {
642 int type;
643 int pathlen;
644 char isopath[256];
645 char alias[256];
646
647 struct menu_alias *next;
648 }menu_alias;
649
650 #define vtoy_class_image_file 0
651 #define vtoy_class_directory 1
652
653 typedef struct menu_class
654 {
655 int type;
656 int patlen;
657 char pattern[256];
658 char class[64];
659
660 struct menu_class *next;
661 }menu_class;
662
663 typedef struct injection_config
664 {
665 int pathlen;
666 char isopath[256];
667 char archive[256];
668
669 struct injection_config *next;
670 }injection_config;
671
672 extern int g_ventoy_menu_esc;
673 extern int g_ventoy_suppress_esc;
674 extern int g_ventoy_last_entry;
675 extern int g_ventoy_memdisk_mode;
676 extern int g_ventoy_iso_raw;
677 extern int g_ventoy_iso_uefi_drv;
678 extern int g_ventoy_case_insensitive;
679 extern grub_uint8_t g_ventoy_chain_type;
680
681
682 #define ventoy_unix_fill_virt(new_data, new_len) \
683 { \
684 data_secs = (new_len + 2047) / 2048; \
685 cur->mem_sector_start = sector; \
686 cur->mem_sector_end = cur->mem_sector_start + data_secs; \
687 cur->mem_sector_offset = offset; \
688 cur->remap_sector_start = 0; \
689 cur->remap_sector_end = 0; \
690 cur->org_sector_start = 0; \
691 grub_memcpy(override + offset, new_data, new_len); \
692 cur++; \
693 sector += data_secs; \
694 offset += new_len; \
695 chain->virt_img_size_in_bytes += data_secs * 2048; \
696 }
697
698 char * ventoy_get_line(char *start);
699 int ventoy_cmp_img(img_info *img1, img_info *img2);
700 void ventoy_swap_img(img_info *img1, img_info *img2);
701 char * ventoy_plugin_get_cur_install_template(const char *isopath);
702 install_template * ventoy_plugin_find_install_template(const char *isopath);
703 persistence_config * ventoy_plugin_find_persistent(const char *isopath);
704 void ventoy_plugin_dump_injection(void);
705 void ventoy_plugin_dump_auto_install(void);
706 int ventoy_fill_windows_rtdata(void *buf, char *isopath);
707 int ventoy_plugin_get_persistent_chunklist(const char *isopath, int index, ventoy_img_chunk_list *chunk_list);
708 const char * ventoy_plugin_get_injection(const char *isopath);
709 const char * ventoy_plugin_get_menu_alias(int type, const char *isopath);
710 const char * ventoy_plugin_get_menu_class(int type, const char *name);
711 int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
712 int ventoy_check_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
713 void ventoy_plugin_dump_persistence(void);
714 grub_err_t ventoy_cmd_plugin_check_json(grub_extcmd_context_t ctxt, int argc, char **args);
715 grub_err_t ventoy_cmd_linux_get_main_initrd_index(grub_extcmd_context_t ctxt, int argc, char **args);
716 grub_err_t ventoy_cmd_collect_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
717 grub_err_t ventoy_cmd_wim_patch_count(grub_extcmd_context_t ctxt, int argc, char **args);
718 grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
719 grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
720 int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid);
721 grub_err_t ventoy_cmd_unix_reset(grub_extcmd_context_t ctxt, int argc, char **args);
722 grub_err_t ventoy_cmd_unix_replace_conf(grub_extcmd_context_t ctxt, int argc, char **args);
723 grub_err_t ventoy_cmd_unix_replace_ko(grub_extcmd_context_t ctxt, int argc, char **args);
724 grub_err_t ventoy_cmd_unix_freebsd_ver(grub_extcmd_context_t ctxt, int argc, char **args);
725 grub_err_t ventoy_cmd_parse_freenas_ver(grub_extcmd_context_t ctxt, int argc, char **args);
726
727 #endif /* __VENTOY_DEF_H__ */
728