Changeset 3dd148d in mainline for uspace/lib/fs/libfs.c


Ignore:
Timestamp:
2013-07-29T15:15:49Z (12 years ago)
Author:
Manuele Conti <conti.ma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
736b07b
Parents:
a1c95da
Message:

Change stafs function operation to allow correct error handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/fs/libfs.c

    ra1c95da r3dd148d  
    834834       
    835835        ops->node_put(fn);
    836        
     836
     837
    837838        async_data_read_finalize(callid, &stat, sizeof(struct stat));
    838839        async_answer_0(rid, EOK);
     
    862863        memset(&statfs, 0, sizeof(struct statfs));
    863864
    864         if (NULL != ops->size_block)   
    865                 statfs.f_bsize = ops->size_block(service_id);
    866         if (NULL != ops->total_block_count)
    867                 statfs.f_blocks = ops->total_block_count(service_id);
    868         if (NULL != ops->free_block_count)
    869                 statfs.f_bfree = ops->free_block_count(service_id);
    870        
     865        if (NULL != ops->size_block) { 
     866                rc = ops->size_block(service_id, &statfs.f_bsize);
     867                if (rc != EOK) goto error;
     868        }
     869
     870        if (NULL != ops->total_block_count) {
     871                rc = ops->total_block_count(service_id, &statfs.f_blocks);
     872                if (rc != EOK) goto error;
     873        }
     874
     875        if (NULL != ops->free_block_count) {
     876                rc = ops->free_block_count(service_id, &statfs.f_bfree);
     877                if (rc != EOK) goto error;
     878        }
     879
    871880        ops->node_put(fn);
    872        
    873881        async_data_read_finalize(callid, &statfs, sizeof(struct statfs));
    874882        async_answer_0(rid, EOK);
     883        return;
     884
     885error:
     886        ops->node_put(fn);
     887        async_answer_0(callid, EINVAL);
     888        async_answer_0(rid, EINVAL);
    875889}
    876890
Note: See TracChangeset for help on using the changeset viewer.