mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chris Snook" <csnook@redhat.com>
To: "Chris Snook" <csnook@redhat.com>, linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, dhowells@redhat.com, jeffpc@josefsipek.net,
	csnook@redhat.com
Subject: [PATCH 1/2] use symbolic constants in generic lseek code
Date: Tue, 20 Feb 2007 17:01:51 -0500	[thread overview]
Message-ID: <20070220.j9k.46008500@egw.corp.redhat.com> (raw)
In-Reply-To: <20070220.waF.48959600@egw.corp.redhat.com>

From: Chris Snook <csnook@redhat.com>

Convert magic numbers to SEEK_* values from fs.h

Signed-off-by: Chris Snook <csnook@redhat.com>
--
--- a/fs/read_write.c	2007-02-20 14:49:45.000000000 -0500
+++ b/fs/read_write.c	2007-02-20 16:48:39.000000000 -0500
@@ -37,10 +37,10 @@ loff_t generic_file_llseek(struct file *

 	mutex_lock(&inode->i_mutex);
 	switch (origin) {
-		case 2:
+		case SEEK_END:
 			offset += inode->i_size;
 			break;
-		case 1:
+		case SEEK_CUR:
 			offset += file->f_pos;
 	}
 	retval = -EINVAL;
@@ -63,10 +63,10 @@ loff_t remote_llseek(struct file *file,

 	lock_kernel();
 	switch (origin) {
-		case 2:
+		case SEEK_END:
 			offset += i_size_read(file->f_path.dentry->d_inode);
 			break;
-		case 1:
+		case SEEK_CUR:
 			offset += file->f_pos;
 	}
 	retval = -EINVAL;
@@ -94,10 +94,10 @@ loff_t default_llseek(struct file *file,

 	lock_kernel();
 	switch (origin) {
-		case 2:
+		case SEEK_END:
 			offset += i_size_read(file->f_path.dentry->d_inode);
 			break;
-		case 1:
+		case SEEK_CUR:
 			offset += file->f_pos;
 	}
 	retval = -EINVAL;


  reply	other threads:[~2007-02-20 22:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20 21:57 [PATCH 0/2] " Chris Snook
2007-02-20 22:01 ` Chris Snook [this message]
2007-02-20 22:05 ` [PATCH 2/2] use use SEEK_MAX to validate user lseek arguments Chris Snook
2007-02-21 11:38 ` [PATCH 0/2] use symbolic constants in generic lseek code David Howells

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=20070220.j9k.46008500@egw.corp.redhat.com \
    --to=csnook@redhat.com \
    --cc=akpm@osdl.org \
    --cc=dhowells@redhat.com \
    --cc=jeffpc@josefsipek.net \
    --cc=linux-kernel@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome