Changeset dd8b6a8 in mainline for uspace/lib/c


Ignore:
Timestamp:
2014-08-27T23:56:16Z (11 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
95fe55ca
Parents:
f27f3fd
Message:

Add synchronize cache operation to block layer and usbmast.

Location:
uspace/lib/c
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/bd.c

    rf27f3fd rdd8b6a8  
    150150}
    151151
     152int bd_sync_cache(bd_t *bd, aoff64_t ba, size_t cnt)
     153{
     154        async_exch_t *exch = async_exchange_begin(bd->sess);
     155
     156        int rc = async_req_3_0(exch, BD_SYNC_CACHE, LOWER32(ba),
     157            UPPER32(ba), cnt);
     158        async_exchange_end(exch);
     159
     160        return rc;
     161}
     162
    152163int bd_get_block_size(bd_t *bd, size_t *rbsize)
    153164{
  • uspace/lib/c/generic/bd_srv.c

    rf27f3fd rdd8b6a8  
    128128}
    129129
     130static void bd_sync_cache_srv(bd_srv_t *srv, ipc_callid_t callid,
     131    ipc_call_t *call)
     132{
     133        aoff64_t ba;
     134        size_t cnt;
     135        int rc;
     136
     137        ba = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call));
     138        cnt = IPC_GET_ARG3(*call);
     139
     140        if (srv->srvs->ops->sync_cache == NULL) {
     141                async_answer_0(callid, ENOTSUP);
     142                return;
     143        }
     144
     145        rc = srv->srvs->ops->sync_cache(srv, ba, cnt);
     146        async_answer_0(callid, rc);
     147}
     148
    130149static void bd_write_blocks_srv(bd_srv_t *srv, ipc_callid_t callid,
    131150    ipc_call_t *call)
     
    244263                        bd_read_toc_srv(srv, callid, &call);
    245264                        break;
     265                case BD_SYNC_CACHE:
     266                        bd_sync_cache_srv(srv, callid, &call);
     267                        break;
    246268                case BD_WRITE_BLOCKS:
    247269                        bd_write_blocks_srv(srv, callid, &call);
  • uspace/lib/c/include/bd.h

    rf27f3fd rdd8b6a8  
    4848extern int bd_read_toc(bd_t *, uint8_t, void *, size_t);
    4949extern int bd_write_blocks(bd_t *, aoff64_t, size_t, const void *, size_t);
     50extern int bd_sync_cache(bd_t *, aoff64_t, size_t);
    5051extern int bd_get_block_size(bd_t *, size_t *);
    5152extern int bd_get_num_blocks(bd_t *, aoff64_t *);
  • uspace/lib/c/include/bd_srv.h

    rf27f3fd rdd8b6a8  
    6262        int (*read_blocks)(bd_srv_t *, aoff64_t, size_t, void *, size_t);
    6363        int (*read_toc)(bd_srv_t *, uint8_t, void *, size_t);
     64        int (*sync_cache)(bd_srv_t *, aoff64_t, size_t);
    6465        int (*write_blocks)(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
    6566        int (*get_block_size)(bd_srv_t *, size_t *);
  • uspace/lib/c/include/ipc/bd.h

    rf27f3fd rdd8b6a8  
    4242        BD_GET_NUM_BLOCKS,
    4343        BD_READ_BLOCKS,
     44        BD_SYNC_CACHE,
    4445        BD_WRITE_BLOCKS,
    4546        BD_READ_TOC
Note: See TracChangeset for help on using the changeset viewer.