<commit_before>/*
 *  linux/drivers/ide/ide_cd.h
 *
 *  Copyright (C) 1996-98  <NAME>
 *  Copyright (C) 1998-2000 <NAME>
 */
#ifndef _IDE_CD_H
#define _IDE_CD_H

#include <linux/cdrom.h>
#include <asm/byteorder.h>

/* Turn this on to have the driver print out the meanings of the
   ATAPI error codes.  This will use up additional kernel-space
   memory, though. */

#ifndef VERBOSE_IDE_CD_ERRORS
#define VERBOSE_IDE_CD_ERRORS 1
#endif


/* Turning this on will remove code to work around various nonstandard
   ATAPI implementations.  If you know your drive follows the standard,
   this will give you a slightly smaller kernel. */

#ifndef STANDARD_ATAPI
#define STANDARD_ATAPI 0
#endif


/* Turning this on will disable the door-locking functionality.
   This is apparently needed for supermount. */

#ifndef NO_DOOR_LOCKING
#define NO_DOOR_LOCKING 0
#endif

/*
 * typical timeout for packet command
 */
#define ATAPI_WAIT_PC		(60 * HZ)
#define ATAPI_WAIT_WRITE_BUSY	(10 * HZ)

/************************************************************************/

#define SECTOR_BITS 		9
#ifndef SECTOR_SIZE
#define SECTOR_SIZE		(1 << SECTOR_BITS)
#endif
#define SECTORS_PER_FRAME	(CD_FRAMESIZE >> SECTOR_BITS)
#define SECTOR_BUFFER_SIZE	(CD_FRAMESIZE * 32)

/* Configuration flags.  These describe the capabilities of the drive.
   They generally do not change after initialization, unless we learn
   more about the drive from stuff failing. */
struct ide_cd_config_flags {
	__u8 drq_interrupt	: 1; /* Device sends an interrupt when ready
					for a packet command. */
	__u8 no_doorlock	: 1; /* Drive cannot lock the door. */
	__u8 no_eject		: 1; /* Drive cannot eject the disc. */
	__u8 nec260		: 1; /* Drive is a pre-1.2 NEC 260 drive. */
	__u8 playmsf_as_bcd	: 1; /* PLAYMSF command takes BCD args. */
	__u8 tocaddr_as_bcd	: 1; /* TOC addresses are in BCD. */
	__u8 toctracks_as_bcd	: 1; /* TOC track numbers are in BCD. */
	__u8 subchan_as_bcd	: 1; /* Subchannel info is in BCD. */
	__u8 is_changer		: 1; /* Drive is a changer. */
	__u8 cd_r		: 1; /* Drive can write to CD-R media . */
	__u8 cd_rw		: 1; /* Drive can write to CD-R/W media . */
	__u8 dvd		: 1; /* Drive is a DVD-ROM */
	__u8 dvd_r		: 1; /* Drive can write DVD-R */
	__u8 dvd_ram		: 1; /* Drive can write DVD-RAM */
	__u8 ram		: 1; /* generic WRITE (dvd-ram/mrw) */
	__u8 test_write		: 1; /* Drive can fake writes */
	__u8 supp_disc_present	: 1; /* Changer can report exact contents
					of slots. */
	__u8 limit_nframes	: 1; /* Drive does not provide data in
					multiples of SECTOR_SIZE when more
					than one interrupt is needed. */
	__u8 seeking		: 1; /* Seeking in progress */
	__u8 audio_play		: 1; /* can do audio related commands */
	__u8 close_tray		: 1; /* can close the tray */
	__u8 writing		: 1; /* pseudo write in progress */
	__u8 mo_drive		: 1; /* drive is an MO device */
	__u8 no_speed_select	: 1; /* SET_CD_SPEED command is unsupported. */
	__u8 reserved		: 1;
	byte max_speed;		     /* Max speed of the drive */
};
#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags))

 
/* State flags.  These give information about the current state of the
   drive, and will change during normal operation. */
struct ide_cd_state_flags {
	__u8 media_changed : 1; /* Driver has noticed a media change. */
	__u8 toc_valid     : 1; /* Saved TOC information is current. */
	__u8 door_locked   : 1; /* We think that the drive door is locked. */
	__u8 writing       : 1; /* the drive is currently writing */
	__u8 reserved      : 4;
	byte current_speed;	/* Current speed of the drive */
};

#define CDROM_STATE_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->state_flags))

/* Structure of a MSF cdrom address. */
struct atapi_msf {
	byte reserved;
	byte minute;
	byte second;
	byte frame;
};

/* Space to hold the disk TOC. */
#define MAX_TRACKS 99
struct atapi_toc_header {
	unsigned short toc_length;
	byte first_track;
	byte last_track;
};

struct atapi_toc_entry {
	byte reserved1;
#if defined(__BIG_ENDIAN_BITFIELD)
	__u8 adr     : 4;
	__u8 control : 4;
#elif defined(__LITTLE_ENDIAN_BITFIELD)
	__u8 control : 4;
	__u8 adr     : 4;
#else
#error "Please fix <asm/byteorder.h>"
#endif
	byte track;
	byte reserved2;
	union {
		unsigned lba;
		struct atapi_msf msf;
	} addr;
};

struct atapi_toc {
	int    last_session_lba;
	int    xa_flag;
	unsigned long capacity;
	struct atapi_toc_header hdr;
	struct atapi_toc_entry  ent[MAX_TRACKS+1];
	  /* One extra for the leadout. */
};


/* This structure is annoyingly close to, but not identical with,
   the cdrom_subchnl structure from cdrom.h. */
struct atapi_cdrom_subchnl {
 	u_char  acdsc_reserved;
 	u_char  acdsc_audiostatus;
 	u_short acdsc_length;
	u_char  acdsc_format;

#if defined(__BIG_ENDIAN_BITFIELD)
	u_char  acdsc_ctrl:     4;
	u_char  acdsc_adr:      4;
#elif defined(__LITTLE_ENDIAN_BITFIELD)
	u_char  acdsc_adr:	4;
	u_char  acdsc_ctrl:	4;
#else
#error "Please fix <asm/byteorder.h>"
#endif
	u_char  acdsc_trk;
	u_char  acdsc_ind;
	union {
		struct atapi_msf msf;
		int	lba;
	} acdsc_absaddr;
	union {
		struct atapi_msf msf;
		int	lba;
	} acdsc_reladdr;
};

<commit_msg>ide-cd: remove unused struct atapi_cdrom_subchnl<commit_after>/*
 *  linux/drivers/ide/ide_cd.h
 *
 *  Copyright (C) 1996-98  <NAME>
 *  Copyright (C) 1998-2000 <NAME>
 */
#ifndef _IDE_CD_H
#define _IDE_CD_H

#include <linux/cdrom.h>
#include <asm/byteorder.h>

/* Turn this on to have the driver print out the meanings of the
   ATAPI error codes.  This will use up additional kernel-space
   memory, though. */

#ifndef VERBOSE_IDE_CD_ERRORS
#define VERBOSE_IDE_CD_ERRORS 1
#endif


/* Turning this on will remove code to work around various nonstandard
   ATAPI implementations.  If you know your drive follows the standard,
   this will give you a slightly smaller kernel. */

#ifndef STANDARD_ATAPI
#define STANDARD_ATAPI 0
#endif


/* Turning this on will disable the door-locking functionality.
   This is apparently needed for supermount. */

#ifndef NO_DOOR_LOCKING
#define NO_DOOR_LOCKING 0
#endif

/*
 * typical timeout for packet command
 */
#define ATAPI_WAIT_PC		(60 * HZ)
#define ATAPI_WAIT_WRITE_BUSY	(10 * HZ)

/************************************************************************/

#define SECTOR_BITS 		9
#ifndef SECTOR_SIZE
#define SECTOR_SIZE		(1 << SECTOR_BITS)
#endif
#define SECTORS_PER_FRAME	(CD_FRAMESIZE >> SECTOR_BITS)
#define SECTOR_BUFFER_SIZE	(CD_FRAMESIZE * 32)

/* Configuration flags.  These describe the capabilities of the drive.
   They generally do not change after initialization, unless we learn
   more about the drive from stuff failing. */
struct ide_cd_config_flags {
	__u8 drq_interrupt	: 1; /* Device sends an interrupt when ready
					for a packet command. */
	__u8 no_doorlock	: 1; /* Drive cannot lock the door. */
	__u8 no_eject		: 1; /* Drive cannot eject the disc. */
	__u8 nec260		: 1; /* Drive is a pre-1.2 NEC 260 drive. */
	__u8 playmsf_as_bcd	: 1; /* PLAYMSF command takes BCD args. */
	__u8 tocaddr_as_bcd	: 1; /* TOC addresses are in BCD. */
	__u8 toctracks_as_bcd	: 1; /* TOC track numbers are in BCD. */
	__u8 subchan_as_bcd	: 1; /* Subchannel info is in BCD. */
	__u8 is_changer		: 1; /* Drive is a changer. */
	__u8 cd_r		: 1; /* Drive can write to CD-R media . */
	__u8 cd_rw		: 1; /* Drive can write to CD-R/W media . */
	__u8 dvd		: 1; /* Drive is a DVD-ROM */
	__u8 dvd_r		: 1; /* Drive can write DVD-R */
	__u8 dvd_ram		: 1; /* Drive can write DVD-RAM */
	__u8 ram		: 1; /* generic WRITE (dvd-ram/mrw) */
	__u8 test_write		: 1; /* Drive can fake writes */
	__u8 supp_disc_present	: 1; /* Changer can report exact contents
					of slots. */
	__u8 limit_nframes	: 1; /* Drive does not provide data in
					multiples of SECTOR_SIZE when more
					than one interrupt is needed. */
	__u8 seeking		: 1; /* Seeking in progress */
	__u8 audio_play		: 1; /* can do audio related commands */
	__u8 close_tray		: 1; /* can close the tray */
	__u8 writing		: 1; /* pseudo write in progress */
	__u8 mo_drive		: 1; /* drive is an MO device */
	__u8 no_speed_select	: 1; /* SET_CD_SPEED command is unsupported. */
	__u8 reserved		: 1;
	byte max_speed;		     /* Max speed of the drive */
};
#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags))

 
/* State flags.  These give information about the current state of the
   drive, and will change during normal operation. */
struct ide_cd_state_flags {
	__u8 media_changed : 1; /* Driver has noticed a media change. */
	__u8 toc_valid     : 1; /* Saved TOC information is current. */
	__u8 door_locked   : 1; /* We think that the drive door is locked. */
	__u8 writing       : 1; /* the drive is currently writing */
	__u8 reserved      : 4;
	byte current_speed;	/* Current speed of the drive */
};

#define CDROM_STATE_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->state_flags))

/* Structure of a MSF cdrom address. */
struct atapi_msf {
	byte reserved;
	byte minute;
	byte second;
	byte frame;
};

/* Space to hold the disk TOC. */
#define MAX_TRACKS 99
struct atapi_toc_header {
	unsigned short toc_length;
	byte first_track;
	byte last_track;
};

struct atapi_toc_entry {
	byte reserved1;
#if defined(__BIG_ENDIAN_BITFIELD)
	__u8 adr     : 4;
	__u8 control : 4;
#elif defined(__LITTLE_ENDIAN_BITFIELD)
	__u8 control : 4;
	__u8 adr     : 4;
#else
#error "Please fix <asm/byteorder.h>"
#endif
	byte track;
	byte reserved2;
	union {
		unsigned lba;
		struct atapi_msf msf;
	} addr;
};

struct atapi_toc {
	int    last_session_lba;
	int    xa_flag;
	unsigned long capacity;
	struct atapi_toc_header hdr;
	struct atapi_toc_entry  ent[MAX_TRACKS+1];
	  /* One extra for the leadout. */
};
{'fraction_non_alphanumeric': 0.11162599114406344, 'fraction_numerical': 0.022242817423540315, 'mean_word_length': 3.463235294117647, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1263740', 'n_tokens_mistral': 3746, 'n_tokens_neox': 3514, 'n_words': 1157}