Changeset 06d85e5 in mainline for uspace/srv/fs/ext4fs/ext4fs_ops.c


Ignore:
Timestamp:
2012-06-18T11:09:34Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2616a75b
Parents:
9a487cc
Message:

Most of comments modified by current coding style

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/ext4fs/ext4fs_ops.c

    r9a487cc r06d85e5  
    7676} ext4fs_node_t;
    7777
    78 // Forward declarations of auxiliary functions
     78/* Forward declarations of auxiliary functions */
    7979
    8080static int ext4fs_read_directory(ipc_callid_t, aoff64_t, size_t,
     
    8787static int ext4fs_node_put_core(ext4fs_node_t *);
    8888
    89 // Forward declarations of EXT4 libfs operations.
     89/* Forward declarations of EXT4 libfs operations. */
    9090
    9191static int ext4fs_root_get(fs_node_t **, service_id_t);
     
    106106static service_id_t ext4fs_service_get(fs_node_t *node);
    107107
    108 // Static variables
     108/* Static variables */
    109109
    110110static LIST_INITIALIZE(instance_list);
     
    250250        }
    251251
    252         // Try to find entry
     252        /* Try to find entry */
    253253        ext4_directory_search_result_t result;
    254254        rc = ext4_directory_find_entry(&result, eparent->inode_ref, component);
     
    261261        }
    262262
    263         // Load node from search result
     263        /* Load node from search result */
    264264        uint32_t inode = ext4_directory_entry_ll_get_inode(result.dentry);
    265265        rc = ext4fs_node_get_core(rfn, eparent->instance, inode);
     
    268268        }
    269269
    270         // Destroy search result structure
     270        /* Destroy search result structure */
    271271        rc = ext4_directory_destroy_result(&result);
    272272        if (rc != EOK) {
     
    330330        }
    331331
    332         // Prepare new enode
     332        /* Prepare new enode */
    333333        enode = malloc(sizeof(ext4fs_node_t));
    334334        if (enode == NULL) {
     
    337337        }
    338338
    339         // Prepare new fs_node and initialize
     339        /* Prepare new fs_node and initialize */
    340340        fs_node_t *fs_node = malloc(sizeof(fs_node_t));
    341341        if (fs_node == NULL) {
     
    346346        fs_node_initialize(fs_node);
    347347
    348         // Load i-node from filesystem
     348        /* Load i-node from filesystem */
    349349        ext4_inode_ref_t *inode_ref;
    350350        rc = ext4_filesystem_get_inode_ref(inst->filesystem, index, &inode_ref);
     
    356356        }
    357357
    358         // Initialize enode
     358        /* Initialize enode */
    359359        enode->inode_ref = inode_ref;
    360360        enode->instance = inst;
     
    391391        enode->instance->open_nodes_count--;
    392392
    393         // Put inode back in filesystem
     393        /* Put inode back in filesystem */
    394394        rc = ext4_filesystem_put_inode_ref(enode->inode_ref);
    395395        if (rc != EOK) {
     
    397397        }
    398398
    399         // Destroy data structure
     399        /* Destroy data structure */
    400400        free(enode->fs_node);
    401401        free(enode);
     
    414414int ext4fs_node_open(fs_node_t *fn)
    415415{
    416         // Stateless operation
     416        /* Stateless operation */
    417417        return EOK;
    418418}
     
    460460        int rc;
    461461
    462         // Allocate enode
     462        /* Allocate enode */
    463463        ext4fs_node_t *enode;
    464464        enode = malloc(sizeof(ext4fs_node_t));
     
    467467        }
    468468
    469         // Allocate fs_node
     469        /* Allocate fs_node */
    470470        fs_node_t *fs_node;
    471471        fs_node = malloc(sizeof(fs_node_t));
     
    475475        }
    476476
    477         // Load instance
     477        /* Load instance */
    478478        ext4fs_instance_t *inst;
    479479        rc = ext4fs_instance_get(service_id, &inst);
     
    484484        }
    485485
    486         // Allocate new i-node in filesystem
     486        /* Allocate new i-node in filesystem */
    487487        ext4_inode_ref_t *inode_ref;
    488488        rc = ext4_filesystem_alloc_inode(inst->filesystem, &inode_ref, flags);
     
    493493        }
    494494
    495         // Do some interconnections in references
     495        /* Do some interconnections in references */
    496496        enode->inode_ref = inode_ref;
    497497        enode->instance = inst;
     
    530530        int rc;
    531531
    532         // If directory, check for children
     532        /* If directory, check for children */
    533533        bool has_children;
    534534        rc = ext4fs_has_children(&has_children, fn);
     
    546546        ext4_inode_ref_t *inode_ref = enode->inode_ref;
    547547
    548         // Release data blocks
     548        /* Release data blocks */
    549549        rc = ext4_filesystem_truncate_inode(inode_ref, 0);
    550550        if (rc != EOK) {
     
    553553        }
    554554
    555         // Handle orphans
     555        /* Handle orphans */
     556        // TODO this code should be deleted
    556557//      ext4_filesystem_t *fs = enode->instance->filesystem;
    557558//      uint32_t rev_level = ext4_superblock_get_rev_level(fs->superblock);
     
    564565//      }
    565566
    566         // TODO set real deletion time when it will be supported,
    567         // temporary set fake time
     567        // TODO set real deletion time when it will be supported, temporary set fake time
    568568//      time_t now = time(NULL);
    569569        ext4_inode_set_deletion_time(inode_ref->inode, 0xdeadbeef);
    570570        inode_ref->dirty = true;
    571571
    572         // Free inode
     572        /* Free inode */
    573573        rc = ext4_filesystem_free_inode(inode_ref);
    574574        if (rc != EOK) {
     
    592592        int rc;
    593593
    594         // Check maximum name length
     594        /* Check maximum name length */
    595595        if (strlen(name) > EXT4_DIRECTORY_FILENAME_LEN) {
    596596                return ENAMETOOLONG;
     
    600600        ext4_filesystem_t *fs = parent->instance->filesystem;
    601601
    602         // Add entry to parent directory
     602        /* Add entry to parent directory */
    603603        rc = ext4_directory_add_entry(parent->inode_ref, name, child->inode_ref);
    604604        if (rc != EOK) {
     
    606606        }
    607607
    608         // Fill new dir -> add '.' and '..' entries
     608        /* Fill new dir -> add '.' and '..' entries */
    609609        if (ext4_inode_is_type(fs->superblock, child->inode_ref->inode, EXT4_INODE_MODE_DIRECTORY)) {
    610610
     
    622622                }
    623623
    624                 // Initialize directory index if supported
     624                /* Initialize directory index if supported */
    625625                if (ext4_superblock_has_feature_compatible(
    626626                                fs->superblock, EXT4_FEATURE_COMPAT_DIR_INDEX)) {
     
    670670        }
    671671
    672         // Cannot unlink non-empty node
     672        /* Cannot unlink non-empty node */
    673673        if (has_children) {
    674674                return ENOTEMPTY;
    675675        }
    676676
    677         // Remove entry from parent directory
     677        /* Remove entry from parent directory */
    678678        ext4_inode_ref_t *parent = EXT4FS_NODE(pfn)->inode_ref;
    679679        rc = ext4_directory_remove_entry(parent, name);
     
    682682        }
    683683
    684         // Decrement links count
     684        /* Decrement links count */
    685685        ext4_inode_ref_t * child_inode_ref = EXT4FS_NODE(cfn)->inode_ref;
    686686
     
    688688        lnk_count--;
    689689
    690         // If directory - handle links from parent
     690        /* If directory - handle links from parent */
    691691        if (lnk_count <= 1 && ext4fs_is_directory(cfn)) {
    692692
     
    744744        ext4_filesystem_t *fs = enode->instance->filesystem;
    745745
    746         // Check if node is directory
     746        /* Check if node is directory */
    747747        if (!ext4_inode_is_type(fs->superblock, enode->inode_ref->inode,
    748748            EXT4_INODE_MODE_DIRECTORY)) {
     
    830830        }
    831831
    832         // For regular files return real links count
     832        /* For regular files return real links count */
    833833        return lnkcnt;
    834834}
     
    10551055        }
    10561056
    1057         // Load i-node
     1057        /* Load i-node */
    10581058        ext4_inode_ref_t *inode_ref;
    10591059        rc = ext4_filesystem_get_inode_ref(inst->filesystem, index, &inode_ref);
     
    10631063        }
    10641064
    1065         // Read from i-node by type
     1065        /* Read from i-node by type */
    10661066        if (ext4_inode_is_type(inst->filesystem->superblock, inode_ref->inode,
    10671067                        EXT4_INODE_MODE_FILE)) {
     
    11831183        }
    11841184
    1185         // Prepare return values
     1185        /* Prepare return values */
    11861186        if (found) {
    11871187                *rbytes = next - pos;
     
    13171317        uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
    13181318
    1319         // Prevent writing to more than one block
     1319        /* Prevent writing to more than one block */
    13201320        uint32_t bytes = min(len, block_size - (pos % block_size));
    13211321
     
    13281328        uint32_t fblock;
    13291329
    1330         // Load inode
     1330        /* Load inode */
    13311331        ext4_inode_ref_t *inode_ref = enode->inode_ref;
    13321332        rc = ext4_filesystem_get_inode_data_block_index(inode_ref, iblock, &fblock);
     
    13371337        }
    13381338
    1339         // Check for sparse file
     1339        /* Check for sparse file */
    13401340        if (fblock == 0) {
    13411341
     
    13751375        }
    13761376
    1377         // Load target block
     1377        /* Load target block */
    13781378        block_t *write_block;
    13791379        rc = block_get(&write_block, service_id, fblock, flags);
     
    14021402        }
    14031403
    1404         // Do some counting
     1404        /* Do some counting */
    14051405        uint32_t old_inode_size = ext4_inode_get_size(fs->superblock, inode_ref->inode);
    14061406        if (pos + bytes > old_inode_size) {
Note: See TracChangeset for help on using the changeset viewer.