2
* Permission is hereby granted, free of charge, to any person obtaining a copy
3
* of this software and associated documentation files (the "Software"), to
4
* deal in the Software without restriction, including without limitation the
5
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6
* sell copies of the Software, and to permit persons to whom the Software is
7
* furnished to do so, subject to the following conditions:
9
* The above copyright notice and this permission notice shall be included in
10
* all copies or substantial portions of the Software.
12
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18
* DEALINGS IN THE SOFTWARE.
20
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
21
* Use is subject to license terms.
24
#ifndef _FSIMAGE_GRUB_H
25
#define _FSIMAGE_GRUB_H
31
#include <sys/types.h>
37
#include "fsimage_plugin.h"
39
typedef struct fsig_plugin_ops {
41
int (*fpo_mount)(fsi_file_t *, const char *);
42
int (*fpo_dir)(fsi_file_t *, char *);
43
int (*fpo_read)(fsi_file_t *, char *, int);
47
#define FSYS_BUFLEN 0x40000
49
#define SECTOR_SIZE 0x200
51
#define FSYS_BUF (fsig_file_buf(ffi))
52
#define filepos (*fsig_filepos(ffi))
53
#define filemax (*fsig_filemax(ffi))
54
#define devread fsig_devread
55
#define substring fsig_substring
56
#define errnum (*fsig_errnum(ffi))
57
#define disk_read_func (*fsig_disk_read_junk())
58
#define disk_read_hook (*fsig_disk_read_junk())
59
#define print_possibilities 0
62
#define grub_memset memset
63
#define grub_memmove memmove
64
#define grub_log2 fsig_log2
66
extern char **fsig_disk_read_junk(void);
67
unsigned long fsig_log2(unsigned long);
69
#define ERR_FSYS_CORRUPT 1
70
#define ERR_OUTSIDE_PART 1
71
#define ERR_SYMLINK_LOOP 1
72
#define ERR_FILELENGTH 1
73
#define ERR_BAD_FILETYPE 1
74
#define ERR_FILE_NOT_FOUND 1
75
#define ERR_BAD_ARGUMENT 1
76
#define ERR_FILESYSTEM_NOT_FOUND 1
77
#define ERR_NO_BOOTPATH 1
78
#define ERR_DEV_VALUES 1
79
#define ERR_WONT_FIT 1
82
fsi_plugin_ops_t *fsig_init(fsi_plugin_t *, fsig_plugin_ops_t *);
84
int fsig_devread(fsi_file_t *, unsigned int, unsigned int, unsigned int, char *);
85
int fsig_substring(const char *, const char *);
87
void *fsig_fs_buf(fsi_t *);
89
fsi_file_t *fsig_file_alloc(fsi_t *);
90
void *fsig_file_buf(fsi_file_t *);
91
uint64_t *fsig_filepos(fsi_file_t *);
92
uint64_t *fsig_filemax(fsi_file_t *);
93
int *fsig_int1(fsi_file_t *);
94
int *fsig_int2(fsi_file_t *);
95
int *fsig_errnum(fsi_file_t *);
101
#endif /* _FSIMAGE_GRUB_H */