Changeset b7fd2a0 in mainline for uspace/srv/fs/udf/udf_file.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/udf/udf_file.c

    r36f0738 rb7fd2a0  
    5757 *
    5858 */
    59 static int udf_read_extended_allocator(udf_node_t *node, uint16_t icb_flag,
     59static errno_t udf_read_extended_allocator(udf_node_t *node, uint16_t icb_flag,
    6060    uint32_t pos)
    6161{
    6262        block_t *block = NULL;
    63         int rc = block_get(&block, node->instance->service_id, pos,
     63        errno_t rc = block_get(&block, node->instance->service_id, pos,
    6464            BLOCK_FLAGS_NONE);
    6565        if (rc != EOK)
     
    9393 *
    9494 */
    95 int udf_read_allocation_sequence(udf_node_t *node, uint8_t *af,
     95errno_t udf_read_allocation_sequence(udf_node_t *node, uint8_t *af,
    9696    uint16_t icb_flag, uint32_t start_alloc, uint32_t len)
    9797{
     
    233233 * @return    EOK on success or an error code.
    234234 */
    235 int udf_read_icb(udf_node_t *node)
     235errno_t udf_read_icb(udf_node_t *node)
    236236{
    237237        while (true) {
     
    239239               
    240240                block_t *block = NULL;
    241                 int rc = block_get(&block, node->instance->service_id, pos,
     241                errno_t rc = block_get(&block, node->instance->service_id, pos,
    242242                    BLOCK_FLAGS_NONE);
    243243                if (rc != EOK)
     
    303303 *
    304304 */
    305 int udf_node_get_core(udf_node_t *node)
     305errno_t udf_node_get_core(udf_node_t *node)
    306306{
    307307        node->link_cnt = 1;
     
    318318 *
    319319 */
    320 static int udf_get_fid_in_data(udf_file_identifier_descriptor_t **fid,
     320static errno_t udf_get_fid_in_data(udf_file_identifier_descriptor_t **fid,
    321321    udf_node_t *node, aoff64_t pos)
    322322{
     
    369369 *
    370370 */
    371 int udf_get_fid(udf_file_identifier_descriptor_t **fid, block_t **block,
     371errno_t udf_get_fid(udf_file_identifier_descriptor_t **fid, block_t **block,
    372372    udf_node_t *node, aoff64_t pos)
    373373{
     
    388388 *
    389389 */
    390 int udf_get_fid_in_allocator(udf_file_identifier_descriptor_t **fid,
     390errno_t udf_get_fid_in_allocator(udf_file_identifier_descriptor_t **fid,
    391391    block_t **block, udf_node_t *node, aoff64_t pos)
    392392{
     
    402402                size_t i = 0;
    403403                while (i * node->instance->sector_size < node->allocators[j].length) {
    404                         int rc = block_get(block, node->instance->service_id,
     404                        errno_t rc = block_get(block, node->instance->service_id,
    405405                            node->allocators[j].position + i, BLOCK_FLAGS_NONE);
    406406                        if (rc != EOK) {
     
    469469 *
    470470 */
    471 int udf_get_fid_in_sector(udf_file_identifier_descriptor_t **fid,
     471errno_t udf_get_fid_in_sector(udf_file_identifier_descriptor_t **fid,
    472472    block_t **block, udf_node_t *node, aoff64_t pos, size_t *n, void **buf,
    473473    size_t *len)
     
    576576 *
    577577 */
    578 int udf_read_file(size_t *read_len, ipc_callid_t callid, udf_node_t *node,
     578errno_t udf_read_file(size_t *read_len, ipc_callid_t callid, udf_node_t *node,
    579579    aoff64_t pos, size_t len)
    580580{
     
    594594       
    595595        block_t *block = NULL;
    596         int rc = block_get(&block, node->instance->service_id,
     596        errno_t rc = block_get(&block, node->instance->service_id,
    597597            node->allocators[i].position + (sector_num - sector_cnt),
    598598            BLOCK_FLAGS_NONE);
Note: See TracChangeset for help on using the changeset viewer.