Changeset a1732929 in mainline for uspace/drv/block


Ignore:
Timestamp:
2018-01-15T17:04:34Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ff99e8
Parents:
c1a966e
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-15 17:04:32)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-15 17:04:34)
Message:

usb: unified logging

Use logger instead of printf. Logger adds newlines automatically.

Location:
uspace/drv/block/usbmast
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/block/usbmast/bo_trans.c

    rc1a966e ra1732929  
    9090            str_error(rc));
    9191        if (rc != EOK) {
    92                 usb_log_error("Bulk out write failed: %s\n", str_error(rc));
     92                usb_log_error("Bulk out write failed: %s", str_error(rc));
    9393                return EIO;
    9494        }
     
    154154        case cbs_failed:
    155155                cmd->status = CMDS_FAILED;
    156                 usb_log_error("CBS Failed.\n");
     156                usb_log_error("CBS Failed.");
    157157                break;
    158158        case cbs_phase_error:
    159                 usb_log_error("CBS phase error.\n");
     159                usb_log_error("CBS phase error.");
    160160                rc = EIO;
    161161                break;
    162162        default:
    163                 usb_log_error("CBS other error.\n");
     163                usb_log_error("CBS other error.");
    164164                rc = EIO;
    165165                break;
     
    168168        const size_t residue = uint32_usb2host(csw.dCSWDataResidue);
    169169        if (residue > dbuf_size) {
    170                 usb_log_error("Residue > buffer size (%zu > %zu).\n",
     170                usb_log_error("Residue > buffer size (%zu > %zu).",
    171171                    residue, dbuf_size);
    172172                return EIO;
  • uspace/drv/block/usbmast/main.c

    rc1a966e ra1732929  
    156156            usb_device_get_mapped_ep_desc(dev, &bulk_out_ep);
    157157        if (!epm_in || !epm_out || !epm_in->present || !epm_out->present) {
    158                 usb_log_error("Required EPs were not mapped.\n");
     158                usb_log_error("Required EPs were not mapped.");
    159159                return ENOENT;
    160160        }
     
    163163        mdev = usb_device_data_alloc(dev, sizeof(usbmast_dev_t));
    164164        if (mdev == NULL) {
    165                 usb_log_error("Failed allocating softstate.\n");
     165                usb_log_error("Failed allocating softstate.");
    166166                return ENOMEM;
    167167        }
     
    169169        mdev->usb_dev = dev;
    170170
    171         usb_log_info("Initializing mass storage `%s'.\n",
     171        usb_log_info("Initializing mass storage `%s'.",
    172172            usb_device_get_name(dev));
    173         usb_log_debug("Bulk in endpoint: %d [%zuB].\n",
     173        usb_log_debug("Bulk in endpoint: %d [%zuB].",
    174174            epm_in->pipe.desc.endpoint_no, epm_in->pipe.desc.max_transfer_size);
    175         usb_log_debug("Bulk out endpoint: %d [%zuB].\n",
     175        usb_log_debug("Bulk out endpoint: %d [%zuB].",
    176176            epm_out->pipe.desc.endpoint_no, epm_out->pipe.desc.max_transfer_size);
    177177
    178         usb_log_debug("Get LUN count...\n");
     178        usb_log_debug("Get LUN count...");
    179179        mdev->lun_count = usb_masstor_get_lun_count(mdev);
    180180        mdev->luns = calloc(mdev->lun_count, sizeof(ddf_fun_t*));
    181181        if (mdev->luns == NULL) {
    182182                rc = ENOMEM;
    183                 usb_log_error("Failed allocating luns table.\n");
     183                usb_log_error("Failed allocating luns table.");
    184184                goto error;
    185185        }
     
    226226
    227227        if (asprintf(&fun_name, "l%u", lun) < 0) {
    228                 usb_log_error("Out of memory.\n");
     228                usb_log_error("Out of memory.");
    229229                rc = ENOMEM;
    230230                goto error;
     
    233233        fun = usb_device_ddf_fun_create(mdev->usb_dev, fun_exposed, fun_name);
    234234        if (fun == NULL) {
    235                 usb_log_error("Failed to create DDF function %s.\n", fun_name);
     235                usb_log_error("Failed to create DDF function %s.", fun_name);
    236236                rc = ENOMEM;
    237237                goto error;
     
    241241        mfun = ddf_fun_data_alloc(fun, sizeof(usbmast_fun_t));
    242242        if (mfun == NULL) {
    243                 usb_log_error("Failed allocating softstate.\n");
     243                usb_log_error("Failed allocating softstate.");
    244244                rc = ENOMEM;
    245245                goto error;
     
    257257        ddf_fun_set_conn_handler(fun, usbmast_bd_connection);
    258258
    259         usb_log_debug("Inquire...\n");
     259        usb_log_debug("Inquire...");
    260260        usbmast_inquiry_data_t inquiry;
    261261        rc = usbmast_inquiry(mfun, &inquiry);
    262262        if (rc != EOK) {
    263                 usb_log_warning("Failed to inquire device `%s': %s.\n",
     263                usb_log_warning("Failed to inquire device `%s': %s.",
    264264                    usb_device_get_name(mdev->usb_dev), str_error(rc));
    265265                rc = EIO;
     
    281281        rc = usbmast_read_capacity(mfun, &nblocks, &block_size);
    282282        if (rc != EOK) {
    283                 usb_log_warning("Failed to read capacity, device `%s': %s.\n",
     283                usb_log_warning("Failed to read capacity, device `%s': %s.",
    284284                    usb_device_get_name(mdev->usb_dev), str_error(rc));
    285285                rc = EIO;
     
    295295        rc = ddf_fun_bind(fun);
    296296        if (rc != EOK) {
    297                 usb_log_error("Failed to bind DDF function %s: %s.\n",
     297                usb_log_error("Failed to bind DDF function %s: %s.",
    298298                    fun_name, str_error(rc));
    299299                goto error;
  • uspace/drv/block/usbmast/scsi_ms.c

    rc1a966e ra1732929  
    116116                rc = usb_massstor_unit_ready(mfun);
    117117                if (rc != EOK) {
    118                         usb_log_error("Inquiry transport failed, device %s: %s.\n",
     118                        usb_log_error("Inquiry transport failed, device %s: %s.",
    119119                           usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
    120120                        return rc;
     
    123123                rc = usb_massstor_cmd(mfun, 0xDEADBEEF, cmd);
    124124                if (rc != EOK) {
    125                         usb_log_error("Inquiry transport failed, device %s: %s.\n",
     125                        usb_log_error("Inquiry transport failed, device %s: %s.",
    126126                           usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
    127127                        return rc;
     
    131131                        return EOK;
    132132
    133                 usb_log_error("SCSI command failed, device %s.\n",
     133                usb_log_error("SCSI command failed, device %s.",
    134134                    usb_device_get_name(mfun->mdev->usb_dev));
    135135
    136136                rc = usbmast_request_sense(mfun, &sense_buf, sizeof(sense_buf));
    137137                if (rc != EOK) {
    138                         usb_log_error("Failed to read sense data.\n");
     138                        usb_log_error("Failed to read sense data.");
    139139                        return EIO;
    140140                }
     
    182182
    183183        if (rc != EOK) {
    184                 usb_log_error("Inquiry transport failed, device %s: %s.\n",
     184                usb_log_error("Inquiry transport failed, device %s: %s.",
    185185                   usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
    186186                return rc;
     
    188188
    189189        if (cmd.status != CMDS_GOOD) {
    190                 usb_log_error("Inquiry command failed, device %s.\n",
     190                usb_log_error("Inquiry command failed, device %s.",
    191191                   usb_device_get_name(mfun->mdev->usb_dev));
    192192                return EIO;
     
    194194
    195195        if (cmd.rcvd_size < SCSI_STD_INQUIRY_DATA_MIN_SIZE) {
    196                 usb_log_error("SCSI Inquiry response too short (%zu).\n",
     196                usb_log_error("SCSI Inquiry response too short (%zu).",
    197197                    cmd.rcvd_size);
    198198                return EIO;
     
    250250
    251251        if (rc != EOK || cmd.status != CMDS_GOOD) {
    252                 usb_log_error("Request Sense failed, device %s: %s.\n",
     252                usb_log_error("Request Sense failed, device %s: %s.",
    253253                   usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
    254254                return rc;
     
    292292
    293293        if (rc != EOK) {
    294                 usb_log_error("Read Capacity (10) transport failed, device %s: %s.\n",
     294                usb_log_error("Read Capacity (10) transport failed, device %s: %s.",
    295295                   usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
    296296                return rc;
     
    298298
    299299        if (cmd.status != CMDS_GOOD) {
    300                 usb_log_error("Read Capacity (10) command failed, device %s.\n",
     300                usb_log_error("Read Capacity (10) command failed, device %s.",
    301301                   usb_device_get_name(mfun->mdev->usb_dev));
    302302                return EIO;
     
    304304
    305305        if (cmd.rcvd_size < sizeof(data)) {
    306                 usb_log_error("SCSI Read Capacity response too short (%zu).\n",
     306                usb_log_error("SCSI Read Capacity response too short (%zu).",
    307307                    cmd.rcvd_size);
    308308                return EIO;
     
    349349
    350350        if (rc != EOK) {
    351                 usb_log_error("Read (10) transport failed, device %s: %s.\n",
     351                usb_log_error("Read (10) transport failed, device %s: %s.",
    352352                   usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
    353353                return rc;
     
    355355
    356356        if (cmd.status != CMDS_GOOD) {
    357                 usb_log_error("Read (10) command failed, device %s.\n",
     357                usb_log_error("Read (10) command failed, device %s.",
    358358                   usb_device_get_name(mfun->mdev->usb_dev));
    359359                return EIO;
     
    361361
    362362        if (cmd.rcvd_size < nblocks * mfun->block_size) {
    363                 usb_log_error("SCSI Read response too short (%zu).\n",
     363                usb_log_error("SCSI Read response too short (%zu).",
    364364                    cmd.rcvd_size);
    365365                return EIO;
     
    405405
    406406        if (rc != EOK) {
    407                 usb_log_error("Write (10) transport failed, device %s: %s.\n",
     407                usb_log_error("Write (10) transport failed, device %s: %s.",
    408408                   usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
    409409                return rc;
     
    411411
    412412        if (cmd.status != CMDS_GOOD) {
    413                 usb_log_error("Write (10) command failed, device %s.\n",
     413                usb_log_error("Write (10) command failed, device %s.",
    414414                   usb_device_get_name(mfun->mdev->usb_dev));
    415415                return EIO;
     
    450450
    451451        if (rc != EOK) {
    452                 usb_log_error("Synchronize Cache (10) transport failed, device %s: %s.\n",
     452                usb_log_error("Synchronize Cache (10) transport failed, device %s: %s.",
    453453                   usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
    454454                return rc;
     
    456456
    457457        if (cmd.status != CMDS_GOOD) {
    458                 usb_log_error("Synchronize Cache (10) command failed, device %s.\n",
     458                usb_log_error("Synchronize Cache (10) command failed, device %s.",
    459459                   usb_device_get_name(mfun->mdev->usb_dev));
    460460                return EIO;
Note: See TracChangeset for help on using the changeset viewer.