source: grub-pc/trunk/fuentes/include/grub/osdep/hostfile_unix.h @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 2.6 KB
Line 
1/*
2 *  GRUB  --  GRand Unified Bootloader
3 *  Copyright (C) 2010,2011,2012,2013  Free Software Foundation, Inc.
4 *
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.
9 *
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.
14 *
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/>.
17 */
18
19#ifndef GRUB_EMU_HOSTFILE_H
20#define GRUB_EMU_HOSTFILE_H 1
21
22#include <config.h>
23#include <stdarg.h>
24
25#include <grub/symbol.h>
26#include <grub/types.h>
27
28#include <sys/types.h>
29#include <sys/stat.h>
30#include <fcntl.h>
31#include <dirent.h>
32#include <unistd.h>
33#include <stdio.h>
34
35typedef struct dirent *grub_util_fd_dirent_t;
36typedef DIR *grub_util_fd_dir_t;
37
38static inline grub_util_fd_dir_t
39grub_util_fd_opendir (const char *name)
40{
41  return opendir (name);
42}
43
44static inline void
45grub_util_fd_closedir (grub_util_fd_dir_t dirp)
46{
47  closedir (dirp);
48}
49
50static inline grub_util_fd_dirent_t
51grub_util_fd_readdir (grub_util_fd_dir_t dirp)
52{
53  return readdir (dirp);
54}
55
56static inline int
57grub_util_unlink (const char *pathname)
58{
59  return unlink (pathname);
60}
61
62static inline int
63grub_util_rmdir (const char *pathname)
64{
65  return rmdir (pathname);
66}
67
68static inline int
69grub_util_rename (const char *from, const char *to)
70{
71  return rename (from, to);
72}
73
74#define grub_util_mkdir(a) mkdir ((a), 0755)
75
76#if defined (__NetBSD__)
77/* NetBSD uses /boot for its boot block.  */
78# define DEFAULT_DIRECTORY      "/"GRUB_DIR_NAME
79#else
80# define DEFAULT_DIRECTORY      "/"GRUB_BOOT_DIR_NAME"/"GRUB_DIR_NAME
81#endif
82
83enum grub_util_fd_open_flags_t
84  {
85    GRUB_UTIL_FD_O_RDONLY = O_RDONLY,
86    GRUB_UTIL_FD_O_WRONLY = O_WRONLY,
87    GRUB_UTIL_FD_O_RDWR = O_RDWR,
88    GRUB_UTIL_FD_O_CREATTRUNC = O_CREAT | O_TRUNC,
89    GRUB_UTIL_FD_O_SYNC = (0
90#ifdef O_SYNC
91                           | O_SYNC
92#endif
93#ifdef O_FSYNC
94                           | O_FSYNC
95#endif
96                           )
97  };
98
99#define DEFAULT_DEVICE_MAP      DEFAULT_DIRECTORY "/device.map"
100
101typedef int grub_util_fd_t;
102#define GRUB_UTIL_FD_INVALID -1
103#define GRUB_UTIL_FD_IS_VALID(x) ((x) >= 0)
104#define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 1
105
106#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) || defined (__sun__) || defined(__OpenBSD__) || defined(__HAIKU__)
107#define GRUB_DISK_DEVS_ARE_CHAR 1
108#else
109#define GRUB_DISK_DEVS_ARE_CHAR 0
110#endif
111
112#endif
Note: See TracBrowser for help on using the repository browser.