Hi Bart,
here's the ide_atapi_pc unification series. It all went pretty smoothly along
the search & replace line. Using driver-specific members in ide_atapi_pc like
idefloppy_callback and idetape_callback is kinda dumb but this approach seemed
the fastest versus unnecessary callback function signature change that will
touch stuff all over the place. Besides, ide-tape might be gone soon so that
would alleviate the problem.On a different note, i noticed ide-scsi might also need a cleanup similar to the
other drivers. It is next on my TODO list in case you don't have anything with a
higher prio.drivers/ide/ide-floppy.c | 205 +++++++++++++++++--------------------
drivers/ide/ide-tape.c | 251 +++++++++++++++++++++-------------------------
drivers/scsi/ide-scsi.c | 133 +++++++++++-------------
include/linux/ide.h | 47 +++++++++
4 files changed, 316 insertions(+), 320 deletions(-)--
Thanks,
Boris.
--
I was actually hoping that you'll continue unifying ATAPI handling...
[ ide-scsi is orphaned and has (probably) unfixable problems (because of having
dependencies on both IDE and SCSI subsystems) so it is not worth IMO but I will
of course accept patches... ]Thanks,
Bart
--
So, why is ide-scsi still in the tree? Is there some use case besides
cdrecord? (Which can use /dev/hda already without the ide-scsi blob...)
--
With old IDE only ide-scsi can handle some of the more obscurely weird
devices, and some tape drives fail with ide-tape but work with ide-scsi
+ osst/st.Alan
--
yeah, sure. ide-scsi simply will wander down the prio stack pushed by the other
does this mean it might have a similar to idetape's destiny...?
--
Regards/Gruß,
Boris.
--
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/ide/ide-tape.c | 251 ++++++++++++++++++++++--------------------------
1 files changed, 114 insertions(+), 137 deletions(-)diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 09ff9b0..aefbb47 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -181,34 +181,6 @@ struct idetape_bh {
char *b_data;
};-typedef struct idetape_packet_command_s {
- /* Actual packet bytes */
- u8 c[12];
- /* On each retry, we increment retries */
- int retries;
- /* Error code */
- int error;
- /* Bytes to transfer */
- int request_transfer;
- /* Bytes actually transferred */
- int actually_transferred;
- /* Size of our data buffer */
- int buffer_size;
- struct idetape_bh *bh;
- char *b_data;
- int b_count;
- /* Data buffer */
- u8 *buffer;
- /* Pointer into the above buffer */
- u8 *current_position;
- /* Called when this packet command is completed */
- ide_startstop_t (*callback) (ide_drive_t *);
- /* Temporary buffer */
- u8 pc_buffer[IDETAPE_PC_BUFFER_SIZE];
- /* Status/Action bit flags: long for set_bit */
- unsigned long flags;
-} idetape_pc_t;
-
/* Packet command flag bits. */
enum {
/* Set when an error is considered normal - We won't retry */
@@ -316,11 +288,11 @@ typedef struct ide_tape_obj {
* retry, to get detailed information on what went wrong.
*/
/* Current packet command */
- idetape_pc_t *pc;
+ struct ide_atapi_pc *pc;
/* Last failed packet command */
- idetape_pc_t *failed_pc;
+ struct ide_atapi_pc *failed_pc;
/* Packet command stack */
- idetape_pc_t pc_stack[IDETAPE_PC_STACK];
+ struct ide_atapi_pc pc_stack[IDETAPE_PC_STACK];
/* Next free packet command storage space */
int pc_stack_index;
struct request rq_stack[IDETAPE_PC_STACK];
@@ -524,7 +496,7 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i)
return tape;
}-static void idetape_input_buffers(ide_drive_t *drive, idetape_pc_t *pc,
+static void ideta...
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/scsi/ide-scsi.c | 133 ++++++++++++++++++++++-------------------------
1 files changed, 62 insertions(+), 71 deletions(-)diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 7fea769..5ec421c 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -60,23 +60,6 @@#define IDESCSI_DEBUG_LOG 0
-typedef struct idescsi_pc_s {
- u8 c[12]; /* Actual packet bytes */
- int request_transfer; /* Bytes to transfer */
- int actually_transferred; /* Bytes actually transferred */
- int buffer_size; /* Size of our data buffer */
- struct request *rq; /* The corresponding request */
- u8 *buffer; /* Data buffer */
- u8 *current_position; /* Pointer into the above buffer */
- struct scatterlist *sg; /* Scatter gather table */
- unsigned int sg_cnt; /* Number of entries in sg */
- int b_count; /* Bytes transferred from current entry */
- struct scsi_cmnd *scsi_cmd; /* SCSI command */
- void (*done)(struct scsi_cmnd *); /* Scsi completion routine */
- unsigned long flags; /* Status/Action flags */
- unsigned long timeout; /* Command timeout */
-} idescsi_pc_t;
-
/*
* Packet command status bits.
*/
@@ -101,14 +84,15 @@ typedef struct ide_scsi_obj {
struct gendisk *disk;
struct Scsi_Host *host;- idescsi_pc_t *pc; /* Current packet command */
+ struct ide_atapi_pc *pc; /* Current packet command */
unsigned long flags; /* Status/Action flags */
unsigned long transform; /* SCSI cmd translation layer */
unsigned long log; /* log flags */
} idescsi_scsi_t;static DEFINE_MUTEX(idescsi_ref_mutex);
-static int idescsi_nocd; /* Set by module param to skip cd */
+/* Set by module param to skip cd */
+static int idescsi_nocd;#define ide_scsi_g(disk) \
container_of((disk)->private_data, struct ide_scsi_obj, driver)
@@ -155,7 +139,8 @@ static inline idescsi_scsi_t *drive_to_idescsi(ide_drive_t *ide_drive)
/*
* PIO dat...
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/ide/ide-floppy.c | 205 +++++++++++++++++++++-------------------------
1 files changed, 93 insertions(+), 112 deletions(-)diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 4ce67bd..7e62dfc 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -78,26 +78,6 @@
*/
#define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES)-typedef struct idefloppy_packet_command_s {
- u8 c[12]; /* Actual packet bytes */
- int retries; /* On each retry, we increment
- retries */
- int error; /* Error code */
- int request_transfer; /* Bytes to transfer */
- int actually_transferred; /* Bytes actually transferred */
- int buffer_size; /* Size of our data buffer */
- int b_count; /* Missing/Available data on
- the current buffer */
- struct request *rq; /* The corresponding request */
- u8 *buffer; /* Data buffer */
- u8 *current_position; /* Pointer into above buffer */
- void (*callback) (ide_drive_t *); /* Called when this packet
- command is completed */
- u8 pc_buffer[IDEFLOPPY_PC_BUFFER_SIZE]; /* Temporary buffer */
- unsigned long flags; /* Status/Action bit flags: long
- for set_bit */
-} idefloppy_pc_t;
-
/* Packet command flag bits. */
enum {
/* 1 when we prefer to use DMA if possible */
@@ -131,11 +111,11 @@ typedef struct ide_floppy_obj {
unsigned int openers; /* protected by BKL for now *//* Current packet command */
- idefloppy_pc_t *pc;
+ struct ide_atapi_pc *pc;
/* Last failed packet command */
- idefloppy_pc_t *failed_pc;
+ struct ide_atapi_pc *failed_pc;
/* Packet command stack */
- idefloppy_pc_t pc_stack[IDEFLOPPY_PC_STACK];
+ struct ide_atapi_pc pc_stack[IDEFLOPPY_PC_STACK];
/* Next free packet command storage space */
int pc_stack_index;
struct request rq_stack[IDEFLOPPY_PC_STACK];
@@ -262,7 +242,7 @@ static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate,...
This new struct unifies ide{-floppy,-tape,-scsi}'s view of a packet command. For now,
it represents the common denominator between the three drivers while adding driver-
specific members at the end of the struct which will be merged/simplified into the
generic ATAPI handling code in later steps, or removed completely.Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
include/linux/ide.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)diff --git a/include/linux/ide.h b/include/linux/ide.h
index e4eddd4..aae98d7 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -629,6 +629,53 @@ typedef struct ide_settings_s {int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set);
+struct ide_atapi_pc {
+ /* actual packet bytes */
+ u8 c[12];
+ /* incremented on each retry */
+ int retries;
+ int error;
+
+ /* bytes to transfer */
+ int req_xfer;
+ /* bytes actually transferred */
+ int xferred;
+
+ /* data buffer */
+ u8 *buf;
+ /* current buffer position */
+ u8 *cur_pos;
+ int buf_size;
+ /* missing/available data on the current buffer */
+ int b_count;
+
+ /* the corresponding request */
+ struct request *rq;
+
+ unsigned long flags;
+
+ /*
+ * those are more or less driver-specific and some of them are subject
+ * to change/removal later.
+ */
+ u8 pc_buf[256];
+ void (*idefloppy_callback) (ide_drive_t *);
+ ide_startstop_t (*idetape_callback) (ide_drive_t *);
+
+ /* idetape only */
+ struct idetape_bh *bh;
+ char *b_data;
+
+ /* idescsi only for now */
+ struct scatterlist *sg;
+ unsigned int sg_cnt;
+
+ struct scsi_cmnd *scsi_cmd;
+ void (*done) (struct scsi_cmnd *);
+
+ unsigned long timeout;
+};
+
/*
* /proc/ide interface
*/
--
1.5.3.7--
| David Miller | Re: Slow DOWN, please!!! |
| debian developer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Roland Dreier | Re: Integration of SCST in the mainstream Linux kernel |
| Ingo Molnar | Re: containers (was Re: -mm merge plans for 2.6.23) |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Josip Rodin | bnx2_poll panicking kernel |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 13/37] dccp: Deprecate Ack Ratio sysctl |
