source: mainline/uspace/srv/fs/minixfs/mfs.h@ ac28650

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since ac28650 was ac28650, checked in by Maurizio Lombardi <m.lombardi85@…>, 14 years ago
  • Fix a bug in mfs_has_children() function
  • Some functions shold be declared as static
  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * Copyright (c) 2011 Maurizio Lombardi
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup fs
30 * @{
31 */
32
33#ifndef _MFS_H_
34#define _MFS_H_
35
36#include <minix.h>
37#include <libblock.h>
38#include <libfs.h>
39#include <adt/list.h>
40#include "../../vfs/vfs.h"
41
42#define NAME "mfs"
43
44#define DEBUG_MODE
45
46#ifdef DEBUG_MODE
47#define mfsdebug(...) printf(__VA_ARGS__)
48#else
49#define mfsdebug(...)
50#endif
51
52#ifdef _MAIN
53#define GLOBAL
54#else
55#define GLOBAL extern
56#endif
57
58GLOBAL fs_reg_t mfs_reg;
59
60typedef enum {
61 MFS_VERSION_V1 = 1,
62 MFS_VERSION_V2,
63 MFS_VERSION_V3
64} mfs_version_t;
65
66/*Generic MinixFS superblock*/
67struct mfs_sb_info {
68 uint32_t ninodes;
69 uint32_t nzones;
70 unsigned long ibmap_blocks;
71 unsigned long zbmap_blocks;
72 unsigned long firstdatazone;
73 unsigned long itable_size;
74 int log2_zone_size;
75 int ino_per_block;
76 int dirsize;
77 int block_size;
78 mfs_version_t fs_version;
79 uint32_t max_file_size;
80 uint16_t magic;
81 uint16_t state;
82 bool long_names;
83 bool native;
84};
85
86/*Generic MinixFS inode*/
87struct mfs_ino_info {
88 uint16_t i_mode;
89 uint16_t i_nlinks;
90 int16_t i_uid;
91 uint16_t i_gid;
92 int32_t i_size;
93 int32_t i_atime;
94 int32_t i_mtime;
95 int32_t i_ctime;
96 /*Block numbers for direct zones*/
97 uint32_t i_dzone[V2_NR_DIRECT_ZONES];
98 /*Block numbers for indirect zones*/
99 uint32_t i_izone[V2_NR_INDIRECT_ZONES];
100
101 bool dirty;
102 fs_index_t index;
103};
104
105/*Generic MFS directory entry*/
106struct mfs_dentry_info {
107 uint32_t d_inum;
108 char d_name[MFS3_MAX_NAME_LEN];
109
110 bool dirty;
111};
112
113struct mfs_instance {
114 link_t link;
115 devmap_handle_t handle;
116 struct mfs_sb_info *sbi;
117};
118
119/*MinixFS node in core*/
120struct mfs_node {
121 struct mfs_ino_info *ino_i;
122 struct mfs_instance *instance;
123};
124
125/*mfs_ops.c*/
126extern void mfs_mounted(ipc_callid_t rid, ipc_call_t *request);
127extern void mfs_mount(ipc_callid_t rid, ipc_call_t *request);
128extern void mfs_lookup(ipc_callid_t rid, ipc_call_t *request);
129extern int mfs_instance_get(devmap_handle_t handle,
130 struct mfs_instance **instance);
131
132extern void mfs_stat(ipc_callid_t rid, ipc_call_t *request);
133
134/*mfs_inode.c*/
135extern
136struct mfs_ino_info *mfs_read_inode_raw(const struct mfs_instance *instance,
137 uint16_t inum);
138extern
139struct mfs_ino_info *mfs2_read_inode_raw(const struct mfs_instance *instance,
140 uint32_t inum);
141
142/*mfs_read.c*/
143int read_map(uint32_t *b, const struct mfs_node *mnode, const uint32_t pos);
144
145/*mfs_dentry.c*/
146extern struct mfs_dentry_info *
147read_directory_entry(struct mfs_node *mnode, unsigned index);
148
149#endif
150
151/**
152 * @}
153 */
154
Note: See TracBrowser for help on using the repository browser.