4 * Open Hack'Ware BIOS: file system library definitions
6 * Copyright (c) 2004-2005 Jocelyn Mayer
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License V2
10 * as published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #if !defined(__OHW_LIBFS_H__)
23 #define __OHW_LIBFS_H__
26 #define FS_SPECIAL "<special>"
28 static inline int is_special_file (const unsigned char *name)
30 int splen = strlen(FS_SPECIAL);
32 return name[0] == '\0' && memcmp(name + 1, FS_SPECIAL, splen) == 0 &&
33 name[splen + 1] == '\0';
36 #if defined (DEBUG_FS)
37 #define FS_DPRINTF(fmt, args...) \
38 do { dprintf("%s: " fmt, __func__ , ##args); } while (0)
40 #define FS_DPRINTF(fmt, args...) \
43 #define FS_ERROR(fmt, args...) \
44 do { printf("ERROR in %s: " fmt, __func__ , ##args); } while (0)
46 typedef struct fs_ops_t {
47 inode_t *(*get_inode)(inode_t *parent, const unsigned char *name);
48 void (*put_inode)(inode_t *inode);
49 uint32_t (*map_bloc)(inode_t *inode, uint32_t bloc);
50 inode_t *(*get_special_inode)(fs_t *fs, int type);
53 #define MAXNAME_LEN 1024
73 /* All internals use inodes */
78 /* Next inode at the same level */
80 /* First child inode */
94 /* Low-level helpers */
102 void fs_cache_add_inode (inode_t *parent, inode_t *inode);
104 int fs_raw_probe (part_t *part, uint32_t *size,
105 fs_ops_t **fs_ops, unsigned char **name,
107 int fs_ext2_probe (part_t *part, uint32_t *size,
108 fs_ops_t **fs_ops, unsigned char **name,
110 int fs_isofs_probe (part_t *part, uint32_t *size,
111 fs_ops_t **fs_ops, unsigned char **name,
113 int fs_hfs_probe (part_t *part, uint32_t *size,
114 fs_ops_t **fs_ops, unsigned char **name,
116 int fs_raw_set_bootfile (part_t *part,
117 uint32_t start_bloc, uint32_t start_offset,
118 uint32_t size_bloc, uint32_t size_offset);
121 FS_TYPE_UNKNOWN = -1,
129 #endif /* !defined(__OHW_LIBFS_H__) */