Changeset 87037cc9 in mainline


Ignore:
Timestamp:
2011-10-14T12:05:40Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3002434
Parents:
a92ce4ef
Message:

usbmast: Keep track of pointers to created LUN functions.

Location:
uspace/drv/bus/usb/usbmast
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmast/main.c

    ra92ce4ef r87037cc9  
    112112
    113113        usb_log_debug("Get LUN count...\n");
    114         mdev->luns = usb_masstor_get_lun_count(mdev);
    115 
    116         for (i = 0; i < mdev->luns; i++) {
     114        mdev->lun_count = usb_masstor_get_lun_count(mdev);
     115        mdev->luns = calloc(mdev->lun_count, sizeof(ddf_fun_t*));
     116        if (mdev->luns == NULL) {
     117                rc = ENOMEM;
     118                usb_log_error("Failed allocating luns table.\n");
     119                goto error;
     120        }
     121
     122        for (i = 0; i < mdev->lun_count; i++) {
    117123                rc = usbmast_fun_create(mdev, i);
    118124                if (rc != EOK)
     
    162168        }
    163169
     170        mfun->ddf_fun = fun;
    164171        mfun->mdev = mdev;
    165172        mfun->lun = lun;
     
    212219
    213220        free(fun_name);
     221        mdev->luns[lun] = fun;
    214222
    215223        return EOK;
  • uspace/drv/bus/usb/usbmast/usbmast.h

    ra92ce4ef r87037cc9  
    4141
    4242/** Mass storage device. */
    43 typedef struct {
     43typedef struct usbmast_dev {
    4444        /** DDF device */
    4545        ddf_dev_t *ddf_dev;
     
    4747        usb_device_t *usb_dev;
    4848        /** Number of LUNs */
    49         unsigned luns;
     49        unsigned lun_count;
     50        /** LUN functions */
     51        ddf_fun_t **luns;
    5052} usbmast_dev_t;
     53
    5154
    5255/** Mass storage function.
Note: See TracChangeset for help on using the changeset viewer.