Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/cdfs/cdfs_ops.c

    rb7fd2a0 r38d150e  
    331331};
    332332
    333 static errno_t cdfs_node_get(fs_node_t **rfn, service_id_t service_id,
     333static int cdfs_node_get(fs_node_t **rfn, service_id_t service_id,
    334334    fs_index_t index)
    335335{
     
    351351}
    352352
    353 static errno_t cdfs_root_get(fs_node_t **rfn, service_id_t service_id)
     353static int cdfs_root_get(fs_node_t **rfn, service_id_t service_id)
    354354{
    355355        return cdfs_node_get(rfn, service_id, CDFS_SOME_ROOT);
     
    371371}
    372372
    373 static errno_t create_node(fs_node_t **rfn, cdfs_t *fs, int lflag,
     373static int create_node(fs_node_t **rfn, cdfs_t *fs, int lflag,
    374374    fs_index_t index)
    375375{
     
    392392       
    393393        fs_node_t *rootfn;
    394         errno_t rc = cdfs_root_get(&rootfn, fs->service_id);
     394        int rc = cdfs_root_get(&rootfn, fs->service_id);
    395395       
    396396        assert(rc == EOK);
     
    417417}
    418418
    419 static errno_t link_node(fs_node_t *pfn, fs_node_t *fn, const char *name)
     419static int link_node(fs_node_t *pfn, fs_node_t *fn, const char *name)
    420420{
    421421        cdfs_node_t *parent = CDFS_NODE(pfn);
     
    460460static char *cdfs_decode_str(void *data, size_t dsize, cdfs_enc_t enc)
    461461{
    462         errno_t rc;
     462        int rc;
    463463        char *str;
    464464        uint16_t *buf;
     
    566566}
    567567
    568 static errno_t cdfs_readdir(cdfs_t *fs, fs_node_t *fs_node)
     568static bool cdfs_readdir(cdfs_t *fs, fs_node_t *fs_node)
    569569{
    570570        cdfs_node_t *node = CDFS_NODE(fs_node);
     
    572572       
    573573        if (node->processed)
    574                 return EOK;
     574                return true;
    575575       
    576576        uint32_t blocks = node->size / BLOCK_SIZE;
     
    580580        for (uint32_t i = 0; i < blocks; i++) {
    581581                block_t *block;
    582                 errno_t rc = block_get(&block, fs->service_id, node->lba + i, BLOCK_FLAGS_NONE);
     582                int rc = block_get(&block, fs->service_id, node->lba + i, BLOCK_FLAGS_NONE);
    583583                if (rc != EOK)
    584                         return rc;
     584                        return false;
    585585               
    586586                cdfs_dir_t *dir;
     
    614614                       
    615615                        fs_node_t *fn;
    616                         errno_t rc = create_node(&fn, fs, dentry_type,
     616                        int rc = create_node(&fn, fs, dentry_type,
    617617                            (node->lba + i) * BLOCK_SIZE + offset);
    618                         if (rc != EOK)
    619                                 return rc;
    620 
    621                         assert(fn != NULL);
     618                        if ((rc != EOK) || (fn == NULL))
     619                                return false;
    622620                       
    623621                        cdfs_node_t *cur = CDFS_NODE(fn);
     
    628626                            dir->name_length, node->fs->enc, dentry_type);
    629627                        if (name == NULL)
    630                                 return EIO;
     628                                return false;
    631629                       
    632630                        // FIXME: check return value
     
    643641       
    644642        node->processed = true;
    645         return EOK;
     643        return true;
    646644}
    647645
     
    652650       
    653651        block_t *block;
    654         errno_t rc = block_get(&block, fs->service_id, lba, BLOCK_FLAGS_NONE);
     652        int rc = block_get(&block, fs->service_id, lba, BLOCK_FLAGS_NONE);
    655653        if (rc != EOK)
    656654                return NULL;
     
    698696}
    699697
    700 static errno_t cdfs_match(fs_node_t **fn, fs_node_t *pfn, const char *component)
     698static int cdfs_match(fs_node_t **fn, fs_node_t *pfn, const char *component)
    701699{
    702700        cdfs_node_t *parent = CDFS_NODE(pfn);
    703701       
    704702        if (!parent->processed) {
    705                 errno_t rc = cdfs_readdir(parent->fs, pfn);
     703                int rc = cdfs_readdir(parent->fs, pfn);
    706704                if (rc != EOK)
    707705                        return rc;
     
    719717}
    720718
    721 static errno_t cdfs_node_open(fs_node_t *fn)
     719static int cdfs_node_open(fs_node_t *fn)
    722720{
    723721        cdfs_node_t *node = CDFS_NODE(fn);
     
    730728}
    731729
    732 static errno_t cdfs_node_put(fs_node_t *fn)
     730static int cdfs_node_put(fs_node_t *fn)
    733731{
    734732        /* Nothing to do */
     
    736734}
    737735
    738 static errno_t cdfs_create_node(fs_node_t **fn, service_id_t service_id, int lflag)
     736static int cdfs_create_node(fs_node_t **fn, service_id_t service_id, int lflag)
    739737{
    740738        /* Read-only */
     
    742740}
    743741
    744 static errno_t cdfs_destroy_node(fs_node_t *fn)
     742static int cdfs_destroy_node(fs_node_t *fn)
    745743{
    746744        /* Read-only */
     
    748746}
    749747
    750 static errno_t cdfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
     748static int cdfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
    751749{
    752750        /* Read-only */
     
    754752}
    755753
    756 static errno_t cdfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
     754static int cdfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
    757755{
    758756        /* Read-only */
     
    760758}
    761759
    762 static errno_t cdfs_has_children(bool *has_children, fs_node_t *fn)
     760static int cdfs_has_children(bool *has_children, fs_node_t *fn)
    763761{
    764762        cdfs_node_t *node = CDFS_NODE(fn);
     
    806804}
    807805
    808 static errno_t cdfs_size_block(service_id_t service_id, uint32_t *size)
     806static int cdfs_size_block(service_id_t service_id, uint32_t *size)
    809807{
    810808        *size = BLOCK_SIZE;
     
    813811}
    814812
    815 static errno_t cdfs_total_block_count(service_id_t service_id, uint64_t *count)
     813static int cdfs_total_block_count(service_id_t service_id, uint64_t *count)
    816814{
    817815        *count = 0;
     
    820818}
    821819
    822 static errno_t cdfs_free_block_count(service_id_t service_id, uint64_t *count)
     820static int cdfs_free_block_count(service_id_t service_id, uint64_t *count)
    823821{
    824822        *count = 0;
     
    851849/** Verify that escape sequence corresonds to one of the allowed encoding
    852850 * escape sequences allowed for Joliet. */
    853 static errno_t cdfs_verify_joliet_esc_seq(uint8_t *seq)
     851static int cdfs_verify_joliet_esc_seq(uint8_t *seq)
    854852{
    855853        size_t i, j, k;
     
    895893 * @return              EOK if found, ENOENT if not
    896894 */
    897 static errno_t cdfs_find_joliet_svd(service_id_t sid, cdfs_lba_t altroot,
     895static int cdfs_find_joliet_svd(service_id_t sid, cdfs_lba_t altroot,
    898896    uint32_t *rlba, uint32_t *rsize, char **vol_ident)
    899897{
     
    902900        for (bi = altroot + 17; ; bi++) {
    903901                block_t *block;
    904                 errno_t rc = block_get(&block, sid, bi, BLOCK_FLAGS_NONE);
     902                int rc = block_get(&block, sid, bi, BLOCK_FLAGS_NONE);
    905903                if (rc != EOK)
    906904                        break;
     
    963961
    964962/** Read the volume descriptors. */
    965 static errno_t iso_read_vol_desc(service_id_t sid, cdfs_lba_t altroot,
     963static bool iso_read_vol_desc(service_id_t sid, cdfs_lba_t altroot,
    966964    uint32_t *rlba, uint32_t *rsize, cdfs_enc_t *enc, char **vol_ident)
    967965{
    968966        /* First 16 blocks of isofs are empty */
    969967        block_t *block;
    970         errno_t rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE);
     968        int rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE);
    971969        if (rc != EOK)
    972                 return rc;
     970                return false;
    973971       
    974972        cdfs_vol_desc_t *vol_desc = (cdfs_vol_desc_t *) block->data;
     
    982980            (vol_desc->version != 1)) {
    983981                block_put(block);
    984                 return ENOTSUP;
     982                return false;
    985983        }
    986984       
     
    10021000                 */
    10031001                block_put(block);
    1004                 return ENOTSUP;
     1002                return false;
    10051003        }
    10061004       
     
    10081006        if (block_size != BLOCK_SIZE) {
    10091007                block_put(block);
    1010                 return ENOTSUP;
     1008                return false;
    10111009        }
    10121010       
     
    10331031       
    10341032        block_put(block);
    1035         return EOK;
    1036 }
    1037 
    1038 static errno_t iso_readfs(cdfs_t *fs, fs_node_t *rfn,
     1033        return true;
     1034}
     1035
     1036static bool iso_readfs(cdfs_t *fs, fs_node_t *rfn,
    10391037    cdfs_lba_t altroot)
    10401038{
    10411039        cdfs_node_t *node = CDFS_NODE(rfn);
    10421040       
    1043         errno_t rc = iso_read_vol_desc(fs->service_id, altroot, &node->lba,
    1044             &node->size, &fs->enc, &fs->vol_ident);
    1045         if (rc != EOK)
    1046                 return rc;
     1041        if (!iso_read_vol_desc(fs->service_id, altroot, &node->lba,
     1042            &node->size, &fs->enc, &fs->vol_ident))
     1043                return false;
    10471044       
    10481045        return cdfs_readdir(fs, rfn);
     
    10641061       
    10651062        /* Create root node */
    1066         errno_t rc = create_node(&rfn, fs, L_DIRECTORY, cdfs_index++);
     1063        int rc = create_node(&rfn, fs, L_DIRECTORY, cdfs_index++);
    10671064       
    10681065        if ((rc != EOK) || (!rfn))
     
    10751072       
    10761073        /* Check if there is cdfs in given session */
    1077         if (iso_readfs(fs, rfn, altroot) != EOK)
     1074        if (!iso_readfs(fs, rfn, altroot))
    10781075                goto error;
    10791076       
     
    10861083}
    10871084
    1088 static errno_t cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
     1085static int cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
    10891086{
    10901087        char *vol_ident;
    10911088
    10921089        /* Initialize the block layer */
    1093         errno_t rc = block_init(service_id, BLOCK_SIZE);
     1090        int rc = block_init(service_id, BLOCK_SIZE);
    10941091        if (rc != EOK)
    10951092                return rc;
     
    11281125        uint32_t rsize;
    11291126        cdfs_enc_t enc;
    1130         rc = iso_read_vol_desc(service_id, altroot, &rlba, &rsize, &enc,
    1131             &vol_ident);
    1132         if (rc != EOK) {
     1127        if (!iso_read_vol_desc(service_id, altroot, &rlba, &rsize, &enc,
     1128            &vol_ident)) {
    11331129                block_cache_fini(service_id);
    11341130                block_fini(service_id);
    1135                 return rc;
     1131                return EIO;
    11361132        }
    11371133       
     
    11441140}
    11451141
    1146 static errno_t cdfs_mounted(service_id_t service_id, const char *opts,
     1142static int cdfs_mounted(service_id_t service_id, const char *opts,
    11471143    fs_index_t *index, aoff64_t *size)
    11481144{
    11491145        /* Initialize the block layer */
    1150         errno_t rc = block_init(service_id, BLOCK_SIZE);
     1146        int rc = block_init(service_id, BLOCK_SIZE);
    11511147        if (rc != EOK)
    11521148                return rc;
     
    12381234}
    12391235
    1240 static errno_t cdfs_unmounted(service_id_t service_id)
     1236static int cdfs_unmounted(service_id_t service_id)
    12411237{
    12421238        cdfs_t *fs;
     
    12501246}
    12511247
    1252 static errno_t cdfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     1248static int cdfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
    12531249    size_t *rbytes)
    12541250{
     
    12661262       
    12671263        if (!node->processed) {
    1268                 errno_t rc = cdfs_readdir(node->fs, FS_NODE(node));
     1264                int rc = cdfs_readdir(node->fs, FS_NODE(node));
    12691265                if (rc != EOK)
    12701266                        return rc;
     
    12901286                       
    12911287                        block_t *block;
    1292                         errno_t rc = block_get(&block, service_id, node->lba + lba,
     1288                        int rc = block_get(&block, service_id, node->lba + lba,
    12931289                            BLOCK_FLAGS_NONE);
    12941290                        if (rc != EOK) {
     
    13211317}
    13221318
    1323 static errno_t cdfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     1319static int cdfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
    13241320    size_t *wbytes, aoff64_t *nsize)
    13251321{
     
    13321328}
    13331329
    1334 static errno_t cdfs_truncate(service_id_t service_id, fs_index_t index,
     1330static int cdfs_truncate(service_id_t service_id, fs_index_t index,
    13351331    aoff64_t size)
    13361332{
     
    13731369}
    13741370
    1375 static errno_t cdfs_close(service_id_t service_id, fs_index_t index)
     1371static int cdfs_close(service_id_t service_id, fs_index_t index)
    13761372{
    13771373        /* Root node is always in memory */
     
    13991395}
    14001396
    1401 static errno_t cdfs_destroy(service_id_t service_id, fs_index_t index)
     1397static int cdfs_destroy(service_id_t service_id, fs_index_t index)
    14021398{
    14031399        /*
     
    14091405}
    14101406
    1411 static errno_t cdfs_sync(service_id_t service_id, fs_index_t index)
     1407static int cdfs_sync(service_id_t service_id, fs_index_t index)
    14121408{
    14131409        /*
Note: See TracChangeset for help on using the changeset viewer.