Fix cross compilation (e.g. on Darwin). Following changes to make.tmpl,
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / osdep / hostfile_aros.h
bloba059c0fa40a5eccbf594497f763687e5bc010740
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2010,2011,2012,2013 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_EMU_HOSTFILE_H
20 #define GRUB_EMU_HOSTFILE_H 1
22 #include <config.h>
23 #include <stdarg.h>
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <fcntl.h>
28 #include <dirent.h>
29 #include <unistd.h>
30 #include <stdio.h>
32 typedef struct dirent *grub_util_fd_dirent_t;
33 typedef DIR *grub_util_fd_dir_t;
35 static inline grub_util_fd_dir_t
36 grub_util_fd_opendir (const char *name)
38 return opendir (name);
41 static inline void
42 grub_util_fd_closedir (grub_util_fd_dir_t dirp)
44 closedir (dirp);
47 static inline grub_util_fd_dirent_t
48 grub_util_fd_readdir (grub_util_fd_dir_t dirp)
50 return readdir (dirp);
53 static inline int
54 grub_util_rmdir (const char *pathname)
56 return rmdir (pathname);
59 static inline int
60 grub_util_unlink (const char *pathname)
62 return unlink (pathname);
65 static inline int
66 grub_util_rename (const char *from, const char *to)
68 return rename (from, to);
71 #define grub_util_mkdir(a) mkdir ((a), 0755)
73 struct grub_util_fd
75 enum { GRUB_UTIL_FD_FILE, GRUB_UTIL_FD_DISK } type;
76 grub_uint64_t off;
77 union
79 int fd;
80 struct {
81 struct IOExtTD *ioreq;
82 struct MsgPort *mp;
83 unsigned int is_floppy:1;
84 unsigned int is_64:1;
88 typedef struct grub_util_fd *grub_util_fd_t;
90 enum grub_util_fd_open_flags_t
92 GRUB_UTIL_FD_O_RDONLY = O_RDONLY,
93 GRUB_UTIL_FD_O_WRONLY = O_WRONLY,
94 GRUB_UTIL_FD_O_RDWR = O_RDWR,
95 GRUB_UTIL_FD_O_CREATTRUNC = O_CREAT | O_TRUNC,
96 GRUB_UTIL_FD_O_SYNC = (0
97 #ifdef O_SYNC
98 | O_SYNC
99 #endif
100 #ifdef O_FSYNC
101 | O_FSYNC
102 #endif
106 #define GRUB_UTIL_FD_INVALID NULL
107 #define GRUB_UTIL_FD_IS_VALID(x) ((x) != GRUB_UTIL_FD_INVALID)
108 #define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 0
110 #define DEFAULT_DIRECTORY "SYS:" GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME
111 #define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
113 #endif