1 diff -Naur linux/arch/alpha/kernel/entry.S linux-p/arch/alpha/kernel/entry.S
2 --- linux/arch/alpha/kernel/entry.S Fri Nov 2 17:39:05 2001
3 +++ linux-p/arch/alpha/kernel/entry.S Mon Jan 14 23:01:48 2002
8 -#define NR_SYSCALLS 377
9 +#define NR_SYSCALLS 378
12 * These offsets must match with alpha_mv in <asm/machvec.h>.
15 .quad sys_ni_syscall /* 375 */
16 .quad sys_pciconfig_iobase
17 + .quad sys_getdents64
18 diff -Naur linux/arch/alpha/kernel/osf_sys.c linux-p/arch/alpha/kernel/osf_sys.c
19 --- linux/arch/alpha/kernel/osf_sys.c Sun Mar 25 18:37:29 2001
20 +++ linux-p/arch/alpha/kernel/osf_sys.c Mon Jan 14 23:01:48 2002
25 -static int osf_filldir(void *__buf, const char *name, int namlen, off_t offset, ino_t ino)
26 +static int osf_filldir(void *__buf, const char *name, int namlen, off_t offset, ino_t ino, unsigned int d_type)
28 struct osf_dirent *dirent;
29 struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf;
30 diff -Naur linux/arch/i386/kernel/entry.S linux-p/arch/i386/kernel/entry.S
31 --- linux/arch/i386/kernel/entry.S Fri Nov 2 17:39:05 2001
32 +++ linux-p/arch/i386/kernel/entry.S Mon Jan 14 23:01:48 2002
34 .long SYMBOL_NAME(sys_ni_syscall) /* streams1 */
35 .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */
36 .long SYMBOL_NAME(sys_vfork) /* 190 */
37 + .long SYMBOL_NAME(sys_ni_syscall) /* getrlimit */
38 + .long SYMBOL_NAME(sys_mmap2) /* 192 */
39 + .long SYMBOL_NAME(sys_truncate64) /* 193 */
40 + .long SYMBOL_NAME(sys_ftruncate64) /* 194 */
41 + .long SYMBOL_NAME(sys_stat64) /* 195 */
42 + .long SYMBOL_NAME(sys_lstat64) /* 196 */
43 + .long SYMBOL_NAME(sys_fstat64) /* 197 */
45 + .long SYMBOL_NAME(sys_ni_syscall)
47 + .long SYMBOL_NAME(sys_getdents64) /* 220 */
48 + .long SYMBOL_NAME(sys_fcntl64) /* 221 */
51 * NOTE!! This doesn't have to be exact - we just have
53 * entries. Don't panic if you notice that this hasn't
54 * been shrunk every time we add a new system call.
56 - .rept NR_syscalls-190
57 + .rept NR_syscalls-221
58 .long SYMBOL_NAME(sys_ni_syscall)
60 diff -Naur linux/arch/i386/kernel/sys_i386.c linux-p/arch/i386/kernel/sys_i386.c
61 --- linux/arch/i386/kernel/sys_i386.c Sun Mar 25 18:31:45 2001
62 +++ linux-p/arch/i386/kernel/sys_i386.c Mon Jan 14 23:01:48 2002
67 +/* common code for old and new mmaps */
68 +static inline long do_mmap2(
69 + unsigned long addr, unsigned long len,
70 + unsigned long prot, unsigned long flags,
71 + unsigned long fd, unsigned long pgoff)
74 + struct file * file = NULL;
76 + down(¤t->mm->mmap_sem);
79 + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
80 + if (!(flags & MAP_ANONYMOUS)) {
86 + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
92 + up(¤t->mm->mmap_sem);
96 +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
97 + unsigned long prot, unsigned long flags,
98 + unsigned long fd, unsigned long pgoff)
100 + return do_mmap2(addr, len, prot, flags, fd, pgoff);
104 * Perform the select(nd, in, out, ex, tv) and mmap() system
105 * calls. Linux/i386 didn't use to be able to handle more than
108 asmlinkage int old_mmap(struct mmap_arg_struct *arg)
110 - int error = -EFAULT;
111 - struct file * file = NULL;
112 struct mmap_arg_struct a;
115 if (copy_from_user(&a, arg, sizeof(a)))
119 - down(¤t->mm->mmap_sem);
121 - if (!(a.flags & MAP_ANONYMOUS)) {
127 - a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
129 + if (a.offset & ~PAGE_MASK)
132 - error = do_mmap(file, a.addr, a.len, a.prot, a.flags, a.offset);
135 + err = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
138 - up(¤t->mm->mmap_sem);
143 extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
144 diff -Naur linux/arch/mips/kernel/sysirix.c linux-p/arch/mips/kernel/sysirix.c
145 --- linux/arch/mips/kernel/sysirix.c Sun Mar 25 18:31:48 2001
146 +++ linux-p/arch/mips/kernel/sysirix.c Mon Jan 14 23:01:48 2002
147 @@ -1984,7 +1984,7 @@
148 #define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
150 static int irix_filldir32(void *__buf, const char *name, int namlen,
151 - off_t offset, ino_t ino)
152 + off_t offset, ino_t ino, unsigned int d_type)
154 struct irix_dirent32 *dirent;
155 struct irix_dirent32_callback *buf =
156 @@ -2097,7 +2097,7 @@
157 #define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
159 static int irix_filldir64(void * __buf, const char * name, int namlen,
160 - off_t offset, ino_t ino)
161 + off_t offset, ino_t ino, unsigned int d_type)
163 struct irix_dirent64 *dirent;
164 struct irix_dirent64_callback * buf =
165 diff -Naur linux/arch/ppc/kernel/misc.S linux-p/arch/ppc/kernel/misc.S
166 --- linux/arch/ppc/kernel/misc.S Sun Mar 25 18:37:30 2001
167 +++ linux-p/arch/ppc/kernel/misc.S Mon Jan 14 23:01:48 2002
172 - .long sys_mmap /* 90 */
173 + .long old_mmap /* 90 */
177 @@ -1058,18 +1058,20 @@
178 .long sys_ni_syscall /* streams1 */
179 .long sys_ni_syscall /* streams2 */
181 - .long sys_ni_syscall /* 190 */ /* MacOnLinux - old */
182 + .long sys_ni_syscall /* 190 getrlimit */
183 .long sys_ni_syscall /* 191 */ /* Unused */
184 - .long sys_ni_syscall /* 192 - reserved - mmap2 */
185 - .long sys_ni_syscall /* 193 - reserved - truncate64 */
186 - .long sys_ni_syscall /* 194 - reserved - ftruncate64 */
187 - .long sys_ni_syscall /* 195 - reserved - stat64 */
188 - .long sys_ni_syscall /* 196 - reserved - lstat64 */
189 - .long sys_ni_syscall /* 197 - reserved - fstat64 */
190 + .long sys_mmap2 /* 192 */
191 + .long sys_truncate64 /* 193 */
192 + .long sys_ftruncate64 /* 194 */
193 + .long sys_stat64 /* 195 */
194 + .long sys_lstat64 /* 196 */
195 + .long sys_fstat64 /* 197 */
196 .long sys_pciconfig_read /* 198 */
197 .long sys_pciconfig_write /* 199 */
198 .long sys_pciconfig_iobase /* 200 */
199 .long sys_ni_syscall /* 201 - reserved - MacOnLinux - new */
200 - .rept NR_syscalls-201
201 + .long sys_getdents64 /* 202 */
202 + .long sys_fcntl64 /* 203 */
203 + .rept NR_syscalls-203
206 diff -Naur linux/arch/ppc/kernel/syscalls.c linux-p/arch/ppc/kernel/syscalls.c
207 --- linux/arch/ppc/kernel/syscalls.c Sun Mar 25 18:31:49 2001
208 +++ linux-p/arch/ppc/kernel/syscalls.c Mon Jan 14 23:01:48 2002
210 #include <linux/sys.h>
211 #include <linux/ipc.h>
212 #include <linux/utsname.h>
213 +#include <linux/file.h>
215 #include <asm/uaccess.h>
217 @@ -192,25 +193,55 @@
221 -asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
222 - unsigned long prot, unsigned long flags,
223 - unsigned long fd, off_t offset)
224 +/* common code for old and new mmaps */
225 +static inline long do_mmap2(
226 + unsigned long addr, unsigned long len,
227 + unsigned long prot, unsigned long flags,
228 + unsigned long fd, unsigned long pgoff)
230 struct file * file = NULL;
233 down(¤t->mm->mmap_sem);
236 if (!(flags & MAP_ANONYMOUS)) {
237 - if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
244 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
245 - ret = do_mmap(file, addr, len, prot, flags, offset);
247 + ret = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
253 up(¤t->mm->mmap_sem);
258 +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
259 + unsigned long prot, unsigned long flags,
260 + unsigned long fd, unsigned long pgoff)
262 + return do_mmap2(addr, len, prot, flags, fd, pgoff);
265 +asmlinkage unsigned long old_mmap(unsigned long addr, size_t len,
266 + unsigned long prot, unsigned long flags,
267 + unsigned long fd, off_t offset)
272 + if (offset & ~PAGE_MASK)
275 + ret = do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
281 diff -Naur linux/arch/sparc/kernel/sys_sparc.c linux-p/arch/sparc/kernel/sys_sparc.c
282 --- linux/arch/sparc/kernel/sys_sparc.c Sun Mar 25 18:31:46 2001
283 +++ linux-p/arch/sparc/kernel/sys_sparc.c Mon Jan 14 23:01:48 2002
287 /* Linux version of mmap */
288 -asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
289 +asmlinkage unsigned long do_mmap2(unsigned long addr, unsigned long len,
290 unsigned long prot, unsigned long flags, unsigned long fd,
292 + unsigned long pgoff)
294 struct file * file = NULL;
295 unsigned long retval = -EBADF;
299 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
300 - retval = do_mmap(file, addr, len, prot, flags, off);
301 + retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
307 up(¤t->mm->mmap_sem);
311 +asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
312 + unsigned long prot, unsigned long flags, unsigned long fd,
313 + unsigned long pgoff)
315 + /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
317 + return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12));
320 +asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
321 + unsigned long prot, unsigned long flags, unsigned long fd,
324 + return do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
327 /* we come to here via sys_nis_syscall so it can setup the regs argument */
328 diff -Naur linux/arch/sparc/kernel/sys_sunos.c linux-p/arch/sparc/kernel/sys_sunos.c
329 --- linux/arch/sparc/kernel/sys_sunos.c Sun Mar 25 18:37:30 2001
330 +++ linux-p/arch/sparc/kernel/sys_sunos.c Mon Jan 14 23:01:48 2002
332 #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
334 static int sunos_filldir(void * __buf, const char * name, int namlen,
335 - off_t offset, ino_t ino)
336 + off_t offset, ino_t ino, unsigned int d_type)
338 struct sunos_dirent * dirent;
339 struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf;
343 static int sunos_filldirentry(void * __buf, const char * name, int namlen,
344 - off_t offset, ino_t ino)
345 + off_t offset, ino_t ino, unsigned int d_type)
347 struct sunos_direntry * dirent;
348 struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf;
349 diff -Naur linux/arch/sparc/kernel/systbls.S linux-p/arch/sparc/kernel/systbls.S
350 --- linux/arch/sparc/kernel/systbls.S Sun Mar 25 18:37:30 2001
351 +++ linux-p/arch/sparc/kernel/systbls.S Mon Jan 14 23:01:48 2002
353 /*40*/ .long sys_newlstat, sys_dup, sys_pipe, sys_times, sys_lfs_syscall
354 /*45*/ .long sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
355 /*50*/ .long sys_getegid, sys_acct, sys_nis_syscall, sys_nis_syscall, sys_ioctl
356 -/*55*/ .long sys_reboot, sys_lfs_syscall, sys_symlink, sys_readlink, sys_execve
357 -/*60*/ .long sys_umask, sys_chroot, sys_newfstat, sys_lfs_syscall, sys_getpagesize
358 +/*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve
359 +/*60*/ .long sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize
360 /*65*/ .long sys_msync, sys_vfork, sys_pread, sys_pwrite, sys_nis_syscall
361 /*70*/ .long sys_nis_syscall, sys_mmap, sys_nis_syscall, sys_munmap, sys_mprotect
362 -/*75*/ .long sys_nis_syscall, sys_vhangup, sys_lfs_syscall, sys_nis_syscall, sys_getgroups
363 -/*80*/ .long sys_setgroups, sys_getpgrp, sys_nis_syscall, sys_setitimer, sys_lfs_syscall
364 +/*75*/ .long sys_nis_syscall, sys_vhangup, sys_truncate64, sys_nis_syscall, sys_getgroups
365 +/*80*/ .long sys_setgroups, sys_getpgrp, sys_nis_syscall, sys_setitimer, sys_ftruncate64
366 /*85*/ .long sys_swapon, sys_getitimer, sys_nis_syscall, sys_sethostname, sys_nis_syscall
367 /*90*/ .long sys_dup2, sys_nis_syscall, sys_fcntl, sys_select, sys_nis_syscall
368 /*95*/ .long sys_fsync, sys_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
370 /*115*/ .long sys_nis_syscall, sys_gettimeofday, sys_getrusage, sys_nis_syscall, sys_getcwd
371 /*120*/ .long sys_readv, sys_writev, sys_settimeofday, sys_fchown, sys_fchmod
372 /*125*/ .long sys_nis_syscall, sys_setreuid, sys_setregid, sys_rename, sys_truncate
373 -/*130*/ .long sys_ftruncate, sys_flock, sys_lfs_syscall, sys_nis_syscall, sys_nis_syscall
374 -/*135*/ .long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_lfs_syscall
375 +/*130*/ .long sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall
376 +/*135*/ .long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64
377 /*140*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_getrlimit
378 /*145*/ .long sys_setrlimit, sys_nis_syscall, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
379 -/*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_lfs_syscall
380 -/*155*/ .long sys_lfs_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
381 +/*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
382 +/*155*/ .long sys_fcntl64, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
383 /*160*/ .long sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall
384 /*165*/ .long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall
385 /*170*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_getdents
386 diff -Naur linux/arch/sparc64/kernel/sparc64_ksyms.c linux-p/arch/sparc64/kernel/sparc64_ksyms.c
387 --- linux/arch/sparc64/kernel/sparc64_ksyms.c Fri Nov 2 17:39:06 2001
388 +++ linux-p/arch/sparc64/kernel/sparc64_ksyms.c Mon Jan 14 23:01:48 2002
390 extern int sys32_ioctl(unsigned int fd, unsigned int cmd, u32 arg);
391 extern int (*handle_mathemu)(struct pt_regs *, struct fpustate *);
392 extern void VISenter(void);
393 +extern long sparc32_open(const char * filename, int flags, int mode);
394 extern int io_remap_page_range(unsigned long from, unsigned long offset, unsigned long size, pgprot_t prot, int space);
396 extern void bcopy (const char *, char *, int);
398 EXPORT_SYMBOL(prom_cpu_nodes);
399 EXPORT_SYMBOL(sys_ioctl);
400 EXPORT_SYMBOL(sys32_ioctl);
401 +EXPORT_SYMBOL(sparc32_open);
402 EXPORT_SYMBOL(move_addr_to_kernel);
403 EXPORT_SYMBOL(move_addr_to_user);
405 diff -Naur linux/arch/sparc64/kernel/sys32.S linux-p/arch/sparc64/kernel/sys32.S
406 --- linux/arch/sparc64/kernel/sys32.S Sun Mar 25 18:31:53 2001
407 +++ linux-p/arch/sparc64/kernel/sys32.S Mon Jan 14 23:01:48 2002
409 sethi %hi(sys_bdflush), %g1
410 jmpl %g1 + %lo(sys_bdflush), %g0
417 + sethi %hi(sys_mmap), %g1
419 + jmpl %g1 + %lo(sys_mmap), %g0
421 diff -Naur linux/arch/sparc64/kernel/sys_sparc32.c linux-p/arch/sparc64/kernel/sys_sparc32.c
422 --- linux/arch/sparc64/kernel/sys_sparc32.c Fri Nov 2 17:39:06 2001
423 +++ linux-p/arch/sparc64/kernel/sys_sparc32.c Mon Jan 14 23:01:48 2002
424 @@ -600,15 +600,27 @@
425 old_fs = get_fs(); set_fs (KERNEL_DS);
426 ret = sys_fcntl(fd, cmd, (unsigned long)&f);
428 + if (ret) return ret;
429 + if (f.l_start >= 0x7fffffffUL ||
430 + f.l_len >= 0x7fffffffUL ||
431 + f.l_start + f.l_len >= 0x7fffffffUL)
433 if(put_flock(&f, (struct flock32 *)arg))
439 return sys_fcntl(fd, cmd, (unsigned long)arg);
443 +asmlinkage long sys32_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg)
445 + if (cmd >= F_GETLK64 && cmd <= F_SETLKW64)
446 + return sys_fcntl(fd, cmd + F_GETLK - F_GETLK64, arg);
447 + return sys32_fcntl(fd, cmd, arg);
451 __u32 dqb_bhardlimit;
452 __u32 dqb_bsoftlimit;
457 +extern asmlinkage long sys_truncate(const char * path, unsigned long length);
458 +extern asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
460 +asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low)
465 + return sys_truncate(path, (high << 32) | low);
468 +asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
473 + return sys_ftruncate(fd, (high << 32) | low);
476 extern asmlinkage int sys_utime(char * filename, struct utimbuf * times);
482 static int fillonedir(void * __buf, const char * name, int namlen,
483 - off_t offset, ino_t ino)
484 + off_t offset, ino_t ino, unsigned int d_type)
486 struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
487 struct old_linux_dirent32 * dirent;
492 -static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino)
493 +static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino,
494 + unsigned int d_type)
496 struct linux_dirent32 * dirent;
497 struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
498 @@ -4049,6 +4081,39 @@
504 +/* This is just a version for 32-bit applications which does
505 + * not force O_LARGEFILE on.
508 +asmlinkage long sparc32_open(const char * filename, int flags, int mode)
513 + tmp = getname(filename);
515 + if (!IS_ERR(tmp)) {
517 + fd = get_unused_fd();
519 + struct file * f = filp_open(tmp, flags, mode);
520 + error = PTR_ERR(f);
537 /* Handle adjtimex compatability. */
538 diff -Naur linux/arch/sparc64/kernel/sys_sunos32.c linux-p/arch/sparc64/kernel/sys_sunos32.c
539 --- linux/arch/sparc64/kernel/sys_sunos32.c Sun Mar 25 18:37:30 2001
540 +++ linux-p/arch/sparc64/kernel/sys_sunos32.c Mon Jan 14 23:01:48 2002
542 #define ROUND_UP(x) (((x)+sizeof(s32)-1) & ~(sizeof(s32)-1))
544 static int sunos_filldir(void * __buf, const char * name, int namlen,
545 - off_t offset, ino_t ino)
546 + off_t offset, ino_t ino, unsigned int d_type)
548 struct sunos_dirent * dirent;
549 struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf;
553 static int sunos_filldirentry(void * __buf, const char * name, int namlen,
554 - off_t offset, ino_t ino)
555 + off_t offset, ino_t ino, unsigned int d_type)
557 struct sunos_direntry * dirent;
558 struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf;
559 @@ -1297,13 +1297,15 @@
563 +extern asmlinkage long sparc32_open(const char * filename, int flags, int mode);
565 asmlinkage int sunos_open(u32 filename, int flags, int mode)
570 current->personality |= PER_BSD;
571 - ret = sys_open ((char *)A(filename), flags, mode);
572 + ret = sparc32_open ((char *)A(filename), flags, mode);
576 diff -Naur linux/arch/sparc64/kernel/systbls.S linux-p/arch/sparc64/kernel/systbls.S
577 --- linux/arch/sparc64/kernel/systbls.S Sun Mar 25 18:37:30 2001
578 +++ linux-p/arch/sparc64/kernel/systbls.S Mon Jan 14 23:01:48 2002
580 .globl sys_call_table32
582 /*0*/ .word sys_nis_syscall, sparc_exit, sys_fork, sys_read, sys_write
583 -/*5*/ .word sys_open, sys_close, sys32_wait4, sys_creat, sys_link
584 +/*5*/ .word sparc32_open, sys_close, sys32_wait4, sys_creat, sys_link
585 /*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod
586 /*15*/ .word sys32_chmod, sys32_lchown16, sparc_brk, sys_perfctr, sys32_lseek
587 /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid
589 /*40*/ .word sys32_newlstat, sys_dup, sys_pipe, sys32_times, sys_lfs_syscall
590 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
591 /*50*/ .word sys_getegid, sys_acct, sys_nis_syscall, sys_nis_syscall, sys32_ioctl
592 - .word sys_reboot, sys_lfs_syscall, sys_symlink, sys_readlink, sys32_execve
593 -/*60*/ .word sys_umask, sys_chroot, sys32_newfstat, sys_lfs_syscall, sys_getpagesize
594 + .word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve
595 +/*60*/ .word sys_umask, sys_chroot, sys32_newfstat, sys_fstat64, sys_getpagesize
596 .word sys_msync, sys_vfork, sys32_pread, sys32_pwrite, sys_nis_syscall
597 /*70*/ .word sys_nis_syscall, sys32_mmap, sys_nis_syscall, sys_munmap, sys_mprotect
598 - .word sys_nis_syscall, sys_vhangup, sys_lfs_syscall, sys_nis_syscall, sys32_getgroups
599 -/*80*/ .word sys32_setgroups, sys_getpgrp, sys_nis_syscall, sys32_setitimer, sys_lfs_syscall
600 + .word sys_nis_syscall, sys_vhangup, sys32_truncate64, sys_nis_syscall, sys32_getgroups
601 +/*80*/ .word sys32_setgroups, sys_getpgrp, sys_nis_syscall, sys32_setitimer, sys32_ftruncate64
602 .word sys_swapon, sys32_getitimer, sys_nis_syscall, sys_sethostname, sys_nis_syscall
603 /*90*/ .word sys_dup2, sys_nis_syscall, sys32_fcntl, sys32_select, sys_nis_syscall
604 .word sys_fsync, sys_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
606 .word sys_nis_syscall, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd
607 /*120*/ .word sys32_readv, sys32_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod
608 .word sys_nis_syscall, sys32_setreuid, sys32_setregid, sys_rename, sys_truncate
609 -/*130*/ .word sys_ftruncate, sys_flock, sys_lfs_syscall, sys_nis_syscall, sys_nis_syscall
610 - .word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_lfs_syscall
611 +/*130*/ .word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall
612 + .word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64
613 /*140*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_getrlimit
614 .word sys32_setrlimit, sys_nis_syscall, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
615 -/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_lfs_syscall
616 - .word sys_lfs_syscall, sys_nis_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount
617 +/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
618 + .word sys32_fcntl64, sys_nis_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount
619 /*160*/ .word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall
620 .word sys32_quotactl, sys_nis_syscall, sys32_mount, sys_ustat, sys_nis_syscall
621 /*170*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_getdents
623 .word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_nis_syscall
624 /*140*/ .word sys_nis_syscall, sys_getpeername, sys_nis_syscall, sys_nis_syscall, sys_getrlimit
625 .word sys_setrlimit, sys_nis_syscall, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
626 -/*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_nis_syscall
627 +/*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
628 .word sys_nis_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
629 /*160*/ .word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_utrap_install
630 .word sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall
631 diff -Naur linux/arch/sparc64/solaris/fs.c linux-p/arch/sparc64/solaris/fs.c
632 --- linux/arch/sparc64/solaris/fs.c Sun Mar 25 18:31:53 2001
633 +++ linux-p/arch/sparc64/solaris/fs.c Mon Jan 14 23:01:48 2002
634 @@ -572,20 +572,20 @@
638 +extern asmlinkage long sparc32_open(const char * filename, int flags, int mode);
640 asmlinkage int solaris_open(u32 filename, int flags, u32 mode)
642 - int (*sys_open)(const char *,int,int) =
643 - (int (*)(const char *,int,int))SYS(open);
644 int fl = flags & 0xf;
646 -/* if (flags & 0x2000) - allow LFS */
647 + if (flags & 0x2000) fl |= O_LARGEFILE;
648 if (flags & 0x8050) fl |= O_SYNC;
649 if (flags & 0x80) fl |= O_NONBLOCK;
650 if (flags & 0x100) fl |= O_CREAT;
651 if (flags & 0x200) fl |= O_TRUNC;
652 if (flags & 0x400) fl |= O_EXCL;
653 if (flags & 0x800) fl |= O_NOCTTY;
654 - return sys_open((const char *)A(filename), fl, mode);
655 + return sparc32_open((const char *)A(filename), fl, mode);
658 #define SOL_F_SETLK 6
659 diff -Naur linux/drivers/block/loop.c linux-p/drivers/block/loop.c
660 --- linux/drivers/block/loop.c Mon Jan 14 22:59:25 2002
661 +++ linux-p/drivers/block/loop.c Mon Jan 14 23:01:48 2002
662 @@ -147,12 +147,12 @@
665 if (S_ISREG(lo->lo_dentry->d_inode->i_mode))
666 - size = (lo->lo_dentry->d_inode->i_size - lo->lo_offset) / BLOCK_SIZE;
667 + size = (lo->lo_dentry->d_inode->i_size - lo->lo_offset) >> BLOCK_SIZE_BITS;
669 kdev_t lodev = lo->lo_device;
670 if (blk_size[MAJOR(lodev)])
671 size = blk_size[MAJOR(lodev)][MINOR(lodev)] -
672 - lo->lo_offset / BLOCK_SIZE;
673 + (lo->lo_offset >> BLOCK_SIZE_BITS);
675 size = MAX_DISK_SIZE;
677 diff -Naur linux/drivers/isdn/avmb1/capifs.c linux-p/drivers/isdn/avmb1/capifs.c
678 --- linux/drivers/isdn/avmb1/capifs.c Fri Nov 2 17:39:06 2001
679 +++ linux-p/drivers/isdn/avmb1/capifs.c Mon Jan 14 23:06:25 2002
684 - if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0)
685 + if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0)
690 - if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0)
691 + if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0)
697 if (np->type) *p++ = np->type;
698 sprintf(p, "%u", np->num);
699 - if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr) < 0 )
700 + if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr, DT_UNKNOWN) < 0 )
704 diff -Naur linux/drivers/usb/inode.c linux-p/drivers/usb/inode.c
705 --- linux/drivers/usb/inode.c Sun Mar 25 18:31:42 2001
706 +++ linux-p/drivers/usb/inode.c Mon Jan 14 23:01:48 2002
707 @@ -302,14 +302,14 @@
711 - if (filldir(dirent, ".", 1, i, IROOT) < 0)
712 + if (filldir(dirent, ".", 1, i, IROOT, DT_DIR) < 0)
719 - if (filldir(dirent, "..", 2, i, IROOT) < 0)
720 + if (filldir(dirent, "..", 2, i, IROOT, DT_DIR) < 0)
726 while (i >= 2 && i < 2+NRSPECIAL) {
727 spec = &special[filp->f_pos-2];
728 - if (filldir(dirent, spec->name, strlen(spec->name), i, ISPECIAL | (filp->f_pos-2+IROOT)) < 0)
729 + if (filldir(dirent, spec->name, strlen(spec->name), i, ISPECIAL | (filp->f_pos-2+IROOT), DT_UNKNOWN) < 0)
735 bus = list_entry(list, struct usb_bus, bus_list);
736 sprintf(numbuf, "%03d", bus->busnum);
737 - if (filldir(dirent, numbuf, 3, filp->f_pos, IBUS | ((bus->busnum & 0xff) << 8)) < 0)
738 + if (filldir(dirent, numbuf, 3, filp->f_pos, IBUS | ((bus->busnum & 0xff) << 8), DT_UNKNOWN) < 0)
746 - if (filldir(dirent, numbuf, 3, filp->f_pos, ino | (dev->devnum & 0xff)) < 0)
747 + if (filldir(dirent, numbuf, 3, filp->f_pos, ino | (dev->devnum & 0xff), DT_UNKNOWN) < 0)
751 @@ -380,13 +380,13 @@
753 switch ((unsigned int)filp->f_pos) {
755 - if (filldir(dirent, ".", 1, filp->f_pos, ino) < 0)
756 + if (filldir(dirent, ".", 1, filp->f_pos, ino, DT_DIR) < 0)
762 - if (filldir(dirent, "..", 2, filp->f_pos, IROOT) < 0)
763 + if (filldir(dirent, "..", 2, filp->f_pos, IROOT, DT_DIR) < 0)
767 diff -Naur linux/fs/adfs/dir.c linux-p/fs/adfs/dir.c
768 --- linux/fs/adfs/dir.c Sun Mar 25 18:31:02 2001
769 +++ linux-p/fs/adfs/dir.c Mon Jan 14 23:01:48 2002
772 switch ((unsigned long)filp->f_pos) {
774 - if (filldir(dirent, ".", 1, 0, inode->i_ino) < 0)
775 + if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0)
780 - if (filldir(dirent, "..", 2, 1, dir.parent_id) < 0)
781 + if (filldir(dirent, "..", 2, 1, dir.parent_id, DT_DIR) < 0)
787 while (ops->getnext(&dir, &obj) == 0) {
788 if (filldir(dirent, obj.name, obj.name_len,
789 - filp->f_pos, obj.file_id) < 0)
790 + filp->f_pos, obj.file_id, DT_UNKNOWN) < 0)
794 diff -Naur linux/fs/affs/dir.c linux-p/fs/affs/dir.c
795 --- linux/fs/affs/dir.c Sun Mar 25 18:30:59 2001
796 +++ linux-p/fs/affs/dir.c Mon Jan 14 23:01:48 2002
799 if (filp->f_pos == 0) {
800 filp->private_data = (void *)0;
801 - if (filldir(dirent,".",1,filp->f_pos,inode->i_ino) < 0) {
802 + if (filldir(dirent,".",1,filp->f_pos,inode->i_ino, DT_DIR) < 0) {
808 if (filp->f_pos == 1) {
809 - if (filldir(dirent,"..",2,filp->f_pos,affs_parent_ino(inode)) < 0) {
810 + if (filldir(dirent,"..",2,filp->f_pos,affs_parent_ino(inode), DT_DIR) < 0) {
815 pr_debug("AFFS: readdir(): filldir(\"%.*s\",ino=%lu), i=%d\n",
817 filp->private_data = (void *)ino;
818 - if (filldir(dirent,name,namelen,filp->f_pos,ino) < 0)
819 + if (filldir(dirent,name,namelen,filp->f_pos,ino, DT_UNKNOWN) < 0)
821 filp->private_data = (void *)i;
823 diff -Naur linux/fs/affs/file.c linux-p/fs/affs/file.c
824 --- linux/fs/affs/file.c Sun Mar 25 18:30:59 2001
825 +++ linux-p/fs/affs/file.c Mon Jan 14 23:01:48 2002
826 @@ -582,17 +582,17 @@
827 affs_file_write(struct file *filp, const char *buf, size_t count, loff_t *ppos)
829 struct inode *inode = filp->f_dentry->d_inode;
835 + ssize_t blocksize, blockshift;
836 struct buffer_head *bh;
841 - pr_debug("AFFS: file_write(ino=%lu,pos=%lu,count=%d)\n",inode->i_ino,
842 - (unsigned long)*ppos,count);
843 + pr_debug("AFFS: file_write(ino=%lu,pos=%Lu,count=%d)\n",inode->i_ino,
847 affs_error(inode->i_sb,"file_write","Inode = NULL");
848 @@ -611,16 +611,22 @@
852 - blocksize = AFFS_I2BSIZE(inode);
853 + blocksize = AFFS_I2BSIZE(inode);
854 + blockshift = AFFS_I2BITS(inode);
856 + if (pos >= 0x7fffffff) /* Max size: 2G-1 */
858 + if ((pos + count) > 0x7fffffff)
859 + count = 0x7fffffff - pos;
861 while (written < count) {
862 - bh = affs_getblock(inode,pos / blocksize);
863 + bh = affs_getblock(inode, pos >> blockshift);
869 - c = blocksize - (pos % blocksize);
870 + c = blocksize - (pos & (blocksize -1));
871 if (c > count - written)
873 if (c != blocksize && !buffer_uptodate(bh)) {
878 - p = (pos % blocksize) + bh->b_data;
879 + p = (pos & (blocksize -1)) + bh->b_data;
880 c -= copy_from_user(p,buf,c);
888 + ssize_t blocksize, blockshift;
889 struct buffer_head *bh;
892 @@ -692,15 +698,16 @@
895 blocksize = AFFS_I2BSIZE(inode) - 24;
896 + blockshift = AFFS_I2BITS(inode);
898 while (written < count) {
899 - bh = affs_getblock(inode,pos / blocksize);
900 + bh = affs_getblock(inode,pos >> blockshift);
906 - c = blocksize - (pos % blocksize);
907 + c = blocksize - (pos & (blocksize -1));
908 if (c > count - written)
910 if (c != blocksize && !buffer_uptodate(bh)) {
915 - p = (pos % blocksize) + bh->b_data + 24;
916 + p = (pos & (blocksize -1)) + bh->b_data + 24;
917 c -= copy_from_user(p,buf,c);
920 @@ -782,10 +789,10 @@
924 - pr_debug("AFFS: truncate(inode=%ld,size=%lu)\n",inode->i_ino,inode->i_size);
925 + pr_debug("AFFS: truncate(inode=%ld,size=%Lu)\n",inode->i_ino,inode->i_size);
927 net_blocksize = blocksize - ((inode->i_sb->u.affs_sb.s_flags & SF_OFS) ? 24 : 0);
928 - first = (inode->i_size + net_blocksize - 1) / net_blocksize;
929 + first = (u_long)(inode->i_size + net_blocksize - 1) / net_blocksize;
930 if (inode->u.affs_i.i_lastblock < first - 1) {
931 /* There has to be at least one new block to be allocated */
932 if (!inode->u.affs_i.i_ec && alloc_ext_cache(inode)) {
934 bh = affs_getblock(inode,first - 1);
936 affs_warning(inode->i_sb,"truncate","Cannot extend file");
937 - inode->i_size = net_blocksize * (inode->u.affs_i.i_lastblock + 1);
938 + inode->i_size = (inode->u.affs_i.i_lastblock + 1) * net_blocksize;
939 } else if (inode->i_sb->u.affs_sb.s_flags & SF_OFS) {
940 - rem = inode->i_size % net_blocksize;
941 + rem = ((u_long)inode->i_size) & (net_blocksize -1);
942 DATA_FRONT(bh)->data_size = cpu_to_be32(rem ? rem : net_blocksize);
943 affs_fix_checksum(blocksize,bh->b_data,5);
944 mark_buffer_dirty(bh,0);
946 affs_free_block(inode->i_sb,ekey);
949 - block = ((inode->i_size + net_blocksize - 1) / net_blocksize) - 1;
950 + block = (((u_long)inode->i_size + net_blocksize - 1) / net_blocksize) - 1;
951 inode->u.affs_i.i_lastblock = block;
953 /* If the file is not truncated to a block boundary,
955 * so it cannot become accessible again.
958 - rem = inode->i_size % net_blocksize;
959 + rem = inode->i_size & (net_blocksize -1);
961 if ((inode->i_sb->u.affs_sb.s_flags & SF_OFS))
963 diff -Naur linux/fs/affs/inode.c linux-p/fs/affs/inode.c
964 --- linux/fs/affs/inode.c Sun Mar 25 18:30:59 2001
965 +++ linux-p/fs/affs/inode.c Mon Jan 14 23:01:48 2002
967 block = AFFS_I2BSIZE(inode) - 24;
969 block = AFFS_I2BSIZE(inode);
970 - inode->u.affs_i.i_lastblock = ((inode->i_size + block - 1) / block) - 1;
971 + inode->u.affs_i.i_lastblock = (((u_long)inode->i_size + block - 1) / block) - 1;
974 inode->i_mode |= S_IFLNK;
975 diff -Naur linux/fs/autofs/dir.c linux-p/fs/autofs/dir.c
976 --- linux/fs/autofs/dir.c Sun Mar 25 18:30:59 2001
977 +++ linux-p/fs/autofs/dir.c Mon Jan 14 23:01:48 2002
979 switch((unsigned long) filp->f_pos)
982 - if (filldir(dirent, ".", 1, 0, inode->i_ino) < 0)
983 + if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0)
988 - if (filldir(dirent, "..", 2, 1, AUTOFS_ROOT_INO) < 0)
989 + if (filldir(dirent, "..", 2, 1, AUTOFS_ROOT_INO, DT_DIR) < 0)
993 diff -Naur linux/fs/autofs/root.c linux-p/fs/autofs/root.c
994 --- linux/fs/autofs/root.c Sun Mar 25 18:30:59 2001
995 +++ linux-p/fs/autofs/root.c Mon Jan 14 23:01:48 2002
1000 - if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0)
1001 + if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0)
1006 - if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0)
1007 + if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0)
1012 while ( onr = nr, ent = autofs_hash_enum(dirhash,&nr,ent) ) {
1013 if ( !ent->dentry || ent->dentry->d_mounts != ent->dentry ) {
1014 - if (filldir(dirent,ent->name,ent->len,onr,ent->ino) < 0)
1015 + if (filldir(dirent,ent->name,ent->len,onr,ent->ino, DT_UNKNOWN) < 0)
1019 diff -Naur linux/fs/binfmt_aout.c linux-p/fs/binfmt_aout.c
1020 --- linux/fs/binfmt_aout.c Mon Jan 14 22:59:27 2002
1021 +++ linux-p/fs/binfmt_aout.c Mon Jan 14 23:01:48 2002
1022 @@ -374,7 +374,11 @@
1025 if (!file->f_op || !file->f_op->mmap ||
1027 fd_offset & (bprm->dentry->d_inode->i_sb->s_blocksize-1)) {
1028 +#else /* LFS enforces PAGE_SIZE file offset granularity in mmap */
1029 + fd_offset & ~PAGE_MASK) {
1033 "fd_offset is not blocksize aligned. Loading %s in anonymous memory.\n",
1034 @@ -472,7 +476,11 @@
1036 start_addr = ex.a_entry & 0xfffff000;
1039 if (N_TXTOFF(ex) & (inode->i_sb->s_blocksize-1)) {
1040 +#else /* LFS enforces PAGE_SIZE file offset granularity in mmap */
1041 + if (N_TXTOFF(ex) & ~PAGE_MASK) {
1045 "N_TXTOFF is not blocksize aligned. Loading library %s in anonymous memory.\n",
1046 diff -Naur linux/fs/buffer.c linux-p/fs/buffer.c
1047 --- linux/fs/buffer.c Mon Jan 14 22:59:26 2002
1048 +++ linux-p/fs/buffer.c Mon Jan 14 23:01:48 2002
1049 @@ -1209,7 +1209,7 @@
1052 if (test_and_clear_bit(PG_swap_unlock_after, &page->flags))
1053 - swap_after_unlock_page(page->offset);
1054 + swap_after_unlock_page(pgoff2ulong(page->index));
1055 if (test_and_clear_bit(PG_free_after, &page->flags))
1058 @@ -1610,15 +1610,46 @@
1059 set_bit(PG_locked, &page->flags);
1060 set_bit(PG_free_after, &page->flags);
1062 + /* Blocks within a page */
1063 i = PAGE_SIZE >> inode->i_sb->s_blocksize_bits;
1064 - block = page->offset >> inode->i_sb->s_blocksize_bits;
1067 - *p = inode->i_op->bmap(inode, block);
1073 + block = pgoff2ulong(page->index);
1074 + /* Scaled already by PAGE_SHIFT, which said shift should
1075 + be same or larger, than that of any filesystem in
1076 + this system -- that is, at i386 with 4k pages one
1077 + can't use 8k (primitive) blocks at the filesystems... */
1080 + /* Filesystem blocksize is same, or smaller than CPU
1081 + page size, we can easily process this.. */
1085 + /* Scale by FS blocks per page, presuming FS-blocks are smaller
1086 + than the processor page... */
1090 + *p = inode->i_op->bmap(inode, block);
1096 + /* Filesystem blocksize is larger than CPU page size,
1097 + but if the underlying storage system block size is
1098 + smaller than CPU page size, all is well, else we
1099 + are in deep trouble -- for direct paging in at least.. */
1100 + /* Nobody needs such monsterous fs block sizes ?
1101 + Well, it is the only way to get files in terabyte
1102 + range.. Nobody needs them ? You are for a surprise..
1103 + However EXT2 (at least) needs access to internal
1104 + blocks and there it needs allocations of 8k/16k (or
1105 + whatever the block size is) for internal uses..
1106 + Fixing this function alone isn't enough, although
1107 + perhaps fairly trivial.. */
1108 + /* FIXME: WRITE THE CODE HERE !!! */
1112 brw_page(READ, page, inode->i_dev, nr, inode->i_sb->s_blocksize, 1);
1113 diff -Naur linux/fs/coda/dir.c linux-p/fs/coda/dir.c
1114 --- linux/fs/coda/dir.c Sun Mar 25 18:31:02 2001
1115 +++ linux-p/fs/coda/dir.c Mon Jan 14 23:01:48 2002
1117 char *name = vdirent->d_name;
1119 errfill = filldir(getdent, name, namlen,
1121 + offs, ino, DT_UNKNOWN);
1122 CDEBUG(D_FILE, "entry %d: ino %ld, namlen %d, reclen %d, type %d, pos %d, string_offs %d, name %*s, offset %d, result: %d, errfill: %d.\n", i,vdirent->d_fileno, vdirent->d_namlen, vdirent->d_reclen, vdirent->d_type, pos, string_offset, vdirent->d_namlen, vdirent->d_name, (u_int) offs, result, errfill);
1123 /* errfill means no space for filling in this round */
1124 if ( errfill < 0 ) {
1125 diff -Naur linux/fs/coda/file.c linux-p/fs/coda/file.c
1126 --- linux/fs/coda/file.c Sun Mar 25 18:37:38 2001
1127 +++ linux-p/fs/coda/file.c Mon Jan 14 23:01:48 2002
1129 &cont_file, &cont_dentry);
1131 CDEBUG(D_INODE, "coda ino: %ld, cached ino %ld, page offset: %lx\n",
1132 - coda_inode->i_ino, cii->c_ovp->i_ino, page->offset);
1133 + coda_inode->i_ino, cii->c_ovp->i_ino, pgoff2ulong(page->index));
1135 generic_readpage(&cont_file, page);
1137 diff -Naur linux/fs/devpts/root.c linux-p/fs/devpts/root.c
1138 --- linux/fs/devpts/root.c Sun Mar 25 18:31:02 2001
1139 +++ linux-p/fs/devpts/root.c Mon Jan 14 23:01:48 2002
1144 - if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0)
1145 + if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0)
1150 - if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0)
1151 + if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0)
1157 if ( sbi->inodes[ptynr] ) {
1158 genptsname(numbuf, ptynr);
1159 - if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr) < 0 )
1160 + if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr, DT_CHR) < 0 )
1164 diff -Naur linux/fs/dquot.c linux-p/fs/dquot.c
1165 --- linux/fs/dquot.c Fri Nov 2 17:39:08 2001
1166 +++ linux-p/fs/dquot.c Mon Jan 14 23:01:48 2002
1167 @@ -1529,7 +1529,7 @@
1168 if (!S_ISREG(inode->i_mode))
1171 - if (inode->i_size == 0 || (inode->i_size % sizeof(struct dqblk)) != 0)
1172 + if (inode->i_size == 0 || ((off_t)inode->i_size % sizeof(struct dqblk)) != 0)
1174 dquot_drop(inode); /* We don't want quota on quota files */
1176 diff -Naur linux/fs/efs/dir.c linux-p/fs/efs/dir.c
1177 --- linux/fs/efs/dir.c Sun Mar 25 18:31:02 2001
1178 +++ linux-p/fs/efs/dir.c Mon Jan 14 23:01:48 2002
1180 filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot;
1182 /* copy filename and data in dirslot */
1183 - filldir(dirent, nameptr, namelen, filp->f_pos, inodenum);
1184 + filldir(dirent, nameptr, namelen, filp->f_pos, inodenum, DT_UNKNOWN);
1187 if (nameptr - (char *) dirblock + namelen > EFS_DIRBSIZE) {
1188 diff -Naur linux/fs/ext2/dir.c linux-p/fs/ext2/dir.c
1189 --- linux/fs/ext2/dir.c Sun Mar 25 18:30:58 2001
1190 +++ linux-p/fs/ext2/dir.c Mon Jan 14 23:01:48 2002
1195 +static unsigned char ext2_filetype_table[] = {
1196 + DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK
1199 static int ext2_readdir(struct file *, void *, filldir_t);
1201 static struct file_operations ext2_dir_operations = {
1202 @@ -201,10 +205,14 @@
1205 unsigned long version = filp->f_version;
1206 + unsigned char d_type = DT_UNKNOWN;
1208 + if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE)
1209 + && de->file_type < EXT2_FT_MAX)
1210 + d_type = ext2_filetype_table[de->file_type];
1211 error = filldir(dirent, de->name,
1213 - filp->f_pos, le32_to_cpu(de->inode));
1214 + filp->f_pos, le32_to_cpu(de->inode), d_type);
1217 if (version != filp->f_version)
1218 diff -Naur linux/fs/ext2/file.c linux-p/fs/ext2/file.c
1219 --- linux/fs/ext2/file.c Mon Jan 14 22:59:27 2002
1220 +++ linux-p/fs/ext2/file.c Mon Jan 14 23:04:52 2002
1222 static long long ext2_file_lseek(struct file *, long long, int);
1223 static ssize_t ext2_file_write (struct file *, const char *, size_t, loff_t *);
1224 static int ext2_release_file (struct inode *, struct file *);
1225 -#if BITS_PER_LONG < 64
1226 -static int ext2_open_file (struct inode *, struct file *);
1230 #define EXT2_MAX_SIZE(bits) \
1231 (((EXT2_NDIR_BLOCKS + (1LL << (bits - 2)) + \
1233 EXT2_MAX_SIZE(10), EXT2_MAX_SIZE(11), EXT2_MAX_SIZE(12), EXT2_MAX_SIZE(13)
1239 * We have mostly NULL's here: the current defaults are ok for
1240 * the ext2 filesystem.
1242 NULL, /* poll - default */
1243 ext2_ioctl, /* ioctl */
1244 generic_file_mmap, /* mmap */
1245 -#if BITS_PER_LONG == 64
1246 NULL, /* no special open is needed */
1251 ext2_release_file, /* release */
1252 ext2_sync_file, /* fsync */
1253 @@ -120,14 +110,9 @@
1255 offset += file->f_pos;
1257 -#if BITS_PER_LONG < 64
1262 offset > ext2_max_sizes[EXT2_BLOCK_SIZE_BITS(inode->i_sb)])
1265 if (offset != file->f_pos) {
1266 file->f_pos = offset;
1269 size_t count, loff_t *ppos)
1271 struct inode * inode = filp->f_dentry->d_inode;
1277 @@ -202,24 +187,18 @@
1279 /* Check for overflow.. */
1281 -#if BITS_PER_LONG < 64
1282 - /* If the fd's pos is already greater than or equal to the file
1283 - * descriptor's offset maximum, then we need to return EFBIG for
1284 - * any non-zero count (and we already tested for zero above). */
1285 - if (((unsigned long) pos) >= 0x7FFFFFFFUL)
1288 - /* If we are about to overflow the maximum file size, we also
1289 - * need to return the error, but only if no bytes can be written
1290 - * successfully. */
1291 - if (((unsigned long) pos + count) > 0x7FFFFFFFUL) {
1292 - count = 0x7FFFFFFFL - pos;
1293 - if (((ssize_t) count) < 0)
1294 + /* L-F-S spec 2.2.1.27: */
1295 + if (!(filp->f_flags & O_LARGEFILE)) {
1296 + if (pos >= 0x7fffffffULL) /* pos@2G forbidden */
1299 + if (pos + count > 0x7fffffffULL)
1300 + /* Write only until end of allowed region */
1301 + count = 0x7fffffffULL - pos;
1306 - off_t max = ext2_max_sizes[EXT2_BLOCK_SIZE_BITS(sb)];
1307 + loff_t max = ext2_max_sizes[EXT2_BLOCK_SIZE_BITS(sb)];
1311 @@ -239,20 +218,18 @@
1312 mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1);
1317 /* From SUS: We must generate a SIGXFSZ for file size overflow
1318 * only if no bytes were actually written to the file. --sct */
1320 limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
1321 - if (limit < RLIM_INFINITY) {
1322 - if (((unsigned long) pos + count) >= limit) {
1323 - count = limit - pos;
1324 - if (((ssize_t) count) <= 0) {
1325 - send_sig(SIGXFSZ, current, 0);
1328 + if (limit != RLIM_INFINITY) {
1329 + if (pos >= limit) {
1330 + send_sig(SIGXFSZ, current, 0);
1333 + if (pos+count > limit)
1334 + count = limit - pos;
1338 @@ -382,15 +359,3 @@
1342 -#if BITS_PER_LONG < 64
1344 - * Called when an inode is about to be open.
1345 - * We use this to disallow opening RW large files on 32bit systems.
1347 -static int ext2_open_file (struct inode * inode, struct file * filp)
1349 - if (inode->u.ext2_i.i_high_size && (filp->f_mode & FMODE_WRITE))
1354 diff -Naur linux/fs/ext2/inode.c linux-p/fs/ext2/inode.c
1355 --- linux/fs/ext2/inode.c Sun Mar 25 18:30:58 2001
1356 +++ linux-p/fs/ext2/inode.c Mon Jan 14 23:05:38 2002
1357 @@ -537,15 +537,8 @@
1358 inode->u.ext2_i.i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1360 inode->u.ext2_i.i_dir_acl = 0;
1361 - inode->u.ext2_i.i_high_size =
1362 - le32_to_cpu(raw_inode->i_size_high);
1363 -#if BITS_PER_LONG < 64
1364 - if (raw_inode->i_size_high)
1365 - inode->i_size = (__u32)-1;
1367 - inode->i_size |= ((__u64)le32_to_cpu(raw_inode->i_size_high))
1370 + inode->i_size = ((__u64)(inode->i_size & 0xFFFFFFFFUL)) |
1371 + (((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32);
1373 inode->u.ext2_i.i_block_group = block_group;
1374 inode->u.ext2_i.i_next_alloc_block = 0;
1375 @@ -667,12 +660,7 @@
1376 if (S_ISDIR(inode->i_mode))
1377 raw_inode->i_dir_acl = cpu_to_le32(inode->u.ext2_i.i_dir_acl);
1379 -#if BITS_PER_LONG < 64
1380 - raw_inode->i_size_high =
1381 - cpu_to_le32(inode->u.ext2_i.i_high_size);
1383 raw_inode->i_size_high = cpu_to_le32(inode->i_size >> 32);
1386 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
1387 raw_inode->i_block[0] = cpu_to_le32(kdev_t_to_nr(inode->i_rdev));
1388 @@ -724,22 +712,19 @@
1391 if (iattr->ia_valid & ATTR_SIZE) {
1392 - off_t size = iattr->ia_size;
1393 + loff_t size = iattr->ia_size;
1394 unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
1398 -#if BITS_PER_LONG == 64
1399 if (size > ext2_max_sizes[EXT2_BLOCK_SIZE_BITS(inode->i_sb)])
1402 - if (limit < RLIM_INFINITY && size > limit) {
1403 + if (limit != RLIM_INFINITY && size > limit) {
1404 send_sig(SIGXFSZ, current, 0);
1408 -#if BITS_PER_LONG == 64
1411 struct super_block *sb = inode->i_sb;
1412 struct ext2_super_block *es = sb->u.ext2_sb.s_es;
1413 if (!(es->s_feature_ro_compat &
1415 mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1);
1421 retval = inode_change_ok(inode, iattr);
1422 diff -Naur linux/fs/ext2/truncate.c linux-p/fs/ext2/truncate.c
1423 --- linux/fs/ext2/truncate.c Sun Mar 25 18:30:58 2001
1424 +++ linux-p/fs/ext2/truncate.c Mon Jan 14 23:01:48 2002
1426 * Currently we always hold the inode semaphore during truncate, so
1427 * there's no need to test for changes during the operation.
1429 -#define DIRECT_BLOCK(inode) \
1430 - ((inode->i_size + inode->i_sb->s_blocksize - 1) / \
1431 - inode->i_sb->s_blocksize)
1432 +#define DIRECT_BLOCK(inode) \
1434 + ((inode->i_size + inode->i_sb->s_blocksize - 1) >> \
1435 + inode->i_sb->s_blocksize_bits))
1436 #define INDIRECT_BLOCK(inode,offset) ((int)DIRECT_BLOCK(inode) - offset)
1437 #define DINDIRECT_BLOCK(inode,offset) \
1438 (INDIRECT_BLOCK(inode,offset) / addr_per_block)
1439 diff -Naur linux/fs/fat/dir.c linux-p/fs/fat/dir.c
1440 --- linux/fs/fat/dir.c Sun Mar 25 18:30:59 2001
1441 +++ linux-p/fs/fat/dir.c Mon Jan 14 23:01:48 2002
1443 /* Fake . and .. for the root directory. */
1444 if (inode->i_ino == MSDOS_ROOT_INO) {
1446 - if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO) < 0)
1447 + if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO, DT_DIR) < 0)
1452 if (!long_slots||shortnames) {
1455 - if (filldir(dirent, bufname, i, *furrfu, inum) < 0)
1456 + if (filldir(dirent, bufname, i, *furrfu, inum,
1457 + (de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0)
1462 memcpy(&longname[long_len+1], bufname, i);
1465 - if (filldir(dirent, longname, long_len, *furrfu, inum) < 0)
1466 + if (filldir(dirent, longname, long_len, *furrfu, inum,
1467 + (de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0)
1477 + unsigned int d_type)
1479 struct dirent *d1 = (struct dirent *)buf;
1480 struct dirent *d2 = d1 + 1;
1481 diff -Naur linux/fs/fat/file.c linux-p/fs/fat/file.c
1482 --- linux/fs/fat/file.c Sun Mar 25 18:30:59 2001
1483 +++ linux-p/fs/fat/file.c Mon Jan 14 23:01:48 2002
1485 Each time we process one block in bhlist, we replace
1486 it by a new prefetch block if needed.
1488 - PRINTK (("#### ino %ld pos %ld size %ld count %d\n",inode->i_ino,*ppos,inode->i_size,count));
1489 + PRINTK (("#### ino %ld pos %ld size %ld count %d\n",inode->i_ino,*ppos,(u_long)inode->i_size,count));
1492 We must prefetch complete block, so we must
1496 PRINTK (("count %d ahead %d nblist %d\n",count,read_ahead[MAJOR(inode->i_dev)],pre.nblist));
1497 - while ((left_in_file = inode->i_size - *ppos) > 0
1498 + while ((left_in_file = (u_long)inode->i_size - *ppos) > 0
1500 struct buffer_head *bh = pre.bhlist[pre.nolist];
1504 void fat_truncate(struct inode *inode)
1507 + int cluster_bytes, cluster_shift;
1509 /* Why no return value? Surely the disk could fail... */
1510 if (IS_IMMUTABLE(inode))
1511 @@ -460,8 +460,10 @@
1512 printk("FAT: fat_truncate called though fs is read-only, uhh...\n");
1513 return /* -EROFS */;
1515 - cluster = SECTOR_SIZE*MSDOS_SB(inode->i_sb)->cluster_size;
1516 - (void) fat_free(inode,(inode->i_size+(cluster-1))/cluster);
1517 + cluster_bytes = SECTOR_SIZE * MSDOS_SB(inode->i_sb)->cluster_size;
1518 + cluster_shift = fslog2(cluster_bytes);
1519 + (void) fat_free(inode,
1520 + (inode->i_size+(cluster_bytes-1)) >> cluster_shift);
1521 MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
1522 mark_inode_dirty(inode);
1524 diff -Naur linux/fs/fat/inode.c linux-p/fs/fat/inode.c
1525 --- linux/fs/fat/inode.c Sun Mar 25 18:30:59 2001
1526 +++ linux-p/fs/fat/inode.c Mon Jan 14 23:01:48 2002
1528 sizeof(struct msdos_dir_entry);
1530 inode->i_blksize = MSDOS_SB(sb)->cluster_size* SECTOR_SIZE;
1531 - inode->i_blocks = (inode->i_size+inode->i_blksize-1)/
1532 - inode->i_blksize*MSDOS_SB(sb)->cluster_size;
1533 + inode->i_blocks = (((inode->i_size+inode->i_blksize-1) >>
1534 + fslog2(inode->i_blksize)) *
1535 + MSDOS_SB(sb)->cluster_size);
1536 MSDOS_I(inode)->i_logstart = 0;
1538 MSDOS_I(inode)->i_attrs = 0;
1540 MSDOS_I(inode)->i_attrs = de->attr & ATTR_UNUSED;
1541 /* this is as close to the truth as we can get ... */
1542 inode->i_blksize = MSDOS_SB(sb)->cluster_size*SECTOR_SIZE;
1543 - inode->i_blocks = (inode->i_size+inode->i_blksize-1)/
1544 - inode->i_blksize*MSDOS_SB(sb)->cluster_size;
1545 + inode->i_blocks = (((inode->i_size+inode->i_blksize-1) >>
1546 + fslog2(inode->i_blksize)) *
1547 + MSDOS_SB(sb)->cluster_size);
1548 inode->i_mtime = inode->i_atime =
1549 date_dos2unix(CF_LE_W(de->time),CF_LE_W(de->date));
1551 diff -Naur linux/fs/fcntl.c linux-p/fs/fcntl.c
1552 --- linux/fs/fcntl.c Sun Mar 25 18:30:58 2001
1553 +++ linux-p/fs/fcntl.c Mon Jan 14 23:01:48 2002
1554 @@ -143,17 +143,11 @@
1558 -asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
1560 - struct file * filp;
1561 - long err = -EBADF;
1567 +static long do_fcntl(unsigned int fd, unsigned int cmd,
1568 + unsigned long arg, struct file * filp)
1575 err = dupfd(fd, arg);
1576 @@ -217,11 +211,60 @@
1577 err = sock_fcntl (filp, cmd, arg);
1584 +asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
1586 + struct file * filp;
1587 + long err = -EBADF;
1594 + err = do_fcntl(fd, cmd, arg, filp);
1602 +#if BITS_PER_LONG == 32
1603 +asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg)
1605 + struct file * filp;
1606 + long err = -EBADF;
1615 + err = fcntl_getlk64(fd, (struct flock64 *) arg);
1618 + err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg);
1621 + err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg);
1624 + err = do_fcntl(fd, cmd, arg, filp);
1635 static void send_sigio(struct fown_struct *fown, struct fasync_struct *fa)
1637 diff -Naur linux/fs/hfs/dir_cap.c linux-p/fs/hfs/dir_cap.c
1638 --- linux/fs/hfs/dir_cap.c Sun Mar 25 18:31:02 2001
1639 +++ linux-p/fs/hfs/dir_cap.c Mon Jan 14 23:01:48 2002
1642 if (filp->f_pos == 0) {
1643 /* Entry 0 is for "." */
1644 - if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino)) {
1645 + if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino, DT_DIR)) {
1652 if (filldir(dirent, DOT_DOT->Name,
1653 - DOT_DOT_LEN, 1, ntohl(cnid))) {
1654 + DOT_DOT_LEN, 1, ntohl(cnid), DT_DIR)) {
1659 len = hfs_namein(dir, tmp_name,
1660 &((struct hfs_cat_key *)brec.key)->CName);
1661 if (filldir(dirent, tmp_name, len,
1662 - filp->f_pos, ino)) {
1663 + filp->f_pos, ino, DT_UNKNOWN)) {
1664 hfs_cat_close(entry, &brec);
1668 /* In root dir last-2 entry is for ".rootinfo" */
1669 if (filldir(dirent, DOT_ROOTINFO->Name,
1670 DOT_ROOTINFO_LEN, filp->f_pos,
1671 - ntohl(entry->cnid) | HFS_CAP_FNDR)) {
1672 + ntohl(entry->cnid) | HFS_CAP_FNDR, DT_UNKNOWN)) {
1677 /* In normal dirs last-1 entry is for ".finderinfo" */
1678 if (filldir(dirent, DOT_FINDERINFO->Name,
1679 DOT_FINDERINFO_LEN, filp->f_pos,
1680 - ntohl(entry->cnid) | HFS_CAP_FDIR)) {
1681 + ntohl(entry->cnid) | HFS_CAP_FDIR, DT_UNKNOWN)) {
1686 /* In normal dirs last entry is for ".resource" */
1687 if (filldir(dirent, DOT_RESOURCE->Name,
1688 DOT_RESOURCE_LEN, filp->f_pos,
1689 - ntohl(entry->cnid) | HFS_CAP_RDIR)) {
1690 + ntohl(entry->cnid) | HFS_CAP_RDIR, DT_UNKNOWN)) {
1694 diff -Naur linux/fs/hfs/dir_dbl.c linux-p/fs/hfs/dir_dbl.c
1695 --- linux/fs/hfs/dir_dbl.c Sun Mar 25 18:31:02 2001
1696 +++ linux-p/fs/hfs/dir_dbl.c Mon Jan 14 23:01:48 2002
1699 if (filp->f_pos == 0) {
1700 /* Entry 0 is for "." */
1701 - if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino)) {
1702 + if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino, DT_DIR)) {
1707 if (filp->f_pos == 1) {
1708 /* Entry 1 is for ".." */
1709 if (filldir(dirent, DOT_DOT->Name, DOT_DOT_LEN, 1,
1710 - hfs_get_hl(entry->key.ParID))) {
1711 + hfs_get_hl(entry->key.ParID), DT_DIR)) {
1716 &((struct hfs_cat_key *)brec.key)->CName);
1719 - if (filldir(dirent, tmp_name, len, filp->f_pos, ino)) {
1720 + if (filldir(dirent, tmp_name, len, filp->f_pos, ino, DT_UNKNOWN)) {
1721 hfs_cat_close(entry, &brec);
1725 /* In root dir last entry is for "%RootInfo" */
1726 if (filldir(dirent, PCNT_ROOTINFO->Name,
1727 PCNT_ROOTINFO_LEN, filp->f_pos,
1728 - ntohl(entry->cnid) | HFS_DBL_HDR)) {
1729 + ntohl(entry->cnid) | HFS_DBL_HDR, DT_UNKNOWN)) {
1733 diff -Naur linux/fs/hfs/dir_nat.c linux-p/fs/hfs/dir_nat.c
1734 --- linux/fs/hfs/dir_nat.c Sun Mar 25 18:31:02 2001
1735 +++ linux-p/fs/hfs/dir_nat.c Mon Jan 14 23:01:48 2002
1738 if (filp->f_pos == 0) {
1739 /* Entry 0 is for "." */
1740 - if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino)) {
1741 + if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino, DT_DIR)) {
1748 if (filldir(dirent, DOT_DOT->Name,
1749 - DOT_DOT_LEN, 1, ntohl(cnid))) {
1750 + DOT_DOT_LEN, 1, ntohl(cnid), DT_DIR)) {
1755 len = hfs_namein(dir, tmp_name,
1756 &((struct hfs_cat_key *)brec.key)->CName);
1757 if (filldir(dirent, tmp_name, len,
1758 - filp->f_pos, ino)) {
1759 + filp->f_pos, ino, DT_UNKNOWN)) {
1760 hfs_cat_close(entry, &brec);
1763 @@ -290,14 +290,14 @@
1764 /* In normal dirs entry 2 is for ".AppleDouble" */
1765 if (filldir(dirent, DOT_APPLEDOUBLE->Name,
1766 DOT_APPLEDOUBLE_LEN, filp->f_pos,
1767 - ntohl(entry->cnid) | HFS_NAT_HDIR)) {
1768 + ntohl(entry->cnid) | HFS_NAT_HDIR, DT_UNKNOWN)) {
1771 } else if (type == HFS_NAT_HDIR) {
1772 /* In .AppleDouble entry 2 is for ".Parent" */
1773 if (filldir(dirent, DOT_PARENT->Name,
1774 DOT_PARENT_LEN, filp->f_pos,
1775 - ntohl(entry->cnid) | HFS_NAT_HDR)) {
1776 + ntohl(entry->cnid) | HFS_NAT_HDR, DT_UNKNOWN)) {
1781 (type == HFS_NAT_HDIR)) {
1782 if (filldir(dirent, ROOTINFO->Name,
1783 ROOTINFO_LEN, filp->f_pos,
1784 - ntohl(entry->cnid) | HFS_NAT_HDR)) {
1785 + ntohl(entry->cnid) | HFS_NAT_HDR, DT_UNKNOWN)) {
1789 diff -Naur linux/fs/hpfs/hpfs_fs.c linux-p/fs/hpfs/hpfs_fs.c
1790 --- linux/fs/hpfs/hpfs_fs.c Sun Mar 25 18:30:59 2001
1791 +++ linux-p/fs/hpfs/hpfs_fs.c Mon Jan 14 23:01:48 2002
1792 @@ -1376,13 +1376,13 @@
1796 - if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino) < 0)
1797 + if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0)
1803 - if (filldir(dirent, "..", 2, filp->f_pos, inode->i_hpfs_parent_dir) < 0)
1804 + if (filldir(dirent, "..", 2, filp->f_pos, inode->i_hpfs_parent_dir, DT_DIR) < 0)
1808 @@ -1402,7 +1402,7 @@
1810 ino = file_ino(de->fnode);
1812 - if (filldir(dirent, tempname, namelen, old_pos, ino) < 0) {
1813 + if (filldir(dirent, tempname, namelen, old_pos, ino, DT_UNKNOWN) < 0) {
1814 filp->f_pos = old_pos;
1817 diff -Naur linux/fs/isofs/dir.c linux-p/fs/isofs/dir.c
1818 --- linux/fs/isofs/dir.c Sun Mar 25 18:37:38 2001
1819 +++ linux-p/fs/isofs/dir.c Mon Jan 14 23:01:48 2002
1822 /* Handle the case of the '.' directory */
1823 if (de->name_len[0] == 1 && de->name[0] == 0) {
1824 - if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino) < 0)
1825 + if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0)
1827 filp->f_pos += de_len;
1830 /* Handle the case of the '..' directory */
1831 if (de->name_len[0] == 1 && de->name[0] == 1) {
1832 inode_number = filp->f_dentry->d_parent->d_inode->i_ino;
1833 - if (filldir(dirent, "..", 2, filp->f_pos, inode_number) < 0)
1834 + if (filldir(dirent, "..", 2, filp->f_pos, inode_number, DT_DIR) < 0)
1836 filp->f_pos += de_len;
1842 - if (filldir(dirent, p, len, filp->f_pos, inode_number) < 0)
1843 + if (filldir(dirent, p, len, filp->f_pos, inode_number, DT_UNKNOWN) < 0)
1846 filp->f_pos += de_len;
1847 diff -Naur linux/fs/isofs/inode.c linux-p/fs/isofs/inode.c
1848 --- linux/fs/isofs/inode.c Sun Mar 25 18:37:38 2001
1849 +++ linux-p/fs/isofs/inode.c Mon Jan 14 23:01:48 2002
1852 int isofs_bmap(struct inode * inode,int block)
1854 - off_t b_off, offset, size;
1856 + unsigned offset, size;
1858 unsigned int firstext;
1859 unsigned long nextino;
1864 - b_off = block << ISOFS_BUFFER_BITS(inode);
1865 + b_off = (loff_t)block << ISOFS_BUFFER_BITS(inode);
1868 * If we are beyond the end of this file, don't give out any
1871 if( b_off >= inode->i_size )
1873 - off_t max_legal_read_offset;
1874 + loff_t max_legal_read_offset;
1877 * If we are *way* beyond the end of the file, print a message.
1879 if( b_off >= max_legal_read_offset )
1882 - printk("_isofs_bmap: block>= EOF(%d, %ld)\n", block,
1883 + printk("_isofs_bmap: block>= EOF(%d, %Ld)\n", block,
1887 @@ -1209,7 +1210,7 @@
1890 printk("Get inode %x: %d %d: %d\n",inode->i_ino, block,
1891 - ((int)pnt) & 0x3ff, inode->i_size);
1892 + ((int)pnt) & 0x3ff, (u_long)inode->i_size);
1895 inode->i_mtime = inode->i_atime = inode->i_ctime =
1896 diff -Naur linux/fs/lockd/svclock.c linux-p/fs/lockd/svclock.c
1897 --- linux/fs/lockd/svclock.c Sun Mar 25 18:37:38 2001
1898 +++ linux-p/fs/lockd/svclock.c Mon Jan 14 23:01:48 2002
1899 @@ -100,14 +100,18 @@
1900 struct nlm_block **head, *block;
1901 struct file_lock *fl;
1903 - dprintk("lockd: nlmsvc_lookup_block f=%p pd=%d %ld-%ld ty=%d\n",
1904 - file, lock->fl.fl_pid, lock->fl.fl_start,
1905 - lock->fl.fl_end, lock->fl.fl_type);
1906 + dprintk("lockd: nlmsvc_lookup_block f=%p pd=%d %Ld-%Ld ty=%d\n",
1907 + file, lock->fl.fl_pid,
1908 + (long long)lock->fl.fl_start,
1909 + (long long)lock->fl.fl_end,
1910 + lock->fl.fl_type);
1911 for (head = &nlm_blocked; (block = *head); head = &block->b_next) {
1912 fl = &block->b_call.a_args.lock.fl;
1913 - dprintk("lockd: check f=%p pd=%d %ld-%ld ty=%d cookie=%x\n",
1914 - block->b_file, fl->fl_pid, fl->fl_start,
1915 - fl->fl_end, fl->fl_type,
1916 + dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%x\n",
1917 + block->b_file, fl->fl_pid,
1918 + (long long)lock->fl.fl_start,
1919 + (long long)lock->fl.fl_end,
1921 *(u32 *)(&block->b_call.a_args.cookie.data));
1922 if (block->b_file == file && nlm_compare_locks(fl, &lock->fl)) {
1924 @@ -293,12 +297,12 @@
1925 struct inode *inode = file->f_file.f_dentry->d_inode;
1928 - dprintk("lockd: nlmsvc_lock(%04x/%ld, ty=%d, pi=%d, %ld-%ld, bl=%d)\n",
1929 + dprintk("lockd: nlmsvc_lock(%04x/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
1930 file->f_file.f_dentry->d_inode->i_dev,
1931 file->f_file.f_dentry->d_inode->i_ino,
1932 lock->fl.fl_type, lock->fl.fl_pid,
1933 - lock->fl.fl_start,
1935 + (long long)lock->fl.fl_start,
1936 + (long long)lock->fl.fl_end,
1939 /* Checking for read only file system */
1940 @@ -371,16 +375,18 @@
1942 struct file_lock *fl;
1944 - dprintk("lockd: nlmsvc_testlock(%04x/%ld, ty=%d, %ld-%ld)\n",
1945 + dprintk("lockd: nlmsvc_testlock(%04x/%ld, ty=%d, %Ld-%Ld)\n",
1946 file->f_file.f_dentry->d_inode->i_dev,
1947 file->f_file.f_dentry->d_inode->i_ino,
1949 - lock->fl.fl_start,
1951 + (long long)lock->fl.fl_start,
1952 + (long long)lock->fl.fl_end);
1954 if ((fl = posix_test_lock(&file->f_file, &lock->fl)) != NULL) {
1955 - dprintk("lockd: conflicting lock(ty=%d, %ld-%ld)\n",
1956 - fl->fl_type, fl->fl_start, fl->fl_end );
1957 + dprintk("lockd: conflicting lock(ty=%d, %Ld-%Ld)\n",
1959 + (long long)lock->fl.fl_start,
1960 + (long long)lock->fl.fl_end);
1962 conflock->caller = "somehost"; /* FIXME */
1963 conflock->oh.len = 0; /* don't return OH info */
1964 @@ -403,12 +409,12 @@
1968 - dprintk("lockd: nlmsvc_unlock(%04x/%ld, pi=%d, %ld-%ld)\n",
1969 + dprintk("lockd: nlmsvc_unlock(%04x/%ld, pi=%d, %Ld-%Ld)\n",
1970 file->f_file.f_dentry->d_inode->i_dev,
1971 file->f_file.f_dentry->d_inode->i_ino,
1973 - lock->fl.fl_start,
1975 + (long long)lock->fl.fl_start,
1976 + (long long)lock->fl.fl_end);
1978 /* First, cancel any lock that might be there */
1979 nlmsvc_cancel_blocked(file, lock);
1980 @@ -431,12 +437,12 @@
1982 struct nlm_block *block;
1984 - dprintk("lockd: nlmsvc_cancel(%04x/%ld, pi=%d, %ld-%ld)\n",
1985 + dprintk("lockd: nlmsvc_cancel(%04x/%ld, pi=%d, %Ld-%Ld)\n",
1986 file->f_file.f_dentry->d_inode->i_dev,
1987 file->f_file.f_dentry->d_inode->i_ino,
1989 - lock->fl.fl_start,
1991 + (long long)lock->fl.fl_start,
1992 + (long long)lock->fl.fl_end);
1994 down(&file->f_sema);
1995 if ((block = nlmsvc_lookup_block(file, lock, 1)) != NULL)
1996 diff -Naur linux/fs/lockd/xdr.c linux-p/fs/lockd/xdr.c
1997 --- linux/fs/lockd/xdr.c Sun Mar 25 18:30:59 2001
1998 +++ linux-p/fs/lockd/xdr.c Mon Jan 14 23:01:48 2002
2001 #define NLMDBG_FACILITY NLMDBG_XDR
2002 #define NLM_MAXSTRLEN 1024
2003 -#define OFFSET_MAX LONG_MAX
2005 #define QUADLEN(len) (((len) + 3) >> 2)
2008 static void nlm_register_stats(void);
2009 static void nlm_unregister_stats(void);
2011 +static inline loff_t
2012 +s32_to_loff_t(__s32 offset)
2014 + return (loff_t)offset;
2017 +static inline __s32
2018 +loff_t_to_s32(loff_t offset)
2021 + if (offset >= NLM_OFFSET_MAX)
2022 + res = NLM_OFFSET_MAX;
2023 + else if (offset <= -NLM_OFFSET_MAX)
2024 + res = -NLM_OFFSET_MAX;
2031 * Initialization of NFS status variables
2034 nlm_decode_lock(u32 *p, struct nlm_lock *lock)
2036 struct file_lock *fl = &lock->fl;
2038 + s32 start, len, end;
2040 if (!(p = xdr_decode_string(p, &lock->caller, &len, NLM_MAXSTRLEN))
2041 || !(p = nlm_decode_fh(p, &lock->fh))
2042 @@ -169,10 +187,16 @@
2043 fl->fl_pid = ntohl(*p++);
2044 fl->fl_flags = FL_POSIX;
2045 fl->fl_type = F_RDLCK; /* as good as anything else */
2046 - fl->fl_start = ntohl(*p++);
2047 + start = ntohl(*p++);
2049 - if (len == 0 || (fl->fl_end = fl->fl_start + len - 1) < 0)
2050 + end = start + len - 1;
2052 + fl->fl_start = s32_to_loff_t(start);
2054 + if (len == 0 || end < 0)
2055 fl->fl_end = OFFSET_MAX;
2057 + fl->fl_end = s32_to_loff_t(end);
2062 nlm_encode_lock(u32 *p, struct nlm_lock *lock)
2064 struct file_lock *fl = &lock->fl;
2067 if (!(p = xdr_encode_string(p, lock->caller, -1))
2068 || !(p = nlm_encode_fh(p, &lock->fh))
2069 @@ -193,12 +218,15 @@
2070 || (fl->fl_end > NLM_OFFSET_MAX && fl->fl_end != OFFSET_MAX))
2073 - *p++ = htonl(fl->fl_pid);
2074 - *p++ = htonl(fl->fl_start);
2075 + start = loff_t_to_s32(fl->fl_start);
2076 if (fl->fl_end == OFFSET_MAX)
2080 - *p++ = htonl(fl->fl_end - fl->fl_start + 1);
2081 + len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1);
2083 + *p++ = htonl(fl->fl_pid);
2084 + *p++ = htonl(start);
2085 + *p++ = htonl(len);
2091 nlm_encode_testres(u32 *p, struct nlm_res *resp)
2095 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
2097 *p++ = resp->status;
2098 @@ -223,11 +253,14 @@
2099 if (!(p = xdr_encode_netobj(p, &resp->lock.oh)))
2102 - *p++ = htonl(fl->fl_start);
2103 + start = loff_t_to_s32(fl->fl_start);
2104 if (fl->fl_end == OFFSET_MAX)
2108 - *p++ = htonl(fl->fl_end - fl->fl_start + 1);
2109 + len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1);
2111 + *p++ = htonl(start);
2112 + *p++ = htonl(len);
2117 resp->status = ntohl(*p++);
2118 if (resp->status == NLM_LCK_DENIED) {
2119 struct file_lock *fl = &resp->lock.fl;
2122 + s32 start, len, end;
2124 memset(&resp->lock, 0, sizeof(resp->lock));
2126 @@ -456,10 +490,15 @@
2128 fl->fl_flags = FL_POSIX;
2129 fl->fl_type = excl? F_WRLCK : F_RDLCK;
2130 - fl->fl_start = ntohl(*p++);
2131 + start = ntohl(*p++);
2133 - if (len == 0 || (fl->fl_end = fl->fl_start + len - 1) < 0)
2134 + end = start + len - 1;
2136 + fl->fl_start = s32_to_loff_t(start);
2137 + if (len == 0 || end < 0)
2138 fl->fl_end = OFFSET_MAX;
2140 + fl->fl_end = s32_to_loff_t(end);
2144 diff -Naur linux/fs/lockd/xdr4.c linux-p/fs/lockd/xdr4.c
2145 --- linux/fs/lockd/xdr4.c Sun Mar 25 18:30:59 2001
2146 +++ linux-p/fs/lockd/xdr4.c Mon Jan 14 23:01:48 2002
2149 #define NLMDBG_FACILITY NLMDBG_XDR
2150 #define NLM_MAXSTRLEN 1024
2151 -#define OFFSET_MAX ((off_t)LONG_MAX)
2153 #define QUADLEN(len) (((len) + 3) >> 2)
2157 typedef struct nlm_args nlm_args;
2159 -static inline off_t
2160 -size_to_off_t(__s64 size)
2161 +static inline loff_t
2162 +s64_to_loff_t(__s64 offset)
2164 - size = (size > (__s64)LONG_MAX) ? (off_t)LONG_MAX : (off_t) size;
2165 - return (size < (__s64)-LONG_MAX) ? (off_t)-LONG_MAX : (off_t) size;
2166 + return (loff_t)offset;
2170 +loff_t_to_s64(loff_t offset)
2173 + if (offset > NLM4_OFFSET_MAX)
2174 + res = NLM4_OFFSET_MAX;
2175 + else if (offset < -NLM4_OFFSET_MAX)
2176 + res = -NLM4_OFFSET_MAX;
2183 @@ -139,11 +150,12 @@
2184 p = xdr_decode_hyper(p, &len);
2185 end = start + len - 1;
2187 - fl->fl_start = size_to_off_t(start);
2188 - fl->fl_end = size_to_off_t(end);
2189 + fl->fl_start = s64_to_loff_t(start);
2191 - if (len == 0 || fl->fl_end < 0)
2192 + if (len == 0 || end < 0)
2193 fl->fl_end = OFFSET_MAX;
2195 + fl->fl_end = s64_to_loff_t(end);
2199 @@ -154,18 +166,26 @@
2200 nlm4_encode_lock(u32 *p, struct nlm_lock *lock)
2202 struct file_lock *fl = &lock->fl;
2205 if (!(p = xdr_encode_string(p, lock->caller, -1))
2206 || !(p = nlm4_encode_fh(p, &lock->fh))
2207 || !(p = nlm4_encode_oh(p, &lock->oh)))
2210 - *p++ = htonl(fl->fl_pid);
2211 - p = xdr_encode_hyper(p, fl->fl_start);
2212 + if (fl->fl_start > NLM4_OFFSET_MAX
2213 + || (fl->fl_end > NLM4_OFFSET_MAX && fl->fl_end != OFFSET_MAX))
2216 + start = loff_t_to_s64(fl->fl_start);
2217 if (fl->fl_end == OFFSET_MAX)
2218 - p = xdr_encode_hyper(p, 0);
2221 - p = xdr_encode_hyper(p, fl->fl_end - fl->fl_start + 1);
2222 + len = loff_t_to_s64(fl->fl_end - fl->fl_start + 1);
2224 + *p++ = htonl(fl->fl_pid);
2225 + p = xdr_encode_hyper(p, start);
2226 + p = xdr_encode_hyper(p, len);
2232 nlm4_encode_testres(u32 *p, struct nlm_res *resp)
2236 dprintk("xdr: before encode_testres (p %p resp %p)\n", p, resp);
2237 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
2238 @@ -192,14 +213,17 @@
2239 if (!(p = xdr_encode_netobj(p, &resp->lock.oh)))
2242 - p = xdr_encode_hyper(p, fl->fl_start);
2243 + start = loff_t_to_s64(fl->fl_start);
2244 if (fl->fl_end == OFFSET_MAX)
2245 - p = xdr_encode_hyper(p, 0);
2248 - p = xdr_encode_hyper(p, fl->fl_end - fl->fl_start + 1);
2249 - dprintk("xdr: encode_testres (status %d pid %d type %d start %ld end %ld)\n", resp->status, fl->fl_pid, fl->fl_type, fl->fl_start, fl->fl_end);
2252 + len = loff_t_to_s64(fl->fl_end - fl->fl_start + 1);
2254 + p = xdr_encode_hyper(p, start);
2255 + p = xdr_encode_hyper(p, len);
2256 + dprintk("xdr: encode_testres (status %d pid %d type %d start %Ld end %Ld)\n",
2257 + resp->status, fl->fl_pid, fl->fl_type,
2258 + fl->fl_start, fl->fl_end);
2261 dprintk("xdr: after encode_testres (p %p resp %p)\n", p, resp);
2262 @@ -435,10 +459,11 @@
2263 p = xdr_decode_hyper(p, &len);
2264 end = start + len - 1;
2266 - fl->fl_start = size_to_off_t(start);
2267 - fl->fl_end = size_to_off_t(end);
2268 - if (len == 0 || fl->fl_end < 0)
2269 + fl->fl_start = s64_to_loff_t(start);
2270 + if (len == 0 || end < 0)
2271 fl->fl_end = OFFSET_MAX;
2273 + fl->fl_end = s64_to_loff_t(end);
2277 diff -Naur linux/fs/locks.c linux-p/fs/locks.c
2278 --- linux/fs/locks.c Fri Nov 2 17:39:08 2001
2279 +++ linux-p/fs/locks.c Mon Jan 14 23:01:48 2002
2280 @@ -111,12 +111,12 @@
2282 #include <asm/uaccess.h>
2284 -#define OFFSET_MAX ((off_t)LONG_MAX) /* FIXME: move elsewhere? */
2286 static int flock_make_lock(struct file *filp, struct file_lock *fl,
2288 -static int posix_make_lock(struct file *filp, struct file_lock *fl,
2289 +static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
2291 +static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
2292 + struct flock64 *l);
2293 static int flock_locks_conflict(struct file_lock *caller_fl,
2294 struct file_lock *sys_fl);
2295 static int posix_locks_conflict(struct file_lock *caller_fl,
2298 if (waiter->fl_prevblock) {
2299 printk(KERN_ERR "locks_insert_block: remove duplicated lock "
2300 - "(pid=%d %ld-%ld type=%d)\n",
2301 + "(pid=%d %Ld-%Ld type=%d)\n",
2302 waiter->fl_pid, waiter->fl_start,
2303 waiter->fl_end, waiter->fl_type);
2304 locks_delete_block(waiter->fl_prevblock, waiter);
2305 @@ -344,9 +344,10 @@
2306 if (!filp->f_dentry || !filp->f_dentry->d_inode || !filp->f_op)
2309 - if (!posix_make_lock(filp, &file_lock, &flock))
2310 + if ((error = flock_to_posix_lock(filp, &file_lock, &flock)))
2314 if (filp->f_op->lock) {
2315 error = filp->f_op->lock(filp, F_GETLK, &file_lock);
2317 @@ -363,6 +364,18 @@
2318 flock.l_type = F_UNLCK;
2320 flock.l_pid = fl->fl_pid;
2321 +#if BITS_PER_LONG == 32
2323 + * Make sure we can represent the posix lock via
2324 + * legacy 32bit flock.
2326 + error = -EOVERFLOW;
2327 + if (fl->fl_start > OFFT_OFFSET_MAX)
2329 + if ((fl->fl_end != OFFSET_MAX)
2330 + && (fl->fl_end > OFFT_OFFSET_MAX))
2333 flock.l_start = fl->fl_start;
2334 flock.l_len = fl->fl_end == OFFSET_MAX ? 0 :
2335 fl->fl_end - fl->fl_start + 1;
2341 - if (!posix_make_lock(filp, &file_lock, &flock))
2342 + if ((error = flock_to_posix_lock(filp, &file_lock, &flock)))
2346 @@ -475,6 +487,169 @@
2350 +#if BITS_PER_LONG == 32
2351 +/* Report the first existing lock that would conflict with l.
2352 + * This implements the F_GETLK command of fcntl().
2354 +int fcntl_getlk64(unsigned int fd, struct flock64 *l)
2356 + struct file *filp;
2357 + struct file_lock *fl,file_lock;
2358 + struct flock64 flock;
2362 + if (copy_from_user(&flock, l, sizeof(flock)))
2365 + if ((flock.l_type != F_RDLCK) && (flock.l_type != F_WRLCK))
2374 + if (!filp->f_dentry || !filp->f_dentry->d_inode || !filp->f_op)
2377 + if (!flock64_to_posix_lock(filp, &file_lock, &flock))
2380 + if (filp->f_op->lock) {
2381 + error = filp->f_op->lock(filp, F_GETLK, &file_lock);
2384 + else if (error == LOCK_USE_CLNT)
2385 + /* Bypass for NFS with no locking - 2.0.36 compat */
2386 + fl = posix_test_lock(filp, &file_lock);
2388 + fl = (file_lock.fl_type == F_UNLCK ? NULL : &file_lock);
2390 + fl = posix_test_lock(filp, &file_lock);
2393 + flock.l_type = F_UNLCK;
2395 + flock.l_pid = fl->fl_pid;
2396 + flock.l_start = fl->fl_start;
2397 + flock.l_len = fl->fl_end == OFFSET_MAX ? 0 :
2398 + fl->fl_end - fl->fl_start + 1;
2399 + flock.l_whence = 0;
2400 + flock.l_type = fl->fl_type;
2403 + if (!copy_to_user(l, &flock, sizeof(flock)))
2412 +/* Apply the lock described by l to an open file descriptor.
2413 + * This implements both the F_SETLK and F_SETLKW commands of fcntl().
2415 +int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l)
2417 + struct file *filp;
2418 + struct file_lock file_lock;
2419 + struct flock64 flock;
2420 + struct dentry * dentry;
2421 + struct inode *inode;
2425 + * This might block, so we do it before checking the inode.
2428 + if (copy_from_user(&flock, l, sizeof(flock)))
2431 + /* Get arguments and validate them ...
2440 + if (!(dentry = filp->f_dentry))
2442 + if (!(inode = dentry->d_inode))
2447 + /* Don't allow mandatory locks on files that may be memory mapped
2450 + if (IS_MANDLOCK(inode) &&
2451 + (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID &&
2453 + struct vm_area_struct *vma = inode->i_mmap;
2456 + if (vma->vm_flags & VM_MAYSHARE)
2458 + } while ((vma = vma->vm_next_share) != NULL);
2462 + if (!flock64_to_posix_lock(filp, &file_lock, &flock))
2466 + switch (flock.l_type) {
2468 + if (!(filp->f_mode & FMODE_READ))
2472 + if (!(filp->f_mode & FMODE_WRITE))
2480 +/* warn a bit for now, but don't overdo it */
2482 + static int count = 0;
2485 + printk(KERN_WARNING
2486 + "fcntl_setlk() called by process %d (%s) with broken flock() emulation\n",
2487 + current->pid, current->comm);
2490 + if (!(filp->f_mode & 3))
2499 + if (filp->f_op->lock != NULL) {
2500 + error = filp->f_op->lock(filp, cmd, &file_lock);
2504 + error = posix_lock_file(filp, &file_lock, cmd == F_SETLKW64);
2511 +#endif /* BITS_PER_LONG == 32 */
2514 * This function is called when the file is being removed
2515 * from the task's fd array.
2516 @@ -655,10 +830,70 @@
2517 /* Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX
2520 -static int posix_make_lock(struct file *filp, struct file_lock *fl,
2522 +static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
2526 + int ret = -EINVAL;
2528 + memset(fl, 0, sizeof(*fl));
2530 + fl->fl_flags = FL_POSIX;
2532 + switch (l->l_type) {
2536 + fl->fl_type = l->l_type;
2542 + switch (l->l_whence) {
2543 + case 0: /*SEEK_SET*/
2546 + case 1: /*SEEK_CUR*/
2547 + start = filp->f_pos;
2549 + case 2: /*SEEK_END*/
2550 + start = filp->f_dentry->d_inode->i_size;
2556 + if (((start += l->l_start) < 0) || (l->l_len < 0))
2558 + fl->fl_end = start + l->l_len - 1;
2559 + if (l->l_len > 0 && fl->fl_end < 0)
2561 + fl->fl_start = start; /* we record the absolute position */
2562 + if (l->l_len != 0) {
2563 + start = fl->fl_end;
2565 + start = fl->fl_start;
2566 + fl->fl_end = OFFSET_MAX;
2569 + if (start > OFFT_OFFSET_MAX)
2572 + fl->fl_file = filp;
2573 + fl->fl_owner = current->files;
2574 + fl->fl_pid = current->pid;
2581 +#if BITS_PER_LONG == 32
2582 +static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
2583 + struct flock64 *l)
2588 memset(fl, 0, sizeof(*fl));
2596 /* Verify a call to flock() and fill in a file_lock structure with
2597 * an appropriate FLOCK lock.
2598 @@ -1218,7 +1454,7 @@
2599 p += sprintf(p, "FLOCK ADVISORY ");
2601 p += sprintf(p, "%s ", (fl->fl_type == F_RDLCK) ? "READ " : "WRITE");
2602 - p += sprintf(p, "%d %s:%ld %ld %ld ",
2603 + p += sprintf(p, "%d %s:%ld %Ld %Ld ",
2605 kdevname(inode->i_dev), inode->i_ino, fl->fl_start,
2607 @@ -1282,6 +1518,3 @@
2609 return (q - buffer);
2614 diff -Naur linux/fs/minix/dir.c linux-p/fs/minix/dir.c
2615 --- linux/fs/minix/dir.c Sun Mar 25 18:30:58 2001
2616 +++ linux-p/fs/minix/dir.c Mon Jan 14 23:01:48 2002
2618 de = (struct minix_dir_entry *) (offset + bh->b_data);
2620 int size = strnlen(de->name, info->s_namelen);
2621 - if (filldir(dirent, de->name, size, filp->f_pos, de->inode) < 0) {
2622 + if (filldir(dirent, de->name, size, filp->f_pos, de->inode, DT_UNKNOWN) < 0) {
2626 diff -Naur linux/fs/minix/file.c linux-p/fs/minix/file.c
2627 --- linux/fs/minix/file.c Sun Mar 25 18:30:58 2001
2628 +++ linux-p/fs/minix/file.c Mon Jan 14 23:01:48 2002
2630 size_t count, loff_t *ppos)
2632 struct inode * inode = filp->f_dentry->d_inode;
2634 - ssize_t written, c;
2636 + ssize_t written, c, m;
2637 struct buffer_head * bh;
2641 pos = inode->i_size;
2645 + /* L-F-S spec 2.2.1.27: */
2646 + if (!(filp->f_flags & O_LARGEFILE)) {
2647 + if (pos >= 0x7fffffffULL) /* pos@2G forbidden */
2650 + if (pos + count > 0x7fffffffULL)
2651 + /* Write only until end of allowed region */
2652 + count = 0x7fffffffULL - pos;
2654 + /* MINIX i-node file-size can't exceed 4G-1 */
2655 + /* With 1k blocks and triple indirection MINIX can have files
2656 + up to 16 GB in size -- filesystem maximum is then 4G*1k = 4T */
2657 + if (pos >= 0xffffffffULL)
2658 + return -EFBIG; /* Absolutely too much! */
2659 + if ((pos + count) >= 0x100000000ULL) /* too much to write! */
2660 + count = 0xffffffffULL - pos;
2663 while (written < count) {
2664 - bh = minix_getblk(inode,pos/BLOCK_SIZE,1);
2665 + bh = minix_getblk(inode, pos >> BLOCK_SIZE_BITS, 1);
2671 - c = BLOCK_SIZE - (pos % BLOCK_SIZE);
2672 + m = pos & (BLOCK_SIZE - 1);
2673 + c = BLOCK_SIZE - m;
2674 if (c > count-written)
2676 if (c != BLOCK_SIZE && !buffer_uptodate(bh)) {
2681 - p = (pos % BLOCK_SIZE) + bh->b_data;
2682 + p = bh->b_data + m;
2683 c -= copy_from_user(p,buf,c);
2686 diff -Naur linux/fs/ncpfs/dir.c linux-p/fs/ncpfs/dir.c
2687 --- linux/fs/ncpfs/dir.c Sun Mar 25 18:30:59 2001
2688 +++ linux-p/fs/ncpfs/dir.c Mon Jan 14 23:01:48 2002
2689 @@ -449,14 +449,14 @@
2691 if (filp->f_pos == 0) {
2692 ncp_invalid_dir_cache(inode);
2693 - if (filldir(dirent, ".", 1, 0, inode->i_ino) < 0) {
2694 + if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0) {
2699 if (filp->f_pos == 1) {
2700 if (filldir(dirent, "..", 2, 1,
2701 - dentry->d_parent->d_inode->i_ino) < 0) {
2702 + dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) {
2707 ino = ncp_invent_inos(1);
2709 if (filldir(dirent, entry->i.entryName, entry->i.nameLen,
2710 - entry->f_pos, ino) < 0) {
2711 + entry->f_pos, ino, DT_UNKNOWN) < 0) {
2714 if ((inode->i_dev != c_dev)
2715 diff -Naur linux/fs/ncpfs/file.c linux-p/fs/ncpfs/file.c
2716 --- linux/fs/ncpfs/file.c Sun Mar 25 18:30:59 2001
2717 +++ linux-p/fs/ncpfs/file.c Mon Jan 14 23:01:48 2002
2719 #include <linux/mm.h>
2720 #include <linux/locks.h>
2721 #include <linux/malloc.h>
2722 +#include <linux/unistd.h>
2724 #include <linux/ncp_fs.h>
2725 #include "ncplib_kernel.h"
2727 /* First read in as much as possible for each bufsize. */
2728 while (already_read < count) {
2730 - size_t to_read = min(bufsize - (pos % bufsize),
2731 + size_t to_read = min(bufsize - (pos & (bufsize-1)),
2732 count - already_read);
2734 error = ncp_read_bounce(NCP_SERVER(inode),
2736 struct dentry *dentry = file->f_dentry;
2737 struct inode *inode = dentry->d_inode;
2738 size_t already_written = 0;
2744 @@ -238,12 +239,18 @@
2746 already_written = 0;
2748 + /* Maximum file size: 2G-1 */
2749 + if (pos >= 0x7fffffffULL)
2751 + if ((pos + count) >= 0x7fffffffULL)
2752 + count = 0x7fffffffULL - pos;
2754 bouncebuffer = kmalloc(bufsize, GFP_NFS);
2756 return -EIO; /* -ENOMEM */
2757 while (already_written < count) {
2758 int written_this_time;
2759 - size_t to_write = min(bufsize - (pos % bufsize),
2760 + size_t to_write = min(bufsize - (pos & (bufsize-1)),
2761 count - already_written);
2763 if (copy_from_user(bouncebuffer, buf, to_write)) {
2764 diff -Naur linux/fs/ncpfs/inode.c linux-p/fs/ncpfs/inode.c
2765 --- linux/fs/ncpfs/inode.c Sun Mar 25 18:30:59 2001
2766 +++ linux-p/fs/ncpfs/inode.c Mon Jan 14 23:01:48 2002
2769 inode->i_blocks = 0;
2770 if ((inode->i_size)&&(inode->i_blksize)) {
2771 - inode->i_blocks = (inode->i_size-1)/(inode->i_blksize)+1;
2772 + inode->i_blocks = ((inode->i_size-1) >> fslog2(inode->i_blksize)) +1;
2775 inode->i_mtime = ncp_date_dos2unix(le16_to_cpu(nwi->modifyTime),
2778 inode->i_blocks = 0;
2779 if ((inode->i_blksize != 0) && (inode->i_size != 0)) {
2781 - (inode->i_size - 1) / inode->i_blksize + 1;
2782 + inode->i_blocks = ((inode->i_size - 1) >> fslog2(inode->i_blksize)) + 1;
2785 inode->i_mtime = ncp_date_dos2unix(le16_to_cpu(nwi->modifyTime),
2786 diff -Naur linux/fs/nfs/dir.c linux-p/fs/nfs/dir.c
2787 --- linux/fs/nfs/dir.c Fri Nov 2 17:39:08 2001
2788 +++ linux-p/fs/nfs/dir.c Mon Jan 14 23:01:48 2002
2790 int plus = NFS_USE_READDIRPLUS(inode);
2793 - dfprintk(VFS, "NFS: nfs_readdir_filler() reading cookie %Lu into page %lu.\n", (long long)desc->entry->cookie, page->offset);
2794 + dfprintk(VFS, "NFS: nfs_readdir_filler() reading cookie %Lu into page %Lu.\n", (long long)desc->entry->cookie, (long long) nfs_page_offset(page));
2797 error = NFS_PROTO(inode)->readdir(inode, cred,
2799 * Note: assumes we have exclusive access to this inode either
2800 * throught inode->i_sem or some other mechanism.
2802 - if (page->offset == 0)
2803 + if (page_index(page) == 0)
2804 invalidate_inode_pages(inode);
2805 nfs_unlock_page(page);
2808 * retrieving the current dirent on the server */
2809 fileid = nfs_fileid_to_ino_t(entry->ino);
2810 res = filldir(dirent, entry->name, entry->len,
2811 - entry->prev_cookie, fileid);
2812 + entry->prev_cookie, fileid, DT_UNKNOWN);
2815 file->f_pos = desc->target = entry->cookie;
2816 diff -Naur linux/fs/nfs/file.c linux-p/fs/nfs/file.c
2817 --- linux/fs/nfs/file.c Sun Mar 25 18:37:38 2001
2818 +++ linux-p/fs/nfs/file.c Mon Jan 14 23:01:48 2002
2821 static int nfs_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to)
2823 + if (!NFS_PROTO(file->f_dentry->d_inode)->bigfiles &&
2824 + page_index(page) > (0x7fffffff>>PAGE_SHIFT))
2826 return nfs_flush_incompatible(file, page);
2829 @@ -232,10 +235,10 @@
2830 struct inode * inode = dentry->d_inode;
2833 - dprintk("NFS: nfs_lock(f=%4x/%ld, t=%x, fl=%x, r=%ld:%ld)\n",
2834 + dprintk("NFS: nfs_lock(f=%4x/%ld, t=%x, fl=%x, r=%Ld:%Ld)\n",
2835 inode->i_dev, inode->i_ino,
2836 fl->fl_type, fl->fl_flags,
2837 - fl->fl_start, fl->fl_end);
2838 + (long long)fl->fl_start, (long long)fl->fl_end);
2842 diff -Naur linux/fs/nfs/inode.c linux-p/fs/nfs/inode.c
2843 --- linux/fs/nfs/inode.c Fri Nov 2 17:39:08 2001
2844 +++ linux-p/fs/nfs/inode.c Mon Jan 14 23:01:48 2002
2846 * Preset the size and mtime, as there's no need
2847 * to invalidate the caches.
2849 - inode->i_size = nfs_size_to_off_t(fattr->size);
2850 + inode->i_size = nfs_size_to_loff_t(fattr->size);
2851 inode->i_mtime = nfs_time_to_secs(fattr->mtime);
2852 inode->i_atime = nfs_time_to_secs(fattr->atime);
2853 inode->i_ctime = nfs_time_to_secs(fattr->ctime);
2854 @@ -773,6 +773,11 @@
2855 if (!S_ISREG(inode->i_mode))
2856 attr->ia_valid &= ~ATTR_SIZE;
2859 + if ((attr->ia_valid & ATTR_SIZE) && !NFS_PROTO(inode)->bigfiles &&
2860 + attr->ia_size > 0x7fffffff)
2863 error = nfs_wb_all(inode);
2866 @@ -831,6 +836,10 @@
2867 struct rpc_cred *cred = rpcauth_lookupcred(auth, 0);
2869 filp->private_data = cred;
2871 + if (!NFS_PROTO(filp->f_dentry->d_inode)->bigfiles)
2872 + filp->f_flags &= ~O_LARGEFILE;
2879 nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
2881 - off_t new_size, new_isize;
2883 + __u64 new_size, new_mtime;
2890 new_mtime = fattr->mtime;
2891 new_size = fattr->size;
2892 - new_isize = nfs_size_to_off_t(fattr->size);
2893 + new_isize = nfs_size_to_loff_t(fattr->size);
2897 diff -Naur linux/fs/nfs/nfs3proc.c linux-p/fs/nfs/nfs3proc.c
2898 --- linux/fs/nfs/nfs3proc.c Sun Mar 25 18:37:38 2001
2899 +++ linux-p/fs/nfs/nfs3proc.c Mon Jan 14 23:01:48 2002
2902 nfs3_proc_read(struct inode *inode, struct rpc_cred *cred,
2903 struct nfs_fattr *fattr, int flags,
2904 - unsigned long offset, unsigned int count,
2905 + loff_t offset, unsigned int count,
2906 void *buffer, int *eofp)
2908 struct nfs_readargs arg = { NFS_FH(inode), offset, count, 1,
2910 struct rpc_message msg = { NFS3PROC_READ, &arg, &res, cred };
2913 - dprintk("NFS call read %d @ %ld\n", count, offset);
2914 + dprintk("NFS call read %d @ %Ld\n", count, (long long) offset);
2916 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
2917 dprintk("NFS reply read: %d\n", status);
2920 nfs3_proc_write(struct inode *inode, struct rpc_cred *cred,
2921 struct nfs_fattr *fattr, int flags,
2922 - unsigned long offset, unsigned int count,
2923 + loff_t offset, unsigned int count,
2924 void *buffer, struct nfs_writeverf *verf)
2926 struct nfs_writeargs arg = { NFS_FH(inode), offset, count,
2928 struct rpc_message msg = { NFS3PROC_WRITE, &arg, &res, cred };
2929 int status, rpcflags = 0;
2931 - dprintk("NFS call write %d @ %ld\n", count, offset);
2932 + dprintk("NFS call write %d @ %Ld\n", count, (long long) offset);
2934 if (flags & NFS_RW_SWAP)
2935 rpcflags |= NFS_RPC_SWAPFLAGS;
2943 diff -Naur linux/fs/nfs/proc.c linux-p/fs/nfs/proc.c
2944 --- linux/fs/nfs/proc.c Sun Mar 25 18:37:38 2001
2945 +++ linux-p/fs/nfs/proc.c Mon Jan 14 23:01:48 2002
2949 nfs_proc_read(struct inode *inode, struct rpc_cred *cred, fattr *fattr,
2950 - int flags, unsigned long offset, unsigned int count,
2951 + int flags, loff_t offset, unsigned int count,
2952 void *buffer, int *eofp)
2954 struct nfs_readargs arg = { NFS_FH(inode), offset, count, 1,
2956 struct rpc_message msg = { NFSPROC_READ, &arg, &res, cred };
2959 - dprintk("NFS call read %d @ %ld\n", count, offset);
2960 + dprintk("NFS call read %d @ %Ld\n", count, (long long) offset);
2962 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
2967 nfs_proc_write(struct inode *inode, struct rpc_cred *cred, fattr *fattr,
2968 - int how, unsigned long offset, unsigned int count,
2969 + int how, loff_t offset, unsigned int count,
2970 void *buffer, struct nfs_writeverf *verf)
2972 struct nfs_writeargs arg = {NFS_FH(inode), offset, count,
2974 struct rpc_message msg = { NFSPROC_WRITE, &arg, &res, cred };
2975 int status, flags = 0;
2977 - dprintk("NFS call write %d @ %ld\n", count, offset);
2978 + dprintk("NFS call write %d @ %Ld\n", count, (long long) offset);
2980 if (how & NFS_RW_SWAP)
2981 flags |= NFS_RPC_SWAPFLAGS;
2988 diff -Naur linux/fs/nfs/read.c linux-p/fs/nfs/read.c
2989 --- linux/fs/nfs/read.c Sun Mar 25 18:37:38 2001
2990 +++ linux-p/fs/nfs/read.c Mon Jan 14 23:01:48 2002
2993 struct rpc_cred *cred = NULL;
2994 struct nfs_fattr fattr;
2995 - unsigned long offset = nfs_page_offset(page);
2996 + loff_t offset = nfs_page_offset(page);
2997 char *buffer = (char *) page_address(page);
2998 int rsize = NFS_SERVER(inode)->rsize;
2999 int result, refresh = 0;
3000 @@ -112,10 +112,10 @@
3001 if ((chunk = rsize) > count)
3004 - dprintk("NFS: nfs_proc_read(%s, (%x/%Ld), %ld, %d, %p)\n",
3005 + dprintk("NFS: nfs_proc_read(%s, (%x/%Ld), %Ld, %d, %p)\n",
3006 NFS_SERVER(inode)->hostname,
3007 inode->i_dev, (long long)NFS_FILEID(inode),
3008 - offset, chunk, buffer);
3009 + (long long) offset, chunk, buffer);
3011 result = NFS_PROTO(inode)->read(inode, cred, &fattr, flags,
3012 offset, chunk, buffer, &eof);
3013 @@ -439,11 +439,11 @@
3014 set_bit(PG_error, &page->flags);
3015 nfs_unlock_page(page);
3017 - dprintk("NFS: read (%x/%Ld %d@%ld)\n",
3018 + dprintk("NFS: read (%x/%Ld %d@%Ld)\n",
3019 req->wb_inode->i_dev,
3020 (long long)NFS_FILEID(req->wb_inode),
3022 - (nfs_page_offset(page) + req->wb_offset));
3023 + (long long)(nfs_page_offset(page) + req->wb_offset));
3024 nfs_unlock_request(req);
3025 nfs_release_request(req);
3029 inode = file->f_dentry->d_inode;
3031 - dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
3032 - page, PAGE_CACHE_SIZE, page->offset);
3033 + dprintk("NFS: nfs_readpage (%p %ld@%Lu)\n",
3034 + page, PAGE_CACHE_SIZE, (long long) nfs_page_offset(page));
3037 * Try to flush any pending writes to the file
3038 diff -Naur linux/fs/nfs/write.c linux-p/fs/nfs/write.c
3039 --- linux/fs/nfs/write.c Sun Mar 25 18:37:38 2001
3040 +++ linux-p/fs/nfs/write.c Mon Jan 14 23:01:48 2002
3044 nfs_writepage_sync(struct file *file, struct inode *inode, struct page *page,
3045 - unsigned long offset, unsigned int count)
3046 + unsigned int offset, unsigned int count)
3048 struct rpc_cred *cred = NULL;
3049 unsigned int wsize = NFS_SERVER(inode)->wsize;
3050 @@ -152,16 +152,17 @@
3052 struct nfs_fattr fattr;
3053 struct nfs_writeverf verifier;
3057 cred = nfs_file_cred(file);
3059 - dprintk("NFS: nfs_writepage_sync(%x/%Ld %d@%ld)\n",
3060 + dprintk("NFS: nfs_writepage_sync(%x/%Ld %d@%Ld)\n",
3061 inode->i_dev, (long long)NFS_FILEID(inode),
3062 - count, nfs_page_offset(page) + offset);
3063 + count, (long long) (nfs_page_offset(page) + offset));
3065 buffer = (u8 *) page_address(page) + offset;
3066 - offset += nfs_page_offset(page);
3067 + base = nfs_page_offset(page) + offset;
3069 flags = ((IS_SWAPFILE(inode)) ? NFS_RW_SWAP : 0) | NFS_RW_SYNC;
3074 result = NFS_PROTO(inode)->write(inode, cred, &fattr, flags,
3075 - offset, wsize, buffer,
3076 + base, wsize, buffer,
3078 nfs_write_attributes(inode, &fattr);
3080 @@ -184,15 +185,15 @@
3089 * If we've extended the file, update the inode
3090 * now so we don't invalidate the cache.
3092 - if (offset > inode->i_size)
3093 - inode->i_size = offset;
3094 + if (base > inode->i_size)
3095 + inode->i_size = base;
3100 inode = page->inode;
3102 inode = file->f_dentry->d_inode;
3103 - if (page->offset >= inode->i_size)
3104 + if (nfs_page_offset(page) >= inode->i_size)
3106 - if (page->offset + offset > inode->i_size)
3107 + if (nfs_page_offset(page) + offset > inode->i_size)
3108 offset = inode->i_size & (PAGE_CACHE_SIZE-1);
3109 return nfs_writepage_sync(file, inode, page, 0, offset);
3112 region_locked(struct inode *inode, struct nfs_page *req)
3114 struct file_lock *fl;
3115 - unsigned long rqstart, rqend;
3116 + loff_t rqstart, rqend;
3118 /* Don't optimize writes if we don't use NLM */
3119 if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM)
3121 struct nfs_page *req;
3124 - dprintk("NFS: nfs_updatepage(%s/%s %d@%ld, sync=%d)\n",
3125 + dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld, sync=%d)\n",
3126 dentry->d_parent->d_name.name, dentry->d_name.name,
3127 - count, nfs_page_offset(page)+offset, sync);
3128 + count, (long long) (nfs_page_offset(page)+offset), sync);
3131 * If wsize is smaller than page size, update and write
3134 nfs_release_request(req);
3136 - dprintk("NFS: nfs_updatepage returns %d (isize %ld)\n",
3137 - status, inode->i_size);
3138 + dprintk("NFS: nfs_updatepage returns %d (isize %Ld)\n",
3139 + status, (long long) inode->i_size);
3141 clear_bit(PG_uptodate, &page->flags);
3143 @@ -1193,18 +1194,18 @@
3145 struct nfs_page *req;
3146 struct inode *inode;
3147 - unsigned long start, end, len;
3148 + loff_t start, end, len;
3150 /* Set up the RPC argument and reply structs
3151 * NB: take care not to mess about with data->commit et al. */
3155 + start = NFS_OFFSET_MAX;
3156 req = nfs_list_entry(head->next);
3157 inode = req->wb_inode;
3158 while (!list_empty(head)) {
3159 struct nfs_page *req;
3160 - unsigned long rqstart, rqend;
3161 + loff_t rqstart, rqend;
3162 req = nfs_list_entry(head->next);
3163 nfs_list_remove_request(req);
3164 nfs_list_add_request(req, &data->pages);
3165 @@ -1220,7 +1221,7 @@
3166 data->args.fh = NFS_FH(inode);
3167 data->args.offset = start;
3169 - if (end >= inode->i_size || len > (~((u32)0) >> 1))
3170 + if (end >= inode->i_size || len < 0 || len > (~((u32)0) >> 1))
3172 data->res.count = data->args.count = (u32)len;
3173 data->res.fattr = &data->fattr;
3174 @@ -1298,11 +1299,11 @@
3175 req = nfs_list_entry(data->pages.next);
3176 nfs_list_remove_request(req);
3178 - dprintk("NFS: commit (%x/%Ld %d@%ld)",
3179 + dprintk("NFS: commit (%x/%Ld %d@%Ld)",
3180 req->wb_inode->i_dev,
3181 (long long)NFS_FILEID(req->wb_inode),
3183 - nfs_page_offset(req->wb_page) + req->wb_offset);
3184 + (long long) (nfs_page_offset(req->wb_page) + req->wb_offset));
3185 if (task->tk_status < 0) {
3187 req->wb_file->f_error = task->tk_status;
3188 diff -Naur linux/fs/nfsd/nfs3xdr.c linux-p/fs/nfsd/nfs3xdr.c
3189 --- linux/fs/nfsd/nfs3xdr.c Sun Mar 25 18:37:38 2001
3190 +++ linux-p/fs/nfsd/nfs3xdr.c Mon Jan 14 23:01:48 2002
3192 iap->ia_valid |= ATTR_SIZE;
3193 p = xdr_decode_hyper(p, &newsize);
3194 if (newsize <= NFS_OFFSET_MAX)
3195 - iap->ia_size = (u32) newsize;
3196 + iap->ia_size = newsize;
3198 - iap->ia_size = ~(size_t) 0;
3199 + iap->ia_size = NFS_OFFSET_MAX;
3201 if ((tmp = ntohl(*p++)) == 1) { /* set to server time */
3202 iap->ia_valid |= ATTR_ATIME;
3203 @@ -678,11 +678,6 @@
3208 - dprintk("encode_entry(%.*s @%ld%s)\n",
3209 - namlen, name, (long) offset, plus? " plus" : "");
3212 /* truncate filename if too long */
3213 if (namlen > NFS3_MAXNAMLEN)
3214 namlen = NFS3_MAXNAMLEN;
3215 @@ -727,14 +722,14 @@
3218 nfs3svc_encode_entry(struct readdir_cd *cd, const char *name,
3219 - int namlen, off_t offset, ino_t ino)
3220 + int namlen, off_t offset, ino_t ino, unsigned int d_type)
3222 return encode_entry(cd, name, namlen, offset, ino, 0);
3226 nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name,
3227 - int namlen, off_t offset, ino_t ino)
3228 + int namlen, off_t offset, ino_t ino, unsigned int d_type)
3230 return encode_entry(cd, name, namlen, offset, ino, 1);
3232 diff -Naur linux/fs/nfsd/nfsfh.c linux-p/fs/nfsd/nfsfh.c
3233 --- linux/fs/nfsd/nfsfh.c Mon Jan 14 22:59:25 2002
3234 +++ linux-p/fs/nfsd/nfsfh.c Mon Jan 14 23:01:48 2002
3236 * the name matching the specified inode number.
3238 static int filldir_one(void * __buf, const char * name, int len,
3239 - off_t pos, ino_t ino)
3240 + off_t pos, ino_t ino, unsigned int d_type)
3242 struct nfsd_getdents_callback *buf = __buf;
3243 struct qstr *qs = buf->name;
3244 diff -Naur linux/fs/nfsd/nfssvc.c linux-p/fs/nfsd/nfssvc.c
3245 --- linux/fs/nfsd/nfssvc.c Fri Nov 2 17:39:08 2001
3246 +++ linux-p/fs/nfsd/nfssvc.c Mon Jan 14 23:01:48 2002
3248 current->session = 1;
3250 current->fs->umask = 0;
3251 + current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
3253 /* Count active threads */
3254 atomic_inc(&nfsd_active);
3255 diff -Naur linux/fs/nfsd/nfsxdr.c linux-p/fs/nfsd/nfsxdr.c
3256 --- linux/fs/nfsd/nfsxdr.c Sun Mar 25 18:37:38 2001
3257 +++ linux-p/fs/nfsd/nfsxdr.c Mon Jan 14 23:01:48 2002
3261 nfssvc_encode_entry(struct readdir_cd *cd, const char *name,
3262 - int namlen, off_t offset, ino_t ino)
3263 + int namlen, off_t offset, ino_t ino, unsigned int d_type)
3265 u32 *p = cd->buffer;
3267 diff -Naur linux/fs/nfsd/vfs.c linux-p/fs/nfsd/vfs.c
3268 --- linux/fs/nfsd/vfs.c Sun Mar 25 18:37:38 2001
3269 +++ linux-p/fs/nfsd/vfs.c Mon Jan 14 23:01:48 2002
3270 @@ -513,11 +513,11 @@
3272 filp->f_dentry = dentry;
3273 if (access & MAY_WRITE) {
3274 - filp->f_flags = O_WRONLY;
3275 + filp->f_flags = O_WRONLY | O_LARGEFILE;
3276 filp->f_mode = FMODE_WRITE;
3279 - filp->f_flags = O_RDONLY;
3280 + filp->f_flags = O_RDONLY | O_LARGEFILE;
3281 filp->f_mode = FMODE_READ;
3285 /* Write back readahead params */
3287 dprintk("nfsd: raparms %ld %ld %ld %ld %ld\n",
3288 - file.f_reada, file.f_ramax, file.f_raend,
3289 - file.f_ralen, file.f_rawin);
3290 + (u_long)file.f_reada, (u_long)file.f_ramax,
3291 + (u_long)file.f_raend, (u_long)file.f_ralen,
3292 + (u_long)file.f_rawin);
3293 ra->p_reada = file.f_reada;
3294 ra->p_ramax = file.f_ramax;
3295 ra->p_raend = file.f_raend;
3296 diff -Naur linux/fs/ntfs/fs.c linux-p/fs/ntfs/fs.c
3297 --- linux/fs/ntfs/fs.c Fri Nov 2 17:39:08 2001
3298 +++ linux-p/fs/ntfs/fs.c Mon Jan 14 23:01:48 2002
3300 /* filldir expects an off_t rather than an loff_t.
3301 Hope we don't have more than 65535 index records */
3302 error=nf->filldir(nf->dirent,nf->name,nf->namelen,
3303 - (nf->ph<<16)|nf->pl,inum);
3304 + (nf->ph<<16)|nf->pl,inum,DT_UNKNOWN);
3305 ntfs_free(nf->name);
3306 /* Linux filldir errors are negative, other errors positive */
3308 @@ -226,11 +226,11 @@
3310 /* FIXME: Maybe we can return those with the previous call */
3312 - case 0: filldir(dirent,".",1,filp->f_pos,dir->i_ino);
3313 + case 0: filldir(dirent,".",1,filp->f_pos,dir->i_ino,DT_DIR);
3314 filp->f_pos=0xFFFF0001;
3316 /* FIXME: parent directory */
3317 - case 1: filldir(dirent,"..",2,filp->f_pos,0);
3318 + case 1: filldir(dirent,"..",2,filp->f_pos,0,DT_DIR);
3319 filp->f_pos=0xFFFF0002;
3329 ntfs_debug(DEBUG_OTHER, "ntfs_statfs\n");
3330 @@ -831,16 +832,17 @@
3331 fs.f_type=NTFS_SUPER_MAGIC;
3332 fs.f_bsize=vol->clustersize;
3334 - error = ntfs_get_volumesize( NTFS_SB2VOL( sb ), &fs.f_blocks );
3335 + error = ntfs_get_volumesize( NTFS_SB2VOL( sb ), &size );
3338 + fs.f_blocks = size;
3339 fs.f_bfree=ntfs_get_free_cluster_count(vol->bitmap);
3340 fs.f_bavail=fs.f_bfree;
3342 /* Number of files is limited by free space only, so we lie here */
3344 mft=iget(sb,FILE_MFT);
3345 - fs.f_files=mft->i_size/vol->mft_recordsize;
3346 + fs.f_files = (long)mft->i_size / vol->mft_recordsize;
3349 /* should be read from volume */
3350 diff -Naur linux/fs/ntfs/super.c linux-p/fs/ntfs/super.c
3351 --- linux/fs/ntfs/super.c Sun Mar 25 18:31:02 2001
3352 +++ linux-p/fs/ntfs/super.c Mon Jan 14 23:01:48 2002
3354 * Writes the volume size into vol_size. Returns 0 if successful
3357 -int ntfs_get_volumesize(ntfs_volume *vol, long *vol_size )
3358 +int ntfs_get_volumesize(ntfs_volume *vol, ntfs_u64 *vol_size )
3363 ntfs_getput_clusters(vol,0,0,&io);
3364 size=NTFS_GETU64(cluster0+0x28);
3365 ntfs_free(cluster0);
3366 - /* FIXME: more than 2**32 cluster */
3367 - /* FIXME: gcc will emit udivdi3 if we don't truncate it */
3368 - *vol_size = ((unsigned long)size)/vol->clusterfactor;
3373 diff -Naur linux/fs/ntfs/super.h linux-p/fs/ntfs/super.h
3374 --- linux/fs/ntfs/super.h Sun Mar 25 18:31:02 2001
3375 +++ linux-p/fs/ntfs/super.h Mon Jan 14 23:01:48 2002
3377 #define ALLOC_REQUIRE_SIZE 2
3379 int ntfs_get_free_cluster_count(ntfs_inode *bitmap);
3380 -int ntfs_get_volumesize(ntfs_volume *vol, long *vol_size );
3381 +int ntfs_get_volumesize(ntfs_volume *vol, ntfs_u64 *vol_size );
3382 int ntfs_init_volume(ntfs_volume *vol,char *boot);
3383 int ntfs_load_special_files(ntfs_volume *vol);
3384 int ntfs_release_volume(ntfs_volume *vol);
3385 diff -Naur linux/fs/open.c linux-p/fs/open.c
3386 --- linux/fs/open.c Mon Jan 14 22:59:27 2002
3387 +++ linux-p/fs/open.c Mon Jan 14 23:01:48 2002
3390 #include <asm/uaccess.h>
3392 -asmlinkage int sys_statfs(const char * path, struct statfs * buf)
3393 +asmlinkage long sys_statfs(const char * path, struct statfs * buf)
3395 struct dentry * dentry;
3401 -asmlinkage int sys_fstatfs(unsigned int fd, struct statfs * buf)
3402 +asmlinkage long sys_fstatfs(unsigned int fd, struct statfs * buf)
3405 struct inode * inode;
3410 -int do_truncate(struct dentry *dentry, unsigned long length)
3411 +int do_truncate(struct dentry *dentry, loff_t length)
3413 struct inode *inode = dentry->d_inode;
3415 struct iattr newattrs;
3417 - /* Not pretty: "inode->i_size" shouldn't really be "off_t". But it is. */
3418 - if ((off_t) length < 0)
3420 + /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
3425 fs_down(&inode->i_sem);
3426 newattrs.ia_size = length;
3428 inode->i_op->truncate(inode);
3430 fs_up(&inode->i_sem);
3435 -asmlinkage int sys_truncate(const char * path, unsigned long length)
3436 +static inline long do_sys_truncate(const char * path, loff_t length)
3438 struct dentry * dentry;
3439 struct inode * inode;
3440 @@ -136,7 +138,12 @@
3444 -asmlinkage int sys_ftruncate(unsigned int fd, unsigned long length)
3445 +asmlinkage long sys_truncate(const char * path, unsigned long length)
3447 + return do_sys_truncate(path, length);
3450 +static inline long do_sys_ftruncate(unsigned int fd, loff_t length)
3452 struct inode * inode;
3453 struct dentry *dentry;
3454 @@ -171,6 +178,24 @@
3458 +asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
3460 + return do_sys_ftruncate(fd, length);
3463 +/* LFS versions of truncate are only needed on 32 bit machines */
3464 +#if BITS_PER_LONG == 32
3465 +asmlinkage long sys_truncate64(const char * path, loff_t length)
3467 + return do_sys_truncate(path, length);
3470 +asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
3472 + return do_sys_ftruncate(fd, length);
3480 * must be owner or have write permission.
3481 * Else, update from *times, must be owner or super user.
3483 -asmlinkage int sys_utime(char * filename, struct utimbuf * times)
3484 +asmlinkage long sys_utime(char * filename, struct utimbuf * times)
3487 struct dentry * dentry;
3489 * must be owner or have write permission.
3490 * Else, update from *times, must be owner or super user.
3492 -asmlinkage int sys_utimes(char * filename, struct timeval * utimes)
3493 +asmlinkage long sys_utimes(char * filename, struct timeval * utimes)
3496 struct dentry * dentry;
3498 * We do this by temporarily clearing all FS-related capabilities and
3499 * switching the fsuid/fsgid around to the real ones.
3501 -asmlinkage int sys_access(const char * filename, int mode)
3502 +asmlinkage long sys_access(const char * filename, int mode)
3504 struct dentry * dentry;
3505 int old_fsuid, old_fsgid;
3510 -asmlinkage int sys_chdir(const char * filename)
3511 +asmlinkage long sys_chdir(const char * filename)
3514 struct inode *inode;
3519 -asmlinkage int sys_fchdir(unsigned int fd)
3520 +asmlinkage long sys_fchdir(unsigned int fd)
3523 struct dentry *dentry;
3528 -asmlinkage int sys_chroot(const char * filename)
3529 +asmlinkage long sys_chroot(const char * filename)
3532 struct inode *inode;
3537 -asmlinkage int sys_fchmod(unsigned int fd, mode_t mode)
3538 +asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
3540 struct inode * inode;
3541 struct dentry * dentry;
3546 -asmlinkage int sys_chmod(const char * filename, mode_t mode)
3547 +asmlinkage long sys_chmod(const char * filename, mode_t mode)
3549 struct dentry * dentry;
3550 struct inode * inode;
3555 -asmlinkage int sys_chown(const char * filename, uid_t user, gid_t group)
3556 +asmlinkage long sys_chown(const char * filename, uid_t user, gid_t group)
3558 struct dentry * dentry;
3564 -asmlinkage int sys_lchown(const char * filename, uid_t user, gid_t group)
3565 +asmlinkage long sys_lchown(const char * filename, uid_t user, gid_t group)
3567 struct dentry * dentry;
3573 -asmlinkage int sys_fchown(unsigned int fd, uid_t user, gid_t group)
3574 +asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
3576 struct dentry * dentry;
3579 f = get_empty_filp();
3582 +#if BITS_PER_LONG != 32
3583 + flags |= O_LARGEFILE;
3585 f->f_flags = flag = flags;
3586 f->f_mode = (flag+1) & O_ACCMODE;
3589 * For backward compatibility? Maybe this should be moved
3590 * into arch/i386 instead?
3592 -asmlinkage int sys_creat(const char * pathname, int mode)
3593 +asmlinkage long sys_creat(const char * pathname, int mode)
3595 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
3598 * This routine simulates a hangup on the tty, to arrange that users
3599 * are given clean terminals at login time.
3601 -asmlinkage int sys_vhangup(void)
3602 +asmlinkage long sys_vhangup(void)
3606 diff -Naur linux/fs/proc/array.c linux-p/fs/proc/array.c
3607 --- linux/fs/proc/array.c Mon Jan 14 22:59:27 2002
3608 +++ linux-p/fs/proc/array.c Mon Jan 14 23:01:48 2002
3609 @@ -1157,11 +1157,11 @@
3610 * + (index into the line)
3612 /* for systems with sizeof(void*) == 4: */
3613 -#define MAPS_LINE_FORMAT4 "%08lx-%08lx %s %08lx %s %lu"
3614 -#define MAPS_LINE_MAX4 49 /* sum of 8 1 8 1 4 1 8 1 5 1 10 1 */
3615 +#define MAPS_LINE_FORMAT4 "%08lx-%08lx %s %016Lx %s %lu"
3616 +#define MAPS_LINE_MAX4 57 /* sum of 8 1 8 1 4 1 16 1 5 1 10 1 */
3618 /* for systems with sizeof(void*) == 8: */
3619 -#define MAPS_LINE_FORMAT8 "%016lx-%016lx %s %016lx %s %lu"
3620 +#define MAPS_LINE_FORMAT8 "%016lx-%016lx %s %016Lx %s %lu"
3621 #define MAPS_LINE_MAX8 73 /* sum of 16 1 16 1 4 1 16 1 5 1 10 1 */
3623 #define MAPS_LINE_MAX MAPS_LINE_MAX8
3624 diff -Naur linux/fs/proc/fd.c linux-p/fs/proc/fd.c
3625 --- linux/fs/proc/fd.c Sun Mar 25 18:30:58 2001
3626 +++ linux-p/fs/proc/fd.c Mon Jan 14 23:01:48 2002
3630 ino = (ino & 0xffff0000) | PROC_PID_INO;
3631 - if (filldir(dirent, "..", fd+1, fd, ino) < 0)
3632 + if (filldir(dirent, "..", fd+1, fd, ino, DT_DIR) < 0)
3637 read_unlock(&tasklist_lock);
3639 ino = (pid << 16) + PROC_PID_FD_DIR + fd;
3640 - if (filldir(dirent, buf+j, NUMBUF-j, fd+2, ino) < 0)
3641 + if (filldir(dirent, buf+j, NUMBUF-j, fd+2, ino, DT_LNK) < 0)
3644 read_lock(&tasklist_lock);
3645 diff -Naur linux/fs/proc/openpromfs.c linux-p/fs/proc/openpromfs.c
3646 --- linux/fs/proc/openpromfs.c Sun Mar 25 18:30:58 2001
3647 +++ linux-p/fs/proc/openpromfs.c Mon Jan 14 23:01:48 2002
3648 @@ -846,14 +846,14 @@
3652 - if (filldir(dirent, ".", 1, i, ino) < 0) return 0;
3653 + if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0) return 0;
3658 if (filldir(dirent, "..", 2, i,
3659 (NODE(ino).parent == 0xffff) ?
3660 - PROC_ROOT_INO : NODE2INO(NODE(ino).parent)) < 0)
3661 + PROC_ROOT_INO : NODE2INO(NODE(ino).parent), DT_DIR) < 0)
3665 @@ -869,14 +869,14 @@
3666 if (prom_getname (nodes[node].node, buffer, 128) < 0)
3668 if (filldir(dirent, buffer, strlen(buffer),
3669 - filp->f_pos, NODE2INO(node)) < 0)
3670 + filp->f_pos, NODE2INO(node), DT_DIR) < 0)
3673 node = nodes[node].next;
3675 j = NODEP2INO(NODE(ino).first_prop);
3677 - if (filldir(dirent, ".node", 5, filp->f_pos, j) < 0)
3678 + if (filldir(dirent, ".node", 5, filp->f_pos, j, DT_REG) < 0)
3683 if (alias_names [i]) {
3684 if (filldir (dirent, alias_names [i],
3685 strlen (alias_names [i]),
3686 - filp->f_pos, j) < 0) return 0;
3687 + filp->f_pos, j, DT_REG) < 0) return 0;
3694 if (filldir(dirent, p, strlen(p),
3695 - filp->f_pos, j) < 0)
3696 + filp->f_pos, j, DT_REG) < 0)
3702 if (filldir(dirent, d->name,
3704 - filp->f_pos, d->inode) < 0)
3705 + filp->f_pos, d->inode, d->mode >> 12) < 0)
3709 diff -Naur linux/fs/proc/root.c linux-p/fs/proc/root.c
3710 --- linux/fs/proc/root.c Mon Jan 14 22:59:27 2002
3711 +++ linux-p/fs/proc/root.c Mon Jan 14 23:01:48 2002
3712 @@ -910,13 +910,13 @@
3716 - if (filldir(dirent, ".", 1, i, ino) < 0)
3717 + if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
3723 - if (filldir(dirent, "..", 2, i, de->parent->low_ino) < 0)
3724 + if (filldir(dirent, "..", 2, i, de->parent->low_ino, DT_DIR) < 0)
3732 - if (filldir(dirent, de->name, de->namelen, filp->f_pos, ino | de->low_ino) < 0)
3733 + if (filldir(dirent, de->name, de->namelen, filp->f_pos, ino | de->low_ino, de->mode >> 12) < 0)
3737 @@ -1002,7 +1002,7 @@
3741 - if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino) < 0)
3742 + if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino, DT_DIR) < 0)
3746 diff -Naur linux/fs/qnx4/dir.c linux-p/fs/qnx4/dir.c
3747 --- linux/fs/qnx4/dir.c Sun Mar 25 18:30:59 2001
3748 +++ linux-p/fs/qnx4/dir.c Mon Jan 14 23:01:48 2002
3750 QNX4_INODES_PER_BLOCK +
3753 - if (filldir(dirent, de->di_fname, size, filp->f_pos, ino) < 0) {
3754 + if (filldir(dirent, de->di_fname, size, filp->f_pos, ino, DT_UNKNOWN) < 0) {
3758 diff -Naur linux/fs/read_write.c linux-p/fs/read_write.c
3759 --- linux/fs/read_write.c Sun Mar 25 18:37:38 2001
3760 +++ linux-p/fs/read_write.c Mon Jan 14 23:01:48 2002
3763 asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
3766 + off_t retval, oldpos;
3768 struct dentry * dentry;
3769 struct inode * inode;
3771 if (!(dentry = file->f_dentry) ||
3772 !(inode = dentry->d_inode))
3774 + oldpos = file->f_pos;
3777 retval = llseek(file, offset, origin);
3779 + /* Demand L-F-S compliance only from normal files,
3780 + thus raw devices can do whatever they please.. */
3781 + if (!(file->f_flags & O_LARGEFILE) &&
3782 + retval >= 0 && S_ISREG(inode->i_mode) &&
3783 + file->f_pos > 0x7fffffff) {
3784 + file->f_pos = oldpos;
3785 + retval = -EOVERFLOW;
3792 struct dentry * dentry;
3793 struct inode * inode;
3795 + loff_t offset, oldpos;
3803 + oldpos = file->f_pos;
3804 offset = llseek(file, ((loff_t) offset_high << 32) | offset_low,
3807 @@ -105,6 +116,14 @@
3808 if (!copy_to_user(result, &offset, sizeof(offset)))
3811 + if (!(file->f_flags & O_LARGEFILE) && S_ISREG(inode->i_mode) &&
3812 + file->f_pos > 0x7fffffff) {
3813 + /* The target position isn't presentable without
3814 + O_LARGEFILE flag being set --> yield error, and
3815 + restore the file position. */
3816 + file->f_pos = oldpos;
3817 + retval = -EOVERFLOW;
3825 ssize_t (*read)(struct file *, char *, size_t, loff_t *);
3826 + struct inode * inode;
3830 @@ -342,10 +362,13 @@
3835 + inode = file->f_dentry->d_inode;
3837 if (!(file->f_mode & FMODE_READ))
3839 - ret = locks_verify_area(FLOCK_VERIFY_READ, file->f_dentry->d_inode,
3840 - file, pos, count);
3842 + ret = locks_verify_area(FLOCK_VERIFY_READ, inode, file, pos, count);
3849 ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
3850 + struct inode * inode;
3854 @@ -376,8 +400,10 @@
3856 if (!(file->f_mode & FMODE_WRITE))
3858 - ret = locks_verify_area(FLOCK_VERIFY_WRITE, file->f_dentry->d_inode,
3859 - file, pos, count);
3861 + inode = file->f_dentry->d_inode;
3863 + ret = locks_verify_area(FLOCK_VERIFY_WRITE, inode, file, pos, count);
3871 - fs_down(&file->f_dentry->d_inode->i_sem);
3872 + fs_down(&inode->i_sem);
3873 ret = write(file, buf, count, &pos);
3874 - fs_up(&file->f_dentry->d_inode->i_sem);
3875 + fs_up(&inode->i_sem);
3879 diff -Naur linux/fs/readdir.c linux-p/fs/readdir.c
3880 --- linux/fs/readdir.c Sun Mar 25 18:30:59 2001
3881 +++ linux-p/fs/readdir.c Mon Jan 14 23:01:48 2002
3886 -static int fillonedir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino)
3887 +static int fillonedir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino, unsigned int d_type)
3889 struct readdir_callback * buf = (struct readdir_callback *) __buf;
3890 struct old_linux_dirent * dirent;
3895 -static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino)
3896 +static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino, unsigned int d_type)
3898 struct linux_dirent * dirent;
3899 struct getdents_callback * buf = (struct getdents_callback *) __buf;
3900 @@ -187,6 +187,123 @@
3901 lastdirent = buf.previous;
3903 put_user(file->f_pos, &lastdirent->d_off);
3904 + error = count - buf.count;
3916 + * And even better one including d_type field and 64bit d_ino and d_off.
3918 +struct linux_dirent64 {
3921 + unsigned short d_reclen;
3922 + unsigned char d_type;
3926 +#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
3928 +struct getdents_callback64 {
3929 + struct linux_dirent64 * current_dir;
3930 + struct linux_dirent64 * previous;
3935 +static int filldir64(void * __buf, const char * name, int namlen, off_t offset,
3936 + ino_t ino, unsigned int d_type)
3938 + struct linux_dirent64 * dirent, d;
3939 + struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf;
3940 + int reclen = ROUND_UP64(NAME_OFFSET(dirent) + namlen + 1);
3942 + buf->error = -EINVAL; /* only used if we fail.. */
3943 + if (reclen > buf->count)
3945 + dirent = buf->previous;
3947 +#if BITS_PER_LONG < 64
3949 + copy_to_user(&dirent->d_off, &d.d_off, sizeof(d.d_off));
3951 + put_user(offset, &dirent->d_off);
3954 + dirent = buf->current_dir;
3955 + buf->previous = dirent;
3956 + memset(&d, 0, NAME_OFFSET(&d));
3958 + d.d_reclen = reclen;
3959 + d.d_type = d_type;
3960 + copy_to_user(dirent, &d, NAME_OFFSET(&d));
3961 + copy_to_user(dirent->d_name, name, namlen);
3962 + put_user(0, dirent->d_name + namlen);
3963 + ((char *) dirent) += reclen;
3964 + buf->current_dir = dirent;
3965 + buf->count -= reclen;
3969 +asmlinkage int sys_getdents64(unsigned int fd, void * dirent, unsigned int count)
3971 + struct file * file;
3972 + struct dentry * dentry;
3973 + struct inode * inode;
3974 + struct linux_dirent64 * lastdirent;
3975 + struct getdents_callback64 buf;
3984 + dentry = file->f_dentry;
3988 + inode = dentry->d_inode;
3992 + buf.current_dir = (struct linux_dirent64 *) dirent;
3993 + buf.previous = NULL;
3994 + buf.count = count;
3998 + if (!file->f_op || !file->f_op->readdir)
4003 + * Get the inode's semaphore to prevent changes
4004 + * to the directory while we read it.
4006 + down(&inode->i_sem);
4007 + error = file->f_op->readdir(file, &buf, filldir64);
4008 + up(&inode->i_sem);
4011 + error = buf.error;
4012 + lastdirent = buf.previous;
4014 +#if BITS_PER_LONG < 64
4016 + d_off = file->f_pos;
4017 + copy_to_user(&lastdirent->d_off, &d_off, sizeof(d_off));
4019 + put_user(file->f_pos, &lastdirent->d_off);
4021 error = count - buf.count;
4024 diff -Naur linux/fs/romfs/inode.c linux-p/fs/romfs/inode.c
4025 --- linux/fs/romfs/inode.c Sun Mar 25 18:30:59 2001
4026 +++ linux-p/fs/romfs/inode.c Mon Jan 14 23:01:48 2002
4027 @@ -258,6 +258,10 @@
4031 +static unsigned char romfs_dtype_table[] = {
4032 + DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_SOCK, DT_FIFO
4036 romfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
4039 nextfh = ntohl(ri.next);
4040 if ((nextfh & ROMFH_TYPE) == ROMFH_HRD)
4041 ino = ntohl(ri.spec);
4042 - if (filldir(dirent, fsname, j, offset, ino) < 0) {
4043 + if (filldir(dirent, fsname, j, offset, ino,
4044 + romfs_dtype_table[nextfh & ROMFH_TYPE]) < 0) {
4049 buf = page_address(page);
4050 clear_bit(PG_uptodate, &page->flags);
4051 clear_bit(PG_error, &page->flags);
4052 - offset = page->offset;
4053 + offset = pgoff2loff(page->index);
4054 if (offset < inode->i_size) {
4055 avail = inode->i_size-offset;
4056 readlen = min(avail, PAGE_SIZE);
4057 diff -Naur linux/fs/smbfs/cache.c linux-p/fs/smbfs/cache.c
4058 --- linux/fs/smbfs/cache.c Sun Mar 25 18:30:59 2001
4059 +++ linux-p/fs/smbfs/cache.c Mon Jan 14 23:01:48 2002
4061 struct cache_head * cachep;
4063 VERBOSE("finding cache for %s/%s\n", DENTRY_PATH(dentry));
4064 - cachep = (struct cache_head *) get_cached_page(inode, 0, 1);
4065 + cachep = (struct cache_head *) get_cached_page(inode, ulong2pgoff(0), 1);
4070 PARANOIA("cache %s/%s has existing block!\n",
4071 DENTRY_PATH(dentry));
4073 - offset = PAGE_SIZE + (i << PAGE_SHIFT);
4074 - block = (struct cache_block *) get_cached_page(inode,
4076 + /* byte_offset = PAGE_SIZE + (i << PAGE_SHIFT); */
4077 + /* --> page_offset = 1 + i */
4078 + block = (struct cache_block *)
4079 + get_cached_page(inode, ulong2pgoff(i+1), 0);
4082 index->block = block;
4084 struct inode * inode = get_cache_inode(cachep);
4085 struct cache_index * index;
4086 struct cache_block * block;
4087 - unsigned long page_off;
4089 unsigned int nent, offset, len = entry->len;
4090 unsigned int needed = len + sizeof(struct cache_entry);
4092 @@ -180,14 +181,15 @@
4096 - page_off = PAGE_SIZE + (cachep->idx << PAGE_SHIFT);
4097 + /* page_byte_off = PAGE_SIZE + (cachep->idx << PAGE_SHIFT); */
4098 + page_off = ulong2pgoff(1 + cachep->idx);
4099 block = (struct cache_block *) get_cached_page(inode, page_off, 1);
4102 index->block = block;
4103 index->space = PAGE_SIZE;
4104 VERBOSE("inode=%p, pages=%d, block at %ld\n",
4105 - inode, cachep->pages, page_off);
4106 + inode, cachep->pages, (u_long)pgoff2loff(page_off));
4110 diff -Naur linux/fs/smbfs/dir.c linux-p/fs/smbfs/dir.c
4111 --- linux/fs/smbfs/dir.c Sun Mar 25 18:30:59 2001
4112 +++ linux-p/fs/smbfs/dir.c Mon Jan 14 23:01:48 2002
4114 switch ((unsigned int) filp->f_pos)
4117 - if (filldir(dirent, ".", 1, 0, dir->i_ino) < 0)
4118 + if (filldir(dirent, ".", 1, 0, dir->i_ino, DT_DIR) < 0)
4122 if (filldir(dirent, "..", 2, 1,
4123 - dentry->d_parent->d_inode->i_ino) < 0)
4124 + dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
4131 if (filldir(dirent, entry->name, entry->len,
4132 - filp->f_pos, entry->ino) < 0)
4133 + filp->f_pos, entry->ino, DT_UNKNOWN) < 0)
4137 diff -Naur linux/fs/smbfs/file.c linux-p/fs/smbfs/file.c
4138 --- linux/fs/smbfs/file.c Sun Mar 25 18:30:59 2001
4139 +++ linux-p/fs/smbfs/file.c Mon Jan 14 23:01:48 2002
4141 #include <linux/mm.h>
4142 #include <linux/malloc.h>
4143 #include <linux/pagemap.h>
4144 +#include <linux/unistd.h>
4146 #include <asm/uaccess.h>
4147 #include <asm/system.h>
4149 smb_readpage_sync(struct dentry *dentry, struct page *page)
4151 char *buffer = (char *) page_address(page);
4152 - unsigned long offset = page->offset;
4153 + loff_t loffset = pgoff2loff(page->index);
4154 int rsize = smb_get_rsize(server_from_dentry(dentry));
4155 int count = PAGE_SIZE;
4158 clear_bit(PG_error, &page->flags);
4160 - VERBOSE("file %s/%s, count=%d@%ld, rsize=%d\n",
4161 - DENTRY_PATH(dentry), count, offset, rsize);
4162 + VERBOSE("file %s/%s, count=%d@%Ld, rsize=%d\n",
4163 + DENTRY_PATH(dentry), count, loffset, rsize);
4164 result = smb_open(dentry, SMB_O_RDONLY);
4171 - result = smb_proc_read(dentry, offset, rsize, buffer);
4172 + result = smb_proc_read(dentry, loffset, rsize, buffer);
4178 + loffset += result;
4180 dentry->d_inode->i_atime = CURRENT_TIME;
4182 @@ -113,23 +114,36 @@
4183 * Offset is the data offset within the page.
4186 -smb_writepage_sync(struct dentry *dentry, struct page *page,
4187 +smb_writepage_sync(struct file *file, struct page *page,
4188 unsigned long offset, unsigned int count)
4190 + struct dentry * dentry = file->f_dentry;
4191 struct inode *inode = dentry->d_inode;
4192 u8 *buffer = (u8 *) page_address(page) + offset;
4193 int wsize = smb_get_wsize(server_from_dentry(dentry));
4194 int result, written = 0;
4195 + loff_t loffset = pgoff2loff(page->index) + offset;
4197 + VERBOSE("file %s/%s, count=%d@%Ld, wsize=%d\n",
4198 + DENTRY_PATH(dentry), count, loffset, wsize);
4200 - offset += page->offset;
4201 - VERBOSE("file %s/%s, count=%d@%ld, wsize=%d\n",
4202 - DENTRY_PATH(dentry), count, offset, wsize);
4203 + if (!(file->f_flags & O_LARGEFILE)) {
4204 + if (loffset >= 0x7fffffffULL)
4206 + if (loffset + count > 0x7fffffffULL)
4207 + count = 0x7fffffff - loffset;
4210 + if (loffset >= 0xffffffffULL) /* 4G-1 ??? Or 2G-1 ??? */
4212 + if ((loffset + count) > 0xffffffffULL)
4213 + count = 0xffffffffULL - loffset;
4219 - result = smb_proc_write(dentry, offset, wsize, buffer);
4220 + result = smb_proc_write(dentry, loffset, wsize, buffer);
4223 /* N.B. what if result < wsize?? */
4224 @@ -138,29 +152,27 @@
4225 printk(KERN_DEBUG "short write, wsize=%d, result=%d\n",
4236 * Update the inode now rather than waiting for a refresh.
4238 inode->i_mtime = inode->i_atime = CURRENT_TIME;
4239 - if (offset > inode->i_size)
4240 - inode->i_size = offset;
4241 + if (loffset > inode->i_size)
4242 + inode->i_size = loffset;
4243 inode->u.smbfs_i.cache_valid |= SMB_F_LOCALWRITE;
4245 return written ? written : result;
4249 - * Write a page to the server. This will be used for NFS swapping only
4250 - * (for now), and we currently do this synchronously only.
4251 + * Write a page to the server.
4254 smb_writepage(struct file *file, struct page *page)
4256 - struct dentry *dentry = file->f_dentry;
4259 #ifdef SMBFS_PARANOIA
4262 set_bit(PG_locked, &page->flags);
4263 atomic_inc(&page->count);
4264 - result = smb_writepage_sync(dentry, page, 0, PAGE_SIZE);
4265 + result = smb_writepage_sync(file, page, 0, PAGE_SIZE);
4266 smb_unlock_page(page);
4267 free_page(page_address(page));
4269 @@ -180,10 +192,10 @@
4271 struct dentry *dentry = file->f_dentry;
4273 - DEBUG1("(%s/%s %d@%ld, sync=%d)\n",
4274 - DENTRY_PATH(dentry), count, page->offset+offset, sync);
4275 + DEBUG1("(%s/%s %d@%Ld, sync=%d)\n",
4276 + DENTRY_PATH(dentry), count, pgoff2loff(page->index)+offset, sync);
4278 - return smb_writepage_sync(dentry, page, offset, count);
4279 + return smb_writepage_sync(file, page, offset, count);
4284 struct dentry * dentry = file->f_dentry;
4287 - VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry),
4288 - (unsigned long) count, (unsigned long) *ppos);
4289 + VERBOSE("file %s/%s, count=%lu@%Lu\n", DENTRY_PATH(dentry),
4290 + (unsigned long) count, *ppos);
4292 status = smb_revalidate_inode(dentry);
4295 struct dentry * dentry = file->f_dentry;
4298 - VERBOSE("file %s/%s, count=%lu@%lu, pages=%ld\n", DENTRY_PATH(dentry),
4299 - (unsigned long) count, (unsigned long) *ppos,
4300 + VERBOSE("file %s/%s, count=%lu@%Lu, pages=%ld\n", DENTRY_PATH(dentry),
4301 + (unsigned long) count, *ppos,
4302 dentry->d_inode->i_nrpages);
4304 result = smb_revalidate_inode(dentry);
4308 result = generic_file_write(file, buf, count, ppos);
4309 - VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n",
4310 - (long) file->f_pos, dentry->d_inode->i_size,
4311 + VERBOSE("pos=%Ld, size=%Ld, mtime=%ld, atime=%ld\n",
4312 + file->f_pos, dentry->d_inode->i_size,
4313 dentry->d_inode->i_mtime, dentry->d_inode->i_atime);
4316 diff -Naur linux/fs/smbfs/proc.c linux-p/fs/smbfs/proc.c
4317 --- linux/fs/smbfs/proc.c Fri Nov 2 17:39:08 2001
4318 +++ linux-p/fs/smbfs/proc.c Mon Jan 14 23:01:48 2002
4319 @@ -1084,13 +1084,16 @@
4320 file-id would not be valid after a reconnection. */
4323 -smb_proc_read(struct dentry *dentry, off_t offset, int count, char *data)
4324 +smb_proc_read(struct dentry *dentry, loff_t offset, int count, char *data)
4326 struct smb_sb_info *server = server_from_dentry(dentry);
4327 __u16 returned_count, data_len;
4331 + if (offset > 0xffffffff)
4334 smb_lock_server(server);
4335 smb_setup_header(server, SMBread, 5, 0);
4336 buf = server->packet;
4337 @@ -1133,13 +1136,16 @@
4341 -smb_proc_write(struct dentry *dentry, off_t offset, int count, const char *data)
4342 +smb_proc_write(struct dentry *dentry, loff_t offset, int count, const char *data)
4344 struct smb_sb_info *server = server_from_dentry(dentry);
4348 - VERBOSE("file %s/%s, count=%d@%ld, packet_size=%d\n",
4349 + if (offset > 0xffffffff)
4352 + VERBOSE("file %s/%s, count=%d@%Ld, packet_size=%d\n",
4353 DENTRY_PATH(dentry), count, offset, server->packet_size);
4355 smb_lock_server(server);
4356 diff -Naur linux/fs/stat.c linux-p/fs/stat.c
4357 --- linux/fs/stat.c Sun Mar 25 18:30:58 2001
4358 +++ linux-p/fs/stat.c Mon Jan 14 23:01:48 2002
4360 tmp.st_uid = inode->i_uid;
4361 tmp.st_gid = inode->i_gid;
4362 tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
4363 +#if BITS_PER_LONG == 32
4364 + if (inode->i_size > 0x7fffffff)
4365 + return -EOVERFLOW;
4367 tmp.st_size = inode->i_size;
4368 tmp.st_atime = inode->i_atime;
4369 tmp.st_mtime = inode->i_mtime;
4371 tmp.st_uid = inode->i_uid;
4372 tmp.st_gid = inode->i_gid;
4373 tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
4374 +#if BITS_PER_LONG == 32
4375 + if (inode->i_size > 0x7fffffff)
4376 + return -EOVERFLOW;
4378 tmp.st_size = inode->i_size;
4379 tmp.st_atime = inode->i_atime;
4380 tmp.st_mtime = inode->i_mtime;
4381 @@ -280,3 +288,127 @@
4387 +/* ---------- LFS-64 ----------- */
4388 +#if !defined(__alpha__)
4390 +static long cp_new_stat64(struct inode * inode, struct stat64 * statbuf)
4392 + struct stat64 tmp;
4393 + unsigned int blocks, indirect;
4395 + memset(&tmp, 0, sizeof(tmp));
4396 + tmp.st_dev = kdev_t_to_nr(inode->i_dev);
4397 + tmp.st_ino = inode->i_ino;
4398 +#ifdef STAT64_HAS_BROKEN_ST_INO
4399 + tmp.__st_ino = inode->i_ino;
4401 + tmp.st_mode = inode->i_mode;
4402 + tmp.st_nlink = inode->i_nlink;
4403 + tmp.st_uid = inode->i_uid;
4404 + tmp.st_gid = inode->i_gid;
4405 + tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
4406 + tmp.st_atime = inode->i_atime;
4407 + tmp.st_mtime = inode->i_mtime;
4408 + tmp.st_ctime = inode->i_ctime;
4409 + tmp.st_size = inode->i_size;
4411 + * st_blocks and st_blksize are approximated with a simple algorithm if
4412 + * they aren't supported directly by the filesystem. The minix and msdos
4413 + * filesystems don't keep track of blocks, so they would either have to
4414 + * be counted explicitly (by delving into the file itself), or by using
4415 + * this simple algorithm to get a reasonable (although not 100% accurate)
4420 + * Use minix fs values for the number of direct and indirect blocks. The
4421 + * count is now exact for the minix fs except that it counts zero blocks.
4422 + * Everything is in units of BLOCK_SIZE until the assignment to
4426 +#define I_B (BLOCK_SIZE / sizeof(unsigned short))
4428 + if (!inode->i_blksize) {
4429 + blocks = (tmp.st_size + BLOCK_SIZE - 1) >> BLOCK_SIZE_BITS;
4430 + if (blocks > D_B) {
4431 + indirect = (blocks - D_B + I_B - 1) / I_B;
4432 + blocks += indirect;
4433 + if (indirect > 1) {
4434 + indirect = (indirect - 1 + I_B - 1) / I_B;
4435 + blocks += indirect;
4440 + tmp.st_blocks = (BLOCK_SIZE / 512) * blocks;
4441 + tmp.st_blksize = BLOCK_SIZE;
4443 + tmp.st_blocks = inode->i_blocks;
4444 + tmp.st_blksize = inode->i_blksize;
4446 + return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
4449 +asmlinkage long sys_stat64(char * filename, struct stat64 * statbuf, long flags)
4451 + struct dentry * dentry;
4455 + dentry = namei(filename);
4457 + error = PTR_ERR(dentry);
4458 + if (!IS_ERR(dentry)) {
4459 + error = do_revalidate(dentry);
4461 + error = cp_new_stat64(dentry->d_inode, statbuf);
4469 +asmlinkage long sys_lstat64(char * filename, struct stat64 * statbuf, long flags)
4471 + struct dentry * dentry;
4475 + dentry = lnamei(filename);
4477 + error = PTR_ERR(dentry);
4478 + if (!IS_ERR(dentry)) {
4479 + error = do_revalidate(dentry);
4481 + error = cp_new_stat64(dentry->d_inode, statbuf);
4489 +asmlinkage long sys_fstat64(unsigned long fd, struct stat64 * statbuf, long flags)
4497 + struct dentry * dentry = f->f_dentry;
4499 + err = do_revalidate(dentry);
4501 + err = cp_new_stat64(dentry->d_inode, statbuf);
4508 +#endif /* LFS-64 */
4509 diff -Naur linux/fs/sysv/dir.c linux-p/fs/sysv/dir.c
4510 --- linux/fs/sysv/dir.c Sun Mar 25 18:30:59 2001
4511 +++ linux-p/fs/sysv/dir.c Mon Jan 14 23:01:48 2002
4513 inode->i_ino, (off_t) filp->f_pos, sde.inode);
4515 i = strnlen(sde.name, SYSV_NAMELEN);
4516 - if (filldir(dirent, sde.name, i, filp->f_pos, sde.inode) < 0) {
4517 + if (filldir(dirent, sde.name, i, filp->f_pos, sde.inode, DT_UNKNOWN) < 0) {
4521 diff -Naur linux/fs/sysv/file.c linux-p/fs/sysv/file.c
4522 --- linux/fs/sysv/file.c Sun Mar 25 18:30:59 2001
4523 +++ linux-p/fs/sysv/file.c Mon Jan 14 23:01:48 2002
4526 struct inode * inode = filp->f_dentry->d_inode;
4527 struct super_block * sb = inode->i_sb;
4531 struct buffer_head * bh;
4533 @@ -232,6 +232,21 @@
4538 + /* L-F-S spec 2.2.1.27: */
4539 + if (!(filp->f_flags & O_LARGEFILE)) {
4540 + if (pos >= 0x7fffffffULL) /* pos@2G forbidden */
4543 + if (pos + count > 0x7fffffffULL)
4544 + /* Write only until end of allowed region */
4545 + count = 0x7fffffffULL - pos;
4547 + if (pos >= 0xffffffffULL)
4548 + return -EFBIG; /* Only up to 4G-1! */
4549 + if ((pos + count) > 0xffffffffULL)
4550 + count = 0xffffffffULL - pos;
4552 while (written<count) {
4553 bh = sysv_getblk (inode, pos >> sb->sv_block_size_bits, 1);
4555 diff -Naur linux/fs/ufs/balloc.c linux-p/fs/ufs/balloc.c
4556 --- linux/fs/ufs/balloc.c Sun Mar 25 18:30:59 2001
4557 +++ linux-p/fs/ufs/balloc.c Mon Jan 14 23:01:48 2002
4559 struct ufs_sb_private_info * uspi;
4560 struct ufs_super_block_first * usb1;
4561 struct ufs_cylinder_group * ucg;
4562 - unsigned start, length, location, result;
4563 - unsigned possition, fragsize, blockmap, mask;
4565 + unsigned int start, length, location, result;
4566 + unsigned int possition, fragsize, blockmap, mask;
4567 + unsigned int swab;
4569 UFSD(("ENTER, cg %u, goal %u, count %u\n", ucpi->c_cgx, goal, count))
4573 start = ucpi->c_frotor >> 3;
4575 - length = howmany(uspi->s_fpg, 8) - start;
4576 + length = ((uspi->s_fpg + 7) >> 3) - start;
4577 location = ubh_scanc(UCPI_UBH, ucpi->c_freeoff + start, length,
4578 (uspi->s_fpb == 8) ? ufs_fragtable_8fpb : ufs_fragtable_other,
4579 1 << (count - 1 + (uspi->s_fpb & 7)));
4580 diff -Naur linux/fs/ufs/dir.c linux-p/fs/ufs/dir.c
4581 --- linux/fs/ufs/dir.c Sun Mar 25 18:30:59 2001
4582 +++ linux-p/fs/ufs/dir.c Mon Jan 14 23:01:48 2002
4585 #include <linux/fs.h>
4586 #include <linux/ufs_fs.h>
4587 +#include <linux/unistd.h>
4591 @@ -124,11 +125,14 @@
4592 * not the directory has been modified
4593 * during the copy operation. */
4594 unsigned long version = inode->i_version;
4595 + unsigned char d_type = DT_UNKNOWN;
4597 UFSD(("filldir(%s,%u)\n", de->d_name, SWAB32(de->d_ino)))
4598 UFSD(("namlen %u\n", ufs_get_de_namlen(de)))
4599 + if ((flags & UFS_DE_MASK) == UFS_DE_44BSD)
4600 + d_type = de->d_u.d_44.d_type;
4601 error = filldir(dirent, de->d_name, ufs_get_de_namlen(de),
4602 - filp->f_pos, SWAB32(de->d_ino));
4603 + filp->f_pos, SWAB32(de->d_ino), d_type);
4606 if (version != inode->i_version)
4608 error_msg = "inode out of bounds";
4610 if (error_msg != NULL)
4611 - ufs_error (sb, function, "bad entry in directory #%lu, size %lu: %s - "
4612 + ufs_error (sb, function, "bad entry in directory #%lu, size %Lu: %s - "
4613 "offset=%lu, inode=%lu, reclen=%d, namlen=%d",
4614 dir->i_ino, dir->i_size, error_msg, offset,
4615 (unsigned long) SWAB32(de->d_ino),
4616 diff -Naur linux/fs/ufs/file.c linux-p/fs/ufs/file.c
4617 --- linux/fs/ufs/file.c Sun Mar 25 18:30:59 2001
4618 +++ linux-p/fs/ufs/file.c Mon Jan 14 23:01:48 2002
4622 struct inode * inode = filp->f_dentry->d_inode;
4628 @@ -177,11 +177,14 @@
4632 - /* Check for overflow.. */
4633 - if (pos > (__u32) (pos + count)) {
4634 - count = ~pos; /* == 0xFFFFFFFF - pos */
4636 + /* L-F-S spec 2.2.1.27: */
4637 + if (!(filp->f_flags & O_LARGEFILE)) {
4638 + if (pos >= 0x7fffffffULL) /* pos@2G forbidden */
4641 + if (pos + count > 0x7fffffffULL)
4642 + /* Write only until end of allowed region */
4643 + count = 0x7fffffffULL - pos;
4647 diff -Naur linux/fs/ufs/inode.c linux-p/fs/ufs/inode.c
4648 --- linux/fs/ufs/inode.c Sun Mar 25 18:30:59 2001
4649 +++ linux-p/fs/ufs/inode.c Mon Jan 14 23:01:48 2002
4652 unsigned swab = inode->i_sb->u.ufs_sb.s_swab;
4653 printk("ino %lu mode 0%6.6o nlink %d uid %d uid32 %u"
4654 - " gid %d gid32 %u size %lu blocks %lu\n",
4655 + " gid %d gid32 %u size %Lu blocks %lu\n",
4656 inode->i_ino, inode->i_mode, inode->i_nlink,
4657 inode->i_uid, inode->u.ufs_i.i_uid, inode->i_gid,
4658 inode->u.ufs_i.i_gid, inode->i_size, inode->i_blocks);
4659 @@ -213,13 +213,14 @@
4662 limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
4663 - if (limit < RLIM_INFINITY) {
4664 + if (limit != RLIM_INFINITY) {
4665 limit >>= sb->s_blocksize_bits;
4666 if (new_fragment >= limit) {
4667 send_sig(SIGXFSZ, current, 0);
4672 lastblock = ufs_fragstoblks (lastfrag);
4673 lastblockoff = ufs_fragnum (lastfrag);
4679 - if (!create || new_fragment >= (current->rlim[RLIMIT_FSIZE].rlim_cur >> sb->s_blocksize)) {
4680 + if (!create || (current->rlim[RLIMIT_FSIZE].rlim_cur != RLIM_INFINITY &&
4681 + new_fragment >= (current->rlim[RLIMIT_FSIZE].rlim_cur >> sb->s_blocksize))) {
4685 @@ -497,13 +499,10 @@
4689 - * Linux i_size can be 32 on some architectures. We will mark
4690 - * big files as read only and let user access first 32 bits.
4691 + * Linux i_size used to be 32 bits on some architectures.
4692 + * These days we allow access to the entire file as is..
4694 - inode->u.ufs_i.i_size = SWAB64(ufs_inode->ui_size);
4695 - inode->i_size = (off_t) inode->u.ufs_i.i_size;
4696 - if (sizeof(off_t) == 4 && (inode->u.ufs_i.i_size >> 32))
4697 - inode->i_size = (__u32)-1;
4698 + inode->i_size = SWAB64(ufs_inode->ui_size);
4700 inode->i_atime = SWAB32(ufs_inode->ui_atime.tv_sec);
4701 inode->i_ctime = SWAB32(ufs_inode->ui_ctime.tv_sec);
4703 inode->u.ufs_i.i_gen = SWAB32(ufs_inode->ui_gen);
4704 inode->u.ufs_i.i_shadow = SWAB32(ufs_inode->ui_u3.ui_sun.ui_shadow);
4705 inode->u.ufs_i.i_oeftflag = SWAB32(ufs_inode->ui_u3.ui_sun.ui_oeftflag);
4706 - inode->u.ufs_i.i_lastfrag = howmany (inode->i_size, uspi->s_fsize);
4707 + inode->u.ufs_i.i_lastfrag = (inode->i_size + uspi->s_fsize -1) >> uspi->s_fshift;
4709 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
4710 inode->i_rdev = to_kdev_t(SWAB32(ufs_inode->ui_u2.ui_addr.ui_db[0]));
4711 diff -Naur linux/fs/ufs/super.c linux-p/fs/ufs/super.c
4712 --- linux/fs/ufs/super.c Sun Mar 25 18:30:59 2001
4713 +++ linux-p/fs/ufs/super.c Mon Jan 14 23:01:48 2002
4717 size = uspi->s_cssize;
4718 - blks = howmany(size, uspi->s_fsize);
4719 + blks = (size + uspi->s_fsize-1) >> uspi->s_fshift;
4720 base = space = kmalloc(size, GFP_KERNEL);
4724 uspi = sb->u.ufs_sb.s_uspi;
4726 size = uspi->s_cssize;
4727 - blks = howmany(size, uspi->s_fsize);
4728 + blks = (size + uspi->s_fsize-1) >> uspi->s_fshift;
4729 base = space = (char*) sb->u.ufs_sb.s_csp[0];
4730 for (i = 0; i < blks; i += uspi->s_fpb) {
4731 size = uspi->s_bsize;
4732 diff -Naur linux/fs/ufs/truncate.c linux-p/fs/ufs/truncate.c
4733 --- linux/fs/ufs/truncate.c Sun Mar 25 18:30:59 2001
4734 +++ linux-p/fs/ufs/truncate.c Mon Jan 14 23:01:48 2002
4739 -#define DIRECT_BLOCK howmany (inode->i_size, uspi->s_bsize)
4740 -#define DIRECT_FRAGMENT howmany (inode->i_size, uspi->s_fsize)
4741 +#define DIRECT_BLOCK ((inode->i_size + uspi->s_bsize -1) >> uspi->s_bshift)
4742 +#define DIRECT_FRAGMENT ((inode->i_size + uspi->s_fsize -1) >> uspi->s_fshift)
4744 static int ufs_trunc_direct (struct inode * inode)
4750 -static int ufs_trunc_indirect (struct inode * inode, unsigned offset, u32 * p)
4751 +static int ufs_trunc_indirect (struct inode * inode, u_long offset, u32 * p)
4753 struct super_block * sb;
4754 struct ufs_sb_private_info * uspi;
4756 struct super_block * sb;
4757 struct ufs_sb_private_info * uspi;
4758 struct ufs_buffer_head * dind_bh;
4759 - unsigned i, tmp, dindirect_block;
4760 + unsigned int i, tmp, dindirect_block;
4765 swab = sb->u.ufs_sb.s_swab;
4766 uspi = sb->u.ufs_sb.s_uspi;
4768 - dindirect_block = (DIRECT_BLOCK > offset)
4769 - ? ((DIRECT_BLOCK - offset) / uspi->s_apb) : 0;
4770 + dindirect_block = ((DIRECT_BLOCK > offset) ?
4771 + ((DIRECT_BLOCK - offset) >> uspi->s_apbshift) : 0);
4778 tindirect_block = (DIRECT_BLOCK > (UFS_NDADDR + uspi->s_apb + uspi->s_2apb))
4779 - ? ((DIRECT_BLOCK - UFS_NDADDR - uspi->s_apb - uspi->s_2apb) / uspi->s_2apb) : 0;
4780 + ? ((DIRECT_BLOCK - UFS_NDADDR - uspi->s_apb - uspi->s_2apb) >> uspi->s_2apbshift) : 0;
4781 p = inode->u.ufs_i.i_u1.i_data + UFS_TIND_BLOCK;
4782 if (!(tmp = SWAB32(*p)))
4787 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
4788 - inode->u.ufs_i.i_lastfrag = howmany (inode->i_size, uspi->s_fsize);
4789 + inode->u.ufs_i.i_lastfrag =
4790 + (inode->i_size + uspi->s_fsize -1) >> uspi->s_fshift;
4791 mark_inode_dirty(inode);
4794 diff -Naur linux/fs/ufs/util.h linux-p/fs/ufs/util.h
4795 --- linux/fs/ufs/util.h Sun Mar 25 18:30:59 2001
4796 +++ linux-p/fs/ufs/util.h Mon Jan 14 23:01:48 2002
4798 * some useful macros
4800 #define in_range(b,first,len) ((b)>=(first)&&(b)<(first)+(len))
4801 -#define howmany(x,y) (((x)+(y)-1)/(y))
4802 #define min(x,y) ((x)<(y)?(x):(y))
4803 #define max(x,y) ((x)>(y)?(x):(y))
4805 diff -Naur linux/fs/umsdos/dir.c linux-p/fs/umsdos/dir.c
4806 --- linux/fs/umsdos/dir.c Sun Mar 25 18:30:59 2001
4807 +++ linux-p/fs/umsdos/dir.c Mon Jan 14 23:01:48 2002
4809 if (d->count == 0) {
4810 PRINTK ((KERN_DEBUG "dir_once :%.*s: offset %Ld\n",
4811 len, name, offset));
4812 - ret = d->filldir (d->dirbuf, name, len, offset, ino);
4813 + ret = d->filldir (d->dirbuf, name, len, offset, ino, DT_UNKNOWN);
4819 Printk ((KERN_WARNING "umsdos_readdir_x: pseudo_root thing UMSDOS_SPECIAL_DIRFPOS\n"));
4820 if (filldir (dirbuf, "DOS", 3,
4821 - UMSDOS_SPECIAL_DIRFPOS, UMSDOS_ROOT_INO) == 0) {
4822 + UMSDOS_SPECIAL_DIRFPOS, UMSDOS_ROOT_INO, DT_DIR) == 0) {
4827 if (inode != pseudo_root &&
4828 (internal_read || !(entry.flags & UMSDOS_HIDDEN))) {
4829 if (filldir (dirbuf, entry.name, entry.name_len,
4830 - cur_f_pos, inode->i_ino) < 0) {
4831 + cur_f_pos, inode->i_ino, DT_UNKNOWN) < 0) {
4832 new_filp.f_pos = cur_f_pos;
4834 Printk(("umsdos_readdir_x: got %s/%s, ino=%ld\n",
4835 diff -Naur linux/fs/umsdos/rdir.c linux-p/fs/umsdos/rdir.c
4836 --- linux/fs/umsdos/rdir.c Sun Mar 25 18:30:59 2001
4837 +++ linux-p/fs/umsdos/rdir.c Mon Jan 14 23:01:48 2002
4844 + unsigned int d_type)
4847 struct RDIR_FILLDIR *d = (struct RDIR_FILLDIR *) buf;
4849 /* Make sure the .. entry points back to the pseudo_root */
4850 ino = pseudo_root->i_ino;
4852 - ret = d->filldir (d->dirbuf, name, name_len, offset, ino);
4853 + ret = d->filldir (d->dirbuf, name, name_len, offset, ino, DT_UNKNOWN);
4856 /* Any DOS directory */
4857 - ret = d->filldir (d->dirbuf, name, name_len, offset, ino);
4858 + ret = d->filldir (d->dirbuf, name, name_len, offset, ino, DT_UNKNOWN);
4862 diff -Naur linux/include/asm-alpha/fcntl.h linux-p/include/asm-alpha/fcntl.h
4863 --- linux/include/asm-alpha/fcntl.h Sun Mar 25 18:31:06 2001
4864 +++ linux-p/include/asm-alpha/fcntl.h Mon Jan 14 23:01:48 2002
4866 #define O_DIRECT 040000 /* direct disk access - should check with OSF/1 */
4867 #define O_DIRECTORY 0100000 /* must be a directory */
4868 #define O_NOFOLLOW 0200000 /* don't follow links */
4869 +#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */
4871 #define F_DUPFD 0 /* dup */
4872 #define F_GETFD 1 /* get f_flags */
4874 __kernel_off_t l_len;
4875 __kernel_pid_t l_pid;
4879 +#define flock64 flock
4883 diff -Naur linux/include/asm-alpha/unistd.h linux-p/include/asm-alpha/unistd.h
4884 --- linux/include/asm-alpha/unistd.h Sun Mar 25 18:31:06 2001
4885 +++ linux-p/include/asm-alpha/unistd.h Mon Jan 14 23:01:48 2002
4887 #define __NR_pivot_root 374 /* implemented in 2.3 */
4888 #define __NR_mincore 375 /* implemented in 2.3 */
4889 #define __NR_pciconfig_iobase 376
4890 +#define __NR_getdents64 377
4892 #if defined(__GNUC__)
4894 diff -Naur linux/include/asm-arm/fcntl.h linux-p/include/asm-arm/fcntl.h
4895 --- linux/include/asm-arm/fcntl.h Sun Mar 25 18:31:10 2001
4896 +++ linux-p/include/asm-arm/fcntl.h Mon Jan 14 23:01:48 2002
4898 #define FASYNC 020000 /* fcntl, for BSD compatibility */
4899 #define O_DIRECTORY 040000 /* must be a directory */
4900 #define O_NOFOLLOW 0100000 /* don't follow links */
4901 +#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
4902 +#define O_LARGEFILE 0400000
4904 #define F_DUPFD 0 /* dup */
4905 #define F_GETFD 1 /* get f_flags */
4907 #define F_SETSIG 10 /* for sockets. */
4908 #define F_GETSIG 11 /* for sockets. */
4910 +#define F_GETLK64 12 /* using 'struct flock64' */
4911 +#define F_SETLK64 13
4912 +#define F_SETLKW64 14
4914 /* for F_[GET|SET]FL */
4915 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
4932 diff -Naur linux/include/asm-arm/stat.h linux-p/include/asm-arm/stat.h
4933 --- linux/include/asm-arm/stat.h Sun Mar 25 18:31:10 2001
4934 +++ linux-p/include/asm-arm/stat.h Mon Jan 14 23:01:48 2002
4936 unsigned long __unused5;
4939 +/* Someone please add a glibc/arm compatible stat64 struct here. */
4941 diff -Naur linux/include/asm-arm/unistd.h linux-p/include/asm-arm/unistd.h
4942 --- linux/include/asm-arm/unistd.h Sun Mar 25 18:31:10 2001
4943 +++ linux-p/include/asm-arm/unistd.h Mon Jan 14 23:01:48 2002
4944 @@ -198,6 +198,13 @@
4947 #define __NR_vfork (__NR_SYSCALL_BASE+190)
4948 +/* #define __NR_getrlimit (__NR_SYSCALL_BASE+191) */
4949 +#define __NR_mmap2 (__NR_SYSCALL_BASE+192)
4950 +#define __NR_truncate64 (__NR_SYSCALL_BASE+193)
4951 +#define __NR_ftruncate64 (__NR_SYSCALL_BASE+194)
4952 +#define __NR_stat64 (__NR_SYSCALL_BASE+195)
4953 +#define __NR_lstat64 (__NR_SYSCALL_BASE+196)
4954 +#define __NR_fstat64 (__NR_SYSCALL_BASE+197)
4956 #define __sys2(x) #x
4957 #define __sys1(x) __sys2(x)
4958 diff -Naur linux/include/asm-i386/fcntl.h linux-p/include/asm-i386/fcntl.h
4959 --- linux/include/asm-i386/fcntl.h Sun Mar 25 18:31:05 2001
4960 +++ linux-p/include/asm-i386/fcntl.h Mon Jan 14 23:01:48 2002
4962 #define F_SETSIG 10 /* for sockets. */
4963 #define F_GETSIG 11 /* for sockets. */
4965 +#define F_GETLK64 12 /* using 'struct flock64' */
4966 +#define F_SETLK64 13
4967 +#define F_SETLKW64 14
4969 /* for F_[GET|SET]FL */
4970 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
4987 diff -Naur linux/include/asm-i386/stat.h linux-p/include/asm-i386/stat.h
4988 --- linux/include/asm-i386/stat.h Sun Mar 25 18:31:05 2001
4989 +++ linux-p/include/asm-i386/stat.h Mon Jan 14 23:01:48 2002
4991 unsigned long __unused5;
4994 +/* This matches struct stat64 in glibc2.1, hence the absolutely
4995 + * insane amounts of padding around dev_t's.
4998 + unsigned short st_dev;
4999 + unsigned char __pad0[10];
5001 +#define STAT64_HAS_BROKEN_ST_INO 1
5002 + unsigned long __st_ino;
5004 + unsigned int st_mode;
5005 + unsigned int st_nlink;
5007 + unsigned long st_uid;
5008 + unsigned long st_gid;
5010 + unsigned short st_rdev;
5011 + unsigned char __pad3[10];
5013 + long long st_size;
5014 + unsigned long st_blksize;
5016 + unsigned long st_blocks; /* Number 512-byte blocks allocated. */
5017 + unsigned long __pad4; /* future possible st_blocks high bits */
5019 + unsigned long st_atime;
5020 + unsigned long __pad5;
5022 + unsigned long st_mtime;
5023 + unsigned long __pad6;
5025 + unsigned long st_ctime;
5026 + unsigned long __pad7; /* will be high 32 bits of ctime someday */
5028 + unsigned long long st_ino;
5032 diff -Naur linux/include/asm-i386/unistd.h linux-p/include/asm-i386/unistd.h
5033 --- linux/include/asm-i386/unistd.h Sun Mar 25 18:31:05 2001
5034 +++ linux-p/include/asm-i386/unistd.h Mon Jan 14 23:01:48 2002
5036 #define __NR_sigpending 73
5037 #define __NR_sethostname 74
5038 #define __NR_setrlimit 75
5039 -#define __NR_getrlimit 76
5040 +#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
5041 #define __NR_getrusage 77
5042 #define __NR_gettimeofday 78
5043 #define __NR_settimeofday 79
5044 @@ -195,8 +195,42 @@
5045 #define __NR_getpmsg 188 /* some people actually want streams */
5046 #define __NR_putpmsg 189 /* some people actually want streams */
5047 #define __NR_vfork 190
5048 +/* #define __NR_ugetrlimit 191 SuS compliant getrlimit */
5049 +#define __NR_mmap2 192
5050 +#define __NR_truncate64 193
5051 +#define __NR_ftruncate64 194
5052 +#define __NR_stat64 195
5053 +#define __NR_lstat64 196
5054 +#define __NR_fstat64 197
5056 +#define __NR_lchown32 198
5057 +#define __NR_getuid32 199
5058 +#define __NR_getgid32 200
5059 +#define __NR_geteuid32 201
5060 +#define __NR_getegid32 202
5061 +#define __NR_setreuid32 203
5062 +#define __NR_setregid32 204
5063 +#define __NR_getgroups32 205
5064 +#define __NR_setgroups32 206
5065 +#define __NR_fchown32 207
5066 +#define __NR_setresuid32 208
5067 +#define __NR_getresuid32 209
5068 +#define __NR_setresgid32 210
5069 +#define __NR_getresgid32 211
5070 +#define __NR_chown32 212
5071 +#define __NR_setuid32 213
5072 +#define __NR_setgid32 214
5073 +#define __NR_setfsuid32 215
5074 +#define __NR_setfsgid32 216
5075 +#define __NR_pivot_root 217
5076 +#define __NR_mincore 218
5077 +#define __NR_madvise 219
5078 +#define __NR_madvise1 219 /* delete when C lib stub is removed */
5080 +#define __NR_getdents64 220
5081 +#define __NR_fcntl64 221
5083 -/* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */
5084 +/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
5086 #define __syscall_return(type, res) \
5088 @@ -269,6 +303,19 @@
5090 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
5091 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
5092 +__syscall_return(type,__res); \
5095 +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
5096 + type5,arg5,type6,arg6) \
5097 +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
5100 +__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \
5102 + : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
5103 + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \
5104 + "0" ((long)(arg6))); \
5105 __syscall_return(type,__res); \
5108 diff -Naur linux/include/asm-m68k/fcntl.h linux-p/include/asm-m68k/fcntl.h
5109 --- linux/include/asm-m68k/fcntl.h Sun Mar 25 18:31:07 2001
5110 +++ linux-p/include/asm-m68k/fcntl.h Mon Jan 14 23:01:48 2002
5112 #define F_SETSIG 10 /* for sockets. */
5113 #define F_GETSIG 11 /* for sockets. */
5115 +#define F_GETLK64 12 /* using 'struct flock64' */
5116 +#define F_SETLK64 13
5117 +#define F_SETLKW64 14
5119 /* for F_[GET|SET]FL */
5120 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5136 #endif /* _M68K_FCNTL_H */
5137 diff -Naur linux/include/asm-m68k/stat.h linux-p/include/asm-m68k/stat.h
5138 --- linux/include/asm-m68k/stat.h Sun Mar 25 18:31:07 2001
5139 +++ linux-p/include/asm-m68k/stat.h Mon Jan 14 23:01:48 2002
5141 unsigned long __unused5;
5144 +/* stat64 struct goes here -- someone please make
5145 + * it mesh with whatever glibc does in userland on
5148 #endif /* _M68K_STAT_H */
5149 diff -Naur linux/include/asm-m68k/unistd.h linux-p/include/asm-m68k/unistd.h
5150 --- linux/include/asm-m68k/unistd.h Sun Mar 25 18:31:07 2001
5151 +++ linux-p/include/asm-m68k/unistd.h Mon Jan 14 23:01:48 2002
5153 #define __NR_sigpending 73
5154 #define __NR_sethostname 74
5155 #define __NR_setrlimit 75
5156 -#define __NR_getrlimit 76
5157 +#define __NR_getrlimit 76
5158 #define __NR_getrusage 77
5159 #define __NR_gettimeofday 78
5160 #define __NR_settimeofday 79
5161 @@ -194,6 +194,13 @@
5162 #define __NR_getpmsg 188 /* some people actually want streams */
5163 #define __NR_putpmsg 189 /* some people actually want streams */
5164 #define __NR_vfork 190
5165 +/* #define __NR_getrlimit 191 */
5166 +#define __NR_mmap2 192
5167 +#define __NR_truncate64 193
5168 +#define __NR_ftruncate64 194
5169 +#define __NR_stat64 195
5170 +#define __NR_lstat64 196
5171 +#define __NR_fstat64 197
5173 /* user-visible error numbers are in the range -1 - -122: see
5174 <asm-m68k/errno.h> */
5175 diff -Naur linux/include/asm-mips/fcntl.h linux-p/include/asm-mips/fcntl.h
5176 --- linux/include/asm-mips/fcntl.h Sun Mar 25 18:31:06 2001
5177 +++ linux-p/include/asm-mips/fcntl.h Mon Jan 14 23:01:48 2002
5179 #define F_SETSIG 10 /* for sockets. */
5180 #define F_GETSIG 11 /* for sockets. */
5182 +#define F_GETLK64 33 /* using 'struct flock64' */
5183 +#define F_SETLK64 34
5184 +#define F_SETLKW64 35
5186 /* for F_[GET|SET]FL */
5187 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5190 __kernel_pid_t l_pid;
5191 long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
5194 +typedef struct flock64 {
5202 #endif /* __ASM_MIPS_FCNTL_H */
5203 diff -Naur linux/include/asm-ppc/fcntl.h linux-p/include/asm-ppc/fcntl.h
5204 --- linux/include/asm-ppc/fcntl.h Sun Mar 25 18:31:08 2001
5205 +++ linux-p/include/asm-ppc/fcntl.h Mon Jan 14 23:01:48 2002
5207 #define FASYNC 020000 /* fcntl, for BSD compatibility */
5208 #define O_DIRECTORY 040000 /* must be a directory */
5209 #define O_NOFOLLOW 0100000 /* don't follow links */
5210 +#define O_LARGEFILE 0200000
5211 +#define O_DIRECT 0400000 /* direct disk access hint - currently ignored */
5213 #define F_DUPFD 0 /* dup */
5214 #define F_GETFD 1 /* get f_flags */
5216 #define F_SETSIG 10 /* for sockets. */
5217 #define F_GETSIG 11 /* for sockets. */
5219 +#define F_GETLK64 12 /* using 'struct flock64' */
5220 +#define F_SETLK64 13
5221 +#define F_SETLKW64 14
5223 /* for F_[GET|SET]FL */
5224 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5241 diff -Naur linux/include/asm-ppc/stat.h linux-p/include/asm-ppc/stat.h
5242 --- linux/include/asm-ppc/stat.h Sun Mar 25 18:31:08 2001
5243 +++ linux-p/include/asm-ppc/stat.h Mon Jan 14 23:01:48 2002
5245 unsigned long __unused5;
5248 +/* This matches struct stat64 in glibc2.1.
5251 + unsigned long long st_dev; /* Device. */
5252 + unsigned long long st_ino; /* File serial number. */
5253 + unsigned int st_mode; /* File mode. */
5254 + unsigned int st_nlink; /* Link count. */
5255 + unsigned int st_uid; /* User ID of the file's owner. */
5256 + unsigned int st_gid; /* Group ID of the file's group. */
5257 + unsigned long long st_rdev; /* Device number, if device. */
5258 + unsigned short int __pad2;
5259 + long long st_size; /* Size of file, in bytes. */
5260 + long st_blksize; /* Optimal block size for I/O. */
5262 + long long st_blocks; /* Number 512-byte blocks allocated. */
5263 + long st_atime; /* Time of last access. */
5264 + unsigned long int __unused1;
5265 + long st_mtime; /* Time of last modification. */
5266 + unsigned long int __unused2;
5267 + long st_ctime; /* Time of last status change. */
5268 + unsigned long int __unused3;
5269 + unsigned long int __unused4;
5270 + unsigned long int __unused5;
5274 diff -Naur linux/include/asm-ppc/unistd.h linux-p/include/asm-ppc/unistd.h
5275 --- linux/include/asm-ppc/unistd.h Sun Mar 25 18:31:08 2001
5276 +++ linux-p/include/asm-ppc/unistd.h Mon Jan 14 23:01:48 2002
5277 @@ -194,11 +194,18 @@
5278 #define __NR_getpmsg 187 /* some people actually want streams */
5279 #define __NR_putpmsg 188 /* some people actually want streams */
5280 #define __NR_vfork 189
5282 +#define __NR_mmap2 192
5283 +#define __NR_truncate64 193
5284 +#define __NR_ftruncate64 194
5285 +#define __NR_stat64 195
5286 +#define __NR_lstat64 196
5287 +#define __NR_fstat64 197
5288 #define __NR_pciconfig_read 198
5289 #define __NR_pciconfig_write 199
5290 #define __NR_pciconfig_iobase 200
5291 #define __NR_multiplexer 201
5292 +#define __NR_getdents64 202
5293 +#define __NR_fcntl64 203
5297 diff -Naur linux/include/asm-sparc/fcntl.h linux-p/include/asm-sparc/fcntl.h
5298 --- linux/include/asm-sparc/fcntl.h Sun Mar 25 18:31:07 2001
5299 +++ linux-p/include/asm-sparc/fcntl.h Mon Jan 14 23:01:48 2002
5301 #define O_NOCTTY 0x8000 /* not fcntl */
5302 #define O_DIRECTORY 0x10000 /* must be a directory */
5303 #define O_NOFOLLOW 0x20000 /* don't follow links */
5304 +#define O_LARGEFILE 0x40000 /* LFS */
5306 #define F_DUPFD 0 /* dup */
5307 #define F_GETFD 1 /* get f_flags */
5310 #define F_SETSIG 10 /* for sockets. */
5311 #define F_GETSIG 11 /* for sockets. */
5312 +#define F_GETLK64 12
5313 +#define F_SETLK64 13
5314 +#define F_SETLKW64 14
5316 /* for F_[GET|SET]FL */
5317 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5334 diff -Naur linux/include/asm-sparc/stat.h linux-p/include/asm-sparc/stat.h
5335 --- linux/include/asm-sparc/stat.h Sun Mar 25 18:31:07 2001
5336 +++ linux-p/include/asm-sparc/stat.h Mon Jan 14 23:01:48 2002
5340 #ifndef _SPARC_STAT_H
5341 #define _SPARC_STAT_H
5346 unsigned long __unused4[2];
5350 + unsigned char __pad0[6];
5351 + unsigned short st_dev;
5353 + unsigned long long st_ino;
5355 + unsigned int st_mode;
5356 + unsigned int st_nlink;
5358 + unsigned int st_uid;
5359 + unsigned int st_gid;
5361 + unsigned char __pad2[6];
5362 + unsigned short st_rdev;
5364 + unsigned char __pad3[8];
5366 + long long st_size;
5367 + unsigned int st_blksize;
5369 + unsigned char __pad4[8];
5370 + unsigned int st_blocks;
5372 + unsigned int st_atime;
5373 + unsigned int __unused1;
5375 + unsigned int st_mtime;
5376 + unsigned int __unused2;
5378 + unsigned int st_ctime;
5379 + unsigned int __unused3;
5381 + unsigned int __unused4;
5382 + unsigned int __unused5;
5386 diff -Naur linux/include/asm-sparc/unistd.h linux-p/include/asm-sparc/unistd.h
5387 --- linux/include/asm-sparc/unistd.h Sun Mar 25 18:37:39 2001
5388 +++ linux-p/include/asm-sparc/unistd.h Mon Jan 14 23:01:48 2002
5390 /* #define __NR_mctl 53 SunOS specific */
5391 #define __NR_ioctl 54 /* Common */
5392 #define __NR_reboot 55 /* Common */
5393 -/* #define __NR_ni_syscall 56 ENOSYS under SunOS */
5394 +#define __NR_mmap2 56 /* Linux sparc32 Specific */
5395 #define __NR_symlink 57 /* Common */
5396 #define __NR_readlink 58 /* Common */
5397 #define __NR_execve 59 /* Common */
5398 #define __NR_umask 60 /* Common */
5399 #define __NR_chroot 61 /* Common */
5400 #define __NR_fstat 62 /* Common */
5401 -/* #define __NR_ni_syscall 63 ENOSYS under SunOS */
5402 +#define __NR_fstat64 63 /* Linux sparc32 Specific */
5403 #define __NR_getpagesize 64 /* Common */
5404 #define __NR_msync 65 /* Common in newer 1.3.x revs... */
5405 #define __NR_vfork 66 /* Common */
5407 #define __NR_mprotect 74 /* Common */
5408 /* #define __NR_madvise 75 SunOS Specific */
5409 #define __NR_vhangup 76 /* Common */
5410 -/* #define __NR_ni_syscall 77 ENOSYS under SunOS */
5411 +#define __NR_truncate64 77 /* Linux sparc32 Specific */
5412 /* #define __NR_mincore 78 SunOS Specific */
5413 #define __NR_getgroups 79 /* Common */
5414 #define __NR_setgroups 80 /* Common */
5415 #define __NR_getpgrp 81 /* Common */
5416 /* #define __NR_setpgrp 82 setpgid, same difference... */
5417 #define __NR_setitimer 83 /* Common */
5418 -/* #define __NR_ni_syscall 84 ENOSYS under SunOS */
5419 +#define __NR_ftruncate64 84 /* Linux sparc32 Specific */
5420 #define __NR_swapon 85 /* Common */
5421 #define __NR_getitimer 86 /* Common */
5422 /* #define __NR_gethostname 87 SunOS Specific */
5423 @@ -147,14 +147,14 @@
5424 #define __NR_truncate 129 /* Common */
5425 #define __NR_ftruncate 130 /* Common */
5426 #define __NR_flock 131 /* Common */
5427 -/* #define __NR_ni_syscall 132 ENOSYS under SunOS */
5428 +#define __NR_lstat64 132 /* Linux sparc32 Specific */
5429 #define __NR_sendto 133 /* Common */
5430 #define __NR_shutdown 134 /* Common */
5431 #define __NR_socketpair 135 /* Common */
5432 #define __NR_mkdir 136 /* Common */
5433 #define __NR_rmdir 137 /* Common */
5434 #define __NR_utimes 138 /* SunOS Specific */
5435 -/* #define __NR_ni_syscall 139 ENOSYS under SunOS */
5436 +#define __NR_stat64 139 /* Linux sparc32 Specific */
5437 /* #define __NR_adjtime 140 SunOS Specific */
5438 #define __NR_getpeername 141 /* Common */
5439 /* #define __NR_gethostid 142 SunOS Specific */
5441 /* #define __NR_getmsg 151 SunOS Specific */
5442 /* #define __NR_putmsg 152 SunOS Specific */
5443 #define __NR_poll 153 /* Common */
5444 -/* #define __NR_getdents64 154 Linux Sparc32 Specific */
5445 -/* #define __NR_fcntl64 155 Linux Sparc32 Specific */
5446 +#define __NR_getdents64 154 /* Linux Sparc32 Specific */
5447 +#define __NR_fcntl64 155 /* Linux Sparc32 Specific */
5448 /* #define __NR_getdirentries 156 SunOS Specific */
5449 #define __NR_statfs 157 /* Common */
5450 #define __NR_fstatfs 158 /* Common */
5451 diff -Naur linux/include/asm-sparc64/fcntl.h linux-p/include/asm-sparc64/fcntl.h
5452 --- linux/include/asm-sparc64/fcntl.h Sun Mar 25 18:31:09 2001
5453 +++ linux-p/include/asm-sparc64/fcntl.h Mon Jan 14 23:01:48 2002
5455 #define O_NOCTTY 0x8000 /* not fcntl */
5456 #define O_DIRECTORY 0x10000 /* must be a directory */
5457 #define O_NOFOLLOW 0x20000 /* don't follow links */
5458 +#define O_LARGEFILE 0x40000
5460 #define F_DUPFD 0 /* dup */
5461 #define F_GETFD 1 /* get f_flags */
5464 #define F_SETSIG 10 /* for sockets. */
5465 #define F_GETSIG 11 /* for sockets. */
5467 +#define F_GETLK64 12
5468 +#define F_SETLK64 13
5469 +#define F_SETLKW64 14
5472 /* for F_[GET|SET]FL */
5473 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5483 __kernel_pid_t32 l_pid;
5487 +struct flock32_64 {
5490 + __kernel_loff_t32 l_start;
5491 + __kernel_loff_t32 l_len;
5492 + __kernel_pid_t32 l_pid;
5496 +#define flock64 flock
5499 #endif /* !(_SPARC64_FCNTL_H) */
5500 diff -Naur linux/include/asm-sparc64/stat.h linux-p/include/asm-sparc64/stat.h
5501 --- linux/include/asm-sparc64/stat.h Sun Mar 25 18:31:09 2001
5502 +++ linux-p/include/asm-sparc64/stat.h Mon Jan 14 23:01:48 2002
5506 #ifndef _SPARC64_STAT_H
5507 #define _SPARC64_STAT_H
5511 unsigned long __unused4[2];
5515 +/* This is sparc32 stat64 structure. */
5518 + unsigned char __pad0[6];
5519 + unsigned short st_dev;
5521 + unsigned long long st_ino;
5523 + unsigned int st_mode;
5524 + unsigned int st_nlink;
5526 + unsigned int st_uid;
5527 + unsigned int st_gid;
5529 + unsigned char __pad2[6];
5530 + unsigned short st_rdev;
5532 + unsigned char __pad3[8];
5534 + long long st_size;
5535 + unsigned int st_blksize;
5537 + unsigned char __pad4[8];
5538 + unsigned int st_blocks;
5540 + unsigned int st_atime;
5541 + unsigned int __unused1;
5543 + unsigned int st_mtime;
5544 + unsigned int __unused2;
5546 + unsigned int st_ctime;
5547 + unsigned int __unused3;
5549 + unsigned int __unused4;
5550 + unsigned int __unused5;
5556 diff -Naur linux/include/asm-sparc64/unistd.h linux-p/include/asm-sparc64/unistd.h
5557 --- linux/include/asm-sparc64/unistd.h Sun Mar 25 18:37:40 2001
5558 +++ linux-p/include/asm-sparc64/unistd.h Mon Jan 14 23:01:48 2002
5560 /* #define __NR_mctl 53 SunOS specific */
5561 #define __NR_ioctl 54 /* Common */
5562 #define __NR_reboot 55 /* Common */
5563 -/* #define __NR_ni_syscall 56 ENOSYS under SunOS */
5564 +/* #define __NR_mmap2 56 Linux sparc32 Specific */
5565 #define __NR_symlink 57 /* Common */
5566 #define __NR_readlink 58 /* Common */
5567 #define __NR_execve 59 /* Common */
5568 #define __NR_umask 60 /* Common */
5569 #define __NR_chroot 61 /* Common */
5570 #define __NR_fstat 62 /* Common */
5571 -/* #define __NR_ni_syscall 63 ENOSYS under SunOS */
5572 +/* #define __NR_fstat64 63 Linux sparc32 Specific */
5573 #define __NR_getpagesize 64 /* Common */
5574 #define __NR_msync 65 /* Common in newer 1.3.x revs... */
5575 #define __NR_vfork 66 /* Common */
5577 #define __NR_mprotect 74 /* Common */
5578 /* #define __NR_madvise 75 SunOS Specific */
5579 #define __NR_vhangup 76 /* Common */
5580 -/* #define __NR_ni_syscall 77 ENOSYS under SunOS */
5581 +/* #define __NR_truncate64 77 Linux sparc32 Specific */
5582 /* #define __NR_mincore 78 SunOS Specific */
5583 #define __NR_getgroups 79 /* Common */
5584 #define __NR_setgroups 80 /* Common */
5585 #define __NR_getpgrp 81 /* Common */
5586 /* #define __NR_setpgrp 82 setpgid, same difference... */
5587 #define __NR_setitimer 83 /* Common */
5588 -/* #define __NR_ni_syscall 84 ENOSYS under SunOS */
5589 +/* #define __NR_ftruncate64 84 Linux sparc32 Specific */
5590 #define __NR_swapon 85 /* Common */
5591 #define __NR_getitimer 86 /* Common */
5592 /* #define __NR_gethostname 87 SunOS Specific */
5593 @@ -147,19 +147,19 @@
5594 #define __NR_truncate 129 /* Common */
5595 #define __NR_ftruncate 130 /* Common */
5596 #define __NR_flock 131 /* Common */
5597 -/* #define __NR_ni_syscall 132 ENOSYS under SunOS */
5598 +/* #define __NR_lstat64 132 Linux sparc32 Specific */
5599 #define __NR_sendto 133 /* Common */
5600 #define __NR_shutdown 134 /* Common */
5601 #define __NR_socketpair 135 /* Common */
5602 #define __NR_mkdir 136 /* Common */
5603 #define __NR_rmdir 137 /* Common */
5604 #define __NR_utimes 138 /* SunOS Specific */
5605 -/* #define __NR_ni_syscall 139 ENOSYS under SunOS */
5606 +/* #define __NR_stat64 139 Linux sparc32 Specific */
5607 /* #define __NR_adjtime 140 SunOS Specific */
5608 #define __NR_getpeername 141 /* Common */
5609 /* #define __NR_gethostid 142 SunOS Specific */
5610 /* #define __NR_ni_syscall 143 ENOSYS under SunOS */
5611 -#define __NR_getrlimit 144 /* Common */
5612 +#define __NR_getrlimit 144 /* Common */
5613 #define __NR_setrlimit 145 /* Common */
5614 /* #define __NR_killpg 146 SunOS Specific */
5615 #define __NR_prctl 147 /* ENOSYS under SunOS */
5616 diff -Naur linux/include/linux/dirent.h linux-p/include/linux/dirent.h
5617 --- linux/include/linux/dirent.h Sun Mar 25 18:31:03 2001
5618 +++ linux-p/include/linux/dirent.h Mon Jan 14 23:01:48 2002
5620 char d_name[256]; /* We must not include limits.h! */
5626 + unsigned short d_reclen;
5627 + unsigned char d_type;
5632 diff -Naur linux/include/linux/ext2_fs_i.h linux-p/include/linux/ext2_fs_i.h
5633 --- linux/include/linux/ext2_fs_i.h Sun Mar 25 18:31:03 2001
5634 +++ linux-p/include/linux/ext2_fs_i.h Mon Jan 14 23:01:48 2002
5636 __u32 i_next_alloc_goal;
5637 __u32 i_prealloc_block;
5638 __u32 i_prealloc_count;
5639 - __u32 i_high_size;
5640 int i_new_inode:1; /* Is a freshly allocated inode */
5643 diff -Naur linux/include/linux/fs.h linux-p/include/linux/fs.h
5644 --- linux/include/linux/fs.h Mon Jan 14 22:59:27 2002
5645 +++ linux-p/include/linux/fs.h Mon Jan 14 23:01:48 2002
5646 @@ -267,6 +267,25 @@
5647 #define buffer_page(bh) (mem_map + MAP_NR((bh)->b_data))
5648 #define touch_buffer(bh) set_bit(PG_referenced, &buffer_page(bh)->flags)
5650 +/* log of base-2 for filesystem uses, in case their super-blocks
5651 + don't have the shift counts readily calculated.. -- presuming
5652 + the divisors in question are power-of-two values! */
5653 +static int fslog2(unsigned long val) __attribute__ ((const));
5654 +static __inline__ int fslog2(unsigned long val)
5657 + for (i = 0; val != 0; ++i, val >>= 1) {
5658 + if (val & 1) return i;
5663 +static int off_t_presentable(loff_t) __attribute((const));
5664 +static __inline__ int off_t_presentable(loff_t loff)
5666 + return loff >= 0 && loff <= (~0UL >> 1);
5669 #include <linux/pipe_fs_i.h>
5670 #include <linux/minix_fs_i.h>
5671 #include <linux/ext2_fs_i.h>
5693 unsigned int f_count, f_flags;
5694 - unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;
5695 + loff_t f_reada, f_ramax, f_raend, f_ralen, f_rawin;
5696 struct fown_struct f_owner;
5697 unsigned int f_uid, f_gid;
5700 struct file *fl_file;
5701 unsigned char fl_flags;
5702 unsigned char fl_type;
5708 void (*fl_notify)(struct file_lock *); /* unblock callback */
5709 void (*fl_insert)(struct file_lock *); /* lock insertion callback */
5714 +#define OFFSET_MAX ((loff_t)((~0ULL)>>1))
5715 +#define OFFT_OFFSET_MAX ((off_t)((~0UL)>>1))
5717 extern struct file_lock *file_lock_table;
5719 #include <linux/fcntl.h>
5721 extern int fcntl_getlk(unsigned int fd, struct flock *l);
5722 extern int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l);
5724 +extern int fcntl_getlk64(unsigned int fd, struct flock64 *l);
5725 +extern int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l);
5728 extern void locks_remove_posix(struct file *, fl_owner_t id);
5729 extern void locks_remove_flock(struct file *);
5730 @@ -609,12 +634,25 @@
5731 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
5736 +#define DT_UNKNOWN 0
5747 * This is the "filldir" function type, used by readdir() to let
5748 * the kernel specify what kind of dirent layout it wants to have.
5749 * This allows the kernel to read directories into kernel space or
5750 * to have different dirent layouts depending on the binary type.
5752 -typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t);
5753 +typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t, unsigned);
5755 struct file_operations {
5756 loff_t (*llseek) (struct file *, loff_t, int);
5759 asmlinkage int sys_open(const char *, int, int);
5760 asmlinkage int sys_close(unsigned int); /* yes, it's really unsigned */
5761 -extern int do_truncate(struct dentry *, unsigned long);
5762 +extern int do_truncate(struct dentry *, loff_t);
5764 extern struct file *filp_open(const char *, int, int);
5765 extern int filp_close(struct file *, fl_owner_t id);
5766 diff -Naur linux/include/linux/mm.h linux-p/include/linux/mm.h
5767 --- linux/include/linux/mm.h Sun Mar 25 18:31:03 2001
5768 +++ linux-p/include/linux/mm.h Mon Jan 14 23:01:48 2002
5770 struct vm_area_struct **vm_pprev_share;
5772 struct vm_operations_struct * vm_ops;
5773 - unsigned long vm_offset;
5775 struct file * vm_file;
5776 unsigned long vm_pte; /* shared mem */
5778 @@ -106,9 +106,46 @@
5779 unsigned long (*wppage)(struct vm_area_struct * area, unsigned long address,
5780 unsigned long page);
5781 int (*swapout)(struct vm_area_struct *, struct page *);
5782 - pte_t (*swapin)(struct vm_area_struct *, unsigned long, unsigned long);
5783 + pte_t (*swapin)(struct vm_area_struct *, loff_t, unsigned long);
5788 + * pgoff_t type -- a complex one, and its simple alternate.
5789 + * The complex one has type that compiler can trap at compile
5790 + * time, but the simple one does simpler code (?)
5794 +typedef struct pgoff_t {
5795 + unsigned long pgoff;
5798 +#define pgoff2ulong(pgof) ((pgof).pgoff)
5799 +extern __inline__ pgoff_t ulong2pgoff(unsigned long ul) {
5805 +#define pgoff2loff(pgof) (((loff_t)(pgof).pgoff) << PAGE_SHIFT)
5806 +#define loff2pgoff(loff) ulong2pgoff((loff) >> PAGE_SHIFT)
5808 +#else /* Integer scalars -- simpler code.. */
5810 +typedef unsigned long pgoff_t;
5812 +#define pgoff2ulong(pgof) (pgof)
5813 +#define ulong2pgoff(pgof) (pgof)
5815 +#define pgoff2loff(pgof) (((loff_t)(pgof)) << PAGE_SHIFT)
5816 +#define loff2pgoff(loff) ulong2pgoff((loff) >> PAGE_SHIFT)
5820 +#define PAGE_MASK_loff ((loff_t)(long)(PAGE_MASK))
5824 * Try to keep the most commonly accessed fields in single cache lines
5825 * here (16 bytes or greater). This ordering should be particularly
5826 @@ -117,12 +154,13 @@
5827 * The first line is data used in page cache lookup, the second line
5828 * is used for linear searches (eg. clock algorithm scans).
5831 typedef struct page {
5832 /* these must be first (free area handling) */
5836 struct inode *inode;
5837 - unsigned long offset;
5838 struct page *next_hash;
5840 unsigned long flags; /* atomic flags, some possibly updated asynchronously */
5842 extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot);
5843 extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot);
5845 -extern void vmtruncate(struct inode * inode, unsigned long offset);
5846 +extern void vmtruncate(struct inode * inode, loff_t offset);
5847 extern int handle_mm_fault(struct task_struct *tsk,struct vm_area_struct *vma, unsigned long address, int write_access);
5848 extern int make_pages_present(unsigned long addr, unsigned long end);
5850 @@ -311,16 +349,22 @@
5851 extern void exit_mmap(struct mm_struct *);
5852 extern unsigned long get_unmapped_area(unsigned long, unsigned long);
5854 -extern unsigned long do_mmap(struct file *, unsigned long, unsigned long,
5855 - unsigned long, unsigned long, unsigned long);
5856 +extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
5857 + unsigned long len, unsigned long prot,
5858 + unsigned long flag, unsigned long pgoff);
5860 +extern unsigned long do_mmap(struct file *, unsigned long,
5861 + unsigned long, unsigned long,
5862 + unsigned long, unsigned long);
5864 extern int do_munmap(unsigned long, size_t);
5867 extern void remove_inode_page(struct page *);
5868 extern unsigned long page_unuse(struct page *);
5869 extern int shrink_mmap(int, int);
5870 -extern void truncate_inode_pages(struct inode *, unsigned long);
5871 -extern unsigned long get_cached_page(struct inode *, unsigned long, int);
5872 +extern void truncate_inode_pages(struct inode *, loff_t);
5873 +extern unsigned long get_cached_page(struct inode *, pgoff_t, int);
5874 extern void put_cached_page(unsigned long);
5877 diff -Naur linux/include/linux/nfs.h linux-p/include/linux/nfs.h
5878 --- linux/include/linux/nfs.h Sun Mar 25 18:37:40 2001
5879 +++ linux-p/include/linux/nfs.h Mon Jan 14 23:01:48 2002
5881 #define NFS_MNTPROC_MNT 1
5882 #define NFS_MNTPROC_UMNT 3
5885 - * This is really a general kernel constant, but since nothing like
5886 - * this is defined in the kernel headers, I have to do it here.
5888 -#define NFS_OFFSET_MAX LONG_MAX
5889 +#define NFS_OFFSET_MAX ((__s64)((~(__u64)0) >> 1))
5892 * These data types are used exlusively by the NFS client implementation.
5893 diff -Naur linux/include/linux/nfs_fs.h linux-p/include/linux/nfs_fs.h
5894 --- linux/include/linux/nfs_fs.h Fri Nov 2 17:39:09 2001
5895 +++ linux-p/include/linux/nfs_fs.h Mon Jan 14 23:01:48 2002
5896 @@ -113,15 +113,15 @@
5900 -unsigned long nfs_page_offset(struct page *page)
5901 +loff_t nfs_page_offset(struct page *page)
5903 - return page->offset;
5904 + return ((loff_t)page->index) << PAGE_CACHE_SHIFT;
5908 unsigned long page_index(struct page *page)
5910 - return page->offset >> PAGE_CACHE_SHIFT;
5911 + return page->index;
5915 @@ -284,6 +284,15 @@
5916 nfs_size_to_off_t(__u64 size)
5918 return (size > (__u64)LONG_MAX) ? (off_t)LONG_MAX : (off_t) size;
5921 +static inline loff_t
5922 +nfs_size_to_loff_t(__u64 size)
5924 + loff_t maxsz = (((loff_t) ULONG_MAX) << PAGE_CACHE_SHIFT) + PAGE_CACHE_SIZE - 1;
5927 + return (loff_t) size;
5931 diff -Naur linux/include/linux/nfs_xdr.h linux-p/include/linux/nfs_xdr.h
5932 --- linux/include/linux/nfs_xdr.h Fri Nov 2 17:39:09 2001
5933 +++ linux-p/include/linux/nfs_xdr.h Mon Jan 14 23:02:57 2002
5934 @@ -329,11 +329,11 @@
5935 int (*readlink)(struct inode *, void *buffer, unsigned int buflen);
5936 int (*read)(struct inode *, struct rpc_cred *,
5938 - int flags, unsigned long offset,
5939 + int flags, loff_t offset,
5940 unsigned int count, void *buffer, int *eofp);
5941 int (*write)(struct inode *, struct rpc_cred *,
5943 - int flags, unsigned long offset,
5944 + int flags, loff_t offset,
5945 unsigned int count, void *buffer,
5946 struct nfs_writeverf *verfp);
5947 int (*commit)(struct inode *, struct nfs_fattr *,
5949 int (*statfs)(struct nfs_server *, struct nfs_fh *,
5950 struct nfs_fsinfo *);
5951 __u32 * (*decode_dirent)(__u32 *, struct nfs_entry *, int plus);
5956 diff -Naur linux/include/linux/nfsd/nfsd.h linux-p/include/linux/nfsd/nfsd.h
5957 --- linux/include/linux/nfsd/nfsd.h Sun Mar 25 18:37:40 2001
5958 +++ linux-p/include/linux/nfsd/nfsd.h Mon Jan 14 23:01:51 2002
5962 typedef int (*encode_dent_fn)(struct readdir_cd *, const char *,
5963 - int, off_t, ino_t);
5964 + int, off_t, ino_t, unsigned int);
5965 typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
5968 diff -Naur linux/include/linux/nfsd/xdr.h linux-p/include/linux/nfsd/xdr.h
5969 --- linux/include/linux/nfsd/xdr.h Sun Mar 25 18:31:04 2001
5970 +++ linux-p/include/linux/nfsd/xdr.h Mon Jan 14 23:01:51 2002
5972 int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *);
5974 int nfssvc_encode_entry(struct readdir_cd *, const char *name,
5975 - int namlen, off_t offset, ino_t ino);
5976 + int namlen, off_t offset, ino_t ino, unsigned int d_type);
5978 int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
5980 diff -Naur linux/include/linux/nfsd/xdr3.h linux-p/include/linux/nfsd/xdr3.h
5981 --- linux/include/linux/nfsd/xdr3.h Sun Mar 25 18:37:40 2001
5982 +++ linux-p/include/linux/nfsd/xdr3.h Mon Jan 14 23:01:51 2002
5984 int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *,
5985 struct nfsd3_fhandle_pair *);
5986 int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
5987 - int namlen, off_t offset, ino_t ino);
5988 + int namlen, off_t offset, ino_t ino, unsigned int d_type);
5989 int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
5990 - int namlen, off_t offset, ino_t ino);
5991 + int namlen, off_t offset, ino_t ino, unsigned int d_type);
5994 #endif /* _LINUX_NFSD_XDR3_H */
5995 diff -Naur linux/include/linux/pagemap.h linux-p/include/linux/pagemap.h
5996 --- linux/include/linux/pagemap.h Sun Mar 25 18:31:04 2001
5997 +++ linux-p/include/linux/pagemap.h Mon Jan 14 23:01:51 2002
5999 #define PAGE_CACHE_SHIFT PAGE_SHIFT
6000 #define PAGE_CACHE_SIZE PAGE_SIZE
6001 #define PAGE_CACHE_MASK PAGE_MASK
6002 +#define PAGE_CACHE_MASK_loff PAGE_MASK_loff
6004 #define page_cache_alloc() __get_free_page(GFP_USER)
6005 #define page_cache_free(x) free_page(x)
6007 * inode pointer and offsets are distributed (ie, we
6008 * roughly know which bits are "significant")
6010 -static inline unsigned long _page_hashfn(struct inode * inode, unsigned long offset)
6011 +static inline unsigned long _page_hashfn(struct inode * inode, pgoff_t index)
6013 #define i (((unsigned long) inode)/(sizeof(struct inode) & ~ (sizeof(struct inode) - 1)))
6014 -#define o ((offset >> PAGE_SHIFT) + (offset & ~PAGE_MASK))
6015 +#define o (index + (index >> PAGE_HASH_BITS))
6016 return ((i+o) & PAGE_HASH_MASK);
6021 #define page_hash(inode,offset) (page_hash_table+_page_hashfn(inode,offset))
6023 -static inline struct page * __find_page(struct inode * inode, unsigned long offset, struct page *page)
6024 +static inline struct page * __find_page(struct inode * inode, pgoff_t index, struct page *page)
6030 if (page->inode != inode)
6032 - if (page->offset == offset)
6033 + if (pgoff2ulong(page->index) == pgoff2ulong(index))
6036 /* Found the page. */
6041 -static inline struct page *find_page(struct inode * inode, unsigned long offset)
6042 +static inline struct page *find_page(struct inode * inode, pgoff_t poffset)
6044 - return __find_page(inode, offset, *page_hash(inode, offset));
6045 + return __find_page(inode, poffset, *page_hash(inode, poffset));
6048 static inline void remove_page_from_hash_queue(struct page * page)
6050 page->pprev_hash = p;
6053 -static inline void add_page_to_hash_queue(struct page * page, struct inode * inode, unsigned long offset)
6054 +static inline void add_page_to_hash_queue(struct page * page, struct inode * inode, pgoff_t poffset)
6056 - __add_page_to_hash_queue(page, page_hash(inode,offset));
6057 + __add_page_to_hash_queue(page, page_hash(inode,poffset));
6060 static inline void remove_page_from_inode_queue(struct page * page)
6062 __wait_on_page(page);
6065 -extern void update_vm_cache_conditional(struct inode *, unsigned long, const char *, int, unsigned long);
6066 -extern void update_vm_cache(struct inode *, unsigned long, const char *, int);
6067 +extern void update_vm_cache_conditional(struct inode *, loff_t, const char *, int, unsigned long);
6068 +extern void update_vm_cache(struct inode *, loff_t, const char *, int);
6070 typedef int filler_t(void *, struct page*);
6072 diff -Naur linux/include/linux/sched.h linux-p/include/linux/sched.h
6073 --- linux/include/linux/sched.h Mon Jan 14 22:59:27 2002
6074 +++ linux-p/include/linux/sched.h Mon Jan 14 23:01:51 2002
6076 int keep_capabilities:1;
6077 struct user_struct *user;
6079 - struct rlimit rlim[RLIM_NLIMITS];
6080 + struct rlimit rlim[RLIM_NLIMITS];
6081 unsigned short used_math;
6083 /* file system info */
6084 diff -Naur linux/include/linux/smb_fs.h linux-p/include/linux/smb_fs.h
6085 --- linux/include/linux/smb_fs.h Sun Mar 25 18:31:04 2001
6086 +++ linux-p/include/linux/smb_fs.h Mon Jan 14 23:01:51 2002
6088 void smb_close_dentry(struct dentry *);
6089 int smb_close_fileid(struct dentry *, __u16);
6090 int smb_open(struct dentry *, int);
6091 -int smb_proc_read(struct dentry *, off_t, int, char *);
6092 -int smb_proc_write(struct dentry *, off_t, int, const char *);
6093 +int smb_proc_read(struct dentry *, loff_t, int, char *);
6094 +int smb_proc_write(struct dentry *, loff_t, int, const char *);
6095 int smb_proc_create(struct dentry *, __u16, time_t, __u16 *);
6096 int smb_proc_mv(struct dentry *, struct dentry *);
6097 int smb_proc_mkdir(struct dentry *);
6098 diff -Naur linux/include/linux/swap.h linux-p/include/linux/swap.h
6099 --- linux/include/linux/swap.h Sun Mar 25 18:31:04 2001
6100 +++ linux-p/include/linux/swap.h Mon Jan 14 23:01:51 2002
6102 extern unsigned int nr_swapfiles;
6103 extern struct swap_info_struct swap_info[];
6104 void si_swapinfo(struct sysinfo *);
6105 -unsigned long get_swap_page(void);
6106 +extern unsigned long get_swap_page(void);
6107 extern void FASTCALL(swap_free(unsigned long));
6108 struct swap_list_t {
6109 int head; /* head of priority-ordered swapfile list */
6111 extern inline unsigned long in_swap_cache(struct page *page)
6113 if (PageSwapCache(page))
6114 - return page->offset;
6115 + return pgoff2ulong(page->index);
6121 count = atomic_read(&page->count);
6122 if (PageSwapCache(page))
6123 - count += swap_count(page->offset) - 2;
6124 + count += swap_count(pgoff2ulong(page->index)) - 2;
6125 if (PageFreeAfter(page))
6128 diff -Naur linux/include/linux/ufs_fs_i.h linux-p/include/linux/ufs_fs_i.h
6129 --- linux/include/linux/ufs_fs_i.h Sun Mar 25 18:31:04 2001
6130 +++ linux-p/include/linux/ufs_fs_i.h Mon Jan 14 23:01:51 2002
6133 __u8 i_symlink[4*15];
6139 diff -Naur linux/kernel/ksyms.c linux-p/kernel/ksyms.c
6140 --- linux/kernel/ksyms.c Mon Jan 14 22:59:27 2002
6141 +++ linux-p/kernel/ksyms.c Mon Jan 14 23:01:51 2002
6144 /* process memory management */
6145 EXPORT_SYMBOL(do_mmap);
6146 +EXPORT_SYMBOL(do_mmap_pgoff);
6147 EXPORT_SYMBOL(do_munmap);
6148 EXPORT_SYMBOL(exit_mm);
6149 EXPORT_SYMBOL(exit_files);
6150 diff -Naur linux/lib/vsprintf.c linux-p/lib/vsprintf.c
6151 --- linux/lib/vsprintf.c Mon Jan 14 22:59:27 2002
6152 +++ linux-p/lib/vsprintf.c Mon Jan 14 23:01:51 2002
6153 @@ -67,10 +67,106 @@
6154 #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
6156 #define do_div(n,base) ({ \
6158 -__res = ((unsigned long) n) % (unsigned) base; \
6159 -n = ((unsigned long) n) / (unsigned) base; \
6162 + __res = ((unsigned long) n) % (unsigned) base; \
6163 + n = ((unsigned long) n) / (unsigned) base; \
6166 +#if BITS_PER_LONG < 64
6168 +/* Note: do_ldiv assumes that unsigned long long is a 64 bit long
6169 + * and unsigned long is at least a 32 bits long.
6171 +#define do_ldiv(n, base) \
6173 + unsigned long long value = n; \
6174 + unsigned long long leftover; \
6175 + unsigned long temp; \
6176 + unsigned long result_div1, result_div2, result_div3, result_mod; \
6178 + temp = value >> 32; \
6179 + result_div1 = temp/(base); \
6180 + result_mod = temp%(base); \
6182 + temp = (result_mod << 24) | ((value >> 8) & 0xFFFFFF); \
6183 + result_div2 = temp/(base); \
6184 + result_mod = temp%(base); \
6186 + temp = (result_mod << 8) | (value & 0xFF); \
6187 + result_div3 = temp/(base); \
6188 + result_mod = temp%(base);\
6190 + leftover = ((unsigned long long)result_div1 << 32) | \
6191 + ((unsigned long long)result_div2 << 8) | (result_div3); \
6198 +static char * lnumber(char * str, long long num, int base, int size,
6199 + int precision, int type)
6201 + char c,sign,tmp[66];
6202 + const char *digits="0123456789abcdef";
6206 + digits = "0123456789ABCDEF";
6209 + if (base < 2 || base > 36)
6211 + c = (type & ZEROPAD) ? '0' : ' ';
6213 + if (type & SIGN) {
6218 + } else if (type & PLUS) {
6221 + } else if (type & SPACE) {
6226 + if (type & SPECIAL) {
6233 + else while (num != 0)
6234 + tmp[i++] = digits[do_ldiv(num,base)];
6235 + if (i > precision)
6237 + size -= precision;
6238 + if (!(type&(ZEROPAD+LEFT)))
6243 + if (type & SPECIAL) {
6246 + *str++ = digits[33];
6249 + if (!(type & LEFT))
6250 + while (size-- > 0)
6252 + while (i < precision--)
6256 + while (size-- > 0)
6262 static char * number(char * str, long num, int base, int size, int precision
6264 @@ -207,7 +303,10 @@
6265 /* get the conversion qualifier */
6267 if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
6269 + if (*fmt == 'l' && qualifier == 'l')
6276 @@ -296,7 +395,22 @@
6280 - if (qualifier == 'l')
6281 + if (qualifier == 'L') {
6283 +#if BITS_PER_LONG < 64
6284 + /* 64-bit printout in 32-bit systems !!
6285 + Needed at some point for 64-bit file offsets and
6286 + mmap() reporting functions. */
6288 + unsigned long long lnum;
6289 + lnum = va_arg(args, unsigned long long);
6290 + str = lnumber(str, lnum, base, field_width,
6291 + precision, flags);
6294 + num = va_arg(args, unsigned long); /* 64-bit longs..*/
6296 + } else if (qualifier == 'l')
6297 num = va_arg(args, unsigned long);
6298 else if (qualifier == 'h') {
6299 num = (unsigned short) va_arg(args, int);
6300 diff -Naur linux/mm/filemap.c linux-p/mm/filemap.c
6301 --- linux/mm/filemap.c Sun Mar 25 18:37:40 2001
6302 +++ linux-p/mm/filemap.c Mon Jan 14 23:01:51 2002
6304 * Truncate the page cache at a set offset, removing the pages
6305 * that are beyond that offset (and zeroing out partial pages).
6307 -void truncate_inode_pages(struct inode * inode, unsigned long start)
6308 +void truncate_inode_pages(struct inode * inode, loff_t start)
6314 p = &inode->i_pages;
6315 while ((page = *p) != NULL) {
6316 - unsigned long offset = page->offset;
6317 + loff_t loffset = pgoff2loff(page->index);
6319 /* page wholly truncated - free it */
6320 - if (offset >= start) {
6321 + if (loffset >= start) {
6322 if (PageLocked(page)) {
6325 @@ -104,9 +104,10 @@
6329 - offset = start - offset;
6330 + loffset = start - loffset;
6331 /* partial truncate, clear end of page */
6332 - if (offset < PAGE_CACHE_SIZE) {
6333 + if (loffset < PAGE_CACHE_SIZE) {
6334 + unsigned int offset = loffset; /* truncate ok */
6335 unsigned long address = page_address(page);
6336 memset((void *) (offset + address), 0, PAGE_CACHE_SIZE - offset);
6337 flush_page_to_ram(address);
6339 * were to be marked referenced..
6341 if (PageSwapCache(page)) {
6342 - if (referenced && swap_count(page->offset) != 1)
6344 + swap_count(pgoff2ulong(page->index)) != 1)
6346 delete_from_swap_cache(page);
6348 @@ -238,11 +240,12 @@
6349 * memory maps. --sct
6352 -void update_vm_cache_conditional(struct inode * inode, unsigned long pos, const char * buf, int count, unsigned long source_address)
6353 +void update_vm_cache_conditional(struct inode * inode, loff_t pos, const char * buf, int count, unsigned long source_address)
6355 unsigned long offset, len;
6356 + pgoff_t pgoff = loff2pgoff(pos);
6358 - offset = (pos & ~PAGE_CACHE_MASK);
6359 + offset = ((unsigned long)pos & ~PAGE_CACHE_MASK);
6360 pos = pos & PAGE_CACHE_MASK;
6361 len = PAGE_CACHE_SIZE - offset;
6367 - page = find_page(inode, pos);
6368 + page = find_page(inode, pgoff);
6370 char *dest = (char*) (offset + page_address(page));
6372 @@ -270,19 +273,20 @@
6376 -void update_vm_cache(struct inode * inode, unsigned long pos, const char * buf, int count)
6377 +void update_vm_cache(struct inode * inode, loff_t pos, const char * buf, int count)
6379 update_vm_cache_conditional(inode, pos, buf, count, 0);
6383 static inline void add_to_page_cache(struct page * page,
6384 - struct inode * inode, unsigned long offset,
6385 - struct page **hash)
6386 + struct inode * inode,
6388 + struct page **hash)
6390 atomic_inc(&page->count);
6391 page->flags = page->flags & ~((1 << PG_uptodate) | (1 << PG_error) | (1 << PG_referenced));
6392 - page->offset = offset;
6393 + page->index = pgoff;
6394 add_page_to_inode_queue(inode, page);
6395 __add_page_to_hash_queue(page, hash);
6397 @@ -293,29 +297,32 @@
6398 * this is all overlapped with the IO on the previous page finishing anyway)
6400 static unsigned long try_to_read_ahead(struct file * file,
6401 - unsigned long offset, unsigned long page_cache)
6402 + pgoff_t pgoff, unsigned long page_cache)
6404 struct inode *inode = file->f_dentry->d_inode;
6405 - struct page * page;
6406 - struct page ** hash;
6409 - offset &= PAGE_CACHE_MASK;
6410 - switch (page_cache) {
6412 + /* Calculate file size in 'pages' -- if even one byte (according to
6413 + the 'i_size') exceeds the final page-size block, round up. */
6414 + pg_size = loff2pgoff(inode->i_size+(PAGE_SIZE-1));
6416 + if (!page_cache) {
6417 page_cache = page_cache_alloc();
6421 - if (offset >= inode->i_size)
6423 - hash = page_hash(inode, offset);
6424 - page = __find_page(inode, offset, *hash);
6425 + return 0; /* Can't allocate! */
6427 + /* Ok, we have a page, make sure it is in the page cache */
6428 + if (pgoff2ulong(pgoff) < pgoff2ulong(pg_size)) {
6429 + struct page * page;
6430 + struct page ** hash;
6431 + hash = page_hash(inode, pgoff);
6432 + page = __find_page(inode, pgoff, *hash);
6435 * Ok, add the new page to the hash-queues...
6437 page = page_cache_entry(page_cache);
6438 - add_to_page_cache(page, inode, offset, hash);
6439 + add_to_page_cache(page, inode, pgoff, hash);
6440 inode->i_op->readpage(file, page);
6443 @@ -369,11 +376,11 @@
6445 #define PROFILE_MAXREADCOUNT 1000
6447 -static unsigned long total_reada;
6448 -static unsigned long total_async;
6449 -static unsigned long total_ramax;
6450 -static unsigned long total_ralen;
6451 -static unsigned long total_rawin;
6452 +static u_long total_reada;
6453 +static u_long total_async;
6454 +static u_long total_ramax;
6455 +static u_long total_ralen;
6456 +static u_long total_rawin;
6458 static void profile_readahead(int async, struct file *filp)
6460 @@ -481,13 +488,13 @@
6462 static inline unsigned long generic_file_readahead(int reada_ok,
6463 struct file * filp, struct inode * inode,
6464 - unsigned long ppos, struct page * page, unsigned long page_cache)
6465 + loff_t ppos, struct page * page, unsigned long page_cache)
6467 - unsigned long max_ahead, ahead;
6468 - unsigned long raend;
6469 + loff_t max_ahead, ahead;
6471 int max_readahead = get_max_readahead(inode);
6473 - raend = filp->f_raend & PAGE_CACHE_MASK;
6474 + raend = filp->f_raend & PAGE_CACHE_MASK_loff;
6480 while (ahead < max_ahead) {
6481 ahead += PAGE_CACHE_SIZE;
6482 - page_cache = try_to_read_ahead(filp, raend + ahead,
6483 + page_cache = try_to_read_ahead(filp, loff2pgoff(raend + ahead),
6487 @@ -612,14 +619,14 @@
6488 struct dentry *dentry = filp->f_dentry;
6489 struct inode *inode = dentry->d_inode;
6490 unsigned long page_cache;
6491 - size_t pos, pgpos;
6494 int max_readahead = get_max_readahead(inode);
6499 - pgpos = pos & PAGE_CACHE_MASK;
6500 + posp = pos & PAGE_CACHE_MASK_loff;
6502 * If the current position is outside the previous read-ahead window,
6503 * we reset the current read-ahead context and set read ahead max to zero
6505 * otherwise, we assume that the file accesses are sequential enough to
6506 * continue read-ahead.
6508 - if (pgpos > filp->f_raend || pgpos + filp->f_rawin < filp->f_raend) {
6509 + if (posp > filp->f_raend || posp + filp->f_rawin < filp->f_raend) {
6513 @@ -643,12 +650,12 @@
6514 * Then, at least MIN_READAHEAD if read ahead is ok,
6515 * and at most MAX_READAHEAD in all cases.
6517 - if (pos + desc->count <= (PAGE_CACHE_SIZE >> 1)) {
6518 + if (pos + desc->count <= (loff_t)(PAGE_CACHE_SIZE >> 1)) {
6521 - unsigned long needed;
6524 - needed = ((pos + desc->count) & PAGE_CACHE_MASK) - pgpos;
6525 + needed = ((pos + desc->count) & PAGE_CACHE_MASK) - posp;
6527 if (filp->f_ramax < needed)
6528 filp->f_ramax = needed;
6532 struct page *page, **hash;
6535 if (pos >= inode->i_size)
6539 * Try to find the data in the page cache..
6541 - hash = page_hash(inode, pos & PAGE_CACHE_MASK);
6542 - page = __find_page(inode, pos & PAGE_CACHE_MASK, *hash);
6543 + pgoff = loff2pgoff(pos);
6544 + hash = page_hash(inode, pgoff);
6545 + page = __find_page(inode, pgoff, *hash);
6547 goto no_cached_page;
6550 * the page has been rewritten.
6552 if (PageUptodate(page) || PageLocked(page))
6553 - page_cache = generic_file_readahead(reada_ok, filp, inode, pos & PAGE_CACHE_MASK, page, page_cache);
6554 + page_cache = generic_file_readahead(reada_ok, filp, inode, pos & PAGE_CACHE_MASK_loff, page, page_cache);
6555 else if (reada_ok && filp->f_ramax > MIN_READAHEAD)
6556 filp->f_ramax = MIN_READAHEAD;
6559 flush_dcache_page(page_address(page));
6561 offset = pos & ~PAGE_CACHE_MASK;
6562 - nr = PAGE_CACHE_SIZE - offset;
6563 - if (nr > inode->i_size - pos)
6564 + nr = PAGE_CACHE_SIZE - offset; /* small value */
6565 + if ((loff_t)nr > (inode->i_size - pos))
6566 nr = inode->i_size - pos;
6571 page = page_cache_entry(page_cache);
6573 - add_to_page_cache(page, inode, pos & PAGE_CACHE_MASK, hash);
6574 + add_to_page_cache(page, inode, pgoff, hash);
6577 * Error handling is tricky. If we get a read error,
6578 @@ -829,10 +838,26 @@
6579 ssize_t generic_file_read(struct file * filp, char * buf, size_t count, loff_t *ppos)
6582 + struct inode *inode = filp->f_dentry->d_inode;
6584 + if (((ssize_t) count) < 0)
6588 if (access_ok(VERIFY_WRITE, buf, count)) {
6591 + /* L-F-S spec 2.2.1.25: */
6592 + if (!(filp->f_flags & O_LARGEFILE) &&
6593 + S_ISREG(inode->i_mode) &&
6594 + (*ppos < inode->i_size) && count) {
6595 + if (*ppos >= 0x7fffffff) /* pos@2G forbidden */
6596 + return -EOVERFLOW;
6597 + if (*ppos + count > 0x7fffffff)
6598 + /* Read only until end of allowed region */
6599 + count = 0x7fffffff - *ppos;
6603 read_descriptor_t desc;
6606 struct file * in_file, * out_file;
6607 struct inode * in_inode, * out_inode;
6609 + if (((ssize_t) count) < 0)
6615 @@ -974,20 +1002,25 @@
6616 struct file * file = area->vm_file;
6617 struct dentry * dentry = file->f_dentry;
6618 struct inode * inode = dentry->d_inode;
6619 - unsigned long offset, reada, i;
6621 + pgoff_t pgoff, reada;
6623 struct page * page, **hash;
6624 unsigned long old_page, new_page;
6627 - offset = (address & PAGE_MASK) - area->vm_start + area->vm_offset;
6628 + offset = ((loff_t)((address & PAGE_MASK) - area->vm_start) +
6631 if (offset >= inode->i_size && (area->vm_flags & VM_SHARED) && area->vm_mm == current->mm)
6635 * Do we have something in the page cache already?
6637 - hash = page_hash(inode, offset);
6638 - page = __find_page(inode, offset, *hash);
6639 + pgoff = loff2pgoff(offset);
6640 + hash = page_hash(inode, pgoff);
6641 + page = __find_page(inode, pgoff, *hash);
6643 goto no_cached_page;
6645 @@ -1038,11 +1071,12 @@
6647 * Try to read in an entire cluster at once.
6650 - reada >>= PAGE_CACHE_SHIFT + page_cluster;
6651 - reada <<= PAGE_CACHE_SHIFT + page_cluster;
6652 + reada = loff2pgoff(offset);
6653 + /* Mask lowest 'page_cluster' worth of the lowest bits */
6654 + reada = ulong2pgoff(pgoff2ulong(reada) & ((~(0UL)) << page_cluster));
6656 - for (i = 1 << page_cluster; i > 0; --i, reada += PAGE_CACHE_SIZE)
6657 + for (i = 1 << page_cluster; i > 0;
6658 + --i, reada = ulong2pgoff(pgoff2ulong(reada)+1))
6659 new_page = try_to_read_ahead(file, reada, new_page);
6662 @@ -1056,7 +1090,7 @@
6663 * cache.. The page we just got may be useful if we
6664 * can't share, so don't get rid of it here.
6666 - page = find_page(inode, offset);
6667 + page = find_page(inode, pgoff);
6671 @@ -1065,7 +1099,7 @@
6673 page = page_cache_entry(new_page);
6675 - add_to_page_cache(page, inode, offset, hash);
6676 + add_to_page_cache(page, inode, pgoff, hash);
6678 if (inode->i_op->readpage(file, page) != 0)
6680 @@ -1114,10 +1148,10 @@
6681 * if the disk is full.
6683 static inline int do_write_page(struct inode * inode, struct file * file,
6684 - const char * page, unsigned long offset)
6685 + const char * page, loff_t offset)
6688 - unsigned long size;
6690 loff_t loff = offset;
6691 mm_segment_t old_fs;
6693 @@ -1141,7 +1175,7 @@
6696 static int filemap_write_page(struct vm_area_struct * vma,
6697 - unsigned long offset,
6702 @@ -1175,7 +1209,7 @@
6704 int filemap_swapout(struct vm_area_struct * vma, struct page * page)
6706 - return filemap_write_page(vma, page->offset, page_address(page));
6707 + return filemap_write_page(vma, pgoff2loff(page->index), page_address(page));
6710 static inline int filemap_sync_pte(pte_t * ptep, struct vm_area_struct *vma,
6711 @@ -1539,7 +1573,7 @@
6713 struct dentry *dentry = file->f_dentry;
6714 struct inode *inode = dentry->d_inode;
6715 - unsigned long pos = *ppos;
6716 + loff_t pos = *ppos;
6717 unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
6718 struct page *page, **hash;
6719 unsigned long page_cache = 0;
6720 @@ -1555,6 +1589,9 @@
6724 + if (((ssize_t) count) < 0)
6727 sync = file->f_flags & O_SYNC;
6730 @@ -1565,31 +1602,39 @@
6731 * Check whether we've reached the file size limit.
6734 - if (pos >= limit) {
6735 + if (limit != RLIM_INFINITY && pos >= limit) {
6736 send_sig(SIGXFSZ, current, 0);
6741 + if (!(file->f_flags & O_LARGEFILE) &&
6742 + S_ISREG(inode->i_mode) && count) {
6743 + if (pos >= 0x7fffffff) /* pos@2G forbidden */
6746 + if (pos + count > 0x7fffffff)
6747 + count = 0x7fffffff - pos;
6752 * Check whether to truncate the write,
6753 * and send the signal if we do.
6755 - if (count > limit - pos) {
6756 - send_sig(SIGXFSZ, current, 0);
6757 + if (limit != RLIM_INFINITY && count > limit - pos)
6758 count = limit - pos;
6762 - unsigned long bytes, pgpos, offset;
6763 + unsigned long bytes, offset;
6764 + pgoff_t pgpos = loff2pgoff(pos);
6768 * Try to find the page in the cache. If it isn't there,
6769 * allocate a free page.
6771 - offset = (pos & ~PAGE_CACHE_MASK);
6772 - pgpos = pos & PAGE_CACHE_MASK;
6773 + offset = ((unsigned long)pos & ~PAGE_CACHE_MASK);
6774 bytes = PAGE_CACHE_SIZE - offset;
6777 @@ -1667,15 +1712,14 @@
6778 * Note: we don't have to worry about races here, as the caller
6779 * is holding the inode semaphore.
6781 -unsigned long get_cached_page(struct inode * inode, unsigned long offset,
6783 +unsigned long get_cached_page(struct inode * inode, pgoff_t pgoff, int new)
6786 struct page ** hash;
6787 unsigned long page_cache = 0;
6789 - hash = page_hash(inode, offset);
6790 - page = __find_page(inode, offset, *hash);
6791 + hash = page_hash(inode, pgoff);
6792 + page = __find_page(inode, pgoff, *hash);
6796 @@ -1684,7 +1728,7 @@
6798 clear_page(page_cache);
6799 page = page_cache_entry(page_cache);
6800 - add_to_page_cache(page, inode, offset, hash);
6801 + add_to_page_cache(page, inode, pgoff, hash);
6803 if (atomic_read(&page->count) != 2)
6804 printk(KERN_ERR "get_cached_page: page count=%d\n",
6805 diff -Naur linux/mm/memory.c linux-p/mm/memory.c
6806 --- linux/mm/memory.c Mon Jan 14 22:59:26 2002
6807 +++ linux-p/mm/memory.c Mon Jan 14 23:01:51 2002
6810 if (!PageSwapCache(page_map))
6812 - if (swap_count(page_map->offset) != 1)
6813 + if (swap_count(pgoff2ulong(page_map->index)) != 1)
6815 delete_from_swap_cache(page_map);
6818 * between the file and the memory map for a potential last
6819 * incomplete page. Ugly, but necessary.
6821 -void vmtruncate(struct inode * inode, unsigned long offset)
6822 +void vmtruncate(struct inode * inode, loff_t offset)
6824 truncate_inode_pages(inode, offset);
6826 diff -Naur linux/mm/mmap.c linux-p/mm/mmap.c
6827 --- linux/mm/mmap.c Mon Jan 14 22:59:27 2002
6828 +++ linux-p/mm/mmap.c Mon Jan 14 23:01:51 2002
6829 @@ -169,11 +169,25 @@
6833 -unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len,
6834 - unsigned long prot, unsigned long flags, unsigned long off)
6835 +unsigned long do_mmap(struct file *file, unsigned long addr,
6836 + unsigned long len, unsigned long prot,
6837 + unsigned long flag, unsigned long offset)
6839 + unsigned long ret = -EINVAL;
6840 + if ((offset + PAGE_ALIGN(len)) < offset)
6842 + if (!(offset & ~PAGE_MASK))
6843 + ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
6848 +unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned long len,
6849 + unsigned long prot, unsigned long flags, unsigned long pg_off)
6851 struct mm_struct * mm = current->mm;
6852 struct vm_area_struct * vma;
6853 + loff_t off = (loff_t)pg_off << PAGE_SHIFT;
6856 if (file && (!file->f_op || !file->f_op->mmap))
6858 * the offsets must be contiguous..
6860 if ((mpnt->vm_file != NULL) || (mpnt->vm_flags & VM_SHM)) {
6861 - unsigned long off = prev->vm_offset+prev->vm_end-prev->vm_start;
6862 + loff_t off = (prev->vm_offset +
6863 + (loff_t)(prev->vm_end - prev->vm_start));
6864 if (off != mpnt->vm_offset)
6867 diff -Naur linux/mm/page_alloc.c linux-p/mm/page_alloc.c
6868 --- linux/mm/page_alloc.c Sun Mar 25 18:37:41 2001
6869 +++ linux-p/mm/page_alloc.c Mon Jan 14 23:01:51 2002
6871 add_mem_queue(area, list(map_nr));
6873 static void free_local_pages(struct page * page) {
6874 - unsigned long order = page->offset;
6875 + unsigned long order = page->index;
6876 unsigned int type = PageDMA(page) ? 1 : 0;
6877 struct free_area_struct *area;
6878 unsigned long map_nr = page - mem_map;
6881 page = mem_map + map_nr;
6882 list_add((struct list_head *) page, ¤t->local_pages);
6883 - page->offset = order;
6884 + page->index = order;
6885 current->nr_local_pages++;
6888 diff -Naur linux/mm/page_io.c linux-p/mm/page_io.c
6889 --- linux/mm/page_io.c Sun Mar 25 18:31:03 2001
6890 +++ linux-p/mm/page_io.c Mon Jan 14 23:01:51 2002
6892 * as if it were: we are not allowed to manipulate the inode
6893 * hashing for locked pages.
6895 - if (page->offset != entry) {
6896 + if (pgoff2ulong(page->index) != entry) {
6897 printk ("swap entry mismatch");
6901 printk("VM: swap page is not in swap cache\n");
6904 - if (page->offset != entry) {
6905 - printk ("swap entry mismatch");
6906 + if (pgoff2ulong(page->index) != entry) {
6907 + printk ("VM: swap entry mismatch");
6910 rw_swap_page_base(rw, entry, page, wait);
6911 @@ -291,12 +291,12 @@
6912 printk ("VM: read_swap_page: page already in page cache!\n");
6915 - page->inode = &swapper_inode;
6916 - page->offset = entry;
6917 + page->inode = &swapper_inode;
6918 + page->index = ulong2pgoff(entry);
6919 atomic_inc(&page->count); /* Protect from shrink_mmap() */
6920 rw_swap_page(rw, entry, buffer, 1);
6921 atomic_dec(&page->count);
6924 clear_bit(PG_swap_cache, &page->flags);
6927 diff -Naur linux/mm/swap_state.c linux-p/mm/swap_state.c
6928 --- linux/mm/swap_state.c Sun Mar 25 18:37:41 2001
6929 +++ linux-p/mm/swap_state.c Mon Jan 14 23:01:51 2002
6931 if (PageTestandSetSwapCache(page)) {
6932 printk(KERN_ERR "swap_cache: replacing non-empty entry %08lx "
6934 - page->offset, page_address(page));
6935 + pgoff2ulong(page->index), page_address(page));
6940 atomic_inc(&page->count);
6941 page->flags = page->flags & ~((1 << PG_uptodate) | (1 << PG_error) | (1 << PG_referenced));
6942 page->inode = &swapper_inode;
6943 - page->offset = entry;
6944 - add_page_to_hash_queue(page, &swapper_inode, entry);
6945 + page->index = ulong2pgoff(entry);
6946 + add_page_to_hash_queue(page, &swapper_inode, ulong2pgoff(entry));
6947 add_page_to_inode_queue(&swapper_inode, page);
6952 void delete_from_swap_cache(struct page *page)
6954 - long entry = page->offset;
6955 + long entry = pgoff2ulong(page->index);
6957 #ifdef SWAP_CACHE_INFO
6958 swap_cache_del_total++;
6960 swap_cache_find_total++;
6963 - found = find_page(&swapper_inode, entry);
6964 + found = find_page(&swapper_inode, ulong2pgoff(entry));
6967 if (found->inode != &swapper_inode || !PageSwapCache(found))
6968 diff -Naur linux/mm/vmscan.c linux-p/mm/vmscan.c
6969 --- linux/mm/vmscan.c Sun Mar 25 18:37:41 2001
6970 +++ linux-p/mm/vmscan.c Mon Jan 14 23:01:51 2002
6972 * memory, and we should just continue our scan.
6974 if (PageSwapCache(page_map)) {
6975 - entry = page_map->offset;
6976 + entry = pgoff2ulong(page_map->index);
6977 swap_duplicate(entry);
6978 set_pte(page_table, __pte(entry));
6980 --- linux/fs/jfs/jfs_dtree.c Mon Jan 14 23:08:34 2002
6981 +++ linux-p/fs/jfs/jfs_dtree.c Mon Jan 14 23:27:22 2002
6982 @@ -3082,9 +3082,7 @@
6985 if (filldir(dirent, ".", 1, 0, ip->i_ino
6992 @@ -3093,9 +3091,7 @@
6995 if (filldir(dirent, "..", 2, 1, PARENT(ip)
7002 @@ -3127,9 +3123,7 @@
7003 /* build "." entry */
7005 if (filldir(dirent, ".", 1, filp->f_pos, ip->i_ino
7011 dtoffset->index = 1;
7012 @@ -3141,9 +3135,7 @@
7014 if (filldir(dirent, "..", 2, filp->f_pos,
7022 @@ -3220,9 +3212,7 @@
7024 if (filldir(dirent, d_name, d_namlen, filp->f_pos,
7025 le32_to_cpu(d->inumber)
7032 diff -Naur linux/fs/jfs/jfs_metapage.c linux-p/fs/jfs/jfs_metapage.c
7033 --- linux/fs/jfs/jfs_metapage.c Tue Jan 15 00:08:19 2002
7034 +++ linux-p/fs/jfs/jfs_metapage.c Tue Jan 15 00:05:21 2002
7036 clear_bit(PG_uptodate, &mp->page->flags);
7037 clear_bit(PG_error, &mp->page->flags);
7038 set_bit(PG_referenced, &mp->page->flags);
7039 - mp->page->offset = offset;
7040 + mp->page->index = offset;
7041 add_page_to_inode_queue(mapping, mp->page);
7042 __add_page_to_hash_queue(mp->page, page_hash);
7046 if (test_bit(META_absolute, &mp->flag)) {
7047 for (i = 0; i < nbufs; i++)
7048 - b[i] = mp->page->offset + i;
7049 + b[i] = mp->page->index + i;
7057 - rc = xtLookup(ip, mp->page->offset + i,
7058 + rc = xtLookup(ip, mp->page->index + i,
7059 nbufs - i, &xflag, &xaddr, &xlen, 0);
7061 jERROR(1,("__write_metapage: xtLookup failed with rc = %d\n", rc));
7062 diff -Naur linux/fs/reiserfs/dir.c linux-p/fs/reiserfs/dir.c
7063 --- linux/fs/reiserfs/dir.c Tue Jan 15 00:08:15 2002
7064 +++ linux-p/fs/reiserfs/dir.c Tue Jan 15 00:05:44 2002
7066 // user space buffer is swapped out. At that time
7067 // entry can move to somewhere else
7068 memcpy (local_buf, d_name, d_reclen);
7069 - if (filldir (dirent, local_buf, d_reclen, d_off, d_ino) < 0) {
7070 + if (filldir (dirent, local_buf, d_reclen, d_off, d_ino, DT_UNKNOWN) < 0) {
7071 pathrelse (&path_to_entry);
7072 filp->f_pos = next_pos;
7073 if (local_buf != small_buf) {
7074 diff -Naur linux/fs/reiserfs/inode.c linux-p/fs/reiserfs/inode.c
7075 --- linux/fs/reiserfs/inode.c Tue Jan 15 00:08:15 2002
7076 +++ linux-p/fs/reiserfs/inode.c Tue Jan 15 00:05:40 2002
7077 @@ -220,10 +220,10 @@
7078 inode = file->f_dentry->d_inode;
7080 increment_i_read_sync_counter(inode) ;
7081 - if (has_tail (inode) && tail_offset (inode) < page->offset + PAGE_SIZE) {
7082 + if (has_tail (inode) && tail_offset (inode) < page->index + PAGE_SIZE) {
7083 /* there is a tail and it is in this page */
7084 memset ((char *)page_address (page), 0, PAGE_SIZE);
7085 - read_file_tail (inode, page->offset, (char *)page_address (page), PAGE_SIZE);
7086 + read_file_tail (inode, page->index, (char *)page_address (page), PAGE_SIZE);
7087 set_bit (PG_uptodate, &page->flags);
7090 diff -Naur linux/fs/udf/dir.c linux-p/fs/udf/dir.c
7091 --- linux/fs/udf/dir.c Tue Jan 15 00:08:16 2002
7092 +++ linux-p/fs/udf/dir.c Tue Jan 15 00:05:54 2002
7095 if ( filp->f_pos == 0 )
7097 - if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino))
7098 + if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR))
7104 if (!lfi) /* parent directory */
7106 - if (filldir(dirent, "..", 2, filp->f_pos, filp->f_dentry->d_parent->d_inode->i_ino))
7107 + if (filldir(dirent, "..", 2, filp->f_pos, filp->f_dentry->d_parent->d_inode->i_ino, DT_DIR))
7109 if (fibh.sbh != fibh.ebh)
7110 udf_release_data(fibh.ebh);
7113 if ((flen = udf_get_filename(nameptr, fname, lfi)))
7115 - if (filldir(dirent, fname, flen, filp->f_pos, iblock))
7116 + if (filldir(dirent, fname, flen, filp->f_pos, iblock, DT_UNKNOWN))
7118 if (fibh.sbh != fibh.ebh)
7119 udf_release_data(fibh.ebh);