Changeset a35b458 in mainline for uspace/lib/drv/generic/remote_ahci.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (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:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_ahci.c

    r3061bc1 ra35b458  
    6262{
    6363        // FIXME: Use a better way than substring match
    64        
     64
    6565        *name = NULL;
    66        
     66
    6767        char devn[MAX_NAME_LENGTH];
    6868        errno_t rc = devman_fun_get_name(funh, devn, MAX_NAME_LENGTH);
    6969        if (rc != EOK)
    7070                return NULL;
    71        
     71
    7272        size_t devn_size = str_size(devn);
    73        
     73
    7474        if ((devn_size > 5) && (str_lcmp(devn, "ahci_", 5) == 0)) {
    7575                async_sess_t *sess = devman_device_connect(funh, IPC_FLAG_BLOCKING);
    76                
     76
    7777                if (sess) {
    7878                        *name = str_dup(devn);
     
    8080                }
    8181        }
    82        
     82
    8383        return NULL;
    8484}
     
    9090        if (!exch)
    9191                return EINVAL;
    92        
     92
    9393        aid_t req = async_send_2(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
    9494            IPC_M_AHCI_GET_SATA_DEVICE_NAME, sata_dev_name_length, NULL);
    95        
     95
    9696        async_data_read_start(exch, sata_dev_name, sata_dev_name_length);
    97        
     97
    9898        errno_t rc;
    9999        async_wait_for(req, &rc);
    100        
     100
    101101        return rc;
    102102}
     
    107107        if (!exch)
    108108                return EINVAL;
    109        
     109
    110110        sysarg_t blocks_hi;
    111111        sysarg_t blocks_lo;
    112112        errno_t rc = async_req_1_2(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
    113113            IPC_M_AHCI_GET_NUM_BLOCKS, &blocks_hi, &blocks_lo);
    114        
     114
    115115        async_exchange_end(exch);
    116        
     116
    117117        if (rc == EOK) {
    118118                *blocks = (((uint64_t) blocks_hi) << 32)
    119119                    | (((uint64_t) blocks_lo) & 0xffffffff);
    120120        }
    121        
     121
    122122        return rc;
    123123}
     
    128128        if (!exch)
    129129                return EINVAL;
    130        
     130
    131131        sysarg_t bs;
    132132        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
    133133            IPC_M_AHCI_GET_BLOCK_SIZE, &bs);
    134        
     134
    135135        async_exchange_end(exch);
    136        
     136
    137137        if (rc == EOK)
    138138                *blocks_size = (size_t) bs;
    139        
     139
    140140        return rc;
    141141}
     
    147147        if (!exch)
    148148                return EINVAL;
    149        
     149
    150150        aid_t req;
    151151        req = async_send_4(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
    152152            IPC_M_AHCI_READ_BLOCKS, HI(blocknum),  LO(blocknum), count, NULL);
    153        
     153
    154154        async_share_out_start(exch, buf, AS_AREA_READ | AS_AREA_WRITE);
    155        
     155
    156156        async_exchange_end(exch);
    157        
     157
    158158        errno_t rc;
    159159        async_wait_for(req, &rc);
    160        
     160
    161161        return rc;
    162162}
     
    168168        if (!exch)
    169169                return EINVAL;
    170        
     170
    171171        aid_t req = async_send_4(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
    172172            IPC_M_AHCI_WRITE_BLOCKS, HI(blocknum),  LO(blocknum), count, NULL);
    173        
     173
    174174        async_share_out_start(exch, buf, AS_AREA_READ | AS_AREA_WRITE);
    175        
     175
    176176        async_exchange_end(exch);
    177        
     177
    178178        errno_t rc;
    179179        async_wait_for(req, &rc);
    180        
     180
    181181        return rc;
    182182}
     
    213213{
    214214        const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
    215        
     215
    216216        if (ahci_iface->get_sata_device_name == NULL) {
    217217                async_answer_0(callid, ENOTSUP);
    218218                return;
    219219        }
    220        
     220
    221221        const size_t sata_dev_name_length =
    222222            (size_t) DEV_IPC_GET_ARG1(*call);
    223        
     223
    224224        char* sata_dev_name = malloc(sata_dev_name_length);
    225225        if (sata_dev_name == NULL) {
     
    227227                return;
    228228        }
    229        
     229
    230230        const errno_t ret = ahci_iface->get_sata_device_name(fun,
    231231            sata_dev_name_length, sata_dev_name);
    232        
     232
    233233        size_t real_size;
    234234        ipc_callid_t cid;
     
    236236            (real_size == sata_dev_name_length))
    237237                async_data_read_finalize(cid, sata_dev_name, sata_dev_name_length);
    238        
     238
    239239        free(sata_dev_name);
    240240        async_answer_0(callid, ret);
     
    245245{
    246246        const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
    247        
     247
    248248        if (ahci_iface->get_num_blocks == NULL) {
    249249                async_answer_0(callid, ENOTSUP);
    250250                return;
    251251        }
    252        
     252
    253253        uint64_t blocks;
    254254        const errno_t ret = ahci_iface->get_num_blocks(fun, &blocks);
    255        
     255
    256256        if (ret != EOK)
    257257                async_answer_0(callid, ret);
     
    264264{
    265265        const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
    266        
     266
    267267        if (ahci_iface->get_block_size == NULL) {
    268268                async_answer_0(callid, ENOTSUP);
    269269                return;
    270270        }
    271        
     271
    272272        size_t blocks;
    273273        const errno_t ret = ahci_iface->get_block_size(fun, &blocks);
    274        
     274
    275275        if (ret != EOK)
    276276                async_answer_0(callid, ret);
     
    283283{
    284284        const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
    285        
     285
    286286        if (ahci_iface->read_blocks == NULL) {
    287287                async_answer_0(callid, ENOTSUP);
    288288                return;
    289289        }
    290        
     290
    291291        size_t maxblock_size;
    292292        unsigned int flags;
    293        
     293
    294294        ipc_callid_t cid;
    295295        async_share_out_receive(&cid, &maxblock_size, &flags);
    296        
     296
    297297        void *buf;
    298298        async_share_out_finalize(cid, &buf);
    299        
     299
    300300        const uint64_t blocknum =
    301301            (((uint64_t) (DEV_IPC_GET_ARG1(*call))) << 32) |
    302302            (((uint64_t) (DEV_IPC_GET_ARG2(*call))) & 0xffffffff);
    303303        const size_t cnt = (size_t) DEV_IPC_GET_ARG3(*call);
    304        
     304
    305305        const errno_t ret = ahci_iface->read_blocks(fun, blocknum, cnt, buf);
    306        
     306
    307307        async_answer_0(callid, ret);
    308308}
     
    312312{
    313313        const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
    314        
     314
    315315        if (ahci_iface->read_blocks == NULL) {
    316316                async_answer_0(callid, ENOTSUP);
    317317                return;
    318318        }
    319        
     319
    320320        size_t maxblock_size;
    321321        unsigned int flags;
    322        
     322
    323323        ipc_callid_t cid;
    324324        async_share_out_receive(&cid, &maxblock_size, &flags);
    325        
     325
    326326        void *buf;
    327327        async_share_out_finalize(cid, &buf);
    328        
     328
    329329        const uint64_t blocknum =
    330330            (((uint64_t)(DEV_IPC_GET_ARG1(*call))) << 32) |
    331331            (((uint64_t)(DEV_IPC_GET_ARG2(*call))) & 0xffffffff);
    332332        const size_t cnt = (size_t) DEV_IPC_GET_ARG3(*call);
    333        
     333
    334334        const errno_t ret = ahci_iface->write_blocks(fun, blocknum, cnt, buf);
    335        
     335
    336336        async_answer_0(callid, ret);
    337337}
Note: See TracChangeset for help on using the changeset viewer.