Changeset b7fd2a0 in mainline for uspace/drv/block/usbmast/scsi_ms.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (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:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified uspace/drv/block/usbmast/scsi_ms.c

    r36f0738 rb7fd2a0  
    7272}
    7373
    74 static int usb_massstor_unit_ready(usbmast_fun_t *mfun)
     74static errno_t usb_massstor_unit_ready(usbmast_fun_t *mfun)
    7575{
    7676        scsi_cmd_t cmd;
    7777        scsi_cdb_test_unit_ready_t cdb;
    78         int rc;
     78        errno_t rc;
    7979
    8080        memset(&cdb, 0, sizeof(cdb));
     
    107107 * XXX This is too simplified.
    108108 */
    109 static int usbmast_run_cmd(usbmast_fun_t *mfun, scsi_cmd_t *cmd)
     109static errno_t usbmast_run_cmd(usbmast_fun_t *mfun, scsi_cmd_t *cmd)
    110110{
    111111        uint8_t sense_key;
    112112        scsi_sense_data_t sense_buf;
    113         int rc;
     113        errno_t rc;
    114114
    115115        do {
     
    162162 * @return              Error code
    163163 */
    164 int usbmast_inquiry(usbmast_fun_t *mfun, usbmast_inquiry_data_t *inq_res)
     164errno_t usbmast_inquiry(usbmast_fun_t *mfun, usbmast_inquiry_data_t *inq_res)
    165165{
    166166        scsi_std_inquiry_data_t inq_data;
    167167        scsi_cmd_t cmd;
    168168        scsi_cdb_inquiry_t cdb;
    169         int rc;
     169        errno_t rc;
    170170
    171171        memset(&cdb, 0, sizeof(cdb));
     
    231231 * @return              Error code.
    232232 */
    233 int usbmast_request_sense(usbmast_fun_t *mfun, void *buf, size_t size)
     233errno_t usbmast_request_sense(usbmast_fun_t *mfun, void *buf, size_t size)
    234234{
    235235        scsi_cmd_t cmd;
    236236        scsi_cdb_request_sense_t cdb;
    237         int rc;
     237        errno_t rc;
    238238
    239239        memset(&cdb, 0, sizeof(cdb));
     
    272272 * @return              Error code.
    273273 */
    274 int usbmast_read_capacity(usbmast_fun_t *mfun, uint32_t *nblocks,
     274errno_t usbmast_read_capacity(usbmast_fun_t *mfun, uint32_t *nblocks,
    275275    uint32_t *block_size)
    276276{
     
    278278        scsi_cdb_read_capacity_10_t cdb;
    279279        scsi_read_capacity_10_data_t data;
    280         int rc;
     280        errno_t rc;
    281281
    282282        memset(&cdb, 0, sizeof(cdb));
     
    323323 * @return              Error code
    324324 */
    325 int usbmast_read(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks, void *buf)
     325errno_t usbmast_read(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks, void *buf)
    326326{
    327327        scsi_cmd_t cmd;
    328328        scsi_cdb_read_10_t cdb;
    329         int rc;
     329        errno_t rc;
    330330
    331331        if (ba > UINT32_MAX)
     
    378378 * @return              Error code
    379379 */
    380 int usbmast_write(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks,
     380errno_t usbmast_write(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks,
    381381    const void *data)
    382382{
    383383        scsi_cmd_t cmd;
    384384        scsi_cdb_write_10_t cdb;
    385         int rc;
     385        errno_t rc;
    386386
    387387        if (ba > UINT32_MAX)
     
    428428 * @return              Error code
    429429 */
    430 int usbmast_sync_cache(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks)
     430errno_t usbmast_sync_cache(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks)
    431431{
    432432        if (ba > UINT32_MAX)
     
    447447        };
    448448
    449         const int rc = usbmast_run_cmd(mfun, &cmd);
     449        const errno_t rc = usbmast_run_cmd(mfun, &cmd);
    450450
    451451        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.