linux/drivers/scsi/sd.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _SCSI_DISK_H
#define _SCSI_DISK_H

/*
 * More than enough for everybody ;)  The huge number of majors
 * is a leftover from 16bit dev_t days, we don't really need that
 * much numberspace.
 */
#define SD_MAJORS

/*
 * Time out in seconds for disks and Magneto-opticals (which are slower).
 */
#define SD_TIMEOUT
#define SD_MOD_TIMEOUT
/*
 * Flush timeout is a multiplier over the standard device timeout which is
 * user modifiable via sysfs but initially set to SD_TIMEOUT
 */
#define SD_FLUSH_TIMEOUT_MULTIPLIER
#define SD_WRITE_SAME_TIMEOUT

/*
 * Number of allowed retries
 */
#define SD_MAX_RETRIES
#define SD_PASSTHROUGH_RETRIES
#define SD_MAX_MEDIUM_TIMEOUTS

/*
 * Size of the initial data buffer for mode and read capacity data
 */
#define SD_BUF_SIZE

/*
 * Number of sectors at the end of the device to avoid multi-sector
 * accesses to in the case of last_sector_bug
 */
#define SD_LAST_BUGGY_SECTORS

enum {};

enum {};

enum {};

enum {};

/**
 * struct zoned_disk_info - Specific properties of a ZBC SCSI device.
 * @nr_zones: number of zones.
 * @zone_blocks: number of logical blocks per zone.
 *
 * This data structure holds the ZBC SCSI device properties that are retrieved
 * twice: a first time before the gendisk capacity is known and a second time
 * after the gendisk capacity is known.
 */
struct zoned_disk_info {};

struct scsi_disk {};
#define to_scsi_disk(obj)

static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
{}

#define sd_printk(prefix, sdsk, fmt, a...)

#define sd_first_printk(prefix, sdsk, fmt, a...)

static inline int scsi_medium_access_command(struct scsi_cmnd *scmd)
{}

static inline sector_t logical_to_sectors(struct scsi_device *sdev, sector_t blocks)
{}

static inline unsigned int logical_to_bytes(struct scsi_device *sdev, sector_t blocks)
{}

static inline sector_t bytes_to_logical(struct scsi_device *sdev, unsigned int bytes)
{}

static inline sector_t sectors_to_logical(struct scsi_device *sdev, sector_t sector)
{}

void sd_dif_config_host(struct scsi_disk *sdkp, struct queue_limits *lim);

#ifdef CONFIG_BLK_DEV_ZONED

int sd_zbc_read_zones(struct scsi_disk *sdkp, struct queue_limits *lim,
		u8 buf[SD_BUF_SIZE]);
int sd_zbc_revalidate_zones(struct scsi_disk *sdkp);
blk_status_t sd_zbc_setup_zone_mgmt_cmnd(struct scsi_cmnd *cmd,
					 unsigned char op, bool all);
unsigned int sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes,
			     struct scsi_sense_hdr *sshdr);
int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
		unsigned int nr_zones, report_zones_cb cb, void *data);

#else /* CONFIG_BLK_DEV_ZONED */

static inline int sd_zbc_read_zones(struct scsi_disk *sdkp,
		struct queue_limits *lim, u8 buf[SD_BUF_SIZE])
{
	return 0;
}

static inline int sd_zbc_revalidate_zones(struct scsi_disk *sdkp)
{
	return 0;
}

static inline blk_status_t sd_zbc_setup_zone_mgmt_cmnd(struct scsi_cmnd *cmd,
						       unsigned char op,
						       bool all)
{
	return BLK_STS_TARGET;
}

static inline unsigned int sd_zbc_complete(struct scsi_cmnd *cmd,
			unsigned int good_bytes, struct scsi_sense_hdr *sshdr)
{
	return good_bytes;
}

#define sd_zbc_report_zones

#endif /* CONFIG_BLK_DEV_ZONED */

void sd_print_sense_hdr(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr);
void sd_print_result(const struct scsi_disk *sdkp, const char *msg, int result);

#endif /* _SCSI_DISK_H */