openblt

a hobby OS from the late 90s
git clone http://frotz.net/git/openblt.git
Log | Files | Refs | LICENSE

bootfs.h (2785B)


      1 /* $Id: //depot/blt/srv/vfs/bootfs.h#6 $
      2 **
      3 ** Copyright 1999 Sidney Cammeresi.
      4 ** All rights reserved.
      5 ** 
      6 ** Redistribution and use in source and binary forms, with or without
      7 ** modification, are permitted provided that the following conditions
      8 ** are met:
      9 ** 1. Redistributions of source code must retain the above copyright notice,
     10 **	this list of conditions and the following disclaimer.
     11 ** 
     12 ** 2. Redistributions in binary form must reproduce the above copyright
     13 **	notice, this list of conditions and the following disclaimer in the
     14 **	documentation and/or other materials provided with the distribution.
     15 ** 
     16 ** 3. The name of the author may not be used to endorse or promote products
     17 **	derived from this software without specific prior written permission.
     18 ** 
     19 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR IMPLIED
     20 ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     21 ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
     22 ** NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
     24 ** TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     25 ** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     26 ** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     27 ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     28 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29 */
     30 
     31 #ifndef _BOOTFS_H_
     32 #define _BOOTFS_H_
     33 
     34 #include <boot.h>
     35 #include "vfs-int.h"
     36 
     37 struct bootfs_inode
     38 {
     39 	int i_ino, i_offset, i_size;
     40 	char i_name[BOOTDIR_NAMELEN];
     41 	struct bootfs_inode *i_next;
     42 };
     43 
     44 struct bootfs_sb_data
     45 {
     46 	int d_bootdir_area;
     47 	boot_dir *d_bootdir;
     48 	struct bootfs_inode *inode_list;
     49 };
     50 
     51 union bootfs_cookie
     52 {
     53 	struct
     54 	{
     55 	    struct vfs_dirent_node *head, *current;
     56 	} u_dir;
     57 	struct
     58 	{
     59 		char *begin;
     60 	    int pos;
     61 	} u_file;
     62 };
     63 
     64 int bootfs_mount (struct superblock *sb, const char *data, int silent);
     65 void bootfs_unmount (struct superblock *sb);
     66 int bootfs_read_vnode (struct vnode *vnode);
     67 void bootfs_drop_vnode (struct vnode *vnode);
     68 struct vnode *bootfs_walk (struct vnode *parent, const char *path);
     69 int bootfs_opendir (struct vnode *dir, void **cookie);
     70 void bootfs_closedir (struct vnode *dir, void *cookie);
     71 int bootfs_rewinddir (struct vnode *dir, void *cookie);
     72 int bootfs_readdir (struct vnode *dir, struct dirent *dirent, void *cookie);
     73 int bootfs_open (struct vnode *dir, void **cookie);
     74 int bootfs_close (struct vnode *dir, void *cookie);
     75 void bootfs_free_cookie (void *cookie);
     76 int bootfs_read (struct vnode *dir, char *buf, size_t count, off_t offset,
     77 	size_t *res, void *cookie);
     78 int bootfs_rstat (struct vnode *vnode, struct stat *buf);
     79 
     80 #endif
     81