Changeset b7fd2a0 in mainline for uspace/srv/fs/udf/udf_ops.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_ops.c

    r36f0738 rb7fd2a0  
    6868static LIST_INITIALIZE(ffn_list);
    6969
    70 static int udf_node_get(fs_node_t **rfn, service_id_t service_id,
     70static errno_t udf_node_get(fs_node_t **rfn, service_id_t service_id,
    7171    fs_index_t index)
    7272{
    7373        udf_instance_t *instance;
    74         int rc = fs_instance_get(service_id, (void **) &instance);
     74        errno_t rc = fs_instance_get(service_id, (void **) &instance);
    7575        if (rc != EOK)
    7676                return rc;
     
    9494}
    9595
    96 static int udf_root_get(fs_node_t **rfn, service_id_t service_id)
     96static errno_t udf_root_get(fs_node_t **rfn, service_id_t service_id)
    9797{
    9898        udf_instance_t *instance;
    99         int rc = fs_instance_get(service_id, (void **) &instance);
     99        errno_t rc = fs_instance_get(service_id, (void **) &instance);
    100100        if (rc != EOK)
    101101                return rc;
     
    114114}
    115115
    116 static int udf_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
     116static errno_t udf_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
    117117{
    118118        char *name = malloc(MAX_FILE_NAME_LEN + 1);
     
    132132               
    133133                if (str_casecmp(name, component) == 0) {
    134                         int rc = udf_node_get(rfn, udf_service_get(pfn),
     134                        errno_t rc = udf_node_get(rfn, udf_service_get(pfn),
    135135                            udf_long_ad_to_pos(UDF_NODE(pfn)->instance, &long_ad));
    136136                       
     
    143143               
    144144                if (block != NULL) {
    145                         int rc = block_put(block);
     145                        errno_t rc = block_put(block);
    146146                        if (rc != EOK)
    147147                                return rc;
     
    155155}
    156156
    157 static int udf_node_open(fs_node_t *fn)
    158 {
    159         return EOK;
    160 }
    161 
    162 static int udf_node_put(fs_node_t *fn)
     157static errno_t udf_node_open(fs_node_t *fn)
     158{
     159        return EOK;
     160}
     161
     162static errno_t udf_node_put(fs_node_t *fn)
    163163{
    164164        udf_node_t *node = UDF_NODE(fn);
     
    177177}
    178178
    179 static int udf_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
    180 {
    181         return ENOTSUP;
    182 }
    183 
    184 static int udf_destroy_node(fs_node_t *fn)
    185 {
    186         return ENOTSUP;
    187 }
    188 
    189 static int udf_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
    190 {
    191         return ENOTSUP;
    192 }
    193 
    194 static int udf_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
    195 {
    196         return ENOTSUP;
    197 }
    198 
    199 static int udf_has_children(bool *has_children, fs_node_t *fn)
     179static errno_t udf_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
     180{
     181        return ENOTSUP;
     182}
     183
     184static errno_t udf_destroy_node(fs_node_t *fn)
     185{
     186        return ENOTSUP;
     187}
     188
     189static errno_t udf_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
     190{
     191        return ENOTSUP;
     192}
     193
     194static errno_t udf_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
     195{
     196        return ENOTSUP;
     197}
     198
     199static errno_t udf_has_children(bool *has_children, fs_node_t *fn)
    200200{
    201201        *has_children = true;
     
    248248}
    249249
    250 static int udf_size_block(service_id_t service_id, uint32_t *size)
     250static errno_t udf_size_block(service_id_t service_id, uint32_t *size)
    251251{
    252252        udf_instance_t *instance;
    253         int rc = fs_instance_get(service_id, (void **) &instance);
     253        errno_t rc = fs_instance_get(service_id, (void **) &instance);
    254254        if (rc != EOK)
    255255                return rc;
     
    263263}
    264264
    265 static int udf_total_block_count(service_id_t service_id, uint64_t *count)
     265static errno_t udf_total_block_count(service_id_t service_id, uint64_t *count)
    266266{
    267267        *count = 0;
     
    270270}
    271271
    272 static int udf_free_block_count(service_id_t service_id, uint64_t *count)
     272static errno_t udf_free_block_count(service_id_t service_id, uint64_t *count)
    273273{
    274274        *count = 0;
     
    299299};
    300300
    301 static int udf_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
    302 {
    303         return ENOTSUP;
    304 }
    305 
    306 static int udf_mounted(service_id_t service_id, const char *opts,
     301static errno_t udf_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
     302{
     303        return ENOTSUP;
     304}
     305
     306static errno_t udf_mounted(service_id_t service_id, const char *opts,
    307307    fs_index_t *index, aoff64_t *size)
    308308{
     
    330330       
    331331        /* initialize block cache */
    332         int rc = block_init(service_id, MAX_SIZE);
     332        errno_t rc = block_init(service_id, MAX_SIZE);
    333333        if (rc != EOK)
    334334                return rc;
     
    415415}
    416416
    417 static int udf_unmounted(service_id_t service_id)
     417static errno_t udf_unmounted(service_id_t service_id)
    418418{
    419419        fs_node_t *fn;
    420         int rc = udf_root_get(&fn, service_id);
     420        errno_t rc = udf_root_get(&fn, service_id);
    421421        if (rc != EOK)
    422422                return rc;
     
    449449}
    450450
    451 static int udf_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     451static errno_t udf_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
    452452    size_t *rbytes)
    453453{
    454454        udf_instance_t *instance;
    455         int rc = fs_instance_get(service_id, (void **) &instance);
     455        errno_t rc = fs_instance_get(service_id, (void **) &instance);
    456456        if (rc != EOK)
    457457                return rc;
     
    523523}
    524524
    525 static int udf_close(service_id_t service_id, fs_index_t index)
    526 {
    527         return EOK;
    528 }
    529 
    530 static int udf_sync(service_id_t service_id, fs_index_t index)
    531 {
    532         return ENOTSUP;
    533 }
    534 
    535 static int udf_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     525static errno_t udf_close(service_id_t service_id, fs_index_t index)
     526{
     527        return EOK;
     528}
     529
     530static errno_t udf_sync(service_id_t service_id, fs_index_t index)
     531{
     532        return ENOTSUP;
     533}
     534
     535static errno_t udf_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
    536536    size_t *wbytes, aoff64_t *nsize)
    537537{
     
    539539}
    540540
    541 static int udf_truncate(service_id_t service_id, fs_index_t index,
     541static errno_t udf_truncate(service_id_t service_id, fs_index_t index,
    542542    aoff64_t size)
    543543{
     
    545545}
    546546
    547 static int udf_destroy(service_id_t service_id, fs_index_t index)
     547static errno_t udf_destroy(service_id_t service_id, fs_index_t index)
    548548{
    549549        return ENOTSUP;
Note: See TracChangeset for help on using the changeset viewer.