]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - LinuxGUI/Ventoy2Disk/Core/ventoy_util.h
1 /******************************************************************************
4 * Copyright (c) 2021, longpanda <admin@ventoy.net>
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.
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.
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/>.
20 #ifndef __VENTOY_UTIL_H__
21 #define __VENTOY_UTIL_H__
23 #define check_free(p) if (p) free(p)
24 #define vtoy_safe_close_fd(fd) \
33 extern uint8_t g_mbr_template
[512];
34 void ventoy_gen_preudo_uuid(void *uuid
);
35 int ventoy_get_disk_part_name(const char *dev
, int part
, char *partbuf
, int bufsize
);
36 int ventoy_get_sys_file_line(char *buffer
, int buflen
, const char *fmt
, ...);
37 uint64_t ventoy_get_human_readable_gb(uint64_t SizeBytes
);
38 void ventoy_md5(const void *data
, uint32_t len
, uint8_t *md5
);
39 int ventoy_is_disk_mounted(const char *devpath
);
40 int ventoy_try_umount_disk(const char *devpath
);
41 int unxz(unsigned char *in
, int in_size
,
42 int (*fill
)(void *dest
, unsigned int size
),
43 int (*flush
)(void *src
, unsigned int size
),
44 unsigned char *out
, int *in_used
,
45 void (*error
)(char *x
));
46 int ventoy_read_file_to_buf(const char *FileName
, int ExtLen
, void **Bufer
, int *BufLen
);
47 const char * ventoy_get_local_version(void);
48 int ventoy_fill_gpt(uint64_t size
, uint64_t reserve
, int align4k
, VTOY_GPT_INFO
*gpt
);
49 int ventoy_fill_mbr(uint64_t size
, uint64_t reserve
, int align4k
, int PartStyle
, MBR_HEAD
*pMBR
);
51 #endif /* __VENTOY_UTIL_H__ */