Changeset 50a01a9 in mainline
- Timestamp:
- 2011-11-13T21:08:52Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 802f0b7
- Parents:
- 54464f6a
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/minix/minix.h
r54464f6a r50a01a9 39 39 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 40 40 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 41 #define S_IFDIR 0040000 /* Directory*/42 #define S_IFREG 0100000 /* Regular file*/41 #define S_IFDIR 0040000 /* Directory */ 42 #define S_IFREG 0100000 /* Regular file */ 43 43 #define S_IFMT 00170000 44 44 45 /* The following block sizes are valid only on V3 filesystem*/45 /* The following block sizes are valid only on V3 filesystem */ 46 46 #define MFS_MIN_BLOCKSIZE 1024 47 47 #define MFS_MAX_BLOCKSIZE 4096 … … 88 88 #define MFS_ERROR_FS 0x0002 89 89 90 /* MFS V1/V2 superblock data on disk*/90 /* MFS V1/V2 superblock data on disk */ 91 91 struct mfs_superblock { 92 /* Total number of inodes on the device*/92 /* Total number of inodes on the device */ 93 93 uint16_t s_ninodes; 94 /* Total number of zones on the device*/94 /* Total number of zones on the device */ 95 95 uint16_t s_nzones; 96 /* Number of inode bitmap blocks*/96 /* Number of inode bitmap blocks */ 97 97 uint16_t s_ibmap_blocks; 98 /* Number of zone bitmap blocks*/98 /* Number of zone bitmap blocks */ 99 99 uint16_t s_zbmap_blocks; 100 /* First data zone on device*/100 /* First data zone on device */ 101 101 uint16_t s_first_data_zone; 102 /* Base 2 logarithm of the zone to block ratio*/102 /* Base 2 logarithm of the zone to block ratio */ 103 103 uint16_t s_log2_zone_size; 104 /* Maximum file size expressed in bytes*/104 /* Maximum file size expressed in bytes */ 105 105 uint32_t s_max_file_size; 106 106 /* … … 109 109 */ 110 110 uint16_t s_magic; 111 /* Flag used to detect FS errors*/111 /* Flag used to detect FS errors*/ 112 112 uint16_t s_state; 113 /* Total number of zones on the device (V2 only)*/113 /* Total number of zones on the device (V2 only) */ 114 114 uint32_t s_nzones2; 115 115 } __attribute__ ((packed)); 116 116 117 117 118 /* MFS V3 superblock data on disk*/118 /* MFS V3 superblock data on disk */ 119 119 struct mfs3_superblock { 120 /* Total number of inodes on the device*/120 /* Total number of inodes on the device */ 121 121 uint32_t s_ninodes; 122 122 uint16_t s_pad0; 123 /* Number of inode bitmap blocks*/123 /* Number of inode bitmap blocks */ 124 124 int16_t s_ibmap_blocks; 125 /* Number of zone bitmap blocks*/125 /* Number of zone bitmap blocks */ 126 126 int16_t s_zbmap_blocks; 127 /* First data zone on device*/127 /* First data zone on device */ 128 128 uint16_t s_first_data_zone; 129 /* Base 2 logarithm of the zone to block ratio*/129 /* Base 2 logarithm of the zone to block ratio */ 130 130 int16_t s_log2_zone_size; 131 131 int16_t s_pad1; 132 /* Maximum file size expressed in bytes*/132 /* Maximum file size expressed in bytes */ 133 133 uint32_t s_max_file_size; 134 /* Total number of zones on the device*/134 /* Total number of zones on the device */ 135 135 uint32_t s_nzones; 136 136 /* … … 140 140 int16_t s_magic; 141 141 int16_t s_pad2; 142 /* Filesystem block size expressed in bytes*/142 /* Filesystem block size expressed in bytes */ 143 143 uint16_t s_block_size; 144 /* Filesystem disk format version*/144 /* Filesystem disk format version */ 145 145 int8_t s_disk_version; 146 146 } __attribute__ ((packed)); 147 147 148 /* MinixFS V1 inode structure as it is on disk*/148 /* MinixFS V1 inode structure as it is on disk */ 149 149 struct mfs_inode { 150 150 uint16_t i_mode; … … 154 154 uint8_t i_gid; 155 155 uint8_t i_nlinks; 156 /* Block numbers for direct zones*/156 /* Block numbers for direct zones */ 157 157 uint16_t i_dzone[V1_NR_DIRECT_ZONES]; 158 /* Block numbers for indirect zones*/158 /* Block numbers for indirect zones */ 159 159 uint16_t i_izone[V1_NR_INDIRECT_ZONES]; 160 160 } __attribute__ ((packed)); 161 161 162 /* MinixFS V2 inode structure as it is on disk (also valid for V3).*/162 /* MinixFS V2 inode structure as it is on disk (also valid for V3). */ 163 163 struct mfs2_inode { 164 164 uint16_t i_mode; … … 170 170 int32_t i_mtime; 171 171 int32_t i_ctime; 172 /* Block numbers for direct zones*/172 /* Block numbers for direct zones */ 173 173 uint32_t i_dzone[V2_NR_DIRECT_ZONES]; 174 /* Block numbers for indirect zones*/174 /* Block numbers for indirect zones */ 175 175 uint32_t i_izone[V2_NR_INDIRECT_ZONES]; 176 176 } __attribute__ ((packed)); 177 177 178 /* MinixFS V1/V2 directory entry on-disk structure*/178 /* MinixFS V1/V2 directory entry on-disk structure */ 179 179 struct mfs_dentry { 180 180 uint16_t d_inum; … … 182 182 }; 183 183 184 /* MinixFS V3 directory entry on-disk structure*/184 /* MinixFS V3 directory entry on-disk structure */ 185 185 struct mfs3_dentry { 186 186 uint32_t d_inum; -
uspace/srv/fs/mfs/mfs.h
r54464f6a r50a01a9 48 48 #define NAME "mfs" 49 49 50 / /#define DEBUG_MODE50 /* #define DEBUG_MODE */ 51 51 52 52 #define min(a, b) ((a) < (b) ? (a) : (b)) … … 71 71 } mfs_version_t; 72 72 73 /* Generic MinixFS superblock*/73 /* Generic MinixFS superblock */ 74 74 struct mfs_sb_info { 75 75 uint32_t ninodes; … … 84 84 uint16_t state; 85 85 86 /* The following fields do not exist on disk but only in memory*/86 /* The following fields do not exist on disk but only in memory */ 87 87 unsigned long itable_size; 88 88 mfs_version_t fs_version; … … 97 97 }; 98 98 99 /* Generic MinixFS inode*/99 /* Generic MinixFS inode */ 100 100 struct mfs_ino_info { 101 101 uint16_t i_mode; … … 107 107 int32_t i_mtime; 108 108 int32_t i_ctime; 109 /* Block numbers for direct zones*/109 /* Block numbers for direct zones */ 110 110 uint32_t i_dzone[V2_NR_DIRECT_ZONES]; 111 /* Block numbers for indirect zones*/111 /* Block numbers for indirect zones */ 112 112 uint32_t i_izone[V2_NR_INDIRECT_ZONES]; 113 113 114 /* The following fields do not exist on disk but only in memory*/114 /* The following fields do not exist on disk but only in memory */ 115 115 bool dirty; 116 116 fs_index_t index; 117 117 }; 118 118 119 /* Generic MFS directory entry*/119 /* Generic MFS directory entry */ 120 120 struct mfs_dentry_info { 121 121 uint32_t d_inum; 122 122 char d_name[MFS3_MAX_NAME_LEN + 1]; 123 123 124 /* The following fields do not exist on disk but only in memory*/125 126 /* Index of the dentry in the list*/124 /* The following fields do not exist on disk but only in memory */ 125 126 /* Index of the dentry in the list */ 127 127 unsigned index; 128 /* Pointer to the node at witch the dentry belongs*/128 /* Pointer to the node at witch the dentry belongs */ 129 129 struct mfs_node *node; 130 130 }; … … 136 136 }; 137 137 138 /* MinixFS node in core*/138 /* MinixFS node in core */ 139 139 struct mfs_node { 140 140 struct mfs_ino_info *ino_i; … … 145 145 }; 146 146 147 /* mfs_ops.c*/147 /* mfs_ops.c */ 148 148 extern vfs_out_ops_t mfs_ops; 149 149 extern libfs_ops_t mfs_libfs_ops; … … 152 152 mfs_global_init(void); 153 153 154 /* mfs_inode.c*/154 /* mfs_inode.c */ 155 155 extern int 156 156 mfs_get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i, … … 163 163 mfs_inode_shrink(struct mfs_node *mnode, size_t size_shrink); 164 164 165 /* mfs_rw.c*/165 /* mfs_rw.c */ 166 166 extern int 167 167 mfs_read_map(uint32_t *b, const struct mfs_node *mnode, const uint32_t pos); … … 174 174 mfs_prune_ind_zones(struct mfs_node *mnode, size_t new_size); 175 175 176 /* mfs_dentry.c*/176 /* mfs_dentry.c */ 177 177 extern int 178 178 mfs_read_dentry(struct mfs_node *mnode, … … 188 188 mfs_insert_dentry(struct mfs_node *mnode, const char *d_name, fs_index_t d_inum); 189 189 190 /* mfs_balloc.c*/190 /* mfs_balloc.c */ 191 191 extern int 192 192 mfs_alloc_inode(struct mfs_instance *inst, uint32_t *inum); … … 201 201 mfs_free_zone(struct mfs_instance *inst, uint32_t zone); 202 202 203 /* mfs_utils.c*/203 /* mfs_utils.c */ 204 204 extern uint16_t 205 205 conv16(bool native, uint16_t n);
Note:
See TracChangeset
for help on using the changeset viewer.