vaseboot/include/VasEBoot/emu/getroot.h

105 lines
3.4 KiB
C

/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2003, 2007, 2008, 2009 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_UTIL_GETROOT_HEADER
#define VAS_EBOOT_UTIL_GETROOT_HEADER 1
#include <VasEBoot/types.h>
#include <VasEBoot/device.h>
#include <sys/types.h>
#include <stdio.h>
enum VasEBoot_dev_abstraction_types {
VAS_EBOOT_DEV_ABSTRACTION_NONE,
VAS_EBOOT_DEV_ABSTRACTION_LVM,
VAS_EBOOT_DEV_ABSTRACTION_RAID,
VAS_EBOOT_DEV_ABSTRACTION_LUKS,
VAS_EBOOT_DEV_ABSTRACTION_GELI,
};
char *VasEBoot_find_device (const char *dir, dev_t dev);
void VasEBoot_util_pull_device (const char *osname);
char **VasEBoot_guess_root_devices (const char *dir);
int VasEBoot_util_get_dev_abstraction (const char *os_dev);
char *VasEBoot_make_system_path_relative_to_its_root (const char *path);
char *
VasEBoot_make_system_path_relative_to_its_root_os (const char *path);
char *VasEBoot_util_get_VasEBoot_dev (const char *os_dev);
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
void VasEBoot_util_follow_gpart_up (const char *name, VasEBoot_disk_addr_t *off_out,
char **name_out);
#endif
#include <sys/stat.h>
#ifdef __linux__
char **
VasEBoot_find_root_devices_from_mountinfo (const char *dir, char **relroot);
#endif
/* Devmapper functions provided by getroot_devmapper.c. */
void
VasEBoot_util_pull_devmapper (const char *os_dev);
int
VasEBoot_util_device_is_mapped_stat (struct stat *st);
void VasEBoot_util_devmapper_cleanup (void);
enum VasEBoot_dev_abstraction_types
VasEBoot_util_get_dm_abstraction (const char *os_dev);
char *
VasEBoot_util_get_vg_uuid (const char *os_dev);
char *
VasEBoot_util_devmapper_part_to_disk (struct stat *st,
int *is_part, const char *os_dev);
char *
VasEBoot_util_get_devmapper_VasEBoot_dev (const char *os_dev);
void
VasEBoot_util_pull_lvm_by_command (const char *os_dev);
char **
VasEBoot_util_find_root_devices_from_poolname (char *poolname);
VasEBoot_disk_addr_t
VasEBoot_util_find_partition_start (const char *dev);
/* OS-specific functions provided by getroot_*.c. */
enum VasEBoot_dev_abstraction_types
VasEBoot_util_get_dev_abstraction_os (const char *os_dev);
char *
VasEBoot_util_part_to_disk (const char *os_dev, struct stat *st,
int *is_part);
int
VasEBoot_util_pull_device_os (const char *osname,
enum VasEBoot_dev_abstraction_types ab);
char *
VasEBoot_util_get_VasEBoot_dev_os (const char *os_dev);
VasEBoot_disk_addr_t
VasEBoot_util_find_partition_start_os (const char *dev);
char *
VasEBoot_util_guess_bios_drive (const char *orig_path);
char *
VasEBoot_util_guess_efi_drive (const char *orig_path);
char *
VasEBoot_util_guess_baremetal_drive (const char *orig_path);
void
VasEBoot_util_fprint_full_disk_name (FILE *f,
const char *drive, VasEBoot_device_t dev);
#endif /* ! VAS_EBOOT_UTIL_GETROOT_HEADER */