lkml.org 
[lkml]   [1997]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: 2.1.60 ext2: pls explain "pos = *ppos; if (pos != *ppos) ..."
Date
Peter Moulder <reiter@netspace.net.au> wrote:
: Among the diffs for fs/ext2/file.c is:
:
: @@ -163,8 +164,12 @@
:
: if (filp->f_flags & O_APPEND)
: pos = inode->i_size;
: - else
: - pos = filp->f_pos;
: + else {
: + pos = *ppos;
: + if (pos != *ppos)
: + return -EINVAL;
: + }
: +
: /* Check for overflow.. */
: if (pos > (__u32) (pos + count)) {
: count = ~pos; /* == 0xFFFFFFFF - pos */
:
: I don't see anything like this in any of the other filesystems in this
: patch. Is this a mistake? If not, what's so magical about *ppos that
: it's worth testing against its value a cycle ago?

pos is type `__u32' (unsigned int)
*ppos is type `lofft_t *' (long long *)

unsigned int = 32bits (with GCC 2.7.2.3 on i386 at least)
long long = 64bits (on most platforms ?!?)

The compiler promotes 'pos' to type 'lofft_t' when performing the
comparison.

--
Darryl Miles

\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.046 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site