Changeset ac28650 in mainline
- Timestamp:
- 2011-03-27T10:10:23Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a04b62d
- Parents:
- 557ea4f6
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs.c
r557ea4f6 rac28650 48 48 #include <stdio.h> 49 49 #include "mfs.h" 50 51 #define NAME "mfs"52 50 53 51 vfs_info_t mfs_vfs_info = { -
uspace/srv/fs/minixfs/mfs.h
r557ea4f6 rac28650 39 39 #include <adt/list.h> 40 40 #include "../../vfs/vfs.h" 41 42 #define NAME "mfs" 41 43 42 44 #define DEBUG_MODE … … 125 127 extern void mfs_mount(ipc_callid_t rid, ipc_call_t *request); 126 128 extern void mfs_lookup(ipc_callid_t rid, ipc_call_t *request); 127 extern aoff64_t mfs_size_get(fs_node_t *node);128 extern bool mfs_is_directory(fs_node_t *fsnode);129 extern bool mfs_is_file(fs_node_t *fsnode);130 extern char mfs_plb_get_char(unsigned pos);131 extern int mfs_has_children(bool *has_children, fs_node_t *fsnode);132 extern int mfs_root_get(fs_node_t **rfn, devmap_handle_t handle);133 extern devmap_handle_t mfs_device_get(fs_node_t *fsnode);134 129 extern int mfs_instance_get(devmap_handle_t handle, 135 130 struct mfs_instance **instance); 136 extern137 int mfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle,138 fs_index_t index);139 131 140 132 extern void mfs_stat(ipc_callid_t rid, ipc_call_t *request); -
uspace/srv/fs/minixfs/mfs_dentry.c
r557ea4f6 rac28650 50 50 return NULL; 51 51 52 int r = read_map(&block, mnode, index * sbi->dirsize);52 int r = read_map(&block, mnode, index * sbi->dirsize); 53 53 54 54 if (r != EOK || block == 0) -
uspace/srv/fs/minixfs/mfs_ops.c
r557ea4f6 rac28650 48 48 static fs_index_t mfs_index_get(fs_node_t *fsnode); 49 49 static unsigned mfs_lnkcnt_get(fs_node_t *fsnode); 50 static char mfs_plb_get_char(unsigned pos); 51 static bool mfs_is_directory(fs_node_t *fsnode); 52 static bool mfs_is_file(fs_node_t *fsnode); 53 static int mfs_has_children(bool *has_children, fs_node_t *fsnode); 54 static int mfs_root_get(fs_node_t **rfn, devmap_handle_t handle); 55 static devmap_handle_t mfs_device_get(fs_node_t *fsnode); 56 static aoff64_t mfs_size_get(fs_node_t *node); 57 58 static 59 int mfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, 60 fs_index_t index); 61 50 62 51 63 static LIST_INITIALIZE(inst_list); … … 221 233 } 222 234 223 aoff64_t mfs_size_get(fs_node_t *node) 224 { 225 mfsdebug("request for inode size\n"); 235 static aoff64_t mfs_size_get(fs_node_t *node) 236 { 226 237 assert(node); 227 238 … … 241 252 } 242 253 243 int mfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle,254 static int mfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, 244 255 fs_index_t index) 245 256 { … … 277 288 static int mfs_node_open(fs_node_t *fsnode) 278 289 { 279 mfsdebug("mfs_node_open()\n");280 290 /* 281 291 * Opening a file is stateless, nothing … … 363 373 } 364 374 365 bool mfs_is_directory(fs_node_t *fsnode)375 static bool mfs_is_directory(fs_node_t *fsnode) 366 376 { 367 377 const struct mfs_node *node = fsnode->data; … … 369 379 } 370 380 371 bool mfs_is_file(fs_node_t *fsnode)381 static bool mfs_is_file(fs_node_t *fsnode) 372 382 { 373 383 struct mfs_node *node = fsnode->data; … … 375 385 } 376 386 377 int mfs_root_get(fs_node_t **rfn, devmap_handle_t handle)387 static int mfs_root_get(fs_node_t **rfn, devmap_handle_t handle) 378 388 { 379 389 int rc = mfs_node_get(rfn, handle, MFS_ROOT_INO); … … 388 398 } 389 399 390 char mfs_plb_get_char(unsigned pos)400 static char mfs_plb_get_char(unsigned pos) 391 401 { 392 402 return mfs_reg.plb_ro[pos % PLB_SIZE]; 393 403 } 394 404 395 int mfs_has_children(bool *has_children, fs_node_t *fsnode)405 static int mfs_has_children(bool *has_children, fs_node_t *fsnode) 396 406 { 397 407 struct mfs_node *mnode = fsnode->data; … … 399 409 const struct mfs_instance *inst = mnode->instance; 400 410 const struct mfs_sb_info *sbi = inst->sbi; 401 int i;411 uint32_t n_dentries = 0; 402 412 403 413 *has_children = false; … … 407 417 408 418 struct mfs_dentry_info *d_info; 409 410 for (i = 2; i < ino_i->i_size / sbi->dirsize; ++i) { 411 d_info = read_directory_entry(mnode, i); 419 n_dentries = ino_i->i_size / sbi->dirsize; 420 421 /* The first two dentries are always . and .. */ 422 assert(n_dentries >= 2); 423 424 if (n_dentries == 2) 425 goto out; 426 427 int i = 2; 428 while (1) { 429 d_info = read_directory_entry(mnode, i++); 412 430 413 431 if (!d_info) … … 424 442 425 443 out: 444 445 if (n_dentries > 2 && !*has_children) 446 printf(NAME ": Filesystem corruption detected"); 426 447 427 448 if (*has_children)
Note:
See TracChangeset
for help on using the changeset viewer.