linux/drivers/scsi/sr.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  sr.c Copyright (C) 1992 David Giller
 *           Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale
 *
 *  adapted from:
 *      sd.c Copyright (C) 1992 Drew Eckhardt
 *      Linux scsi disk driver by
 *              Drew Eckhardt <[email protected]>
 *
 *	Modified by Eric Youngdale [email protected] to
 *	add scatter-gather, multiple outstanding request, and other
 *	enhancements.
 *
 *      Modified by Eric Youngdale [email protected] to support loadable
 *      low-level scsi drivers.
 *
 *      Modified by Thomas Quinot [email protected] to
 *      provide auto-eject.
 *
 *      Modified by Gerd Knorr <[email protected]> to support the
 *      generic cdrom interface
 *
 *      Modified by Jens Axboe <[email protected]> - Uniform sr_packet()
 *      interface, capabilities probe additions, ioctl cleanups, etc.
 *
 *	Modified by Richard Gooch <[email protected]> to support devfs
 *
 *	Modified by Jens Axboe <[email protected]> - support DVD-RAM
 *	transparently and lose the GHOST hack
 *
 *	Modified by Arnaldo Carvalho de Melo <[email protected]>
 *	check resource allocation in sr_init and some cleanups
 */

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/bio.h>
#include <linux/compat.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/cdrom.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/major.h>
#include <linux/blkdev.h>
#include <linux/blk-pm.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/pm_runtime.h>
#include <linux/uaccess.h>

#include <asm/unaligned.h>

#include <scsi/scsi.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_driver.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>	/* For the door lock/unlock commands */

#include "scsi_logging.h"
#include "sr.h"


MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS_BLOCKDEV_MAJOR();
MODULE_ALIAS_SCSI_DEVICE();
MODULE_ALIAS_SCSI_DEVICE();

#define SR_DISKS

#define SR_CAPABILITIES

static int sr_probe(struct device *);
static int sr_remove(struct device *);
static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt);
static int sr_done(struct scsi_cmnd *);
static int sr_runtime_suspend(struct device *dev);

static const struct dev_pm_ops sr_pm_ops =;

static struct scsi_driver sr_template =;

static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG];
static DEFINE_SPINLOCK(sr_index_lock);

static struct lock_class_key sr_bio_compl_lkclass;

static int sr_open(struct cdrom_device_info *, int);
static void sr_release(struct cdrom_device_info *);

static int get_sectorsize(struct scsi_cd *);
static int get_capabilities(struct scsi_cd *);

static unsigned int sr_check_events(struct cdrom_device_info *cdi,
				    unsigned int clearing, int slot);
static int sr_packet(struct cdrom_device_info *, struct packet_command *);
static int sr_read_cdda_bpc(struct cdrom_device_info *cdi, void __user *ubuf,
		u32 lba, u32 nr, u8 *last_sense);

static const struct cdrom_device_ops sr_dops =;

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

static int sr_runtime_suspend(struct device *dev)
{}

static unsigned int sr_get_events(struct scsi_device *sdev)
{}

/*
 * This function checks to see if the media has been changed or eject
 * button has been pressed.  It is possible that we have already
 * sensed a change, or the drive may have sensed one and not yet
 * reported it.  The past events are accumulated in sdev->changed and
 * returned together with the current state.
 */
static unsigned int sr_check_events(struct cdrom_device_info *cdi,
				    unsigned int clearing, int slot)
{}

/*
 * sr_done is the interrupt routine for the device driver.
 *
 * It will be notified on the end of a SCSI read / write, and will take one
 * of several actions based on success or failure.
 */
static int sr_done(struct scsi_cmnd *SCpnt)
{}

static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt)
{}

static int sr_revalidate_disk(struct scsi_cd *cd)
{}

static int sr_block_open(struct gendisk *disk, blk_mode_t mode)
{}

static void sr_block_release(struct gendisk *disk)
{}

static int sr_block_ioctl(struct block_device *bdev, blk_mode_t mode,
		unsigned cmd, unsigned long arg)
{}

static unsigned int sr_block_check_events(struct gendisk *disk,
					  unsigned int clearing)
{}

static void sr_free_disk(struct gendisk *disk)
{}

static const struct block_device_operations sr_bdops =;

static int sr_open(struct cdrom_device_info *cdi, int purpose)
{}

static void sr_release(struct cdrom_device_info *cdi)
{}

static int sr_probe(struct device *dev)
{}


static int get_sectorsize(struct scsi_cd *cd)
{}

static int get_capabilities(struct scsi_cd *cd)
{}

/*
 * sr_packet() is the entry point for the generic commands generated
 * by the Uniform CD-ROM layer.
 */
static int sr_packet(struct cdrom_device_info *cdi,
		struct packet_command *cgc)
{}

static int sr_read_cdda_bpc(struct cdrom_device_info *cdi, void __user *ubuf,
		u32 lba, u32 nr, u8 *last_sense)
{}

static int sr_remove(struct device *dev)
{}

static int __init init_sr(void)
{}

static void __exit exit_sr(void)
{}

module_init();
module_exit(exit_sr);
MODULE_LICENSE();