2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2003, 2007, 2008, 2009 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_UTIL_GETROOT_HEADER
20 #define GRUB_UTIL_GETROOT_HEADER 1
22 #include <grub/types.h>
24 #include <sys/types.h>
26 enum grub_dev_abstraction_types
{
27 GRUB_DEV_ABSTRACTION_NONE
,
28 GRUB_DEV_ABSTRACTION_LVM
,
29 GRUB_DEV_ABSTRACTION_RAID
,
30 GRUB_DEV_ABSTRACTION_LUKS
,
31 GRUB_DEV_ABSTRACTION_GELI
,
34 char *grub_find_device (const char *dir
, dev_t dev
);
35 void grub_util_pull_device (const char *osname
);
36 char **grub_guess_root_devices (const char *dir
);
37 int grub_util_get_dev_abstraction (const char *os_dev
);
38 char *grub_make_system_path_relative_to_its_root (const char *path
);
40 grub_make_system_path_relative_to_its_root_os (const char *path
);
41 char *grub_util_get_grub_dev (const char *os_dev
);
42 #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
43 void grub_util_follow_gpart_up (const char *name
, grub_disk_addr_t
*off_out
,
51 grub_find_root_devices_from_mountinfo (const char *dir
, char **relroot
);
54 /* Devmapper functions provided by getroot_devmapper.c. */
56 grub_util_pull_devmapper (const char *os_dev
);
58 grub_util_device_is_mapped_stat (struct stat
*st
);
59 void grub_util_devmapper_cleanup (void);
60 enum grub_dev_abstraction_types
61 grub_util_get_dm_abstraction (const char *os_dev
);
63 grub_util_get_vg_uuid (const char *os_dev
);
65 grub_util_devmapper_part_to_disk (struct stat
*st
,
66 int *is_part
, const char *os_dev
);
68 grub_util_get_devmapper_grub_dev (const char *os_dev
);
71 grub_util_pull_lvm_by_command (const char *os_dev
);
73 grub_util_find_root_devices_from_poolname (char *poolname
);
76 grub_util_find_partition_start (const char *dev
);
78 /* OS-specific functions provided by getroot_*.c. */
79 enum grub_dev_abstraction_types
80 grub_util_get_dev_abstraction_os (const char *os_dev
);
82 grub_util_part_to_disk (const char *os_dev
, struct stat
*st
,
85 grub_util_pull_device_os (const char *osname
,
86 enum grub_dev_abstraction_types ab
);
88 grub_util_get_grub_dev_os (const char *os_dev
);
90 grub_util_find_partition_start_os (const char *dev
);
92 #endif /* ! GRUB_UTIL_GETROOT_HEADER */