2008-12-11 20:30:53 +00:00
|
|
|
/*
|
2006-04-26 15:08:19 +00:00
|
|
|
* Creation Date: <2001/05/06 17:12:45 samuel>
|
|
|
|
|
* Time-stamp: <2003/10/22 11:43:45 samuel>
|
2008-12-11 20:30:53 +00:00
|
|
|
*
|
2006-04-26 15:08:19 +00:00
|
|
|
* <fs_loader.h>
|
2008-12-11 20:30:53 +00:00
|
|
|
*
|
2006-04-26 15:08:19 +00:00
|
|
|
* Generic file system access
|
2008-12-11 20:30:53 +00:00
|
|
|
*
|
2006-04-26 15:08:19 +00:00
|
|
|
* Copyright (C) 2001, 2002, 2003 Samuel Rydh (samuel@ibrium.se)
|
2008-12-11 20:30:53 +00:00
|
|
|
*
|
2006-04-26 15:08:19 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation
|
2008-12-11 20:30:53 +00:00
|
|
|
*
|
2006-04-26 15:08:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _H_FS
|
|
|
|
|
#define _H_FS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct fs_ops fs_ops_t;
|
|
|
|
|
typedef struct opaque_struct file_desc_t;
|
|
|
|
|
|
|
|
|
|
#define fs_open_path( fs, path ) (fs)->open_path( fs, path )
|
|
|
|
|
#define fs_search_rom( fs ) (fs)->search_rom( fs )
|
|
|
|
|
#define fs_search_file( fs, name ) (fs)->search_file( fs, name )
|
|
|
|
|
#define fs_vol_name( fs, buf, size ) (fs)->vol_name( fs, buf, size )
|
|
|
|
|
|
|
|
|
|
struct fs_ops {
|
|
|
|
|
void *fs_data;
|
|
|
|
|
int fd; /* owner block device */
|
|
|
|
|
int type;
|
|
|
|
|
|
|
|
|
|
void (*close_fs)( fs_ops_t *fs );
|
|
|
|
|
file_desc_t *(*open_path)( fs_ops_t *fs, const char *path );
|
|
|
|
|
file_desc_t *(*search_rom)( fs_ops_t *fs );
|
|
|
|
|
file_desc_t *(*search_file)( fs_ops_t *fs, const char *name );
|
|
|
|
|
char *(*vol_name)( fs_ops_t *fs, char *buf, int size );
|
|
|
|
|
|
|
|
|
|
/* file ops */
|
|
|
|
|
void (*close)( file_desc_t *file );
|
|
|
|
|
int (*read)( file_desc_t *file, void *buf, size_t count );
|
|
|
|
|
int (*lseek)( file_desc_t *file, off_t offset, int whence );
|
|
|
|
|
char *(*get_path)( file_desc_t *file, char *buf, int len );
|
2009-11-22 09:58:01 +00:00
|
|
|
void (*dir)( file_desc_t *file );
|
2006-04-26 15:08:19 +00:00
|
|
|
|
2008-12-14 12:54:23 +00:00
|
|
|
const char *(*get_fstype)( fs_ops_t *fs );
|
2006-04-26 15:08:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern fs_ops_t *fs_open( int fs_type, int fd );
|
|
|
|
|
extern void fs_close( fs_ops_t *fs );
|
|
|
|
|
const char *fs_get_name( fs_ops_t *fs );
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_HFSP
|
|
|
|
|
extern int fs_hfsp_open( int fd, fs_ops_t *fs );
|
2010-06-09 22:30:32 +00:00
|
|
|
extern int fs_hfsp_probe( int fd, llong offs );
|
2006-04-26 15:08:19 +00:00
|
|
|
#else
|
|
|
|
|
static inline int fs_hfsp_open( int fd, fs_ops_t *fs ) { return -1; }
|
2010-06-09 22:30:32 +00:00
|
|
|
static inline int fs_hfsp_probe( int fd, llong offs ) { return -1; }
|
2006-04-26 15:08:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_HFS
|
|
|
|
|
extern int fs_hfs_open( int fd, fs_ops_t *fs );
|
2010-06-09 22:30:32 +00:00
|
|
|
extern int fs_hfs_probe( int fd, llong offs );
|
2006-04-26 15:08:19 +00:00
|
|
|
#else
|
|
|
|
|
static inline int fs_hfs_open( int fd, fs_ops_t *fs ) { return -1; }
|
2010-06-09 22:30:32 +00:00
|
|
|
static inline int fs_hfs_probe( int fd, llong offs ) { return -1; }
|
2006-04-26 15:08:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
2009-11-22 09:26:50 +00:00
|
|
|
#ifdef CONFIG_ISO9660
|
|
|
|
|
extern int fs_iso9660_open( int fd, fs_ops_t *fs );
|
2010-06-23 20:41:34 +00:00
|
|
|
extern int fs_iso9660_probe( int fd, llong offs );
|
2009-11-22 09:26:50 +00:00
|
|
|
#else
|
|
|
|
|
static inline int fs_iso9660_open( int fd, fs_ops_t *fs ) { return -1; }
|
2010-06-23 20:41:34 +00:00
|
|
|
static inline int fs_iso9660_probe( int fd, llong offs ) { return -1; }
|
2009-11-22 09:26:50 +00:00
|
|
|
#endif
|
|
|
|
|
|
2009-11-22 09:47:08 +00:00
|
|
|
#ifdef CONFIG_EXT2
|
|
|
|
|
extern int fs_ext2_open( int fd, fs_ops_t *fs );
|
2010-06-09 22:30:32 +00:00
|
|
|
extern int fs_ext2_probe( int fd, llong offs );
|
2009-11-22 09:47:08 +00:00
|
|
|
#else
|
|
|
|
|
static inline int fs_ext2_open( int fd, fs_ops_t *fs ) { return -1; }
|
2010-06-09 22:30:32 +00:00
|
|
|
static inline int fs_ext2_probe( int fd, llong offs ) { return -1; }
|
2009-11-22 09:47:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
2006-04-26 15:08:19 +00:00
|
|
|
#ifdef CONFIG_GRUBFS
|
|
|
|
|
extern int fs_grubfs_open( int fd, fs_ops_t *fs );
|
2010-06-08 20:59:08 +00:00
|
|
|
extern int fs_grubfs_probe( int fd, llong offs );
|
2006-04-26 15:08:19 +00:00
|
|
|
#else
|
|
|
|
|
static inline int fs_grubfs_open( int fd, fs_ops_t *fs ) { return -1; }
|
2010-06-09 22:30:32 +00:00
|
|
|
static inline int fs_grubfs_probe( int fd, llong offs ) { return -1; }
|
2006-04-26 15:08:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* misc */
|
|
|
|
|
extern char *get_hfs_vol_name( int fd, char *buf, int size );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _H_FS */
|