/*
* @file hv_drv_UsbStorageScsiInternal.h
* @brief Header file of usb scsi internal.
*
* @author HiView SoC Software Team
* @version 1.0.0
* @date 2022-06-15
*/

#ifndef __HV_DRV_USB_STORAGE_SCSI_INTERNAL_H
#define __HV_DRV_USB_STORAGE_SCSI_INTERNAL_H

#include "hv_drv_UsbStorageCommonScsi.h"
#include "hv_drv_UsbStorageUmass.h"

struct scsi_extra {
    struct us_data      *us;
    struct timer_list   check_timer;
    unsigned int        prepare_period;
    unsigned int        error_cnt;
    unsigned int        busy_cnt;
    unsigned int        mount_failed_cnt;
};

INLINE struct us_data *scsi_to_us(struct scsi_device *sdev) {
    if (sdev && sdev->extra) {
        return ((struct scsi_extra *) (sdev->extra))->us;
    }
    return NULL;
}

void associate_scsi_device(struct scsi_device *dev);
int attach_block_dev(struct scsi_device *dev);
void detach_block_dev(struct scsi_device *dev);

#endif
