~elementary-os/elementaryos/os-patch-grub2-bionic

« back to all changes in this revision

Viewing changes to include/grub/osdep/hostfile_aros.h

  • Committer: RabbitBot
  • Date: 2018-02-05 13:05:56 UTC
  • Revision ID: rabbitbot@elementary.io-20180205130556-qgaormf12qpm3v40
Initial import, version 2.02-2ubuntu4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 <sys/types.h>
 
26
#include <sys/stat.h>
 
27
#include <fcntl.h>
 
28
#include <dirent.h>
 
29
#include <unistd.h>
 
30
#include <stdio.h>
 
31
 
 
32
typedef struct dirent *grub_util_fd_dirent_t;
 
33
typedef DIR *grub_util_fd_dir_t;
 
34
 
 
35
static inline grub_util_fd_dir_t
 
36
grub_util_fd_opendir (const char *name)
 
37
{
 
38
  return opendir (name);
 
39
}
 
40
 
 
41
static inline void
 
42
grub_util_fd_closedir (grub_util_fd_dir_t dirp)
 
43
{
 
44
  closedir (dirp);
 
45
}
 
46
 
 
47
static inline grub_util_fd_dirent_t
 
48
grub_util_fd_readdir (grub_util_fd_dir_t dirp)
 
49
{
 
50
  return readdir (dirp);
 
51
}
 
52
 
 
53
static inline int
 
54
grub_util_rmdir (const char *pathname)
 
55
{
 
56
  return rmdir (pathname);
 
57
}
 
58
 
 
59
static inline int
 
60
grub_util_unlink (const char *pathname)
 
61
{
 
62
  return unlink (pathname);
 
63
}
 
64
 
 
65
static inline int
 
66
grub_util_rename (const char *from, const char *to)
 
67
{
 
68
  return rename (from, to);
 
69
}
 
70
 
 
71
#define grub_util_mkdir(a) mkdir ((a), 0755)
 
72
 
 
73
struct grub_util_fd
 
74
{
 
75
  enum { GRUB_UTIL_FD_FILE, GRUB_UTIL_FD_DISK } type;
 
76
  grub_uint64_t off;
 
77
  union
 
78
  {
 
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;
 
85
    };
 
86
  };
 
87
};
 
88
typedef struct grub_util_fd *grub_util_fd_t;
 
89
 
 
90
enum grub_util_fd_open_flags_t
 
91
  {
 
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
 
103
                           )
 
104
  };
 
105
 
 
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
 
109
 
 
110
#define DEFAULT_DIRECTORY       "SYS:" GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME
 
111
#define DEFAULT_DEVICE_MAP      DEFAULT_DIRECTORY "/device.map"
 
112
 
 
113
#endif