source: rtems/cpukit/libfs/src/rfs/rtems-rfs-group.h @ 01f41602

4.115
Last change on this file since 01f41602 was 01f41602, checked in by Ralf Corsepius <ralf.corsepius@…>, on 06/12/10 at 05:18:16

2010-06-12 Ralf Corsépius <ralf.corsepius@…>

  • libfs/src/devfs/devfs.h, libfs/src/rfs/rtems-rfs-block-pos.h, libfs/src/rfs/rtems-rfs-block.h, libfs/src/rfs/rtems-rfs-dir.h, libfs/src/rfs/rtems-rfs-group.h, libfs/src/rfs/rtems-rfs-inode.h: Fix broken doxygen commands.
  • Property mode set to 100644
File size: 4.8 KB
Line 
1/*
2 *  COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org>
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.rtems.com/license/LICENSE.
7 *
8 *  $Id$
9 */
10/**
11 * @file
12 *
13 * @ingroup rtems-rfs
14 *
15 * RTEMS File Systems Group Management.
16 *
17 * These functions manage the groups used in the file system.
18 */
19
20#if !defined (_RTEMS_RFS_GROUP_H_)
21#define _RTEMS_RFS_GROUP_H_
22
23#include <rtems/rfs/rtems-rfs-trace.h>
24#include <rtems/rfs/rtems-rfs-bitmaps.h>
25#include <rtems/rfs/rtems-rfs-buffer.h>
26
27/**
28 * Block allocations for a group on disk.
29 */
30#define RTEMS_RFS_GROUP_BLOCK_BITMAP_BLOCK (0)
31#define RTEMS_RFS_GROUP_INODE_BITMAP_BLOCK (1)
32#define RTEMS_RFS_GROUP_INODE_BLOCK        (2)
33
34/**
35 * A group is a selection of blocks on the disk. Typically the number of blocks
36 * in a group is determined by the number of bits a block holds. This makes the
37 * bit allocator for blocks in the group simpler plus is allows a simple way to
38 * localise access to files and directories.
39 */
40typedef struct rtems_rfs_group_t
41{
42  /**
43   * Base block number.
44   */
45  rtems_rfs_buffer_block base;
46
47  /**
48   * The number of blocks in the group. Groups may be different sizes.
49   */
50  size_t size;
51
52  /**
53   * The block bitmap control.
54   */
55  rtems_rfs_bitmap_control block_bitmap;
56
57  /**
58   * The handle to the block bitmap buffer.
59   */
60  rtems_rfs_buffer_handle block_bitmap_buffer;
61
62  /**
63   * The inode bitmap control.
64   */
65  rtems_rfs_bitmap_control inode_bitmap;
66
67  /**
68   * The handle to the inode bitmap buffer.
69   */
70  rtems_rfs_buffer_handle inode_bitmap_buffer;
71
72} rtems_rfs_group;
73
74/**
75 * Return the disk's block for a block in a group.
76 */
77#define rtems_rfs_group_block(_g, _b) (((_g)->base) + (_b))
78
79/**
80 * Return the file system inode for a inode in a group.
81 */
82#define rtems_rfs_group_inode(_f, _g, _i) \
83  (((_f)->group_inodes * (_g)) + (_i) + RTEMS_RFS_ROOT_INO)
84
85/**
86 * Open a group. Allocate all the resources including the bitmaps.
87 *
88 * @param fs The file system.
89 * @param base The base block number.
90 * @param size The number of blocks in the group.
91 * @param group Reference to the group to open.
92 * @return int The error number (errno). No error if 0.
93 */
94int rtems_rfs_group_open (rtems_rfs_file_system* fs,
95                          rtems_rfs_buffer_block base,
96                          size_t                 size,
97                          size_t                 inodes,
98                          rtems_rfs_group*       group);
99
100/**
101 * Close a group. Release all resources the group holds.
102 *
103 * @param fs The file system.
104 * @param group The group to close.
105 * @return int The error number (errno). No error if 0.
106 */
107int rtems_rfs_group_close (rtems_rfs_file_system* fs,
108                           rtems_rfs_group*       group);
109
110/**
111 * Allocate an inode or block. The groups are searched to find the next
112 * available inode or block.
113 *
114 * @param fs The file system data.
115 * @param goal The goal to seed the bitmap search.
116 * @param inode If true allocate an inode else allocate a block.
117 * @param result The allocated bit in the bitmap.
118 * @return int The error number (errno). No error if 0.
119 */
120int rtems_rfs_group_bitmap_alloc (rtems_rfs_file_system* fs,
121                                  rtems_rfs_bitmap_bit   goal,
122                                  bool                   inode,
123                                  rtems_rfs_bitmap_bit*  result);
124
125/**
126 * Free the group allocated bit.
127 *
128 * @param fs The file system data.
129 * @param inode If true the number to free is an inode else it is a block.
130 * @param block The inode or block number to free.
131 * @return int The error number (errno). No error if 0.
132 */
133int rtems_rfs_group_bitmap_free (rtems_rfs_file_system* fs,
134                                 bool                   inode,
135                                 rtems_rfs_bitmap_bit   no);
136
137/**
138 * Test the group allocated bit.
139 *
140 * @param fs The file system data.
141 * @param inode If true the number to free is an inode else it is a block.
142 * @param block The inode or block number to free.
143 * @param state Return the state of the bit.
144 * @return int The error number (errno). No error if 0.
145 */
146int rtems_rfs_group_bitmap_test (rtems_rfs_file_system* fs,
147                                 bool                   inode,
148                                 rtems_rfs_bitmap_bit   no,
149                                 bool*                  state);
150
151/**
152 * Determine the number of blocks and inodes used.
153 *
154 * @param fs The file system data.
155 * @param blocks The number of blocks used.
156 * @param inodes The number of inodes used.
157 * @return int The error number (errno). No error if 0.
158 */
159int rtems_rfs_group_usage (rtems_rfs_file_system* fs,
160                           size_t*                blocks,
161                           size_t*                inodes);
162
163#endif
Note: See TracBrowser for help on using the repository browser.