Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / include / fs / fs.h
1 /*
2  *   Creation Date: <2001/05/06 17:12:45 samuel>
3  *   Time-stamp: <2003/10/22 11:43:45 samuel>
4  *
5  *      <fs_loader.h>
6  *
7  *      Generic file system access
8  *
9  *   Copyright (C) 2001, 2002, 2003 Samuel Rydh (samuel@ibrium.se)
10  *
11  *   This program is free software; you can redistribute it and/or
12  *   modify it under the terms of the GNU General Public License
13  *   as published by the Free Software Foundation
14  *
15  */
16
17 #ifndef _H_FS
18 #define _H_FS
19
20
21 typedef struct fs_ops           fs_ops_t;
22 typedef struct opaque_struct    file_desc_t;
23
24 #define fs_open_path( fs, path )        (fs)->open_path( fs, path )
25 #define fs_search_rom( fs )             (fs)->search_rom( fs )
26 #define fs_search_file( fs, name )      (fs)->search_file( fs, name )
27 #define fs_vol_name( fs, buf, size )    (fs)->vol_name( fs, buf, size )
28
29 struct fs_ops {
30         void            *fs_data;
31         int             fd;             /* owner block device */
32         int             type;
33
34         void            (*close_fs)( fs_ops_t *fs );
35         file_desc_t     *(*open_path)( fs_ops_t *fs, const char *path );
36         file_desc_t     *(*search_rom)( fs_ops_t *fs );
37         file_desc_t     *(*search_file)( fs_ops_t *fs, const char *name );
38         char            *(*vol_name)( fs_ops_t *fs, char *buf, int size );
39
40         /* file ops */
41         void            (*close)( file_desc_t *file );
42         int             (*read)( file_desc_t *file, void *buf, size_t count );
43         int             (*lseek)( file_desc_t *file, off_t offset, int whence );
44         char            *(*get_path)( file_desc_t *file, char *buf, int len );
45         void            (*dir)( file_desc_t *file );
46
47         const char      *(*get_fstype)( fs_ops_t *fs );
48 };
49
50 extern fs_ops_t         *fs_open( int fs_type, int fd );
51 extern void             fs_close( fs_ops_t *fs );
52 const char              *fs_get_name( fs_ops_t *fs );
53
54 #ifdef CONFIG_HFSP
55 extern int              fs_hfsp_open( int fd, fs_ops_t *fs );
56 extern int              fs_hfsp_probe( int fd, long long offs );
57 #else
58 static inline int       fs_hfsp_open( int fd, fs_ops_t *fs ) { return -1; }
59 static inline int       fs_hfsp_probe( int fd, long long offs ) { return -1; }
60 #endif
61
62 #ifdef CONFIG_HFS
63 extern int              fs_hfs_open( int fd, fs_ops_t *fs );
64 extern int              fs_hfs_probe( int fd, long long offs );
65 #else
66 static inline int       fs_hfs_open( int fd, fs_ops_t *fs ) { return -1; }
67 static inline int       fs_hfs_probe( int fd, long long offs ) { return -1; }
68 #endif
69
70 #ifdef CONFIG_ISO9660
71 extern int              fs_iso9660_open( int fd, fs_ops_t *fs );
72 extern int              fs_iso9660_probe( int fd, long long offs );
73 #else
74 static inline int       fs_iso9660_open( int fd, fs_ops_t *fs ) { return -1; }
75 static inline int       fs_iso9660_probe( int fd, long long offs ) { return -1; }
76 #endif
77
78 #ifdef CONFIG_EXT2
79 extern int              fs_ext2_open( int fd, fs_ops_t *fs );
80 extern int              fs_ext2_probe( int fd, long long offs );
81 #else
82 static inline int       fs_ext2_open( int fd, fs_ops_t *fs ) { return -1; }
83 static inline int       fs_ext2_probe( int fd, long long offs ) { return -1; }
84 #endif
85
86 #ifdef CONFIG_GRUBFS
87 extern int              fs_grubfs_open( int fd, fs_ops_t *fs );
88 extern int              fs_grubfs_probe( int fd, long long offs );
89 #else
90 static inline int       fs_grubfs_open( int fd, fs_ops_t *fs ) { return -1; }
91 static inline int       fs_grubfs_probe( int fd, long long offs ) { return -1; }
92 #endif
93
94
95
96 /* misc */
97 extern char             *get_hfs_vol_name( int fd, char *buf, int size );
98
99
100 #endif   /* _H_FS */