libbluray
filesystem.h
Go to the documentation of this file.
1 /*
2  * This file is part of libbluray
3  * Copyright (C) 2009-2010 Obliter0n
4  * Copyright (C) 2009-2010 John Stebbins
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
29 #ifndef BD_FILESYSTEM_H_
30 #define BD_FILESYSTEM_H_
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <stdint.h>
37 
41 typedef struct bd_file_s BD_FILE_H;
42 struct bd_file_s
43 {
47  void* internal;
48 
54  void (*close) (BD_FILE_H *file);
55 
68  int64_t (*seek) (BD_FILE_H *file, int64_t offset, int32_t origin);
69 
76  int64_t (*tell) (BD_FILE_H *file);
77 
86  int (*eof) (BD_FILE_H *file);
87 
96  int64_t (*read) (BD_FILE_H *file, uint8_t *buf, int64_t size);
97 
108  int64_t (*write) (BD_FILE_H *file, const uint8_t *buf, int64_t size);
109 };
110 
115 typedef struct
116 {
117  char d_name[256];
118 } BD_DIRENT;
119 
124 typedef struct bd_dir_s BD_DIR_H;
125 struct bd_dir_s
126 {
127  void* internal;
134  void (*close)(BD_DIR_H *dir);
135 
143  int (*read)(BD_DIR_H *dir, BD_DIRENT *entry);
144 };
145 
155 typedef BD_FILE_H* (*BD_FILE_OPEN)(const char* filename, const char *mode);
156 
165 typedef BD_DIR_H* (*BD_DIR_OPEN) (const char* dirname);
166 
176 
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 #endif /* BD_FILESYSTEM_H_ */
BD_DIR_OPEN bd_register_dir(BD_DIR_OPEN p)
Register function pointer that will be used to open a directory.
BD_FILE_H *(* BD_FILE_OPEN)(const char *filename, const char *mode)
Open a file.
Definition: filesystem.h:155
BD_DIR_H *(* BD_DIR_OPEN)(const char *dirname)
Open a directory.
Definition: filesystem.h:165
BD_FILE_OPEN bd_register_file(BD_FILE_OPEN p)
Register function pointer that will be used to open a file.
Directory entry.
Definition: filesystem.h:116
Directory access.
Definition: filesystem.h:126
void(* close)(BD_DIR_H *dir)
Close directory stream.
Definition: filesystem.h:134
int(* read)(BD_DIR_H *dir, BD_DIRENT *entry)
Read next directory entry.
Definition: filesystem.h:143
File access.
Definition: filesystem.h:43
int64_t(* tell)(BD_FILE_H *file)
Get current read or write position.
Definition: filesystem.h:76
void(* close)(BD_FILE_H *file)
Close file.
Definition: filesystem.h:54
int64_t(* read)(BD_FILE_H *file, uint8_t *buf, int64_t size)
Read from file.
Definition: filesystem.h:96
int(* eof)(BD_FILE_H *file)
Check for end of file.
Definition: filesystem.h:86
int64_t(* seek)(BD_FILE_H *file, int64_t offset, int32_t origin)
Reposition file offset.
Definition: filesystem.h:68
int64_t(* write)(BD_FILE_H *file, const uint8_t *buf, int64_t size)
Write to file.
Definition: filesystem.h:108