00001 /* 00002 * This file is part of libbluray 00003 * Copyright (C) 2009-2010 Obliter0n 00004 * Copyright (C) 2009-2010 John Stebbins 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library. If not, see 00018 * <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef BD_FILESYSTEM_H_ 00022 #define BD_FILESYSTEM_H_ 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 #include <stdint.h> 00029 #include <sys/types.h> 00030 00031 /* 00032 * file access 00033 */ 00034 00035 typedef struct bd_file_s BD_FILE_H; 00036 struct bd_file_s 00037 { 00038 void* internal; 00039 void (*close)(BD_FILE_H *file); 00040 int64_t (*seek)(BD_FILE_H *file, int64_t offset, int32_t origin); 00041 int64_t (*tell)(BD_FILE_H *file); 00042 int (*eof)(BD_FILE_H *file); 00043 int (*stat)(BD_FILE_H *file, struct stat *buf); 00044 int64_t (*read)(BD_FILE_H *file, uint8_t *buf, int64_t size); 00045 int64_t (*write)(BD_FILE_H *file, const uint8_t *buf, int64_t size); 00046 }; 00047 00048 /* 00049 * directory access 00050 */ 00051 00052 // Our dirent struct only contains the parts we care about. 00053 typedef struct 00054 { 00055 char d_name[256]; 00056 } BD_DIRENT; 00057 00058 typedef struct bd_dir_s BD_DIR_H; 00059 struct bd_dir_s 00060 { 00061 void* internal; 00062 void (*close)(BD_DIR_H *dir); 00063 int (*read)(BD_DIR_H *dir, BD_DIRENT *entry); 00064 }; 00065 00066 typedef BD_FILE_H* (*BD_FILE_OPEN)(const char* filename, const char *mode); 00067 typedef BD_DIR_H* (*BD_DIR_OPEN) (const char* dirname); 00068 00076 BD_FILE_OPEN bd_register_file(BD_FILE_OPEN p); 00077 00085 BD_DIR_OPEN bd_register_dir(BD_DIR_OPEN p); 00086 00087 #ifdef __cplusplus 00088 }; 00089 #endif 00090 00091 #endif /* BD_FILESYSTEM_H_ */
1.6.3