8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libgrubmgmt / common / libgrubmgmt.h
blobfb4d88768d1fb4eb5bbc90803e20476ebbd42dbc
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _LIBGRUBMGMT_H
27 #define _LIBGRUBMGMT_H
29 #include <sys/types.h>
30 #include <sys/param.h>
31 #include <sys/mntent.h>
32 #include <sys/uadmin.h>
33 #include <libzfs.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 #define GRUB_ENTRY_DEFAULT -1 /* Use the default entry */
42 * Data structure for describing the GRUB menu
44 typedef struct grub_menu grub_menu_t;
45 typedef struct grub_line grub_line_t;
46 typedef struct grub_entry grub_entry_t;
49 * Data structure for describing the file system where the
50 * GRUB menu resides
52 typedef struct grub_fsdesc {
53 int gfs_is_tmp_mounted; /* is temporary mounted */
54 char gfs_dev[MAXNAMELEN]; /* device/zfs dataset to mount */
55 char gfs_mountp[MAXPATHLEN]; /* mount point */
56 } grub_fsdesc_t;
59 * Data structure for collecting data for Fast Reboot
61 typedef struct grub_boot_args {
62 grub_fsdesc_t gba_fsd;
63 int gba_kernel_fd;
64 char gba_kernel[BOOTARGS_MAX];
65 char gba_module[BOOTARGS_MAX];
66 char gba_bootargs[BOOTARGS_MAX];
67 } grub_boot_args_t;
70 * Wrapper functions for retriving boot arguments for Fast Reboot.
71 * grub_get_boot_args() calls grub_menu_init() and grub_menu_fini().
72 * If menupath is NULL, it will use 'currently active' GRUB menu file.
74 * All _get_boot_args functions will mount the root file system for the
75 * given entry if not mounted, and open and validate the kernel file.
76 * Caller must allocate bargs, and call grub_cleanup_boot_args() to
77 * clean up mount points and open file handles when done.
79 * grub_get_boot_args:
80 * Collects boot argument from the specified GRUB menu entry.
81 * If entrynum == -1, default GRUB menu entry will be used.
83 * grub_cleanup_boot_args:
84 * Cleans up and releases all the resources allocated by
85 * grub_get_boot_args. Closes kernel file. Umounts root file
86 * system if temporarily mounted.
88 extern int grub_get_boot_args(grub_boot_args_t *bargs, const char *menupath,
89 int entrynum);
90 extern void grub_cleanup_boot_args(grub_boot_args_t *bargs);
92 extern const char *grub_strerror(int);
94 #ifdef __cplusplus
96 #endif
98 #endif /* _LIBGRUBMGMT_H */