/* * VAS_EBOOT -- GRand Unified Bootloader * Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc. * * VAS_EBOOT 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. * * VAS_EBOOT 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 VAS_EBOOT. If not, see . */ #ifndef VAS_EBOOT_EMU_HOSTFILE_H #define VAS_EBOOT_EMU_HOSTFILE_H 1 #include #include #include #include #include #include #include #include typedef struct dirent *VasEBoot_util_fd_dirent_t; typedef DIR *VasEBoot_util_fd_dir_t; static inline VasEBoot_util_fd_dir_t VasEBoot_util_fd_opendir (const char *name) { return opendir (name); } static inline void VasEBoot_util_fd_closedir (VasEBoot_util_fd_dir_t dirp) { closedir (dirp); } static inline VasEBoot_util_fd_dirent_t VasEBoot_util_fd_readdir (VasEBoot_util_fd_dir_t dirp) { return readdir (dirp); } static inline int VasEBoot_util_rmdir (const char *pathname) { return rmdir (pathname); } static inline int VasEBoot_util_unlink (const char *pathname) { return unlink (pathname); } static inline int VasEBoot_util_rename (const char *from, const char *to) { return rename (from, to); } static inline ssize_t VasEBoot_util_readlink (const char *name, char *buf, size_t bufsize) { return readlink(name, buf, bufsize); } #define VasEBoot_util_mkdir(a) (void) mkdir ((a), 0755) struct VasEBoot_util_fd { enum { VAS_EBOOT_UTIL_FD_FILE, VAS_EBOOT_UTIL_FD_DISK } type; VasEBoot_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 VasEBoot_util_fd *VasEBoot_util_fd_t; enum VasEBoot_util_fd_open_flags_t { VAS_EBOOT_UTIL_FD_O_RDONLY = O_RDONLY, VAS_EBOOT_UTIL_FD_O_WRONLY = O_WRONLY, VAS_EBOOT_UTIL_FD_O_RDWR = O_RDWR, VAS_EBOOT_UTIL_FD_O_CREATTRUNC = O_CREAT | O_TRUNC, VAS_EBOOT_UTIL_FD_O_SYNC = (0 #ifdef O_SYNC | O_SYNC #endif #ifdef O_FSYNC | O_FSYNC #endif ) }; #define VAS_EBOOT_UTIL_FD_INVALID NULL #define VAS_EBOOT_UTIL_FD_IS_VALID(x) ((x) != VAS_EBOOT_UTIL_FD_INVALID) #define VAS_EBOOT_UTIL_FD_STAT_IS_FUNCTIONAL 0 #define DEFAULT_DIRECTORY "SYS:" VAS_EBOOT_BOOT_DIR_NAME "/" VAS_EBOOT_DIR_NAME #define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map" #endif