Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112916
b: refs/heads/master
c: e996fc8
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Oct 10, 2008
1 parent d92fe0a commit 9d8b1d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: acaa0f5f675ccf6b8a3a11a933419068b1ea1f46
refs/heads/master: e996fc8ae96a822f037e25463cb8dac5b93839f7
39 changes: 16 additions & 23 deletions trunk/drivers/ide/ide-floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,17 @@ static ide_driver_t idefloppy_driver = {
#endif
};

static void ide_floppy_set_media_lock(ide_drive_t *drive, int on)
{
struct ide_atapi_pc pc;

/* IOMEGA Clik! drives do not support lock/unlock commands */
if ((drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE) == 0) {
idefloppy_create_prevent_cmd(&pc, on);
(void)idefloppy_queue_pc_tail(drive, &pc);
}
}

static int idefloppy_open(struct inode *inode, struct file *filp)
{
struct gendisk *disk = inode->i_bdev->bd_disk;
Expand Down Expand Up @@ -1084,12 +1095,9 @@ static int idefloppy_open(struct inode *inode, struct file *filp)
ret = -EROFS;
goto out_put_floppy;
}

drive->atapi_flags |= IDE_AFLAG_MEDIA_CHANGED;
/* IOMEGA Clik! drives do not support lock/unlock commands */
if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) {
idefloppy_create_prevent_cmd(&pc, 1);
(void) idefloppy_queue_pc_tail(drive, &pc);
}
ide_floppy_set_media_lock(drive, 1);
check_disk_change(inode->i_bdev);
} else if (drive->atapi_flags & IDE_AFLAG_FORMAT_IN_PROGRESS) {
ret = -EBUSY;
Expand All @@ -1108,17 +1116,11 @@ static int idefloppy_release(struct inode *inode, struct file *filp)
struct gendisk *disk = inode->i_bdev->bd_disk;
struct ide_floppy_obj *floppy = ide_floppy_g(disk);
ide_drive_t *drive = floppy->drive;
struct ide_atapi_pc pc;

debug_log("Reached %s\n", __func__);

if (floppy->openers == 1) {
/* IOMEGA Clik! drives do not support lock/unlock commands */
if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) {
idefloppy_create_prevent_cmd(&pc, 0);
(void) idefloppy_queue_pc_tail(drive, &pc);
}

ide_floppy_set_media_lock(drive, 0);
drive->atapi_flags &= ~IDE_AFLAG_FORMAT_IN_PROGRESS;
}

Expand All @@ -1144,21 +1146,12 @@ static int ide_floppy_lockdoor(ide_drive_t *drive, struct ide_atapi_pc *pc,
unsigned long arg, unsigned int cmd)
{
idefloppy_floppy_t *floppy = drive->driver_data;
int prevent = (arg && cmd != CDROMEJECT) ? 1 : 0;

if (floppy->openers > 1)
return -EBUSY;

/* The IOMEGA Clik! Drive doesn't support this command -
* no room for an eject mechanism */
if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) {
int prevent = arg ? 1 : 0;

if (cmd == CDROMEJECT)
prevent = 0;

idefloppy_create_prevent_cmd(pc, prevent);
(void) idefloppy_queue_pc_tail(floppy->drive, pc);
}
ide_floppy_set_media_lock(drive, prevent);

if (cmd == CDROMEJECT) {
idefloppy_create_start_stop_cmd(pc, 2);
Expand Down

0 comments on commit 9d8b1d7

Please sign in to comment.