Re: [PATCH 11/22] ide: add ide_set_media_lock() helper

From: Bartlomiej Zolnierkiewicz
Date: Tue Aug 12 2008 - 05:31:44 EST


On Monday 11 August 2008, Borislav Petkov wrote:
> Hi,
>
> On Sun, Aug 10, 2008 at 05:36:45PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > * Set IDE_AFLAG_NO_DOORLOCK in idetape_get_mode_sense_result(), check it
> > in ide_tape_set_media_lock() and cleanup idetape_create_prevent_cmd().
> >
> > * Set IDE_AFLAG_NO_DOORLOCK in ide_floppy_create_read_capacity_cmd() and
> > check it instead of IDE_AFLAG_CLIK_DRIVE in ide_floppy_set_media_lock().
> >
> > * Add ide_set_media_lock() helper and convert ide-{floppy,tape}.c to use it.
> >
> > * Remove no longer used ide*_create_prevent_cmd()/ide*_set_media_lock().
> >
> > * Update comment in <linux/ide.h> accordingly.
> >
> > Cc: Borislav Petkov <petkovbb@xxxxxxxxx>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
> > ---
> > drivers/ide/ide-atapi.c | 15 +++++++++++++++
> > drivers/ide/ide-floppy.c | 32 +++++++-------------------------
> > drivers/ide/ide-tape.c | 41 ++++++++++-------------------------------
> > include/linux/ide.h | 6 ++++--
> > 4 files changed, 36 insertions(+), 58 deletions(-)
> >
> > Index: b/drivers/ide/ide-atapi.c
> > ===================================================================
> > --- a/drivers/ide/ide-atapi.c
> > +++ b/drivers/ide/ide-atapi.c
> > @@ -162,6 +162,21 @@ int ide_queue_pc_tail(ide_drive_t *drive
> > }
> > EXPORT_SYMBOL_GPL(ide_queue_pc_tail);
> >
> > +int ide_set_media_lock(ide_drive_t *drive, struct gendisk *disk, int on)
> > +{
> > + struct ide_atapi_pc pc;
> > +
> > + if (drive->atapi_flags & IDE_AFLAG_NO_DOORLOCK)
> > + return 0;
> > +
> > + ide_init_pc(&pc);
> > + pc.c[0] = ALLOW_MEDIUM_REMOVAL;
>
> Are we switching to SCSI opcodes? What about the generic packet commands in
> <include/linux/cdrom.h>?

I prefer to use them when possible but there is no strict policy.

[ SCSI defines are shorter, one of the drivers was using them already
and it also makes easier for comparing code with SCSI. ]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/