LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Borislav Petkov <petkovbb@gmail.com>
To: <bzolnier@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	Borislav Petkov <bbpetkov@yahoo.de>
Subject: [PATCH 21/32] ide-tape: idetape_chrdev_direction_t:shorten enum names
Date: Sun, 27 Jan 2008 10:48:09 +0100	[thread overview]
Message-ID: <1201427300-3954-16-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1201427300-3954-1-git-send-email-petkovbb@gmail.com>

From: Borislav Petkov <bbpetkov@yahoo.de>

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
---
 drivers/ide/ide-tape.c |   60 ++++++++++++++++++++++++-----------------------
 1 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index cf308d7..b487d56 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -178,11 +178,13 @@ enum {
 /*
  *	For general magnetic tape device compatibility.
  */
+
+/* tape directions */
 typedef enum {
-	idetape_direction_none,
-	idetape_direction_read,
-	idetape_direction_write
-} idetape_chrdev_direction_t;
+	idetape_dir_none,
+	idetape_dir_read,
+	idetape_dir_write
+} idetape_chrdev_dir_t;
 
 struct idetape_bh {
 	u32 b_size;
@@ -318,7 +320,7 @@ typedef struct ide_tape_obj {
 	/* device name */
 	char name[4];
 	/* Current character device data transfer direction */
-	idetape_chrdev_direction_t chrdev_direction;
+	idetape_chrdev_dir_t chrdev_direction;
 
 	/*
 	 *	Device information
@@ -1934,7 +1936,7 @@ static void idetape_init_merge_stage (idetape_tape_t *tape)
 	struct idetape_bh *bh = tape->merge_stage->bh;
 	
 	tape->bh = bh;
-	if (tape->chrdev_direction == idetape_direction_write)
+	if (tape->chrdev_direction == idetape_dir_write)
 		atomic_set(&bh->b_count, 0);
 	else {
 		tape->b_data = bh->b_data;
@@ -2205,7 +2207,7 @@ static int __idetape_discard_read_pipeline (ide_drive_t *drive)
 	unsigned long flags;
 	int cnt;
 
-	if (tape->chrdev_direction != idetape_direction_read)
+	if (tape->chrdev_direction != idetape_dir_read)
 		return 0;
 
 	/* Remove merge stage. */
@@ -2220,7 +2222,7 @@ static int __idetape_discard_read_pipeline (ide_drive_t *drive)
 
 	/* Clear pipeline flags. */
 	clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags);
-	tape->chrdev_direction = idetape_direction_none;
+	tape->chrdev_direction = idetape_dir_none;
 
 	/* Remove pipeline stages. */
 	if (tape->first_stage == NULL)
@@ -2260,7 +2262,7 @@ static int idetape_position_tape (ide_drive_t *drive, unsigned int block, u8 par
 	int retval;
 	idetape_pc_t pc;
 
-	if (tape->chrdev_direction == idetape_direction_read)
+	if (tape->chrdev_direction == idetape_dir_read)
 		__idetape_discard_read_pipeline(drive);
 	idetape_wait_ready(drive, 60 * 5 * HZ);
 	idetape_create_locate_cmd(drive, &pc, block, partition, skip);
@@ -2487,7 +2489,7 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive)
 	int blocks, min;
 	struct idetape_bh *bh;
 
-	if (tape->chrdev_direction != idetape_direction_write) {
+	if (tape->chrdev_direction != idetape_dir_write) {
 		printk(KERN_ERR "ide-tape: bug: Trying to empty write pipeline, but we are not writing.\n");
 		return;
 	}
@@ -2530,7 +2532,7 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive)
 		tape->merge_stage = NULL;
 	}
 	clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags);
-	tape->chrdev_direction = idetape_direction_none;
+	tape->chrdev_direction = idetape_dir_none;
 
 	/*
 	 *	On the next backup, perform the feedback loop again.
@@ -2574,8 +2576,8 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages)
 	u16 blocks = *(u16 *)&tape->caps[12];
 
 	/* Initialize read operation */
-	if (tape->chrdev_direction != idetape_direction_read) {
-		if (tape->chrdev_direction == idetape_direction_write) {
+	if (tape->chrdev_direction != idetape_dir_read) {
+		if (tape->chrdev_direction == idetape_dir_write) {
 			idetape_empty_write_pipeline(drive);
 			idetape_flush_tape_buffers(drive);
 		}
@@ -2585,7 +2587,7 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages)
 		}
 		if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL)
 			return -ENOMEM;
-		tape->chrdev_direction = idetape_direction_read;
+		tape->chrdev_direction = idetape_dir_read;
 
 		/*
 		 *	Issue a read 0 command to ensure that DSC handshake
@@ -2599,7 +2601,7 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages)
 			if (bytes_read < 0) {
 				__idetape_kfree_stage(tape->merge_stage);
 				tape->merge_stage = NULL;
-				tape->chrdev_direction = idetape_direction_none;
+				tape->chrdev_direction = idetape_dir_none;
 				return bytes_read;
 			}
 		}
@@ -2815,7 +2817,7 @@ static int idetape_space_over_filemarks (ide_drive_t *drive,short mt_op,int mt_c
 		mt_count = - mt_count;
 	}
 
-	if (tape->chrdev_direction == idetape_direction_read) {
+	if (tape->chrdev_direction == idetape_dir_read) {
 		/*
 		 *	We have a read-ahead buffer. Scan it for crossed
 		 *	filemarks.
@@ -2905,7 +2907,7 @@ static ssize_t idetape_chrdev_read (struct file *file, char __user *buf,
 
 	debug_log(DBG_CHRDEV, "Enter %s, count %Zd\n", __func__, count);
 
-	if (tape->chrdev_direction != idetape_direction_read) {
+	if (tape->chrdev_direction != idetape_dir_read) {
 		if (test_bit(IDETAPE_DETECT_BS, &tape->flags))
 			if (count > tape->tape_block_size &&
 			    (count % tape->tape_block_size) == 0)
@@ -2970,8 +2972,8 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf,
 	debug_log(DBG_CHRDEV, "Enter %s, count %Zd\n", __func__, count);
 
 	/* Initialize write operation */
-	if (tape->chrdev_direction != idetape_direction_write) {
-		if (tape->chrdev_direction == idetape_direction_read)
+	if (tape->chrdev_direction != idetape_dir_write) {
+		if (tape->chrdev_direction == idetape_dir_read)
 			idetape_discard_read_pipeline(drive, 1);
 		if (tape->merge_stage || tape->merge_stage_size) {
 			printk(KERN_ERR "ide-tape: merge_stage_size "
@@ -2980,7 +2982,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf,
 		}
 		if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL)
 			return -ENOMEM;
-		tape->chrdev_direction = idetape_direction_write;
+		tape->chrdev_direction = idetape_dir_write;
 		idetape_init_merge_stage(tape);
 
 		/*
@@ -2995,7 +2997,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf,
 			if (retval < 0) {
 				__idetape_kfree_stage(tape->merge_stage);
 				tape->merge_stage = NULL;
-				tape->chrdev_direction = idetape_direction_none;
+				tape->chrdev_direction = idetape_dir_none;
 				return retval;
 			}
 		}
@@ -3267,7 +3269,7 @@ static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigne
 	debug_log(DBG_CHRDEV, "Enter %s, cmd=%u\n", __func__, cmd);
 
 	tape->restart_speed_control_req = 1;
-	if (tape->chrdev_direction == idetape_direction_write) {
+	if (tape->chrdev_direction == idetape_dir_write) {
 		idetape_empty_write_pipeline(drive);
 		idetape_flush_tape_buffers(drive);
 	}
@@ -3298,7 +3300,7 @@ static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigne
 				return -EFAULT;
 			return 0;
 		default:
-			if (tape->chrdev_direction == idetape_direction_read)
+			if (tape->chrdev_direction == idetape_dir_read)
 				idetape_discard_read_pipeline(drive, 1);
 			return idetape_blkdev_ioctl(drive, cmd, arg);
 	}
@@ -3377,7 +3379,7 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
 	if (!test_bit(IDETAPE_ADDRESS_VALID, &tape->flags))
 		(void)idetape_rewind_tape(drive);
 
-	if (tape->chrdev_direction != idetape_direction_read)
+	if (tape->chrdev_direction != idetape_dir_read)
 		clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags);
 
 	/* Read block size and write protect status from drive. */
@@ -3402,7 +3404,7 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
 	/*
 	 * Lock the tape drive door so user can't eject.
 	 */
-	if (tape->chrdev_direction == idetape_direction_none) {
+	if (tape->chrdev_direction == idetape_dir_none) {
 		if (idetape_create_prevent_cmd(drive, &pc, 1)) {
 			if (!idetape_queue_pc_tail(drive, &pc)) {
 				if (tape->door_locked != DOOR_EXPLICITLY_LOCKED)
@@ -3450,9 +3452,9 @@ static int idetape_chrdev_release (struct inode *inode, struct file *filp)
 
 	debug_log(DBG_CHRDEV, "Enter %s\n", __func__);
 
-	if (tape->chrdev_direction == idetape_direction_write)
+	if (tape->chrdev_direction == idetape_dir_write)
 		idetape_write_release(drive, minor);
-	if (tape->chrdev_direction == idetape_direction_read) {
+	if (tape->chrdev_direction == idetape_dir_read) {
 		if (minor < 128)
 			idetape_discard_read_pipeline(drive, 1);
 		else
@@ -3464,7 +3466,7 @@ static int idetape_chrdev_release (struct inode *inode, struct file *filp)
 	}
 	if (minor < 128 && test_bit(IDETAPE_MEDIUM_PRESENT, &tape->flags))
 		(void) idetape_rewind_tape(drive);
-	if (tape->chrdev_direction == idetape_direction_none) {
+	if (tape->chrdev_direction == idetape_dir_none) {
 		if (tape->door_locked == DOOR_LOCKED) {
 			if (idetape_create_prevent_cmd(drive, &pc, 0)) {
 				if (!idetape_queue_pc_tail(drive, &pc))
@@ -3657,7 +3659,7 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor)
 	tape->name[0] = 'h';
 	tape->name[1] = 't';
 	tape->name[2] = '0' + minor;
-	tape->chrdev_direction = idetape_direction_none;
+	tape->chrdev_direction = idetape_dir_none;
 	tape->pc = tape->pc_stack;
 	tape->max_insert_speed = 10000;
 	tape->speed_control = 1;
-- 
1.5.3.7


  parent reply	other threads:[~2008-01-27  9:53 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-27  9:47 [PATCH 06/32] ide-tape: remove IDETAPE_DEBUG_BUGS Borislav Petkov
2008-01-27  9:47 ` [PATCH 07/32] ide-tape: refactor the debug logging facility Borislav Petkov
2008-01-27 16:12   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:47 ` [PATCH 08/32] ide-tape: remove struct idetape_capabilities_page_t Borislav Petkov
2008-01-27 16:46   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:47 ` [PATCH 09/32] ide-tape: remove struct idetape_inquiry_result_t Borislav Petkov
2008-01-27  9:47 ` [PATCH 10/32] ide-tape: remove struct idetape_read_position_result_t Borislav Petkov
2008-01-27 19:43   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:47 ` [PATCH 11/32] ide-tape: remove struct idetape_data_compression_page_t Borislav Petkov
2008-01-27  9:48 ` [PATCH 12/32] ide-tape: remove struct idetape_medium_partition_page_t Borislav Petkov
2008-01-27  9:48 ` [PATCH 13/32] ide-tape: remove struct idetape_parameter_block_descriptor_t Borislav Petkov
2008-01-27  9:48 ` [PATCH 14/32] ide-tape: remove structs os_partition_t, os_dat_entry_t, os_dat_t Borislav Petkov
2008-01-27  9:48 ` [PATCH 15/32] ide-tape: remove struct idetape_block_size_page_t Borislav Petkov
2008-01-27  9:48 ` [PATCH 16/32] ide-tape: use generic scsi commands Borislav Petkov
2008-01-27  9:48 ` [PATCH 17/32] ide-tape: remove EXPERIMENTAL driver status Borislav Petkov
2008-01-27  9:48 ` [PATCH 18/32] ide-tape: use generic byteorder macros Borislav Petkov
2008-01-27  9:48 ` [PATCH 19/32] ide-tape: remove unused sense packet commands Borislav Petkov
2008-01-27  9:48 ` [PATCH 20/32] ide-tape: make function name more accurate Borislav Petkov
2008-01-27  9:48 ` Borislav Petkov [this message]
2008-01-27 18:38   ` [PATCH 21/32] ide-tape: idetape_chrdev_direction_t:shorten enum names Bartlomiej Zolnierkiewicz
2008-01-27  9:48 ` [PATCH 22/32] ide-tape: struct idetape_packet_command_s: shorten member names Borislav Petkov
2008-01-27 19:40   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:48 ` [PATCH 23/32] ide-tape: struct idetape_tape_t: " Borislav Petkov
2008-02-02 23:43   ` Bartlomiej Zolnierkiewicz
2008-02-03 11:36     ` Borislav Petkov
2008-01-27  9:48 ` [PATCH 24/32] ide-tape: remove unreachable code chunk Borislav Petkov
2008-01-27 19:41   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:48 ` [PATCH 25/32] ide-tape: simplify code branching in the interrupt handler Borislav Petkov
2008-01-27 19:42   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:48 ` [RFC PATCH 26/32] ide-tape: remove packet command and struct request memory buffers Borislav Petkov
2008-02-03  0:03   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:48 ` [PATCH 27/32] ide-tape: remove idetape_increase_max_pipeline_stages() Borislav Petkov
2008-02-03  0:07   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:48 ` [PATCH 28/32] ide-tape: shorten some function names Borislav Petkov
2008-02-03  0:12   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:48 ` [PATCH 29/32] ide-tape: remove mtio.h related comments Borislav Petkov
2008-01-27 18:24   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:48 ` [PATCH 30/32] ide-tape: remove atomic test/set macros Borislav Petkov
2008-01-27  9:48 ` [PATCH 31/32] ide-tape: remove idetape_config_t typedef Borislav Petkov
2008-01-27 18:30   ` Bartlomiej Zolnierkiewicz
2008-01-27  9:48 ` [PATCH 32/32] ide-tape: cleanup the remaining codestyle issues Borislav Petkov
2008-01-27 10:48 ` [PATCH 06/32] ide-tape: remove IDETAPE_DEBUG_BUGS Borislav Petkov
2008-01-27 15:35 ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1201427300-3954-16-git-send-email-petkovbb@gmail.com \
    --to=petkovbb@gmail.com \
    --cc=bbpetkov@yahoo.de \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 21/32] ide-tape: idetape_chrdev_direction_t:shorten enum names' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).