All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
@ 2004-03-22  4:13 Andi Kleen
  2004-03-22  4:29 ` Nicholas Miell
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Andi Kleen @ 2004-03-22  4:13 UTC (permalink / raw)
  To: marcelo.tosatti; +Cc: linux-kernel


On 64bit architectures open() sets O_LARGEFILE implicitely. This causes the LSB
testsuite to fail, which checks that F_GETFL only returns the flags set by 
a previous open.

According to the POSIX standards gurus the Linux behaviour is not compliant.

This patch fixes this by just not reporting O_LARGEFILE in F_GETFL.

This has been in several shipping SuSE releases and the x86-64.org CVS
treee for a long time, so is unlikely to break anything.

-Andi

diff -burpN -X ../KDIFX linux-2.4.26-pre5/fs/fcntl.c linux-merge/fs/fcntl.c
--- linux-2.4.26-pre5/fs/fcntl.c	2004-01-13 10:29:17.000000000 +0100
+++ linux-merge/fs/fcntl.c	2003-10-23 15:40:52.000000000 +0200
@@ -271,7 +271,7 @@ static long do_fcntl(unsigned int fd, un
 			set_close_on_exec(fd, arg&1);
 			break;
 		case F_GETFL:
-			err = filp->f_flags;
+			err = filp->f_flags & ~O_LARGEFILE;
 			break;
 		case F_SETFL:
 			lock_kernel();

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
  2004-03-22  4:13 [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance Andi Kleen
@ 2004-03-22  4:29 ` Nicholas Miell
  2004-03-22  4:34 ` Andrea Arcangeli
  2004-03-22  5:39 ` Andrew Morton
  2 siblings, 0 replies; 10+ messages in thread
From: Nicholas Miell @ 2004-03-22  4:29 UTC (permalink / raw)
  To: Andi Kleen; +Cc: marcelo.tosatti, linux-kernel

On Sun, 2004-03-21 at 20:13, Andi Kleen wrote:
> diff -burpN -X ../KDIFX linux-2.4.26-pre5/fs/fcntl.c linux-merge/fs/fcntl.c
> --- linux-2.4.26-pre5/fs/fcntl.c	2004-01-13 10:29:17.000000000 +0100
> +++ linux-merge/fs/fcntl.c	2003-10-23 15:40:52.000000000 +0200
> @@ -271,7 +271,7 @@ static long do_fcntl(unsigned int fd, un
>  			set_close_on_exec(fd, arg&1);
>  			break;
>  		case F_GETFL:
> -			err = filp->f_flags;
> +			err = filp->f_flags & ~O_LARGEFILE;
>  			break;
>  		case F_SETFL:
>  			lock_kernel();

Shouldn't this be guarded by #if BITS_PER_LONG != 32, like sys_open?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
  2004-03-22  4:13 [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance Andi Kleen
  2004-03-22  4:29 ` Nicholas Miell
@ 2004-03-22  4:34 ` Andrea Arcangeli
  2004-03-22  4:45   ` Andi Kleen
  2004-03-22  5:39 ` Andrew Morton
  2 siblings, 1 reply; 10+ messages in thread
From: Andrea Arcangeli @ 2004-03-22  4:34 UTC (permalink / raw)
  To: Andi Kleen; +Cc: marcelo.tosatti, linux-kernel

On Mon, Mar 22, 2004 at 05:13:18AM +0100, Andi Kleen wrote:
> 
> On 64bit architectures open() sets O_LARGEFILE implicitely. This causes the LSB
> testsuite to fail, which checks that F_GETFL only returns the flags set by 
> a previous open.
> 
> According to the POSIX standards gurus the Linux behaviour is not compliant.
> 
> This patch fixes this by just not reporting O_LARGEFILE in F_GETFL.
> 
> This has been in several shipping SuSE releases and the x86-64.org CVS
> treee for a long time, so is unlikely to break anything.
> 
> -Andi
> 
> diff -burpN -X ../KDIFX linux-2.4.26-pre5/fs/fcntl.c linux-merge/fs/fcntl.c
> --- linux-2.4.26-pre5/fs/fcntl.c	2004-01-13 10:29:17.000000000 +0100
> +++ linux-merge/fs/fcntl.c	2003-10-23 15:40:52.000000000 +0200
> @@ -271,7 +271,7 @@ static long do_fcntl(unsigned int fd, un
>  			set_close_on_exec(fd, arg&1);
>  			break;
>  		case F_GETFL:
> -			err = filp->f_flags;
> +			err = filp->f_flags & ~O_LARGEFILE;
>  			break;
>  		case F_SETFL:
>  			lock_kernel();
> -

in my 2.4 tree I have this one instead (written in oct 2002):

--- x/fs/fcntl.c.~1~	Wed Oct 16 17:26:27 2002
+++ x/fs/fcntl.c	Wed Oct 16 17:27:43 2002
@@ -277,7 +277,11 @@ static long do_fcntl(unsigned int fd, un
 			set_close_on_exec(fd, arg&1);
 			break;
 		case F_GETFL:
+#if BITS_PER_LONG != 32
+			err = filp->f_flags & ~O_LARGEFILE;
+#else
 			err = filp->f_flags;
+#endif
 			break;
 		case F_SETFL:
 			err = setfl(fd, filp, arg);


32bit archs needs to get O_LARGEFILE in return from getfl (if they set
it [it's not set implicitly in 32bit archs] they will be able to handle
it transparently in glibc too, and I believe they really want it). 64bit
archs not, hence the fix.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
  2004-03-22  4:34 ` Andrea Arcangeli
@ 2004-03-22  4:45   ` Andi Kleen
  2004-03-22  5:07     ` Andrea Arcangeli
  0 siblings, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2004-03-22  4:45 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: marcelo.tosatti, linux-kernel

On Mon, 22 Mar 2004 05:34:54 +0100
Andrea Arcangeli <andrea@suse.de> wrote:


> 32bit archs needs to get O_LARGEFILE in return from getfl (if they set
> it [it's not set implicitly in 32bit archs] they will be able to handle
> it transparently in glibc too, and I believe they really want it). 64bit
> archs not, hence the fix.

If 32bit archs need it then 64bit archs need it too (think 32bit emulated processes
on 64bit jernels)  But I think in practice it doesn't matter, so I would prefer to be 
consistent between 32bit and 64bit.

I don't feel very strongly about this however ...

-Andi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
  2004-03-22  4:45   ` Andi Kleen
@ 2004-03-22  5:07     ` Andrea Arcangeli
  0 siblings, 0 replies; 10+ messages in thread
From: Andrea Arcangeli @ 2004-03-22  5:07 UTC (permalink / raw)
  To: Andi Kleen; +Cc: marcelo.tosatti, linux-kernel

On Mon, Mar 22, 2004 at 05:45:12AM +0100, Andi Kleen wrote:
> On Mon, 22 Mar 2004 05:34:54 +0100
> Andrea Arcangeli <andrea@suse.de> wrote:
> 
> 
> > 32bit archs needs to get O_LARGEFILE in return from getfl (if they set
> > it [it's not set implicitly in 32bit archs] they will be able to handle
> > it transparently in glibc too, and I believe they really want it). 64bit
> > archs not, hence the fix.
> 
> If 32bit archs need it then 64bit archs need it too (think 32bit emulated processes
> on 64bit jernels)  But I think in practice it doesn't matter, so I would prefer to be 
> consistent between 32bit and 64bit.
> 
> I don't feel very strongly about this however ...

I agree it'd be a lot simpler to handle 32bit user on 64bit kernel if we
can clear it unconditionally (otherwise we've to trap getfl with a
ia32 wrapper) but I'm afraid the api may break if we clear that bit
unconditionally. I can't tell you for sure by memory though because the
last time I worked on this was one year and half ago and this is really
a matter of API. We should ask the glibc people for another confirmation
before choosing if to clear it only in 64bit archs or in 32bit too.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
  2004-03-22  4:13 [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance Andi Kleen
  2004-03-22  4:29 ` Nicholas Miell
  2004-03-22  4:34 ` Andrea Arcangeli
@ 2004-03-22  5:39 ` Andrew Morton
  2004-03-22  6:14   ` Andi Kleen
  2 siblings, 1 reply; 10+ messages in thread
From: Andrew Morton @ 2004-03-22  5:39 UTC (permalink / raw)
  To: Andi Kleen; +Cc: marcelo.tosatti, linux-kernel

Andi Kleen <ak@suse.de> wrote:
>
> 
> On 64bit architectures open() sets O_LARGEFILE implicitely. This causes the LSB
> testsuite to fail, which checks that F_GETFL only returns the flags set by 
> a previous open.
> 
> According to the POSIX standards gurus the Linux behaviour is not compliant.
> 
> This patch fixes this by just not reporting O_LARGEFILE in F_GETFL.
> 
> This has been in several shipping SuSE releases and the x86-64.org CVS
> treee for a long time, so is unlikely to break anything.
> 
> -Andi
> 
> diff -burpN -X ../KDIFX linux-2.4.26-pre5/fs/fcntl.c linux-merge/fs/fcntl.c
> --- linux-2.4.26-pre5/fs/fcntl.c	2004-01-13 10:29:17.000000000 +0100
> +++ linux-merge/fs/fcntl.c	2003-10-23 15:40:52.000000000 +0200
> @@ -271,7 +271,7 @@ static long do_fcntl(unsigned int fd, un
>  			set_close_on_exec(fd, arg&1);
>  			break;
>  		case F_GETFL:
> -			err = filp->f_flags;
> +			err = filp->f_flags & ~O_LARGEFILE;
>  			break;
>  		case F_SETFL:
>  			lock_kernel();

eh?   If the application on a 64-bit box does

	open("foo", O_LARGEFILE|O_RDWR);

then a subsequent F_GETFL will now return just O_RDWR, will it not?  So
it's still posixly incorrect?

I think open() needs to set O_KERNEL_LARGEFILE, and we mask that off in
F_GETFL, and test for (O_LARGEFILE|O_KERNEL_LARGEFILE) everywhere.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
  2004-03-22  5:39 ` Andrew Morton
@ 2004-03-22  6:14   ` Andi Kleen
  2004-03-22  7:04     ` Ulrich Drepper
  2004-03-22  7:08     ` Andrew Morton
  0 siblings, 2 replies; 10+ messages in thread
From: Andi Kleen @ 2004-03-22  6:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: marcelo.tosatti, linux-kernel

On Sun, 21 Mar 2004 21:39:44 -0800
Andrew Morton <akpm@osdl.org> wrote:

> Andi Kleen <ak@suse.de> wrote:
> >
> > 
> > On 64bit architectures open() sets O_LARGEFILE implicitely. This causes the LSB
> > testsuite to fail, which checks that F_GETFL only returns the flags set by 
> > a previous open.
> > 
> > According to the POSIX standards gurus the Linux behaviour is not compliant.
> > 
> > This patch fixes this by just not reporting O_LARGEFILE in F_GETFL.
> > 
> > This has been in several shipping SuSE releases and the x86-64.org CVS
> > treee for a long time, so is unlikely to break anything.
> > 
> > -Andi
> > 
> > diff -burpN -X ../KDIFX linux-2.4.26-pre5/fs/fcntl.c linux-merge/fs/fcntl.c
> > --- linux-2.4.26-pre5/fs/fcntl.c	2004-01-13 10:29:17.000000000 +0100
> > +++ linux-merge/fs/fcntl.c	2003-10-23 15:40:52.000000000 +0200
> > @@ -271,7 +271,7 @@ static long do_fcntl(unsigned int fd, un
> >  			set_close_on_exec(fd, arg&1);
> >  			break;
> >  		case F_GETFL:
> > -			err = filp->f_flags;
> > +			err = filp->f_flags & ~O_LARGEFILE;
> >  			break;
> >  		case F_SETFL:
> >  			lock_kernel();
> 
> eh?   If the application on a 64-bit box does
> 
> 	open("foo", O_LARGEFILE|O_RDWR);
> 
> then a subsequent F_GETFL will now return just O_RDWR, will it not?  So
> it's still posixly incorrect?

No, because O_LARGEFILE is not part of POSIX :-) (they use open64 etc.)


> I think open() needs to set O_KERNEL_LARGEFILE, and we mask that off in
> F_GETFL, and test for (O_LARGEFILE|O_KERNEL_LARGEFILE) everywhere.


That would be the best solution, agreed But it would be a lot more intrusive
because all file systems need to be audited and fixed.

-Andi 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
  2004-03-22  6:14   ` Andi Kleen
@ 2004-03-22  7:04     ` Ulrich Drepper
  2004-03-22  7:09       ` Andi Kleen
  2004-03-22  7:08     ` Andrew Morton
  1 sibling, 1 reply; 10+ messages in thread
From: Ulrich Drepper @ 2004-03-22  7:04 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, marcelo.tosatti, linux-kernel

Andi Kleen wrote:

> No, because O_LARGEFILE is not part of POSIX :-) (they use open64 etc.)

What are you talking about?  Neither O_LARGEFILE nor open64 is in POSIX.
 But both are in the LFS extensions.

This whole change seems dubious at best.  Who has argued that
O_LARGEFILE mustn't be returned?  I do not agree at all.  If the test
suite checks this the author must defend the position.

I suggest to not make any changes.  It is perfectly OK to define new O_
flags and the open() specification does not require that none of them
must set implicitly.


-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
  2004-03-22  6:14   ` Andi Kleen
  2004-03-22  7:04     ` Ulrich Drepper
@ 2004-03-22  7:08     ` Andrew Morton
  1 sibling, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2004-03-22  7:08 UTC (permalink / raw)
  To: Andi Kleen; +Cc: marcelo.tosatti, linux-kernel

Andi Kleen <ak@suse.de> wrote:
>
> > > +++ linux-merge/fs/fcntl.c	2003-10-23 15:40:52.000000000 +0200
> > > @@ -271,7 +271,7 @@ static long do_fcntl(unsigned int fd, un
> > >  			set_close_on_exec(fd, arg&1);
> > >  			break;
> > >  		case F_GETFL:
> > > -			err = filp->f_flags;
> > > +			err = filp->f_flags & ~O_LARGEFILE;
> > >  			break;
> > >  		case F_SETFL:
> > >  			lock_kernel();
> > 
> > eh?   If the application on a 64-bit box does
> > 
> > 	open("foo", O_LARGEFILE|O_RDWR);
> > 
> > then a subsequent F_GETFL will now return just O_RDWR, will it not?  So
> > it's still posixly incorrect?
> 
> No, because O_LARGEFILE is not part of POSIX :-) (they use open64 etc.)
> 

But doesn't glibc implement open64() by adding O_LARGEFILE?  If so then an
F_GETFL will return O_LARGEFILE even though the caller didn't supply it. 
Unless glibc jumps through hoops.

Which it does not:

#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>

main()
{
	int fd;
	int flags;

	fd = open64("foo", O_RDONLY);
	if (fd < 0)
		perror("open");
	flags = fcntl(fd, F_GETFL);
	printf("supplied %o, received %o\n", O_RDONLY, flags);
}

bix:/home/akpm> ./a.out
supplied 0, received 100000

I guess your test suite forgot to test that ;)

> > I think open() needs to set O_KERNEL_LARGEFILE, and we mask that off in
> > F_GETFL, and test for (O_LARGEFILE|O_KERNEL_LARGEFILE) everywhere.
> 
> 
> That would be the best solution, agreed But it would be a lot more intrusive
> because all file systems need to be audited and fixed.

Only weirdo filesystems go looking at O_LARGEFILE (hi, sgi).  Oh, and ext3
too, although that looks bogus.


Here's a 2.6 patch.

---

 25-akpm/arch/ia64/ia32/sys_ia32.c     |    3 +-
 25-akpm/arch/ppc64/kernel/sys_ppc32.c |    2 -
 25-akpm/arch/x86_64/ia32/sys_ia32.c   |    2 -
 25-akpm/fs/block_dev.c                |    2 -
 25-akpm/fs/exec.c                     |    3 +-
 25-akpm/fs/ext3/file.c                |    6 ++--
 25-akpm/fs/fcntl.c                    |    2 -
 25-akpm/fs/ncpfs/file.c               |    3 +-
 25-akpm/fs/nfsd/vfs.c                 |    4 +--
 25-akpm/fs/open.c                     |   12 ++++-----
 25-akpm/fs/udf/file.c                 |    5 ++-
 25-akpm/fs/xfs/linux/xfs_file.c       |    3 +-
 25-akpm/fs/xfs/linux/xfs_ioctl.c      |    2 -
 25-akpm/include/asm-alpha/fcntl.h     |   37 ++++++++++++++-------------
 25-akpm/include/asm-arm/fcntl.h       |   35 +++++++++++++-------------
 25-akpm/include/asm-arm26/fcntl.h     |   35 +++++++++++++-------------
 25-akpm/include/asm-cris/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-h8300/fcntl.h     |   35 +++++++++++++-------------
 25-akpm/include/asm-i386/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-ia64/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-m68k/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-mips/fcntl.h      |   33 ++++++++++++------------
 25-akpm/include/asm-parisc/fcntl.h    |   45 +++++++++++++++++-----------------
 25-akpm/include/asm-ppc/fcntl.h       |   35 +++++++++++++-------------
 25-akpm/include/asm-ppc64/fcntl.h     |   35 +++++++++++++-------------
 25-akpm/include/asm-s390/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-sh/fcntl.h        |   35 +++++++++++++-------------
 25-akpm/include/asm-sparc/fcntl.h     |   35 +++++++++++++-------------
 25-akpm/include/asm-sparc64/fcntl.h   |   36 +++++++++++++--------------
 25-akpm/include/asm-v850/fcntl.h      |   35 +++++++++++++-------------
 25-akpm/include/asm-x86_64/fcntl.h    |   35 +++++++++++++-------------
 25-akpm/mm/filemap.c                  |    2 -
 arch/sparc64/kernel/sys_sparc32.c     |    0 
 arch/sparc64/solaris/fs.c             |    0 
 drivers/usb/gadget/file_storage.c     |    0 
 fs/cifs/file.c                        |    0 
 36 files changed, 357 insertions(+), 335 deletions(-)

diff -puN arch/sparc64/kernel/sys_sparc32.c~O_LARGEFILE-fix arch/sparc64/kernel/sys_sparc32.c
diff -puN arch/sparc64/solaris/fs.c~O_LARGEFILE-fix arch/sparc64/solaris/fs.c
diff -puN arch/ia64/ia32/sys_ia32.c~O_LARGEFILE-fix arch/ia64/ia32/sys_ia32.c
--- 25/arch/ia64/ia32/sys_ia32.c~O_LARGEFILE-fix	2004-03-21 22:36:32.530114696 -0800
+++ 25-akpm/arch/ia64/ia32/sys_ia32.c	2004-03-21 22:37:45.050089984 -0800
@@ -2106,7 +2106,8 @@ sys32_brk (unsigned int brk)
 }
 
 /*
- * Exactly like fs/open.c:sys_open(), except that it doesn't set the O_LARGEFILE flag.
+ * Exactly like fs/open.c:sys_open(), except that it doesn't set the
+ * O_KERNEL_LARGEFILE flag.
  */
 asmlinkage long
 sys32_open (const char * filename, int flags, int mode)
diff -puN arch/ppc64/kernel/sys_ppc32.c~O_LARGEFILE-fix arch/ppc64/kernel/sys_ppc32.c
--- 25/arch/ppc64/kernel/sys_ppc32.c~O_LARGEFILE-fix	2004-03-21 22:36:32.583106640 -0800
+++ 25-akpm/arch/ppc64/kernel/sys_ppc32.c	2004-03-21 22:37:51.785066112 -0800
@@ -2399,7 +2399,7 @@ off_t ppc32_lseek(unsigned int fd, u32 o
 
 /*
  * This is just a version for 32-bit applications which does
- * not force O_LARGEFILE on.
+ * not force O_KERNEL_LARGEFILE on.
  */
 long sys32_open(const char * filename, int flags, int mode)
 {
diff -puN arch/x86_64/ia32/sys_ia32.c~O_LARGEFILE-fix arch/x86_64/ia32/sys_ia32.c
--- 25/arch/x86_64/ia32/sys_ia32.c~O_LARGEFILE-fix	2004-03-21 22:36:32.612102232 -0800
+++ 25-akpm/arch/x86_64/ia32/sys_ia32.c	2004-03-21 22:37:56.536343808 -0800
@@ -1783,7 +1783,7 @@ asmlinkage long sys32_open(const char * 
 	char * tmp;
 	int fd, error;
 
-	/* don't force O_LARGEFILE */
+	/* don't force O_KERNEL_LARGEFILE */
 	tmp = getname(filename);
 	fd = PTR_ERR(tmp);
 	if (!IS_ERR(tmp)) {
diff -puN drivers/usb/gadget/file_storage.c~O_LARGEFILE-fix drivers/usb/gadget/file_storage.c
diff -puN include/asm-ppc64/fcntl.h~O_LARGEFILE-fix include/asm-ppc64/fcntl.h
--- 25/include/asm-ppc64/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.662094632 -0800
+++ 25-akpm/include/asm-ppc64/fcntl.h	2004-03-21 22:39:15.803293400 -0800
@@ -10,23 +10,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY      040000	/* must be a directory */
-#define O_NOFOLLOW      0100000	/* don't follow links */
-#define O_LARGEFILE     0200000
-#define O_DIRECT	0400000	/* direct disk access hint */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY          040000	/* must be a directory */
+#define O_NOFOLLOW          0100000	/* don't follow links */
+#define O_LARGEFILE         0200000
+#define O_DIRECT	    0400000	/* direct disk access hint */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-x86_64/fcntl.h~O_LARGEFILE-fix include/asm-x86_64/fcntl.h
--- 25/include/asm-x86_64/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.688090680 -0800
+++ 25-akpm/include/asm-x86_64/fcntl.h	2004-03-21 22:40:04.754851632 -0800
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-ppc/fcntl.h~O_LARGEFILE-fix include/asm-ppc/fcntl.h
--- 25/include/asm-ppc/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.718086120 -0800
+++ 25-akpm/include/asm-ppc/fcntl.h	2004-03-21 22:40:43.884902960 -0800
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY      040000	/* must be a directory */
-#define O_NOFOLLOW      0100000	/* don't follow links */
-#define O_LARGEFILE     0200000
-#define O_DIRECT	0400000	/* direct disk access hint */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY          040000	/* must be a directory */
+#define O_NOFOLLOW          0100000	/* don't follow links */
+#define O_LARGEFILE         0200000
+#define O_DIRECT	    0400000	/* direct disk access hint */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-m68k/fcntl.h~O_LARGEFILE-fix include/asm-m68k/fcntl.h
--- 25/include/asm-m68k/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.745082016 -0800
+++ 25-akpm/include/asm-m68k/fcntl.h	2004-03-21 22:41:22.805986056 -0800
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		  0100	/* not fcntl */
-#define O_EXCL		  0200	/* not fcntl */
-#define O_NOCTTY	  0400	/* not fcntl */
-#define O_TRUNC		 01000	/* not fcntl */
-#define O_APPEND	 02000
-#define O_NONBLOCK	 04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		010000
-#define FASYNC		020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	040000	/* must be a directory */
-#define O_NOFOLLOW	0100000	/* don't follow links */
-#define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0400000
+#define O_ACCMODE	      0003
+#define O_RDONLY	        00
+#define O_WRONLY	        01
+#define O_RDWR		        02
+#define O_CREAT		      0100	/* not fcntl */
+#define O_EXCL		      0200	/* not fcntl */
+#define O_NOCTTY	      0400	/* not fcntl */
+#define O_TRUNC		     01000	/* not fcntl */
+#define O_APPEND	     02000
+#define O_NONBLOCK	     04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		    010000
+#define FASYNC		    020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	    040000	/* must be a directory */
+#define O_NOFOLLOW	    0100000	/* don't follow links */
+#define O_DIRECT	    0200000	/* direct disk access hint */
+#define O_LARGEFILE	    0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-ia64/fcntl.h~O_LARGEFILE-fix include/asm-ia64/fcntl.h
--- 25/include/asm-ia64/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.772077912 -0800
+++ 25-akpm/include/asm-ia64/fcntl.h	2004-03-21 22:42:03.518796768 -0800
@@ -11,23 +11,24 @@
  * open/fcntl - O_SYNC is only implemented on blocks devices and on
  * files located on an ext2 file system
  */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-parisc/fcntl.h~O_LARGEFILE-fix include/asm-parisc/fcntl.h
--- 25/include/asm-parisc/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.802073352 -0800
+++ 25-akpm/include/asm-parisc/fcntl.h	2004-03-21 22:43:02.661805664 -0800
@@ -3,28 +3,29 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	00000003
-#define O_RDONLY	00000000
-#define O_WRONLY	00000001
-#define O_RDWR		00000002
-#define O_APPEND	00000010
-#define O_BLKSEEK	00000100 /* HPUX only */
-#define O_CREAT		00000400 /* not fcntl */
-#define O_TRUNC		00001000 /* not fcntl */
-#define O_EXCL		00002000 /* not fcntl */
-#define O_LARGEFILE	00004000
-#define O_SYNC		00100000
-#define O_NONBLOCK	00200004 /* HPUX has separate NDELAY & NONBLOCK */
-#define O_NDELAY	O_NONBLOCK
-#define O_NOCTTY	00400000 /* not fcntl */
-#define O_DSYNC		01000000 /* HPUX only */
-#define O_RSYNC		02000000 /* HPUX only */
-
-#define FASYNC		00020000 /* fcntl, for BSD compatibility */
-#define O_DIRECT	00040000 /* direct disk access hint - currently ignored */
-#define O_DIRECTORY	00010000 /* must be a directory */
-#define O_NOFOLLOW	00000200 /* don't follow links */
-#define O_INVISIBLE	04000000 /* invisible I/O, for DMAPI/XDSM */
+#define O_ACCMODE		00000003
+#define O_RDONLY		00000000
+#define O_WRONLY		00000001
+#define O_RDWR			00000002
+#define O_APPEND		00000010
+#define O_BLKSEEK		00000100 /* HPUX only */
+#define O_CREAT			00000400 /* not fcntl */
+#define O_TRUNC			00001000 /* not fcntl */
+#define O_EXCL			00002000 /* not fcntl */
+#define O_LARGEFILE		00004000
+#define O_SYNC			00100000
+#define O_NONBLOCK		00200004 /* HPUX has separate NDELAY & NONBLOCK */
+#define O_NDELAY		O_NONBLOCK
+#define O_NOCTTY		00400000 /* not fcntl */
+#define O_DSYNC			01000000 /* HPUX only */
+#define O_RSYNC			02000000 /* HPUX only */
+
+#define FASYNC			00020000 /* fcntl, for BSD compatibility */
+#define O_DIRECT		00040000 /* direct disk access hint */
+#define O_DIRECTORY		00010000 /* must be a directory */
+#define O_NOFOLLOW		00000200 /* don't follow links */
+#define O_INVISIBLE		04000000 /* invisible I/O, for DMAPI/XDSM */
+#define O_KERNEL_LARGEFILE     010000000 /* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get f_flags */
diff -puN include/asm-arm/fcntl.h~O_LARGEFILE-fix include/asm-arm/fcntl.h
--- 25/include/asm-arm/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.835068336 -0800
+++ 25-akpm/include/asm-arm/fcntl.h	2004-03-21 22:43:34.447973432 -0800
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	 040000	/* must be a directory */
-#define O_NOFOLLOW	0100000	/* don't follow links */
-#define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0400000
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	     040000	/* must be a directory */
+#define O_NOFOLLOW	    0100000	/* don't follow links */
+#define O_DIRECT	    0200000	/* direct disk access hint */
+#define O_LARGEFILE	    0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-mips/fcntl.h~O_LARGEFILE-fix include/asm-mips/fcntl.h
--- 25/include/asm-mips/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.859064688 -0800
+++ 25-akpm/include/asm-mips/fcntl.h	2004-03-21 22:44:03.819508280 -0800
@@ -10,22 +10,23 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	0x0003
-#define O_RDONLY	0x0000
-#define O_WRONLY	0x0001
-#define O_RDWR		0x0002
-#define O_APPEND	0x0008
-#define O_SYNC		0x0010
-#define O_NONBLOCK	0x0080
-#define O_CREAT         0x0100	/* not fcntl */
-#define O_TRUNC		0x0200	/* not fcntl */
-#define O_EXCL		0x0400	/* not fcntl */
-#define O_NOCTTY	0x0800	/* not fcntl */
-#define FASYNC		0x1000	/* fcntl, for BSD compatibility */
-#define O_LARGEFILE	0x2000	/* allow large file opens */
-#define O_DIRECT	0x8000	/* direct disk access hint */
-#define O_DIRECTORY	0x10000	/* must be a directory */
-#define O_NOFOLLOW	0x20000	/* don't follow links */
+#define O_ACCMODE		0x0003
+#define O_RDONLY		0x0000
+#define O_WRONLY		0x0001
+#define O_RDWR			0x0002
+#define O_APPEND		0x0008
+#define O_SYNC			0x0010
+#define O_NONBLOCK		0x0080
+#define O_CREAT         	0x0100	/* not fcntl */
+#define O_TRUNC			0x0200	/* not fcntl */
+#define O_EXCL			0x0400	/* not fcntl */
+#define O_NOCTTY		0x0800	/* not fcntl */
+#define FASYNC			0x1000	/* fcntl, for BSD compatibility */
+#define O_LARGEFILE		0x2000	/* allow large file opens */
+#define O_DIRECT		0x8000	/* direct disk access hint */
+#define O_DIRECTORY		0x10000	/* must be a directory */
+#define O_NOFOLLOW		0x20000	/* don't follow links */
+#define O_KERNEL_LARGEFILE	0x40000	/* kernel-internal large file hint */
 
 #define O_NDELAY	O_NONBLOCK
 
diff -puN include/asm-sparc/fcntl.h~O_LARGEFILE-fix include/asm-sparc/fcntl.h
--- 25/include/asm-sparc/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.885060736 -0800
+++ 25-akpm/include/asm-sparc/fcntl.h	2004-03-21 22:44:27.766867728 -0800
@@ -4,23 +4,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_RDONLY	0x0000
-#define O_WRONLY	0x0001
-#define O_RDWR		0x0002
-#define O_ACCMODE	0x0003
-#define O_APPEND	0x0008
-#define FASYNC		0x0040	/* fcntl, for BSD compatibility */
-#define O_CREAT		0x0200	/* not fcntl */
-#define O_TRUNC		0x0400	/* not fcntl */
-#define O_EXCL		0x0800	/* not fcntl */
-#define O_SYNC		0x2000
-#define O_NONBLOCK	0x4000
-#define O_NDELAY	(0x0004 | O_NONBLOCK)
-#define O_NOCTTY	0x8000	/* not fcntl */
-#define O_DIRECTORY	0x10000	/* must be a directory */
-#define O_NOFOLLOW	0x20000	/* don't follow links */
-#define O_LARGEFILE	0x40000
-#define O_DIRECT        0x100000 /* direct disk access hint */
+#define O_RDONLY		0x0000
+#define O_WRONLY		0x0001
+#define O_RDWR			0x0002
+#define O_ACCMODE		0x0003
+#define O_APPEND		0x0008
+#define FASYNC			0x0040	/* fcntl, for BSD compatibility */
+#define O_CREAT			0x0200	/* not fcntl */
+#define O_TRUNC			0x0400	/* not fcntl */
+#define O_EXCL			0x0800	/* not fcntl */
+#define O_SYNC			0x2000
+#define O_NONBLOCK		0x4000
+#define O_NDELAY		(0x0004 | O_NONBLOCK)
+#define O_NOCTTY		0x8000	/* not fcntl */
+#define O_DIRECTORY		0x10000	/* must be a directory */
+#define O_NOFOLLOW		0x20000	/* don't follow links */
+#define O_LARGEFILE		0x40000
+#define O_DIRECT        	0x100000 /* direct disk access hint */
+#define O_KERNEL_LARGEFILE	0x200000 /* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-alpha/fcntl.h~O_LARGEFILE-fix include/asm-alpha/fcntl.h
--- 25/include/asm-alpha/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.917055872 -0800
+++ 25-akpm/include/asm-alpha/fcntl.h	2004-03-21 22:45:48.553586280 -0800
@@ -3,24 +3,25 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		 01000	/* not fcntl */
-#define O_TRUNC		 02000	/* not fcntl */
-#define O_EXCL		 04000	/* not fcntl */
-#define O_NOCTTY	010000	/* not fcntl */
-
-#define O_NONBLOCK	 00004
-#define O_APPEND	 00010
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		040000
-#define FASYNC		020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	0100000	/* must be a directory */
-#define O_NOFOLLOW	0200000 /* don't follow links */
-#define O_LARGEFILE	0400000 /* will be set by the kernel on every open */
-#define O_DIRECT	02000000 /* direct disk access - should check with OSF/1 */
+#define O_ACCMODE	      0003
+#define O_RDONLY	        00
+#define O_WRONLY	        01
+#define O_RDWR		        02
+#define O_CREAT		     01000	/* not fcntl */
+#define O_TRUNC		     02000	/* not fcntl */
+#define O_EXCL		     04000	/* not fcntl */
+#define O_NOCTTY	    010000	/* not fcntl */
+
+#define O_NONBLOCK	     00004
+#define O_APPEND	     00010
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		    040000
+#define FASYNC		    020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	    0100000	/* must be a directory */
+#define O_NOFOLLOW	    0200000	/* don't follow links */
+#define O_LARGEFILE	    0400000
+#define O_DIRECT	    02000000 /* direct access - check with OSF/1 */
+#define O_KERNEL_LARGEFILE  04000000 /* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-i386/fcntl.h~O_LARGEFILE-fix include/asm-i386/fcntl.h
--- 25/include/asm-i386/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.963048880 -0800
+++ 25-akpm/include/asm-i386/fcntl.h	2004-03-21 22:46:11.798052584 -0800
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-s390/fcntl.h~O_LARGEFILE-fix include/asm-s390/fcntl.h
--- 25/include/asm-s390/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:32.988045080 -0800
+++ 25-akpm/include/asm-s390/fcntl.h	2004-03-21 22:46:36.897236928 -0800
@@ -10,23 +10,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-h8300/fcntl.h~O_LARGEFILE-fix include/asm-h8300/fcntl.h
--- 25/include/asm-h8300/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:33.023039760 -0800
+++ 25-akpm/include/asm-h8300/fcntl.h	2004-03-21 22:47:08.332458048 -0800
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		  0100	/* not fcntl */
-#define O_EXCL		  0200	/* not fcntl */
-#define O_NOCTTY	  0400	/* not fcntl */
-#define O_TRUNC		 01000	/* not fcntl */
-#define O_APPEND	 02000
-#define O_NONBLOCK	 04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		010000
-#define FASYNC		020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	040000	/* must be a directory */
-#define O_NOFOLLOW	0100000	/* don't follow links */
-#define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0400000
+#define O_ACCMODE	      0003
+#define O_RDONLY	        00
+#define O_WRONLY	        01
+#define O_RDWR		        02
+#define O_CREAT		      0100	/* not fcntl */
+#define O_EXCL		      0200	/* not fcntl */
+#define O_NOCTTY	      0400	/* not fcntl */
+#define O_TRUNC		     01000	/* not fcntl */
+#define O_APPEND	     02000
+#define O_NONBLOCK	     04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		    010000
+#define FASYNC		    020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	    040000	/* must be a directory */
+#define O_NOFOLLOW	    0100000	/* don't follow links */
+#define O_DIRECT	    0200000	/* direct disk access hint */
+#define O_LARGEFILE	    0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-sparc64/fcntl.h~O_LARGEFILE-fix include/asm-sparc64/fcntl.h
--- 25/include/asm-sparc64/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:33.051035504 -0800
+++ 25-akpm/include/asm-sparc64/fcntl.h	2004-03-21 22:47:34.488481728 -0800
@@ -4,24 +4,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_RDONLY	0x0000
-#define O_WRONLY	0x0001
-#define O_RDWR		0x0002
-#define O_ACCMODE	0x0003
-#define O_NDELAY	0x0004
-#define O_APPEND	0x0008
-#define FASYNC		0x0040	/* fcntl, for BSD compatibility */
-#define O_CREAT		0x0200	/* not fcntl */
-#define O_TRUNC		0x0400	/* not fcntl */
-#define O_EXCL		0x0800	/* not fcntl */
-#define O_SYNC		0x2000
-#define O_NONBLOCK	0x4000
-#define O_NOCTTY	0x8000	/* not fcntl */
-#define O_DIRECTORY	0x10000	/* must be a directory */
-#define O_NOFOLLOW	0x20000	/* don't follow links */
-#define O_LARGEFILE	0x40000
-#define O_DIRECT        0x100000 /* direct disk access hint */
-
+#define O_RDONLY		0x0000
+#define O_WRONLY		0x0001
+#define O_RDWR			0x0002
+#define O_ACCMODE		0x0003
+#define O_NDELAY		0x0004
+#define O_APPEND		0x0008
+#define FASYNC			0x0040	/* fcntl, for BSD compatibility */
+#define O_CREAT			0x0200	/* not fcntl */
+#define O_TRUNC			0x0400	/* not fcntl */
+#define O_EXCL			0x0800	/* not fcntl */
+#define O_SYNC			0x2000
+#define O_NONBLOCK		0x4000
+#define O_NOCTTY		0x8000	/* not fcntl */
+#define O_DIRECTORY		0x10000	/* must be a directory */
+#define O_NOFOLLOW		0x20000	/* don't follow links */
+#define O_LARGEFILE		0x40000
+#define O_DIRECT        	0x100000 /* direct disk access hint */
+#define O_KERNEL_LARGEFILE	0x200000 /* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-arm26/fcntl.h~O_LARGEFILE-fix include/asm-arm26/fcntl.h
--- 25/include/asm-arm26/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:33.079031248 -0800
+++ 25-akpm/include/asm-arm26/fcntl.h	2004-03-21 22:48:00.467532312 -0800
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	 040000	/* must be a directory */
-#define O_NOFOLLOW	0100000	/* don't follow links */
-#define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0400000
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	     040000	/* must be a directory */
+#define O_NOFOLLOW	    0100000	/* don't follow links */
+#define O_DIRECT	    0200000	/* direct disk access hint */
+#define O_LARGEFILE	    0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-cris/fcntl.h~O_LARGEFILE-fix include/asm-cris/fcntl.h
--- 25/include/asm-cris/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:33.109026688 -0800
+++ 25-akpm/include/asm-cris/fcntl.h	2004-03-21 22:48:37.901841432 -0800
@@ -5,23 +5,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get f_flags */
diff -puN include/asm-v850/fcntl.h~O_LARGEFILE-fix include/asm-v850/fcntl.h
--- 25/include/asm-v850/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:33.139022128 -0800
+++ 25-akpm/include/asm-v850/fcntl.h	2004-03-21 22:49:23.909847152 -0800
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		  0100	/* not fcntl */
-#define O_EXCL		  0200	/* not fcntl */
-#define O_NOCTTY	  0400	/* not fcntl */
-#define O_TRUNC		 01000	/* not fcntl */
-#define O_APPEND	 02000
-#define O_NONBLOCK	 04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		010000
-#define FASYNC		020000	/* fcntl, for BSD compatibility */
-#define O_DIRECTORY	040000	/* must be a directory */
-#define O_NOFOLLOW     0100000	/* don't follow links */
-#define O_DIRECT       0200000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE    0400000
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	     O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECTORY	     040000	/* must be a directory */
+#define O_NOFOLLOW          0100000	/* don't follow links */
+#define O_DIRECT            0200000	/* direct disk access hint */
+#define O_LARGEFILE         0400000
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN include/asm-sh/fcntl.h~O_LARGEFILE-fix include/asm-sh/fcntl.h
--- 25/include/asm-sh/fcntl.h~O_LARGEFILE-fix	2004-03-21 22:36:33.168017720 -0800
+++ 25-akpm/include/asm-sh/fcntl.h	2004-03-21 22:49:56.544885872 -0800
@@ -3,23 +3,24 @@
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint - currently ignored */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
+#define O_ACCMODE	       0003
+#define O_RDONLY	         00
+#define O_WRONLY	         01
+#define O_RDWR		         02
+#define O_CREAT		       0100	/* not fcntl */
+#define O_EXCL		       0200	/* not fcntl */
+#define O_NOCTTY	       0400	/* not fcntl */
+#define O_TRUNC		      01000	/* not fcntl */
+#define O_APPEND	      02000
+#define O_NONBLOCK	      04000
+#define O_NDELAY	    O_NONBLOCK
+#define O_SYNC		     010000
+#define FASYNC		     020000	/* fcntl, for BSD compatibility */
+#define O_DIRECT	     040000	/* direct disk access hint */
+#define O_LARGEFILE	    0100000
+#define O_DIRECTORY	    0200000	/* must be a directory */
+#define O_NOFOLLOW	    0400000	/* don't follow links */
+#define O_KERNEL_LARGEFILE 01000000	/* kernel-internal large file hint */
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
diff -puN fs/xfs/linux/xfs_file.c~O_LARGEFILE-fix fs/xfs/linux/xfs_file.c
--- 25/fs/xfs/linux/xfs_file.c~O_LARGEFILE-fix	2004-03-21 22:36:33.184015288 -0800
+++ 25-akpm/fs/xfs/linux/xfs_file.c	2004-03-21 22:50:24.923571656 -0800
@@ -276,7 +276,8 @@ linvfs_open(
 	vnode_t		*vp = LINVFS_GET_VP(inode);
 	int		error;
 
-	if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
+	if (!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) &&
+			i_size_read(inode) > MAX_NON_LFS)
 		return -EFBIG;
 
 	ASSERT(vp);
diff -puN fs/xfs/linux/xfs_ioctl.c~O_LARGEFILE-fix fs/xfs/linux/xfs_ioctl.c
--- 25/fs/xfs/linux/xfs_ioctl.c~O_LARGEFILE-fix	2004-03-21 22:36:33.200012856 -0800
+++ 25-akpm/fs/xfs/linux/xfs_ioctl.c	2004-03-21 22:50:35.833913032 -0800
@@ -326,7 +326,7 @@ xfs_open_by_handle(
 	}
 
 #if BITS_PER_LONG != 32
-	hreq.oflags |= O_LARGEFILE;
+	hreq.oflags |= O_KERNEL_LARGEFILE;
 #endif
 	/* Put open permission in namei format. */
 	permflag = hreq.oflags;
diff -puN fs/nfsd/vfs.c~O_LARGEFILE-fix fs/nfsd/vfs.c
--- 25/fs/nfsd/vfs.c~O_LARGEFILE-fix	2004-03-21 22:36:33.217010272 -0800
+++ 25-akpm/fs/nfsd/vfs.c	2004-03-21 22:51:02.437868616 -0800
@@ -455,7 +455,7 @@ nfsd_open(struct svc_rqst *rqstp, struct
 {
 	struct dentry	*dentry;
 	struct inode	*inode;
-	int		flags = O_RDONLY|O_LARGEFILE, err;
+	int		flags = O_RDONLY|O_KERNEL_LARGEFILE, err;
 
 	/*
 	 * If we get here, then the client has already done an "open",
@@ -491,7 +491,7 @@ nfsd_open(struct svc_rqst *rqstp, struct
 		if (err)
 			goto out_nfserr;
 
-		flags = O_WRONLY|O_LARGEFILE;
+		flags = O_WRONLY|O_KERNEL_LARGEFILE;
 
 		DQUOT_INIT(inode);
 	}
diff -puN fs/cifs/file.c~O_LARGEFILE-fix fs/cifs/file.c
diff -puN fs/udf/file.c~O_LARGEFILE-fix fs/udf/file.c
--- 25/fs/udf/file.c~O_LARGEFILE-fix	2004-03-21 22:36:33.270002216 -0800
+++ 25-akpm/fs/udf/file.c	2004-03-21 22:51:59.948125728 -0800
@@ -262,14 +262,15 @@ static int udf_release_file(struct inode
  *
  * DESCRIPTION
  *  Use this to disallow opening RW large files on 32 bit systems.
- *  On 64 bit systems we force on O_LARGEFILE in sys_open.
+ *  On 64 bit systems we force on O_KERNEL_LARGEFILE in sys_open.
  *
  * HISTORY
  *
  */
 static int udf_open_file(struct inode * inode, struct file * filp)
 {
-	if ((inode->i_size & 0xFFFFFFFF80000000ULL) && !(filp->f_flags & O_LARGEFILE))
+	if ((inode->i_size & 0xFFFFFFFF80000000ULL) &&
+			!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)))
 		return -EFBIG;
 	return 0;
 }
diff -puN fs/ncpfs/file.c~O_LARGEFILE-fix fs/ncpfs/file.c
--- 25/fs/ncpfs/file.c~O_LARGEFILE-fix	2004-03-21 22:36:33.290999024 -0800
+++ 25-akpm/fs/ncpfs/file.c	2004-03-21 22:52:28.007860000 -0800
@@ -213,7 +213,8 @@ ncp_file_write(struct file *file, const 
 		pos = inode->i_size;
 	}
 
-	if (pos + count > MAX_NON_LFS && !(file->f_flags&O_LARGEFILE)) {
+	if (pos + count > MAX_NON_LFS &&
+	    !(file->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE))) {
 		if (pos >= MAX_NON_LFS) {
 			send_sig(SIGXFSZ, current, 0);
 			return -EFBIG;
diff -puN fs/open.c~O_LARGEFILE-fix fs/open.c
--- 25/fs/open.c~O_LARGEFILE-fix	2004-03-21 22:36:33.310995984 -0800
+++ 25-akpm/fs/open.c	2004-03-21 22:53:52.105075280 -0800
@@ -279,7 +279,7 @@ static inline long do_sys_ftruncate(unsi
 		goto out;
 
 	/* explicitly opened as large or we are on 64-bit box */
-	if (file->f_flags & O_LARGEFILE)
+	if (file->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE))
 		small = 0;
 
 	dentry = file->f_dentry;
@@ -931,7 +931,7 @@ asmlinkage long sys_open(const char __us
 	int fd, error;
 
 #if BITS_PER_LONG != 32
-	flags |= O_LARGEFILE;
+	flags |= O_KERNEL_LARGEFILE;
 #endif
 	tmp = getname(filename);
 	fd = PTR_ERR(tmp);
@@ -1046,14 +1046,14 @@ asmlinkage long sys_vhangup(void)
 /*
  * Called when an inode is about to be open.
  * We use this to disallow opening large files on 32bit systems if
- * the caller didn't specify O_LARGEFILE.  On 64bit systems we force
- * on this flag in sys_open.
+ * the caller didn't specify O_LARGEFILE or O_KERNEL_LARGEFILE.  On 64bit
+ * systems we force on O_KERNEL_LARGEFILE in sys_open.
  */
 int generic_file_open(struct inode * inode, struct file * filp)
 {
-	if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
+	if (!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) &&
+				i_size_read(inode) > MAX_NON_LFS)
 		return -EFBIG;
 	return 0;
 }
-
 EXPORT_SYMBOL(generic_file_open);
diff -puN fs/ext3/file.c~O_LARGEFILE-fix fs/ext3/file.c
--- 25/fs/ext3/file.c~O_LARGEFILE-fix	2004-03-21 22:36:33.328993248 -0800
+++ 25-akpm/fs/ext3/file.c	2004-03-21 22:54:25.683970512 -0800
@@ -44,12 +44,12 @@ static int ext3_release_file (struct ino
 /*
  * Called when an inode is about to be opened.
  * We use this to disallow opening RW large files on 32bit systems if
- * the caller didn't specify O_LARGEFILE.  On 64bit systems we force
- * on this flag in sys_open.
+ * the caller didn't specify O_LARGEFILE or O_KERNEL_LARGEFILE.  On 64bit
+ * systems we force on O_KERNEL_LARGEFILE in sys_open.
  */
 static int ext3_open_file (struct inode *inode, struct file *filp)
 {
-	if (!(filp->f_flags & O_LARGEFILE) &&
+	if (!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) &&
 	    inode->i_size > 0x7FFFFFFFLL)
 		return -EFBIG;
 	return 0;
diff -puN fs/exec.c~O_LARGEFILE-fix fs/exec.c
--- 25/fs/exec.c~O_LARGEFILE-fix	2004-03-21 22:36:33.354989296 -0800
+++ 25-akpm/fs/exec.c	2004-03-21 22:55:33.016734376 -0800
@@ -1387,7 +1387,8 @@ int do_coredump(long signr, int exit_cod
 		goto fail_unlock;
 
  	format_corename(corename, core_pattern, signr);
-	file = filp_open(corename, O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE, 0600);
+	file = filp_open(corename,
+			O_CREAT|O_RDWR|O_NOFOLLOW|O_KERNEL_LARGEFILE, 0600);
 	if (IS_ERR(file))
 		goto fail_unlock;
 	inode = file->f_dentry->d_inode;
diff -puN fs/block_dev.c~O_LARGEFILE-fix fs/block_dev.c
--- 25/fs/block_dev.c~O_LARGEFILE-fix	2004-03-21 22:36:33.375986104 -0800
+++ 25-akpm/fs/block_dev.c	2004-03-21 22:55:40.934530688 -0800
@@ -679,7 +679,7 @@ int blkdev_open(struct inode * inode, st
 	 * binary needs it. We might want to drop this workaround
 	 * during an unstable branch.
 	 */
-	filp->f_flags |= O_LARGEFILE;
+	filp->f_flags |= O_KEREL_LARGEFILE;
 
 	bdev = bd_acquire(inode);
 
diff -puN mm/filemap.c~O_LARGEFILE-fix mm/filemap.c
--- 25/mm/filemap.c~O_LARGEFILE-fix	2004-03-21 22:36:33.408981088 -0800
+++ 25-akpm/mm/filemap.c	2004-03-21 22:56:09.042257664 -0800
@@ -1668,7 +1668,7 @@ inline int generic_write_checks(struct f
 	 * LFS rule
 	 */
 	if (unlikely(*pos + *count > MAX_NON_LFS &&
-				!(file->f_flags & O_LARGEFILE))) {
+	    !(file->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)))) {
 		if (*pos >= MAX_NON_LFS) {
 			send_sig(SIGXFSZ, current, 0);
 			return -EFBIG;
diff -puN fs/fcntl.c~O_LARGEFILE-fix fs/fcntl.c
--- 25/fs/fcntl.c~O_LARGEFILE-fix	2004-03-21 22:56:12.073796800 -0800
+++ 25-akpm/fs/fcntl.c	2004-03-21 22:56:27.551443840 -0800
@@ -300,7 +300,7 @@ static long do_fcntl(unsigned int fd, un
 			set_close_on_exec(fd, arg & FD_CLOEXEC);
 			break;
 		case F_GETFL:
-			err = filp->f_flags;
+			err = filp->f_flags & ~O_KERNEL_LARGEFILE;
 			break;
 		case F_SETFL:
 			err = setfl(fd, filp, arg);

_


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance
  2004-03-22  7:04     ` Ulrich Drepper
@ 2004-03-22  7:09       ` Andi Kleen
  0 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2004-03-22  7:09 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: akpm, marcelo.tosatti, linux-kernel

On Sun, 21 Mar 2004 23:04:44 -0800
Ulrich Drepper <drepper@redhat.com> wrote:

> Andi Kleen wrote:
> 
> > No, because O_LARGEFILE is not part of POSIX :-) (they use open64 etc.)
> 
> What are you talking about?  Neither O_LARGEFILE nor open64 is in POSIX.
>  But both are in the LFS extensions.
> 
> This whole change seems dubious at best.  Who has argued that
> O_LARGEFILE mustn't be returned?  I do not agree at all.  If the test
> suite checks this the author must defend the position.

I complained to this to the Austin group people at that point
and Andrew Josey told me that the issue has been discussed and the comittee
ruled that the Linux behaviour was not compliant I didn't inquire about the details
(standardeese bores me), ask him himself.

> I suggest to not make any changes.  It is perfectly OK to define new O_
> flags and the open() specification does not require that none of them
> must set implicitly.

Just the LSB test suite won't pass then.

-Andi

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-03-22  7:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-22  4:13 [PATCH] Drop O_LARGEFILE from F_GETFL for POSIX compliance Andi Kleen
2004-03-22  4:29 ` Nicholas Miell
2004-03-22  4:34 ` Andrea Arcangeli
2004-03-22  4:45   ` Andi Kleen
2004-03-22  5:07     ` Andrea Arcangeli
2004-03-22  5:39 ` Andrew Morton
2004-03-22  6:14   ` Andi Kleen
2004-03-22  7:04     ` Ulrich Drepper
2004-03-22  7:09       ` Andi Kleen
2004-03-22  7:08     ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.