12 * Maximum number of open files. This is *currently* constrained by the
13 * fact that PXE needs to be able to fit all its packet buffers into a
14 * 64K segment; this should be fixed by moving the packet buffers to high
17 #define MAX_OPEN_LG2 5
18 #define MAX_OPEN (1 << MAX_OPEN_LG2)
20 #define FILENAME_MAX_LG2 8
21 #define FILENAME_MAX (1 << FILENAME_MAX_LG2)
24 const struct fs_ops *fs_ops;
25 struct device *fs_dev;
26 void *fs_info; /* The fs-specific information */
27 int blk_bits; /* block_size = 1 << (blk_bits + SECTOR_SHIFT */
30 extern struct fs_info *this_fs;
32 struct dirent; /* Directory entry structure */
39 /* in fact, we use fs_ops structure to find the right fs */
41 enum fs_flags fs_flags;
43 int (*fs_init)(struct fs_info *);
44 void (*searchdir)(char *, struct file *);
45 uint32_t (*getfssec)(struct file *, char *, int, bool *);
46 void (*close_file)(struct file *);
47 void (*mangle_name)(char *, const char *);
48 char * (*unmangle_name)(char *, const char *);
51 struct inode * (*iget_root)(void);
52 struct inode * (*iget_current)(void);
53 struct inode * (*iget)(char *, struct inode *);
54 char * (*follow_symlink)(struct inode *, const char *);
57 void (*opendir)(com32sys_t *);
58 struct dirent * (*readdir)(struct file *);
61 enum inode_mode {I_FILE, I_DIR, I_SYMLINK};
64 * The inode structure, including the detail file information
67 int mode; /* FILE , DIR or SYMLINK */
69 uint32_t ino; /* Inode number */
70 uint32_t atime; /* Access time */
71 uint32_t mtime; /* Modify time */
72 uint32_t ctime; /* Create time */
73 uint32_t dtime; /* Delete time */
74 int blocks; /* How many blocks the file take */
75 uint32_t * data; /* The block address array where the file stored */
82 extern struct inode *this_inode;
89 /* For the new universal-path_lookup */
91 struct inode *inode; /* The file-specific information */
92 uint32_t offset; /* for next read */
95 /* For the old searhdir method */
97 struct open_file_t *open_file;/* The fs-specific open file struct */
104 enum dev_type {CHS, EDD};
107 * Generic functions that filesystem drivers may choose to use
109 void generic_mangle_name(char *, const char *);
110 #define generic_unmangle_name stpcpy
113 * Struct device contains:
114 * the pointer points to the disk structure,
120 /* the cache stuff */
123 uint16_t cache_block_size;
124 uint16_t cache_entries;
129 * Our definition of "not whitespace"
131 static inline bool not_whitespace(char c)
133 return (unsigned char)c > ' ';
136 static inline void free_inode(struct inode * inode)
145 static inline void malloc_error(char *obj)
147 printf("Out of memory: can't allocate memory for %s\n", obj);
153 void mangle_name(com32sys_t *);
154 void searchdir(com32sys_t *);
155 void _close_file(struct file *);
156 inline uint16_t file_to_handle(struct file *);
157 inline struct file *handle_to_file(uint16_t);