vaseboot/include/VasEBoot/emu/hostdisk.h

99 lines
3.2 KiB
C

/* biosdisk.h - emulate biosdisk */
/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2002,2007 Free Software Foundation, Inc.
*
* VAS_EBOOT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VAS_EBOOT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VAS_EBOOT. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VAS_EBOOT_BIOSDISK_MACHINE_UTIL_HEADER
#define VAS_EBOOT_BIOSDISK_MACHINE_UTIL_HEADER 1
#include <VasEBoot/disk.h>
#include <VasEBoot/partition.h>
#include <sys/types.h>
#include <VasEBoot/emu/hostfile.h>
VasEBoot_util_fd_t
VasEBoot_util_fd_open_device (const VasEBoot_disk_t disk, VasEBoot_disk_addr_t sector, int flags,
VasEBoot_disk_addr_t *max);
void VasEBoot_util_biosdisk_init (const char *dev_map);
void VasEBoot_util_biosdisk_fini (void);
char *VasEBoot_util_biosdisk_get_VasEBoot_dev (const char *os_dev);
const char *VasEBoot_util_biosdisk_get_osdev (VasEBoot_disk_t disk);
int VasEBoot_util_biosdisk_is_present (const char *name);
int VasEBoot_util_biosdisk_is_floppy (VasEBoot_disk_t disk);
const char *
VasEBoot_util_biosdisk_get_compatibility_hint (VasEBoot_disk_t disk);
VasEBoot_err_t VasEBoot_util_biosdisk_flush (struct VasEBoot_disk *disk);
VasEBoot_err_t
VasEBoot_cryptodisk_cheat_mount (const char *sourcedev, const char *cheat);
const char *
VasEBoot_util_cryptodisk_get_uuid (VasEBoot_disk_t disk);
char *
VasEBoot_util_get_ldm (VasEBoot_disk_t disk, VasEBoot_disk_addr_t start);
int
VasEBoot_util_is_ldm (VasEBoot_disk_t disk);
#ifdef VAS_EBOOT_UTIL
VasEBoot_err_t
VasEBoot_util_ldm_embed (struct VasEBoot_disk *disk, unsigned int *nsectors,
unsigned int max_nsectors,
VasEBoot_embed_type_t embed_type,
VasEBoot_disk_addr_t **sectors);
#endif
const char *
VasEBoot_hostdisk_os_dev_to_VasEBoot_drive (const char *os_dev, int add);
char *
VasEBoot_util_get_os_disk (const char *os_dev);
int
VasEBoot_util_get_dm_node_linear_info (dev_t dev,
int *maj, int *min,
VasEBoot_disk_addr_t *st);
/* Supplied by hostdisk_*.c. */
VasEBoot_int64_t
VasEBoot_util_get_fd_size_os (VasEBoot_util_fd_t fd, const char *name, unsigned *log_secsize);
/* REturns partition offset in 512B blocks. */
VasEBoot_disk_addr_t
VasEBoot_hostdisk_find_partition_start_os (const char *dev);
void
VasEBoot_hostdisk_flush_initial_buffer (const char *os_dev);
#ifdef __GNU__
int
VasEBoot_util_hurd_get_disk_info (const char *dev, VasEBoot_uint32_t *secsize, VasEBoot_disk_addr_t *offset,
VasEBoot_disk_addr_t *size, char **parent);
#endif
struct VasEBoot_util_hostdisk_data
{
char *dev;
int access_mode;
VasEBoot_util_fd_t fd;
int is_disk;
int device_map;
};
void VasEBoot_host_init (void);
void VasEBoot_host_fini (void);
void VasEBoot_hostfs_init (void);
void VasEBoot_hostfs_fini (void);
#endif /* ! VAS_EBOOT_BIOSDISK_MACHINE_UTIL_HEADER */