Changes in / [6a7e497:18626b3] in mainline


Ignore:
Location:
uspace
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/blkdump/blkdump.c

    r6a7e497 r18626b3  
    202202        }
    203203       
    204         /* Print hexadecimal values */
     204        // Print hexadecimal values
    205205        for (pos = 0; pos < length; pos++) {
    206206                if (pos == length/2) {
     
    210210        }
    211211       
    212         /* Pad with spaces if we have less than 16 bytes */
     212        // pad with spaces if we have less than 16 bytes
    213213        for (pos = length; pos < bytes_per_row; pos++) {
    214214                if (pos == length/2) {
     
    218218        }
    219219       
    220         /* Print printable characters */
     220        // Print printable characters
    221221        for (pos = 0; pos < length; pos++) {
    222222                if (pos == length/2) {
  • uspace/app/bnchmark/bnchmark.c

    r6a7e497 r18626b3  
    210210static void syntax_print(void)
    211211{
    212         fprintf(stderr, "syntax: " NAME " <iterations> <test type> <log-str> <path>\n");
    213         fprintf(stderr, "  <iterations>    number of times to run a given test\n");
    214         fprintf(stderr, "  <test-type>     one of:\n");
    215         fprintf(stderr, "                    sequential-file-read\n");
    216         fprintf(stderr, "                    sequential-dir-read\n");
    217         fprintf(stderr, "  <log-str>       a string to attach to results\n");
    218         fprintf(stderr, "  <path>          file/directory to use for testing\n");
     212        fprintf(stderr, "syntax: bnchmark <iterations> <test type> <log-str> <path>\n");
     213        fprintf(stderr, "  <iterations>    number of times to run a given test");
     214        fprintf(stderr, "  <test-type>     one of:");
     215        fprintf(stderr, "                    sequential-file-read");
     216        fprintf(stderr, "                    sequential-dir-read");
     217        fprintf(stderr, "  <log-str>       a string to attach to results");
     218        fprintf(stderr, "  <path>          file/directory to use for testing");
    219219}
    220220
  • uspace/app/ext2info/ext2info.c

    r6a7e497 r18626b3  
    9595        }
    9696       
    97         /* Skip program name */
     97        // Skip program name
    9898        --argc; ++argv;
    9999       
     
    171171        assert(argc == 1);
    172172       
    173         /* Display common things by default */
     173        // Display common things by default
    174174        if ((arg_flags & ARG_ALL) == 0) {
    175175                arg_flags = ARG_COMMON;
  • uspace/app/testread/testread.c

    r6a7e497 r18626b3  
    8484        }
    8585       
    86         /* Skip program name */
     86        // Skip program name
    8787        --argc; ++argv;
    8888       
  • uspace/lib/ext2/libext2_directory.c

    r6a7e497 r18626b3  
    9393        it->fs = fs;
    9494       
    95         /* Get the first data block, so we can get the first entry */
     95        // Get the first data block, so we can get first entry
    9696        rc = ext2_filesystem_get_inode_data_block_index(fs, inode_ref->inode, 0,
    9797            &block_id);
     
    133133        size = ext2_inode_get_size(it->fs->superblock, it->inode_ref->inode);
    134134       
    135         /* Are we at the end? */
     135        // Are we at the end?
    136136        if (it->current_offset + skip >= size) {
    137137                rc = block_put(it->current_block);
     
    150150        next_block_idx = (it->current_offset + skip) / block_size;
    151151       
    152         /* If we are moving accross block boundary,
    153          * we need to get another block
    154          */
     152        // If we are moving accross block boundary,
     153        // we need to get another block
    155154        if (current_block_idx != next_block_idx) {
    156155                rc = block_put(it->current_block);
     
    177176        offset_in_block = (it->current_offset + skip) % block_size;
    178177       
    179         /* Ensure proper alignment */
     178        // Ensure proper alignment
    180179        if ((offset_in_block % 4) != 0) {
    181180                it->current = NULL;
     
    183182        }
    184183       
    185         /* Ensure that the core of the entry does not overflow the block */
     184        // Ensure that the core of the entry does not overflow the block
    186185        if (offset_in_block > block_size - 8) {
    187186                it->current = NULL;
     
    192191        it->current_offset += skip;
    193192       
    194         /* Ensure that the whole entry does not overflow the block */
     193        // Ensure that the whole entry does not overflow the block
    195194        skip = ext2_directory_entry_ll_get_entry_length(it->current);
    196195        if (offset_in_block + skip > block_size) {
     
    199198        }
    200199       
    201         /* Ensure the name length is not too large */
     200        // Ensure the name length is not too large
    202201        if (ext2_directory_entry_ll_get_name_length(it->fs->superblock,
    203202            it->current) > skip-8) {
  • uspace/lib/ext2/libext2_filesystem.c

    r6a7e497 r18626b3  
    117117int ext2_filesystem_check_flags(ext2_filesystem_t *fs, bool *o_read_only)
    118118{
    119         /* feature flags are present in rev 1 and later */
     119        // feature flags are present in rev 1 and later
    120120        if (ext2_superblock_get_rev_major(fs->superblock) == 0) {
    121121                *o_read_only = false;
    122                 return EOK;
     122                return 0;
    123123        }
    124124       
     
    129129        read_only = ext2_superblock_get_features_read_only(fs->superblock);
    130130       
    131         /* check whether we support all features
    132          * first unset any supported feature flags
    133          * and see whether any unspported feature remains */
     131        // unset any supported features
    134132        incompatible &= ~EXT2_SUPPORTED_INCOMPATIBLE_FEATURES;
    135133        read_only &= ~EXT2_SUPPORTED_READ_ONLY_FEATURES;
     
    173171            / EXT2_BLOCK_GROUP_DESCRIPTOR_SIZE;
    174172       
    175         /* Block group descriptor table starts at the next block after superblock */
     173        // Block group descriptor table starts at the next block after superblock
    176174        block_id = ext2_superblock_get_first_block(fs->superblock) + 1;
    177175       
    178         /* Find the block containing the descriptor we are looking for */
     176        // Find the block containing the descriptor we are looking for
    179177        block_id += bgid / descriptors_per_block;
    180178        offset = (bgid % descriptors_per_block) * EXT2_BLOCK_GROUP_DESCRIPTOR_SIZE;
     
    242240        inodes_per_group = ext2_superblock_get_inodes_per_group(fs->superblock);
    243241       
    244         /* inode numbers are 1-based, but it is simpler to work with 0-based
    245          * when computing indices
    246          */
     242        // inode numbers are 1-based
    247243        index -= 1;
    248244        block_group = index / inodes_per_group;
     
    273269       
    274270        newref->inode = newref->block->data + offset_in_block;
    275         /* we decremented index above, but need to store the original value
    276          * in the reference
    277          */
    278         newref->index = index+1;
     271        newref->index = index+1; // we decremented index above
    279272       
    280273        *ref = newref;
     
    322315        block_t *block;
    323316       
    324         /* Handle simple case when we are dealing with direct reference */
    325317        if (iblock < EXT2_INODE_DIRECT_BLOCKS) {
    326318                current_block = ext2_inode_get_direct_block(inode, (uint32_t)iblock);
     
    329321        }
    330322       
    331         /* Compute limits for indirect block levels
    332          * TODO: compute this once when loading filesystem and store in ext2_filesystem_t
    333          */
     323        // Compute limits for indirect block levels
     324        // TODO: compute this once when loading filesystem and store in ext2_filesystem_t
    334325        block_ids_per_block = ext2_superblock_get_block_size(fs->superblock) / sizeof(uint32_t);
    335326        limits[0] = EXT2_INODE_DIRECT_BLOCKS;
     
    341332        }
    342333       
    343         /* Determine the indirection level needed to get the desired block */
     334        // Determine the indirection level needed to get the desired block
    344335        level = -1;
    345336        for (i = 1; i < 4; i++) {
     
    354345        }
    355346       
    356         /* Compute offsets for the topmost level */
    357347        block_offset_in_level = iblock - limits[level-1];
    358348        current_block = ext2_inode_get_indirect_block(inode, level-1);
    359349        offset_in_block = block_offset_in_level / blocks_per_level[level-1];
    360350       
    361         /* Navigate through other levels, until we find the block number
    362          * or find null reference meaning we are dealing with sparse file
    363          */
    364351        while (level > 0) {
    365352                rc = block_get(&block, fs->device, current_block, 0);
     
    377364               
    378365                if (current_block == 0) {
    379                         /* This is a sparse file */
    380366                        *fblock = 0;
    381367                        return EOK;
     
    384370                level -= 1;
    385371               
    386                 /* If we are on the last level, break here as
    387                  * there is no next level to visit
    388                  */
    389372                if (level == 0) {
    390373                        break;
    391374                }
    392375               
    393                 /* Visit the next level */
    394376                block_offset_in_level %= blocks_per_level[level];
    395377                offset_in_block = block_offset_in_level / blocks_per_level[level-1];
     
    403385/**
    404386 * Allocate a given number of blocks and store their ids in blocks
    405  *
    406  * @todo TODO: This function is not finished and really has never been
    407  *             used (and tested) yet
    408387 *
    409388 * @param fs pointer to filesystem
     
    441420        idx = 0;
    442421       
    443         /* Read the block group descriptor */
     422        // Read the block group descriptor
    444423        rc = ext2_filesystem_get_block_group_ref(fs, block_group, &bg);
    445424        if (rc != EOK) {
     
    465444                }
    466445               
    467                 /* We found a block group with free block, let's look at the block bitmap */
     446                // We found a block group with free block, let's look at the block bitmap
    468447                bb_block = ext2_block_group_get_block_bitmap_block(bg->block_group);
    469448               
     
    473452                }
    474453               
    475                 /* Use all blocks from this block group */
     454                // Use all blocks from this block group
    476455                for (bb_idx = 0; bb_idx < block_size && idx < count; bb_idx++) {
    477456                        uint8_t *data = (uint8_t *) block->data;
     
    479458                                continue;
    480459                        }
    481                         /* find an empty bit */
     460                        // find an empty bit
    482461                        uint8_t mask;
    483462                        for (mask = 1, bb_bit = 0;
  • uspace/srv/fs/ext2fs/ext2fs.c

    r6a7e497 r18626b3  
    161161               
    162162        rc = fs_register(vfs_phone, &ext2fs_reg, &ext2fs_vfs_info, ext2fs_connection);
    163         if (rc != EOK) {
    164                 fprintf(stdout, NAME ": Failed to register fs (%d)\n", rc);
    165                 return 1;
    166         }
    167163       
    168164        printf(NAME ": Accepting connections\n");
  • uspace/srv/fs/ext2fs/ext2fs_ops.c

    r6a7e497 r18626b3  
    245245        }
    246246
    247         /* Find length of component in bytes
    248          * TODO: check for library function call that does this
    249          */
     247        // Find length of component in bytes
     248        // TODO: check for library function call that does this
    250249        component_size = 0;
    251250        while (*(component+component_size) != 0) {
     
    254253       
    255254        while (it.current != NULL) {
    256                 /* ignore empty directory entries */
     255                // ignore empty directory entries
    257256                if (it.current->inode != 0) {
    258257                        name_size = ext2_directory_entry_ll_get_name_length(fs->superblock,
     
    482481        }
    483482       
    484         /* Find a non-empty directory entry */
     483        // Find a non-empty directory entry
    485484        while (it.current != NULL) {
    486485                if (it.current->inode != 0) {
     
    718717        }
    719718       
    720         /* Remove the instance from the list */
     719        // Remove the instance from list
    721720        fibril_mutex_lock(&instance_list_mutex);
    722721        list_remove(&inst->link);
     
    788787        }
    789788        else {
    790                 /* Other inode types not supported */
     789                // Other inode types not supported
    791790                async_answer_0(callid, ENOTSUP);
    792791                async_answer_0(rid, ENOTSUP);
     
    829828        }
    830829       
    831         /* Find the index we want to read
    832          * Note that we need to iterate and count as
    833          * the underlying structure is a linked list
    834          * Moreover, we want to skip . and .. entries
    835          * as these are not used in HelenOS
    836          */
     830        // Find the index we want to read
     831        // Note that we need to iterate and count as
     832        // the underlying structure is a linked list
     833        // Moreover, we want to skip . and .. entries
     834        // as these are not used in HelenOS
    837835        cur = 0;
    838836        while (it.current != NULL) {
     
    844842                        inst->filesystem->superblock, it.current);
    845843               
    846                 /* skip . and .. */
     844                // skip . and ..
    847845                if (ext2fs_is_dots(&it.current->name, name_size)) {
    848846                        goto skip;
    849847                }
    850848               
    851                 /* Is this the dir entry we want to read? */
     849                // Is this the dir entry we want to read?
    852850                if (cur == pos) {
    853                         /* The on-disk entry does not contain \0 at the end
    854                          * end of entry name, so we copy it to new buffer
    855                          * and add the \0 at the end
    856                          */
     851                        // The on-disk entry does not contain \0 at the end
     852                        // end of entry name, so we copy it to new buffer
     853                        // and add the \0 at the end
    857854                        buf = malloc(name_size+1);
    858855                        if (buf == NULL) {
     
    913910       
    914911        if (pos >= file_size) {
    915                 /* Read 0 bytes successfully */
     912                // Read 0 bytes successfully
    916913                async_data_read_finalize(callid, NULL, 0);
    917914                async_answer_1(rid, EOK, 0);
     
    919916        }
    920917       
    921         /* For now, we only read data from one block at a time */
     918        // For now, we only read data from one block at a time
    922919        block_size = ext2_superblock_get_block_size(inst->filesystem->superblock);
    923920        file_block = pos / block_size;
     
    925922        bytes = min(block_size - offset_in_block, size);
    926923       
    927         /* Handle end of file */
     924        // Handle end of file
    928925        if (pos + bytes > file_size) {
    929926                bytes = file_size - pos;
    930927        }
    931928       
    932         /* Get the real block number */
    933929        rc = ext2_filesystem_get_inode_data_block_index(inst->filesystem,
    934930                inode_ref->inode, file_block, &fs_block);
     
    939935        }
    940936       
    941         /* Check for sparse file
    942          * If ext2_filesystem_get_inode_data_block_index returned
    943          * fs_block == 0, it means that the given block is not allocated for the
    944          * file and we need to return a buffer of zeros
    945          */
     937        // Check for sparse file
     938        // If ext2_filesystem_get_inode_data_block_index returned
     939        // fs_block == 0, it means that the given block is not allocated for the
     940        // file and we need to return a buffer of zeros
    946941        if (fs_block == 0) {
    947942                buffer = malloc(bytes);
     
    962957        }
    963958       
    964         /* Usual case - we need to read a block from device */
     959        // Usual case - we need to read a block from device
    965960        rc = block_get(&block, inst->devmap_handle, fs_block, BLOCK_FLAGS_NONE);
    966961        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.