- Timestamp:
- Apr 26, 2017, 2:24:47 PM (8 years ago)
- Location:
- trunk/kernel/vfs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/vfs/fatfs.c
r1 r10 252 252 253 253 // compute FATFS_cluster index for the accessed page 254 uint32_t cluster ;254 uint32_t cluster = 0; 255 255 error_t error = fatfs_cluster_from_index( fatfs_ctx, 256 256 first_cluster, -
trunk/kernel/vfs/ramfs.c
r1 r10 71 71 void ramfs_inode_destroy( struct vfs_inode_s * inode ) 72 72 { 73 printk("\n[PANIC] %s not fully implemented yet\n", __FUNCTION__ ); 74 hal_core_sleep(); 75 76 return 0; 73 assert( false , __FUNCTION__ , "not fully implemented yet" ); 77 74 } 78 75 -
trunk/kernel/vfs/vfs.c
r1 r10 177 177 178 178 // initialize inode locks 179 remote_rwlock_init( XPTR( local_cxy , &inode-> size_lock ) );179 remote_rwlock_init( XPTR( local_cxy , &inode->data_lock ) ); 180 180 remote_spinlock_init( XPTR( local_cxy , &inode->main_lock ) ); 181 181 … … 238 238 239 239 // get size 240 remote_rwlock_rd_lock( XPTR( cxy , &ptr-> size_lock ) );240 remote_rwlock_rd_lock( XPTR( cxy , &ptr->data_lock ) ); 241 241 uint32_t size = hal_remote_lw( XPTR( cxy , &ptr->size ) ); 242 remote_rwlock_rd_unlock( XPTR( cxy , &ptr-> size_lock ) );242 remote_rwlock_rd_unlock( XPTR( cxy , &ptr->data_lock ) ); 243 243 return size; 244 244 } … … 253 253 254 254 // set size 255 remote_rwlock_wr_unlock( XPTR( cxy , &ptr-> size_lock ) );255 remote_rwlock_wr_unlock( XPTR( cxy , &ptr->data_lock ) ); 256 256 hal_remote_sw( XPTR( cxy , &ptr->size ) , size ); 257 remote_rwlock_wr_unlock( XPTR( cxy , &ptr-> size_lock ) );257 remote_rwlock_wr_unlock( XPTR( cxy , &ptr->data_lock ) ); 258 258 } 259 259 -
trunk/kernel/vfs/vfs.h
r1 r10 166 166 * The <parent> inode is unique for a directory (not hard links for directories). 167 167 * For a file, the parent field points to the first dentry who created this inode. 168 * TODO pourquoi deux types de locks ??? 169 *****************************************************************************************/ 168 * Syncronisation: 169 * - the main_lock (spinlock) is used during the inode tree traversal or for inode 170 * modification (add/remove children). 171 * - the data_lock (rwlock) is used during read/write accesses to the data stored 172 * in the mapper. 173 * - the mapper lock (rwlock) is only used during the radix tree traversal to return 174 * to return the relevant page for red/write. 175 *****************************************************************************************/ 176 177 typedef enum 178 { 179 INODE_TYPE_NORMAL, /*! file or directory */ 180 INODE_TYPE_PIPE, /*! POSIX pipe */ 181 INODE_TYPE_SOCKET, /*! POSIX socket */ 182 INODE_TYPE_DEV, /*! peripheral channel */ 183 } 184 vfs_inode_type_t; 170 185 171 186 typedef enum … … 176 191 INODE_ATTR_NEW = 0x08, 177 192 } 178 inode_attr_t;193 vfs_inode_attr_t; 179 194 180 195 typedef struct vfs_inode_s … … 184 199 uint32_t inum; /*! inode identifier (unique in file system) */ 185 200 uint32_t attr; /*! inode attributes (see above) */ 201 uint32_t type; /*! inode type (see above) */ 186 202 uint32_t size; /*! number of bytes */ 187 203 uint32_t links; /*! number of alias dentry */ … … 192 208 xptr_t parent_xp; /*! extended pointer on parent dentry */ 193 209 xhtab_t children; /*! embedded htab of dir entries (for dir type) */ 194 remote_rwlock_t size_lock; /*! protect size field modifications*/195 remote_spinlock_t main_lock; /*! protect other fields (including children)*/210 remote_rwlock_t data_lock; /*! protect read/write to data and to size */ 211 remote_spinlock_t main_lock; /*! protect inode tree traversal and modifs */ 196 212 xlist_entry_t xlist; /*! member of set of inodes in same cluster */ 197 213 xlist_entry_t wait_root; /*! root of threads waiting on this inode */ … … 229 245 *****************************************************************************************/ 230 246 231 typedef enum232 {233 VFS_FD_NORMAL, /*! file or directory */234 VFS_FD_PIPE, /*! POSIX pipe */235 VFS_FD_SOCKET, /*! POSIX socket */236 VFS_FD_DEV, /*! peripheral channel */237 }238 vfs_fd_type_t;239 247 240 248 typedef enum 241 249 { 242 VFS_ATTR_READ_ENABLE = 0x01, /*! read access possible */243 VFS_ATTR_WRITE_ENABLE = 0x02, /*! write access possible */244 VFS_ATTR_APPEND = 0x04, /*! append on each write */245 VFS_ATTR_CLOSE_EXEC = 0x08, /*! close file on exec */246 VFS_ATTR_SYNC = 0x10, /*! synchronise FS on each write */247 VFS_ATTR_IS_DIR = 0x20, /*! this is a directory */250 FD_ATTR_READ_ENABLE = 0x01, /*! read access possible */ 251 FD_ATTR_WRITE_ENABLE = 0x02, /*! write access possible */ 252 FD_ATTR_APPEND = 0x04, /*! append on each write */ 253 FD_ATTR_CLOSE_EXEC = 0x08, /*! close file on exec */ 254 FD_ATTR_SYNC = 0x10, /*! synchronise FS on each write */ 255 FD_ATTR_IS_DIR = 0x20, /*! this is a directory */ 248 256 } 249 257 vfs_fd_attr_t; … … 281 289 vfs_types_t; 282 290 291 typedef enum 292 { 293 CTX_ATTR_READ_ONLY = 0x01, /*! read access possible */ 294 CTX_ATTR_SYNC = 0x10, /*! synchronise FS on each write */ 295 } 296 vfs_ctx_attr_t; 297 283 298 typedef struct vfs_ctx_s 284 299 { 285 300 uint32_t type; /*! File System type */ 286 uint32_t flags; /*! TODO ???*/301 uint32_t attr; /*! global attributes for all files in FS */ 287 302 uint32_t count; /*! number of clusters */ 288 303 uint32_t blksize; /*! cluster size */
Note: See TracChangeset
for help on using the changeset viewer.