libbluray
Loading...
Searching...
No Matches
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
28
29#ifndef BD_FILESYSTEM_H_
30#define BD_FILESYSTEM_H_
31
32#ifdef __cplusplus
33extern "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
47typedef struct bd_file_s BD_FILE_H;
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
120
121typedef struct
122{
123 char d_name[256];
124} BD_DIRENT;
125
129
130typedef struct bd_dir_s BD_DIR_H;
132{
133 void* internal;
134
140 void (*close)(BD_DIR_H *dir);
141
149 int (*read)(BD_DIR_H *dir, BD_DIRENT *entry);
150};
151
161typedef BD_FILE_H* (*BD_FILE_OPEN)(const char* filename, const char *mode);
162
171typedef 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_PUBLIC BD_FILE_OPEN bd_register_file(BD_FILE_OPEN p)
Register function pointer that will be used to open a file.
BD_PUBLIC 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:161
BD_DIR_H *(* BD_DIR_OPEN)(const char *dirname)
Open a directory.
Definition filesystem.h:171
Directory entry.
Definition filesystem.h:122
char d_name[256]
Null-terminated filename.
Definition filesystem.h:123
Directory access.
Definition filesystem.h:132
void(* close)(BD_DIR_H *dir)
Close directory stream.
Definition filesystem.h:140
int(* read)(BD_DIR_H *dir, BD_DIRENT *entry)
Read next directory entry.
Definition filesystem.h:149
void * internal
reserved for BD_DIR_H implementation use
Definition filesystem.h:133
File access.
Definition filesystem.h:49
int64_t(* tell)(BD_FILE_H *file)
Get current read or write position.
Definition filesystem.h:82
void * internal
Reserved for BD_FILE_H implementation use.
Definition filesystem.h:53
void(* close)(BD_FILE_H *file)
Close file.
Definition filesystem.h:60
int64_t(* read)(BD_FILE_H *file, uint8_t *buf, int64_t size)
Read from file.
Definition filesystem.h:102
int(* eof)(BD_FILE_H *file)
Check for end of file.
Definition filesystem.h:92
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