Debian Codegraph @

tools/libfsimage/zfs/fsi_zfs.h

raw
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
4 *
5 * This program 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 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; If not, see <http://www.gnu.org/licenses/>.
17 */
18 /*
19 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
20 * Use is subject to license terms.
21 */
22 #ifndef _FSI_ZFS_H
23 #define _FSI_ZFS_H
24
25 #ifdef FSYS_ZFS
26
27 #include <sys/types.h>
28 #include <stdio.h>
29 #include <string.h>
30 #include <xenfsimage_grub.h>
31
32
33 /*** START FROM shared.h ****/
34 #include "mb_info.h"
35
36 /* Boot signature related defines for the findroot command */
37 #define BOOTSIGN_DIR "/boot/grub/bootsign"
38 #define BOOTSIGN_BACKUP "/etc/bootsign"
39
40 /* Maybe redirect memory requests through grub_scratch_mem. */
41 #define RAW_ADDR(x) (x)
42 #define RAW_SEG(x) (x)
43
44 /* ZFS will use the top 4 Meg of physical memory (below 4Gig) for sratch */
45 #define ZFS_SCRATCH_SIZE 0x400000
46
47 #define MAXPATHLEN 1024
48 #define MAXNAMELEN 256
49 #define MIN(x, y) ((x) < (y) ? (x) : (y))
50
51 #define MAXUINT 0xFFFFFFFF
52
53 #undef NULL
54 #define NULL ((void *) 0)
55
56 #define grub_printf printf
57 #define grub_strcmp strcmp
58 #define grub_strncmp strncmp
59 #define grub_strstr strstr
60 #define grub_strlen strlen
61 #define grub_memmove memmove
62
63 extern char current_bootpath[MAXPATHLEN];
64 extern char current_rootpool[MAXNAMELEN];
65 extern char current_bootfs[MAXNAMELEN];
66 extern uint64_t current_bootfs_obj;
67 extern char current_devid[MAXPATHLEN];
68 extern int is_zfs_mount;
69 extern unsigned long best_drive;
70 extern unsigned long best_part;
71 extern int find_best_root;
72
73 extern unsigned long part_length;
74
75 #undef filemax
76 #undef filepos
77 extern uint64_t filemax;
78 extern uint64_t filepos;
79
80 extern struct multiboot_info mbi;
81
82 /*** END FROM shared.h ***/
83
84 #ifdef __linux__
85 typedef unsigned char uchar_t;
86 #endif
87
88 typedef struct fsi_file *fsi_file_handle_t;
89 extern fsi_file_handle_t zfs_ffi;
90 extern int fsig_devread(fsi_file_handle_t, unsigned int, unsigned int,
91 unsigned int, char *);
92
93 #undef devread
94 #define devread(a, b, c, d) fsig_devread(zfs_ffi, a, b, c, d)
95
96 #undef errnum
97 extern int errnum;
98
99 #endif /* FSI_ZFS */
100
101 #endif /* !_FSI_ZFS_H */
102