Changeset f65d9cc in mainline for uspace/lib


Ignore:
Timestamp:
2013-09-21T05:28:00Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
026271d5
Parents:
772a172 (diff), b9f7848b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Mainline changes.

Location:
uspace/lib
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/block/block.c

    r772a172 rf65d9cc  
    3737 */
    3838
    39 #include "../../srv/vfs/vfs.h"
    4039#include <ipc/loc.h>
    4140#include <ipc/services.h>
  • uspace/lib/block/block.h

    r772a172 rf65d9cc  
    2929 */
    3030
    31 /** @addtogroup libblock 
     31/** @addtogroup libblock
    3232 * @{
    33  */ 
     33 */
    3434/**
    3535 * @file
     
    4141#include <stdint.h>
    4242#include <async.h>
    43 #include "../../srv/vfs/vfs.h"
    4443#include <fibril_synch.h>
    4544#include <adt/hash_table.h>
    4645#include <adt/list.h>
     46#include <loc.h>
    4747
    4848/*
     
    5050 */
    5151
    52 /** 
     52/**
    5353 * This macro is a symbolic value for situations where no special flags are
    5454 * needed.
  • uspace/lib/c/generic/inetcfg.c

    r772a172 rf65d9cc  
    279279        aid_t req = async_send_1(exch, INETCFG_LINK_GET, link_id, &answer);
    280280        aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply);
     281        int rc = async_data_read_start(exch, &linfo->mac_addr, sizeof(addr48_t));
    281282        async_wait_for(dreq, &dretval);
    282283
    283284        async_exchange_end(exch);
    284285
    285         if (dretval != EOK) {
     286        if (dretval != EOK || rc != EOK) {
    286287                async_forget(req);
    287288                return dretval;
  • uspace/lib/c/generic/vfs/vfs.c

    r772a172 rf65d9cc  
    893893}
    894894
    895 int statfs(const char *path, struct statfs *statfs)
    896 {
    897         sysarg_t rc;
    898         sysarg_t rc_orig;
     895int statfs(const char *path, struct statfs *st)
     896{
     897        sysarg_t rc, rc_orig;
    899898        aid_t req;
    900899        size_t pa_size;
    901        
     900
    902901        char *pa = absolutize(path, &pa_size);
    903902        if (!pa)
    904903                return ENOMEM;
    905         async_exch_t *exch = vfs_exchange_begin();
    906        
     904
     905        async_exch_t *exch = vfs_exchange_begin();
     906
    907907        req = async_send_0(exch, VFS_IN_STATFS, NULL);
    908908        rc = async_data_write_start(exch, pa, pa_size);
    909         if (rc != EOK) {
    910                 vfs_exchange_end(exch);
    911                 free(pa);
    912                 async_wait_for(req, &rc_orig);
    913                 if (rc_orig == EOK)
    914                         return (int) rc;
    915                 else
    916                         return (int) rc_orig;
    917         }
    918         rc = async_data_read_start(exch, (void *) statfs, sizeof(struct statfs));
    919         if (rc != EOK) {
    920                 vfs_exchange_end(exch);
    921                 free(pa);
    922                 async_wait_for(req, &rc_orig);
    923                 if (rc_orig == EOK)
    924                         return (int) rc;
    925                 else
    926                         return (int) rc_orig;
    927         }
     909        if (rc != EOK)
     910                goto exit;
     911
     912        rc = async_data_read_start(exch, (void *) st, sizeof(*st));
     913
     914exit:
    928915        vfs_exchange_end(exch);
    929916        free(pa);
    930         async_wait_for(req, &rc);
    931         return rc;
     917        async_wait_for(req, &rc_orig);
     918        return (int) (rc_orig != EOK ? rc_orig : rc);
    932919}
    933920
  • uspace/lib/c/include/inet/inet.h

    r772a172 rf65d9cc  
    3939#include <ipc/loc.h>
    4040#include <sys/types.h>
    41 
    42 #define INET_TTL_MAX 255
    43 
    44 typedef struct {
    45         /** Local IP link service ID (optional) */
    46         service_id_t iplink;
    47         inet_addr_t src;
    48         inet_addr_t dest;
    49         uint8_t tos;
    50         void *data;
    51         size_t size;
    52 } inet_dgram_t;
    53 
    54 typedef struct {
    55         int (*recv)(inet_dgram_t *);
    56 } inet_ev_ops_t;
    57 
    58 typedef enum {
    59         INET_DF = 1
    60 } inet_df_t;
     41#include <types/inet.h>
    6142
    6243extern int inet_init(uint8_t, inet_ev_ops_t *);
  • uspace/lib/c/include/inet/inetcfg.h

    r772a172 rf65d9cc  
    3838#include <inet/inet.h>
    3939#include <sys/types.h>
    40 
    41 /** Address object info */
    42 typedef struct {
    43         /** Network address */
    44         inet_naddr_t naddr;
    45         /** Link service ID */
    46         sysarg_t ilink;
    47         /** Address object name */
    48         char *name;
    49 } inet_addr_info_t;
    50 
    51 /** IP link info */
    52 typedef struct {
    53         /** Link service name */
    54         char *name;
    55         /** Default MTU */
    56         size_t def_mtu;
    57 } inet_link_info_t;
    58 
    59 /** Static route info */
    60 typedef struct {
    61         /** Destination network address */
    62         inet_naddr_t dest;
    63         /** Router address */
    64         inet_addr_t router;
    65         /** Static route name */
    66         char *name;
    67 } inet_sroute_info_t;
     40#include <types/inetcfg.h>
    6841
    6942extern int inetcfg_init(void);
  • uspace/lib/ext4/libext4_filesystem.c

    r772a172 rf65d9cc  
    3939#include <errno.h>
    4040#include <malloc.h>
     41#include <ipc/vfs.h>
    4142#include "libext4.h"
    4243
  • uspace/lib/fs/libfs.c

    r772a172 rf65d9cc  
    806806        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    807807        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    808        
     808
    809809        fs_node_t *fn;
    810810        int rc = ops->node_get(&fn, service_id, index);
    811811        on_error(rc, answer_and_return(rid, rc));
    812        
     812
    813813        ipc_callid_t callid;
    814814        size_t size;
     
    820820                return;
    821821        }
    822        
     822
    823823        struct stat stat;
    824824        memset(&stat, 0, sizeof(struct stat));
    825        
     825
    826826        stat.fs_handle = fs_handle;
    827827        stat.service_id = service_id;
     
    832832        stat.size = ops->size_get(fn);
    833833        stat.service = ops->service_get(fn);
    834        
     834
    835835        ops->node_put(fn);
    836836
     
    845845        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    846846        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    847        
     847
    848848        fs_node_t *fn;
    849849        int rc = ops->node_get(&fn, service_id, index);
    850850        on_error(rc, answer_and_return(rid, rc));
    851        
     851
    852852        ipc_callid_t callid;
    853853        size_t size;
    854854        if ((!async_data_read_receive(&callid, &size)) ||
    855855            (size != sizeof(struct statfs))) {
    856                 ops->node_put(fn);
    857                 async_answer_0(callid, EINVAL);
    858                 async_answer_0(rid, EINVAL);
    859                 return;
    860         }
    861        
    862         struct statfs statfs;
    863         memset(&statfs, 0, sizeof(struct statfs));
    864 
    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;
     856                goto error;
     857        }
     858
     859        struct statfs st;
     860        memset(&st, 0, sizeof(struct statfs));
     861
     862        if (ops->size_block != NULL) {
     863                rc = ops->size_block(service_id, &st.f_bsize);
     864                if (rc != EOK)
     865                        goto error;
     866        }
     867
     868        if (ops->total_block_count != NULL) {
     869                rc = ops->total_block_count(service_id, &st.f_blocks);
     870                if (rc != EOK)
     871                        goto error;
     872        }
     873
     874        if (ops->free_block_count != NULL) {
     875                rc = ops->free_block_count(service_id, &st.f_bfree);
     876                if (rc != EOK)
     877                        goto error;
    878878        }
    879879
    880880        ops->node_put(fn);
    881         async_data_read_finalize(callid, &statfs, sizeof(struct statfs));
     881        async_data_read_finalize(callid, &st, sizeof(struct statfs));
    882882        async_answer_0(rid, EOK);
    883883        return;
Note: See TracChangeset for help on using the changeset viewer.