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 
38 #ifdef BLURAY_API_EXPORT
39 #include "util/attributes.h"
40 #elif !defined(BD_PUBLIC)
41 #define BD_PUBLIC
42 #endif
43 
47 typedef struct bd_file_s BD_FILE_H;
48 struct bd_file_s
49 {
53  void* internal;
54 
60  void (*close) (BD_FILE_H *file);
61 
74  int64_t (*seek) (BD_FILE_H *file, int64_t offset, int32_t origin);
75 
82  int64_t (*tell) (BD_FILE_H *file);
83 
92  int (*eof) (BD_FILE_H *file);
93 
102  int64_t (*read) (BD_FILE_H *file, uint8_t *buf, int64_t size);
103 
114  int64_t (*write) (BD_FILE_H *file, const uint8_t *buf, int64_t size);
115 };
116 
121 typedef struct
122 {
123  char d_name[256];
124 } BD_DIRENT;
125 
130 typedef struct bd_dir_s BD_DIR_H;
131 struct bd_dir_s
132 {
133  void* internal;
140  void (*close)(BD_DIR_H *dir);
141 
149  int (*read)(BD_DIR_H *dir, BD_DIRENT *entry);
150 };
151 
161 typedef BD_FILE_H* (*BD_FILE_OPEN)(const char* filename, const char *mode);
162 
171 typedef BD_DIR_H* (*BD_DIR_OPEN) (const char* dirname);
172 
182 
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif /* BD_FILESYSTEM_H_ */
BD_FILE_H *(* BD_FILE_OPEN)(const char *filename, const char *mode)
Open a file.
Definition: filesystem.h:161
int64_t(* tell)(BD_FILE_H *file)
Get current read or write position.
Definition: filesystem.h:82
Directory access.
Definition: filesystem.h:131
BD_PUBLIC BD_DIR_OPEN bd_register_dir(BD_DIR_OPEN p)
Register function pointer that will be used to open a directory.
int(* read)(BD_DIR_H *dir, BD_DIRENT *entry)
Read next directory entry.
Definition: filesystem.h:149
Directory entry.
Definition: filesystem.h:121
int64_t(* read)(BD_FILE_H *file, uint8_t *buf, int64_t size)
Read from file.
Definition: filesystem.h:102
BD_PUBLIC BD_FILE_OPEN bd_register_file(BD_FILE_OPEN p)
Register function pointer that will be used to open a file.
BD_DIR_H *(* BD_DIR_OPEN)(const char *dirname)
Open a directory.
Definition: filesystem.h:171
int(* eof)(BD_FILE_H *file)
Check for end of file.
Definition: filesystem.h:92
File access.
Definition: filesystem.h:48
void(* close)(BD_FILE_H *file)
Close file.
Definition: filesystem.h:60
int64_t(* seek)(BD_FILE_H *file, int64_t offset, int32_t origin)
Reposition file offset.
Definition: filesystem.h:74
int64_t(* write)(BD_FILE_H *file, const uint8_t *buf, int64_t size)
Write to file.
Definition: filesystem.h:114
void(* close)(BD_DIR_H *dir)
Close directory stream.
Definition: filesystem.h:140