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

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

Link mfs_is_directory() and mfs_is_file() functions to the libfs_ops structure

  • Property mode set to 100644
File size: 2.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 DEBUG_MODE
43
44#ifdef DEBUG_MODE
45#define mfsdebug(...) printf(__VA_ARGS__)
46#else
47#define mfsdebug(...)
48#endif
49
50#ifdef _MAIN
51#define GLOBAL
52#else
53#define GLOBAL extern
54#endif
55
56GLOBAL fs_reg_t mfs_reg;
57
58typedef enum {
59 MFS_VERSION_V1 = 1,
60 MFS_VERSION_V2,
61 MFS_VERSION_V3
62} mfs_version_t;
63
64/*Generic MinixFS superblock*/
65struct mfs_sb_info {
66 uint32_t ninodes;
67 uint32_t nzones;
68 unsigned long ibmap_blocks;
69 unsigned long zbmap_blocks;
70 unsigned long firstdatazone;
71 unsigned long itable_size;
72 int log2_zone_size;
73 int ino_per_block;
74 int dirsize;
75 int block_size;
76 int fs_version;
77 uint32_t max_file_size;
78 uint16_t magic;
79 uint16_t state;
80 bool long_names;
81 bool native;
82};
83
84struct mfs_instance {
85 link_t link;
86 devmap_handle_t handle;
87 struct mfs_sb_info *sbi;
88};
89
90/*MinixFS node in core*/
91struct mfs_node {
92 union {
93 struct mfs_inode *ino;
94 struct mfs2_inode *ino2;
95 };
96
97 struct mfs_instance *instance;
98};
99
100extern void mfs_mounted(ipc_callid_t rid, ipc_call_t *request);
101extern void mfs_mount(ipc_callid_t rid, ipc_call_t *request);
102extern bool mfs_is_directory(fs_node_t *fsnode);
103extern bool mfs_is_file(fs_node_t *fsnode);
104extern devmap_handle_t mfs_device_get(fs_node_t *fsnode);
105extern int mfs_get_instance(devmap_handle_t handle,
106 struct mfs_instance **instance);
107
108#endif
109
110/**
111 * @}
112 */
113
Note: See TracBrowser for help on using the repository browser.