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

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since ef76d72 was ef76d72, checked in by Maurizio Lombardi <m.lombardi85@…>, 14 years ago

Add the isearch and zsearch fields to the superblock
structure, they will be used to optimize search in inode/zone bitmaps.

  • Property mode set to 100644
File size: 4.2 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 int log2_zone_size;
74 int block_size;
75 uint32_t max_file_size;
76 uint16_t magic;
77 uint16_t state;
78
79 /*The following fields do not exist on disk but only in memory*/
80 unsigned long itable_size;
81 mfs_version_t fs_version;
82 int ino_per_block;
83 int dirsize;
84 bool long_names;
85 bool native;
86 unsigned isearch;
87 unsigned zsearch;
88};
89
90/*Generic MinixFS inode*/
91struct mfs_ino_info {
92 uint16_t i_mode;
93 uint16_t i_nlinks;
94 int16_t i_uid;
95 uint16_t i_gid;
96 int32_t i_size;
97 int32_t i_atime;
98 int32_t i_mtime;
99 int32_t i_ctime;
100 /*Block numbers for direct zones*/
101 uint32_t i_dzone[V2_NR_DIRECT_ZONES];
102 /*Block numbers for indirect zones*/
103 uint32_t i_izone[V2_NR_INDIRECT_ZONES];
104
105 /*The following fields do not exist on disk but only in memory*/
106 bool dirty;
107 fs_index_t index;
108};
109
110/*Generic MFS directory entry*/
111struct mfs_dentry_info {
112 uint32_t d_inum;
113 char d_name[MFS3_MAX_NAME_LEN];
114
115 /*The following fields do not exist on disk but only in memory*/
116 bool dirty;
117};
118
119struct mfs_instance {
120 link_t link;
121 devmap_handle_t handle;
122 struct mfs_sb_info *sbi;
123};
124
125/*MinixFS node in core*/
126struct mfs_node {
127 struct mfs_ino_info *ino_i;
128 struct mfs_instance *instance;
129};
130
131/*mfs_ops.c*/
132extern void mfs_mounted(ipc_callid_t rid, ipc_call_t *request);
133extern void mfs_mount(ipc_callid_t rid, ipc_call_t *request);
134extern void mfs_lookup(ipc_callid_t rid, ipc_call_t *request);
135extern int mfs_instance_get(devmap_handle_t handle,
136 struct mfs_instance **instance);
137
138extern void mfs_stat(ipc_callid_t rid, ipc_call_t *request);
139
140/*mfs_inode.c*/
141extern struct mfs_ino_info *
142mfs_read_inode_raw(const struct mfs_instance *instance, uint16_t inum);
143
144extern struct mfs_ino_info *
145mfs2_read_inode_raw(const struct mfs_instance *instance, uint32_t inum);
146
147/*mfs_read.c*/
148int read_map(uint32_t *b, const struct mfs_node *mnode, const uint32_t pos);
149
150/*mfs_dentry.c*/
151extern struct mfs_dentry_info *
152read_directory_entry(struct mfs_node *mnode, unsigned index);
153
154#endif
155
156/**
157 * @}
158 */
159
Note: See TracBrowser for help on using the repository browser.