Move OS-dependent file definitions to include/grub/osdep/hostfile*.h.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-10-09 08:20:20 +02:00
parent 37149a2f20
commit 761c718b52
8 changed files with 154 additions and 68 deletions

View file

@ -0,0 +1,7 @@
#if defined (__AROS__)
#include "hostfile_aros.h"
#elif defined (__CYGWIN__) || defined (__MINGW32__)
#include "hostfile_windows.h"
#else
#include "hostfile_unix.h"
#endif

View file

@ -0,0 +1,49 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_EMU_HOSTFILE_H
#define GRUB_EMU_HOSTFILE_H 1
#include <config.h>
#include <stdarg.h>
struct grub_util_fd
{
enum { GRUB_UTIL_FD_FILE, GRUB_UTIL_FD_DISK } type;
grub_uint64_t off;
union
{
int fd;
struct {
struct IOExtTD *ioreq;
struct MsgPort *mp;
unsigned int is_floppy:1;
unsigned int is_64:1;
};
};
};
typedef struct grub_util_fd *grub_util_fd_t;
#define GRUB_UTIL_FD_INVALID NULL
#define GRUB_UTIL_FD_IS_VALID(x) ((x) != GRUB_UTIL_FD_INVALID)
#define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 0
#define DEFAULT_DIRECTORY "SYS:" GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
#endif

View file

@ -0,0 +1,48 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_EMU_HOSTFILE_H
#define GRUB_EMU_HOSTFILE_H 1
#include <config.h>
#include <stdarg.h>
#include <grub/symbol.h>
#include <grub/types.h>
#if defined (__NetBSD__)
/* NetBSD uses /boot for its boot block. */
# define DEFAULT_DIRECTORY "/"GRUB_DIR_NAME
#else
# define DEFAULT_DIRECTORY "/"GRUB_BOOT_DIR_NAME"/"GRUB_DIR_NAME
#endif
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
typedef int grub_util_fd_t;
#define GRUB_UTIL_FD_INVALID -1
#define GRUB_UTIL_FD_IS_VALID(x) ((x) >= 0)
#define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 1
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) || defined (__sun__) || defined(__OpenBSD__)
#define GRUB_DISK_DEVS_ARE_CHAR 1
#else
#define GRUB_DISK_DEVS_ARE_CHAR 0
#endif
#endif

View file

@ -0,0 +1,43 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_EMU_HOSTFILE_H
#define GRUB_EMU_HOSTFILE_H 1
#include <config.h>
#include <stdarg.h>
#include <windows.h>
typedef HANDLE grub_util_fd_t;
#define GRUB_UTIL_FD_INVALID INVALID_HANDLE_VALUE
#define GRUB_UTIL_FD_IS_VALID(x) ((x) != GRUB_UTIL_FD_INVALID)
#define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 0
#define DEFAULT_DIRECTORY "C:\\"GRUB_BOOT_DIR_NAME"\\"GRUB_DIR_NAME
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
#ifdef __MINGW32__
int fsync (int fno);
#define fseeko fseeko64
#define ftello ftello64
#endif
#endif