Messages in this thread | | | From | Darryl Miles <> | Subject | Re: 2.1.60 ext2: pls explain "pos = *ppos; if (pos != *ppos) ..." | Date | Wed, 29 Oct 1997 05:55:28 +0000 |
| |
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
| |