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 /* 204 */
203 + .rept NR_syscalls-204
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 @@ -381,16 +358,3 @@
1339 ext2_discard_prealloc (inode);
1343 -#if BITS_PER_LONG < 64
1345 - * Called when an inode is about to be open.
1346 - * We use this to disallow opening RW large files on 32bit systems.
1348 -static int ext2_open_file (struct inode * inode, struct file * filp)
1350 - if (inode->u.ext2_i.i_high_size && (filp->f_mode & FMODE_WRITE))
1355 diff -Naur linux/fs/ext2/inode.c linux-p/fs/ext2/inode.c
1356 --- linux/fs/ext2/inode.c Sun Mar 25 18:30:58 2001
1357 +++ linux-p/fs/ext2/inode.c Mon Jan 14 23:05:38 2002
1358 @@ -537,15 +537,8 @@
1359 inode->u.ext2_i.i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1361 inode->u.ext2_i.i_dir_acl = 0;
1362 - inode->u.ext2_i.i_high_size =
1363 - le32_to_cpu(raw_inode->i_size_high);
1364 -#if BITS_PER_LONG < 64
1365 - if (raw_inode->i_size_high)
1366 - inode->i_size = (__u32)-1;
1368 - inode->i_size |= ((__u64)le32_to_cpu(raw_inode->i_size_high))
1371 + inode->i_size = ((__u64)(inode->i_size & 0xFFFFFFFFUL)) |
1372 + (((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32);
1374 inode->u.ext2_i.i_block_group = block_group;
1375 inode->u.ext2_i.i_next_alloc_block = 0;
1376 @@ -667,12 +660,7 @@
1377 if (S_ISDIR(inode->i_mode))
1378 raw_inode->i_dir_acl = cpu_to_le32(inode->u.ext2_i.i_dir_acl);
1380 -#if BITS_PER_LONG < 64
1381 - raw_inode->i_size_high =
1382 - cpu_to_le32(inode->u.ext2_i.i_high_size);
1384 raw_inode->i_size_high = cpu_to_le32(inode->i_size >> 32);
1387 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
1388 raw_inode->i_block[0] = cpu_to_le32(kdev_t_to_nr(inode->i_rdev));
1389 @@ -724,22 +712,19 @@
1392 if (iattr->ia_valid & ATTR_SIZE) {
1393 - off_t size = iattr->ia_size;
1394 + loff_t size = iattr->ia_size;
1395 unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
1399 -#if BITS_PER_LONG == 64
1400 if (size > ext2_max_sizes[EXT2_BLOCK_SIZE_BITS(inode->i_sb)])
1403 - if (limit < RLIM_INFINITY && size > limit) {
1404 + if (limit != RLIM_INFINITY && size > limit) {
1405 send_sig(SIGXFSZ, current, 0);
1409 -#if BITS_PER_LONG == 64
1412 struct super_block *sb = inode->i_sb;
1413 struct ext2_super_block *es = sb->u.ext2_sb.s_es;
1414 if (!(es->s_feature_ro_compat &
1416 mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1);
1422 retval = inode_change_ok(inode, iattr);
1423 diff -Naur linux/fs/ext2/truncate.c linux-p/fs/ext2/truncate.c
1424 --- linux/fs/ext2/truncate.c Sun Mar 25 18:30:58 2001
1425 +++ linux-p/fs/ext2/truncate.c Mon Jan 14 23:01:48 2002
1427 * Currently we always hold the inode semaphore during truncate, so
1428 * there's no need to test for changes during the operation.
1430 -#define DIRECT_BLOCK(inode) \
1431 - ((inode->i_size + inode->i_sb->s_blocksize - 1) / \
1432 - inode->i_sb->s_blocksize)
1433 +#define DIRECT_BLOCK(inode) \
1435 + ((inode->i_size + inode->i_sb->s_blocksize - 1) >> \
1436 + inode->i_sb->s_blocksize_bits))
1437 #define INDIRECT_BLOCK(inode,offset) ((int)DIRECT_BLOCK(inode) - offset)
1438 #define DINDIRECT_BLOCK(inode,offset) \
1439 (INDIRECT_BLOCK(inode,offset) / addr_per_block)
1440 diff -Naur linux/fs/fat/dir.c linux-p/fs/fat/dir.c
1441 --- linux/fs/fat/dir.c Sun Mar 25 18:30:59 2001
1442 +++ linux-p/fs/fat/dir.c Mon Jan 14 23:01:48 2002
1444 /* Fake . and .. for the root directory. */
1445 if (inode->i_ino == MSDOS_ROOT_INO) {
1447 - if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO) < 0)
1448 + if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO, DT_DIR) < 0)
1453 if (!long_slots||shortnames) {
1456 - if (filldir(dirent, bufname, i, *furrfu, inum) < 0)
1457 + if (filldir(dirent, bufname, i, *furrfu, inum,
1458 + (de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0)
1463 memcpy(&longname[long_len+1], bufname, i);
1466 - if (filldir(dirent, longname, long_len, *furrfu, inum) < 0)
1467 + if (filldir(dirent, longname, long_len, *furrfu, inum,
1468 + (de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0)
1478 + unsigned int d_type)
1480 struct dirent *d1 = (struct dirent *)buf;
1481 struct dirent *d2 = d1 + 1;
1482 diff -Naur linux/fs/fat/file.c linux-p/fs/fat/file.c
1483 --- linux/fs/fat/file.c Sun Mar 25 18:30:59 2001
1484 +++ linux-p/fs/fat/file.c Mon Jan 14 23:01:48 2002
1486 Each time we process one block in bhlist, we replace
1487 it by a new prefetch block if needed.
1489 - PRINTK (("#### ino %ld pos %ld size %ld count %d\n",inode->i_ino,*ppos,inode->i_size,count));
1490 + PRINTK (("#### ino %ld pos %ld size %ld count %d\n",inode->i_ino,*ppos,(u_long)inode->i_size,count));
1493 We must prefetch complete block, so we must
1497 PRINTK (("count %d ahead %d nblist %d\n",count,read_ahead[MAJOR(inode->i_dev)],pre.nblist));
1498 - while ((left_in_file = inode->i_size - *ppos) > 0
1499 + while ((left_in_file = (u_long)inode->i_size - *ppos) > 0
1501 struct buffer_head *bh = pre.bhlist[pre.nolist];
1505 void fat_truncate(struct inode *inode)
1508 + int cluster_bytes, cluster_shift;
1510 /* Why no return value? Surely the disk could fail... */
1511 if (IS_IMMUTABLE(inode))
1512 @@ -460,8 +460,10 @@
1513 printk("FAT: fat_truncate called though fs is read-only, uhh...\n");
1514 return /* -EROFS */;
1516 - cluster = SECTOR_SIZE*MSDOS_SB(inode->i_sb)->cluster_size;
1517 - (void) fat_free(inode,(inode->i_size+(cluster-1))/cluster);
1518 + cluster_bytes = SECTOR_SIZE * MSDOS_SB(inode->i_sb)->cluster_size;
1519 + cluster_shift = fslog2(cluster_bytes);
1520 + (void) fat_free(inode,
1521 + (inode->i_size+(cluster_bytes-1)) >> cluster_shift);
1522 MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
1523 mark_inode_dirty(inode);
1525 diff -Naur linux/fs/fat/inode.c linux-p/fs/fat/inode.c
1526 --- linux/fs/fat/inode.c Sun Mar 25 18:30:59 2001
1527 +++ linux-p/fs/fat/inode.c Mon Jan 14 23:01:48 2002
1529 sizeof(struct msdos_dir_entry);
1531 inode->i_blksize = MSDOS_SB(sb)->cluster_size* SECTOR_SIZE;
1532 - inode->i_blocks = (inode->i_size+inode->i_blksize-1)/
1533 - inode->i_blksize*MSDOS_SB(sb)->cluster_size;
1534 + inode->i_blocks = (((inode->i_size+inode->i_blksize-1) >>
1535 + fslog2(inode->i_blksize)) *
1536 + MSDOS_SB(sb)->cluster_size);
1537 MSDOS_I(inode)->i_logstart = 0;
1539 MSDOS_I(inode)->i_attrs = 0;
1541 MSDOS_I(inode)->i_attrs = de->attr & ATTR_UNUSED;
1542 /* this is as close to the truth as we can get ... */
1543 inode->i_blksize = MSDOS_SB(sb)->cluster_size*SECTOR_SIZE;
1544 - inode->i_blocks = (inode->i_size+inode->i_blksize-1)/
1545 - inode->i_blksize*MSDOS_SB(sb)->cluster_size;
1546 + inode->i_blocks = (((inode->i_size+inode->i_blksize-1) >>
1547 + fslog2(inode->i_blksize)) *
1548 + MSDOS_SB(sb)->cluster_size);
1549 inode->i_mtime = inode->i_atime =
1550 date_dos2unix(CF_LE_W(de->time),CF_LE_W(de->date));
1552 diff -Naur linux/fs/fcntl.c linux-p/fs/fcntl.c
1553 --- linux/fs/fcntl.c Sun Mar 25 18:30:58 2001
1554 +++ linux-p/fs/fcntl.c Mon Jan 14 23:01:48 2002
1555 @@ -143,17 +143,11 @@
1559 -asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
1561 - struct file * filp;
1562 - long err = -EBADF;
1568 +static long do_fcntl(unsigned int fd, unsigned int cmd,
1569 + unsigned long arg, struct file * filp)
1576 err = dupfd(fd, arg);
1577 @@ -217,11 +211,60 @@
1578 err = sock_fcntl (filp, cmd, arg);
1585 +asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
1587 + struct file * filp;
1588 + long err = -EBADF;
1595 + err = do_fcntl(fd, cmd, arg, filp);
1603 +#if BITS_PER_LONG == 32
1604 +asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg)
1606 + struct file * filp;
1607 + long err = -EBADF;
1616 + err = fcntl_getlk64(fd, (struct flock64 *) arg);
1619 + err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg);
1622 + err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg);
1625 + err = do_fcntl(fd, cmd, arg, filp);
1636 static void send_sigio(struct fown_struct *fown, struct fasync_struct *fa)
1638 diff -Naur linux/fs/hfs/dir_cap.c linux-p/fs/hfs/dir_cap.c
1639 --- linux/fs/hfs/dir_cap.c Sun Mar 25 18:31:02 2001
1640 +++ linux-p/fs/hfs/dir_cap.c Mon Jan 14 23:01:48 2002
1643 if (filp->f_pos == 0) {
1644 /* Entry 0 is for "." */
1645 - if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino)) {
1646 + if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino, DT_DIR)) {
1653 if (filldir(dirent, DOT_DOT->Name,
1654 - DOT_DOT_LEN, 1, ntohl(cnid))) {
1655 + DOT_DOT_LEN, 1, ntohl(cnid), DT_DIR)) {
1660 len = hfs_namein(dir, tmp_name,
1661 &((struct hfs_cat_key *)brec.key)->CName);
1662 if (filldir(dirent, tmp_name, len,
1663 - filp->f_pos, ino)) {
1664 + filp->f_pos, ino, DT_UNKNOWN)) {
1665 hfs_cat_close(entry, &brec);
1669 /* In root dir last-2 entry is for ".rootinfo" */
1670 if (filldir(dirent, DOT_ROOTINFO->Name,
1671 DOT_ROOTINFO_LEN, filp->f_pos,
1672 - ntohl(entry->cnid) | HFS_CAP_FNDR)) {
1673 + ntohl(entry->cnid) | HFS_CAP_FNDR, DT_UNKNOWN)) {
1678 /* In normal dirs last-1 entry is for ".finderinfo" */
1679 if (filldir(dirent, DOT_FINDERINFO->Name,
1680 DOT_FINDERINFO_LEN, filp->f_pos,
1681 - ntohl(entry->cnid) | HFS_CAP_FDIR)) {
1682 + ntohl(entry->cnid) | HFS_CAP_FDIR, DT_UNKNOWN)) {
1687 /* In normal dirs last entry is for ".resource" */
1688 if (filldir(dirent, DOT_RESOURCE->Name,
1689 DOT_RESOURCE_LEN, filp->f_pos,
1690 - ntohl(entry->cnid) | HFS_CAP_RDIR)) {
1691 + ntohl(entry->cnid) | HFS_CAP_RDIR, DT_UNKNOWN)) {
1695 diff -Naur linux/fs/hfs/dir_dbl.c linux-p/fs/hfs/dir_dbl.c
1696 --- linux/fs/hfs/dir_dbl.c Sun Mar 25 18:31:02 2001
1697 +++ linux-p/fs/hfs/dir_dbl.c Mon Jan 14 23:01:48 2002
1700 if (filp->f_pos == 0) {
1701 /* Entry 0 is for "." */
1702 - if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino)) {
1703 + if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino, DT_DIR)) {
1708 if (filp->f_pos == 1) {
1709 /* Entry 1 is for ".." */
1710 if (filldir(dirent, DOT_DOT->Name, DOT_DOT_LEN, 1,
1711 - hfs_get_hl(entry->key.ParID))) {
1712 + hfs_get_hl(entry->key.ParID), DT_DIR)) {
1717 &((struct hfs_cat_key *)brec.key)->CName);
1720 - if (filldir(dirent, tmp_name, len, filp->f_pos, ino)) {
1721 + if (filldir(dirent, tmp_name, len, filp->f_pos, ino, DT_UNKNOWN)) {
1722 hfs_cat_close(entry, &brec);
1726 /* In root dir last entry is for "%RootInfo" */
1727 if (filldir(dirent, PCNT_ROOTINFO->Name,
1728 PCNT_ROOTINFO_LEN, filp->f_pos,
1729 - ntohl(entry->cnid) | HFS_DBL_HDR)) {
1730 + ntohl(entry->cnid) | HFS_DBL_HDR, DT_UNKNOWN)) {
1734 diff -Naur linux/fs/hfs/dir_nat.c linux-p/fs/hfs/dir_nat.c
1735 --- linux/fs/hfs/dir_nat.c Sun Mar 25 18:31:02 2001
1736 +++ linux-p/fs/hfs/dir_nat.c Mon Jan 14 23:01:48 2002
1739 if (filp->f_pos == 0) {
1740 /* Entry 0 is for "." */
1741 - if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino)) {
1742 + if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino, DT_DIR)) {
1749 if (filldir(dirent, DOT_DOT->Name,
1750 - DOT_DOT_LEN, 1, ntohl(cnid))) {
1751 + DOT_DOT_LEN, 1, ntohl(cnid), DT_DIR)) {
1756 len = hfs_namein(dir, tmp_name,
1757 &((struct hfs_cat_key *)brec.key)->CName);
1758 if (filldir(dirent, tmp_name, len,
1759 - filp->f_pos, ino)) {
1760 + filp->f_pos, ino, DT_UNKNOWN)) {
1761 hfs_cat_close(entry, &brec);
1764 @@ -290,14 +290,14 @@
1765 /* In normal dirs entry 2 is for ".AppleDouble" */
1766 if (filldir(dirent, DOT_APPLEDOUBLE->Name,
1767 DOT_APPLEDOUBLE_LEN, filp->f_pos,
1768 - ntohl(entry->cnid) | HFS_NAT_HDIR)) {
1769 + ntohl(entry->cnid) | HFS_NAT_HDIR, DT_UNKNOWN)) {
1772 } else if (type == HFS_NAT_HDIR) {
1773 /* In .AppleDouble entry 2 is for ".Parent" */
1774 if (filldir(dirent, DOT_PARENT->Name,
1775 DOT_PARENT_LEN, filp->f_pos,
1776 - ntohl(entry->cnid) | HFS_NAT_HDR)) {
1777 + ntohl(entry->cnid) | HFS_NAT_HDR, DT_UNKNOWN)) {
1782 (type == HFS_NAT_HDIR)) {
1783 if (filldir(dirent, ROOTINFO->Name,
1784 ROOTINFO_LEN, filp->f_pos,
1785 - ntohl(entry->cnid) | HFS_NAT_HDR)) {
1786 + ntohl(entry->cnid) | HFS_NAT_HDR, DT_UNKNOWN)) {
1790 diff -Naur linux/fs/hpfs/hpfs_fs.c linux-p/fs/hpfs/hpfs_fs.c
1791 --- linux/fs/hpfs/hpfs_fs.c Sun Mar 25 18:30:59 2001
1792 +++ linux-p/fs/hpfs/hpfs_fs.c Mon Jan 14 23:01:48 2002
1793 @@ -1376,13 +1376,13 @@
1797 - if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino) < 0)
1798 + if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0)
1804 - if (filldir(dirent, "..", 2, filp->f_pos, inode->i_hpfs_parent_dir) < 0)
1805 + if (filldir(dirent, "..", 2, filp->f_pos, inode->i_hpfs_parent_dir, DT_DIR) < 0)
1809 @@ -1402,7 +1402,7 @@
1811 ino = file_ino(de->fnode);
1813 - if (filldir(dirent, tempname, namelen, old_pos, ino) < 0) {
1814 + if (filldir(dirent, tempname, namelen, old_pos, ino, DT_UNKNOWN) < 0) {
1815 filp->f_pos = old_pos;
1818 diff -Naur linux/fs/isofs/dir.c linux-p/fs/isofs/dir.c
1819 --- linux/fs/isofs/dir.c Sun Mar 25 18:37:38 2001
1820 +++ linux-p/fs/isofs/dir.c Mon Jan 14 23:01:48 2002
1823 /* Handle the case of the '.' directory */
1824 if (de->name_len[0] == 1 && de->name[0] == 0) {
1825 - if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino) < 0)
1826 + if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0)
1828 filp->f_pos += de_len;
1831 /* Handle the case of the '..' directory */
1832 if (de->name_len[0] == 1 && de->name[0] == 1) {
1833 inode_number = filp->f_dentry->d_parent->d_inode->i_ino;
1834 - if (filldir(dirent, "..", 2, filp->f_pos, inode_number) < 0)
1835 + if (filldir(dirent, "..", 2, filp->f_pos, inode_number, DT_DIR) < 0)
1837 filp->f_pos += de_len;
1843 - if (filldir(dirent, p, len, filp->f_pos, inode_number) < 0)
1844 + if (filldir(dirent, p, len, filp->f_pos, inode_number, DT_UNKNOWN) < 0)
1847 filp->f_pos += de_len;
1848 diff -Naur linux/fs/isofs/inode.c linux-p/fs/isofs/inode.c
1849 --- linux/fs/isofs/inode.c Sun Mar 25 18:37:38 2001
1850 +++ linux-p/fs/isofs/inode.c Mon Jan 14 23:01:48 2002
1853 int isofs_bmap(struct inode * inode,int block)
1855 - off_t b_off, offset, size;
1857 + unsigned offset, size;
1859 unsigned int firstext;
1860 unsigned long nextino;
1865 - b_off = block << ISOFS_BUFFER_BITS(inode);
1866 + b_off = (loff_t)block << ISOFS_BUFFER_BITS(inode);
1869 * If we are beyond the end of this file, don't give out any
1872 if( b_off >= inode->i_size )
1874 - off_t max_legal_read_offset;
1875 + loff_t max_legal_read_offset;
1878 * If we are *way* beyond the end of the file, print a message.
1880 if( b_off >= max_legal_read_offset )
1883 - printk("_isofs_bmap: block>= EOF(%d, %ld)\n", block,
1884 + printk("_isofs_bmap: block>= EOF(%d, %Ld)\n", block,
1888 @@ -1209,7 +1210,7 @@
1891 printk("Get inode %x: %d %d: %d\n",inode->i_ino, block,
1892 - ((int)pnt) & 0x3ff, inode->i_size);
1893 + ((int)pnt) & 0x3ff, (u_long)inode->i_size);
1896 inode->i_mtime = inode->i_atime = inode->i_ctime =
1897 diff -Naur linux/fs/lockd/svclock.c linux-p/fs/lockd/svclock.c
1898 --- linux/fs/lockd/svclock.c Sun Mar 25 18:37:38 2001
1899 +++ linux-p/fs/lockd/svclock.c Mon Jan 14 23:01:48 2002
1900 @@ -100,14 +100,18 @@
1901 struct nlm_block **head, *block;
1902 struct file_lock *fl;
1904 - dprintk("lockd: nlmsvc_lookup_block f=%p pd=%d %ld-%ld ty=%d\n",
1905 - file, lock->fl.fl_pid, lock->fl.fl_start,
1906 - lock->fl.fl_end, lock->fl.fl_type);
1907 + dprintk("lockd: nlmsvc_lookup_block f=%p pd=%d %Ld-%Ld ty=%d\n",
1908 + file, lock->fl.fl_pid,
1909 + (long long)lock->fl.fl_start,
1910 + (long long)lock->fl.fl_end,
1911 + lock->fl.fl_type);
1912 for (head = &nlm_blocked; (block = *head); head = &block->b_next) {
1913 fl = &block->b_call.a_args.lock.fl;
1914 - dprintk("lockd: check f=%p pd=%d %ld-%ld ty=%d cookie=%x\n",
1915 - block->b_file, fl->fl_pid, fl->fl_start,
1916 - fl->fl_end, fl->fl_type,
1917 + dprintk("lockd: check f=%p pd=%d %Ld-%Ld ty=%d cookie=%x\n",
1918 + block->b_file, fl->fl_pid,
1919 + (long long)lock->fl.fl_start,
1920 + (long long)lock->fl.fl_end,
1922 *(u32 *)(&block->b_call.a_args.cookie.data));
1923 if (block->b_file == file && nlm_compare_locks(fl, &lock->fl)) {
1925 @@ -293,12 +297,12 @@
1926 struct inode *inode = file->f_file.f_dentry->d_inode;
1929 - dprintk("lockd: nlmsvc_lock(%04x/%ld, ty=%d, pi=%d, %ld-%ld, bl=%d)\n",
1930 + dprintk("lockd: nlmsvc_lock(%04x/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
1931 file->f_file.f_dentry->d_inode->i_dev,
1932 file->f_file.f_dentry->d_inode->i_ino,
1933 lock->fl.fl_type, lock->fl.fl_pid,
1934 - lock->fl.fl_start,
1936 + (long long)lock->fl.fl_start,
1937 + (long long)lock->fl.fl_end,
1940 /* Checking for read only file system */
1941 @@ -371,16 +375,18 @@
1943 struct file_lock *fl;
1945 - dprintk("lockd: nlmsvc_testlock(%04x/%ld, ty=%d, %ld-%ld)\n",
1946 + dprintk("lockd: nlmsvc_testlock(%04x/%ld, ty=%d, %Ld-%Ld)\n",
1947 file->f_file.f_dentry->d_inode->i_dev,
1948 file->f_file.f_dentry->d_inode->i_ino,
1950 - lock->fl.fl_start,
1952 + (long long)lock->fl.fl_start,
1953 + (long long)lock->fl.fl_end);
1955 if ((fl = posix_test_lock(&file->f_file, &lock->fl)) != NULL) {
1956 - dprintk("lockd: conflicting lock(ty=%d, %ld-%ld)\n",
1957 - fl->fl_type, fl->fl_start, fl->fl_end );
1958 + dprintk("lockd: conflicting lock(ty=%d, %Ld-%Ld)\n",
1960 + (long long)lock->fl.fl_start,
1961 + (long long)lock->fl.fl_end);
1963 conflock->caller = "somehost"; /* FIXME */
1964 conflock->oh.len = 0; /* don't return OH info */
1965 @@ -403,12 +409,12 @@
1969 - dprintk("lockd: nlmsvc_unlock(%04x/%ld, pi=%d, %ld-%ld)\n",
1970 + dprintk("lockd: nlmsvc_unlock(%04x/%ld, pi=%d, %Ld-%Ld)\n",
1971 file->f_file.f_dentry->d_inode->i_dev,
1972 file->f_file.f_dentry->d_inode->i_ino,
1974 - lock->fl.fl_start,
1976 + (long long)lock->fl.fl_start,
1977 + (long long)lock->fl.fl_end);
1979 /* First, cancel any lock that might be there */
1980 nlmsvc_cancel_blocked(file, lock);
1981 @@ -431,12 +437,12 @@
1983 struct nlm_block *block;
1985 - dprintk("lockd: nlmsvc_cancel(%04x/%ld, pi=%d, %ld-%ld)\n",
1986 + dprintk("lockd: nlmsvc_cancel(%04x/%ld, pi=%d, %Ld-%Ld)\n",
1987 file->f_file.f_dentry->d_inode->i_dev,
1988 file->f_file.f_dentry->d_inode->i_ino,
1990 - lock->fl.fl_start,
1992 + (long long)lock->fl.fl_start,
1993 + (long long)lock->fl.fl_end);
1995 down(&file->f_sema);
1996 if ((block = nlmsvc_lookup_block(file, lock, 1)) != NULL)
1997 diff -Naur linux/fs/lockd/xdr.c linux-p/fs/lockd/xdr.c
1998 --- linux/fs/lockd/xdr.c Sun Mar 25 18:30:59 2001
1999 +++ linux-p/fs/lockd/xdr.c Mon Jan 14 23:01:48 2002
2002 #define NLMDBG_FACILITY NLMDBG_XDR
2003 #define NLM_MAXSTRLEN 1024
2004 -#define OFFSET_MAX LONG_MAX
2006 #define QUADLEN(len) (((len) + 3) >> 2)
2009 static void nlm_register_stats(void);
2010 static void nlm_unregister_stats(void);
2012 +static inline loff_t
2013 +s32_to_loff_t(__s32 offset)
2015 + return (loff_t)offset;
2018 +static inline __s32
2019 +loff_t_to_s32(loff_t offset)
2022 + if (offset >= NLM_OFFSET_MAX)
2023 + res = NLM_OFFSET_MAX;
2024 + else if (offset <= -NLM_OFFSET_MAX)
2025 + res = -NLM_OFFSET_MAX;
2032 * Initialization of NFS status variables
2035 nlm_decode_lock(u32 *p, struct nlm_lock *lock)
2037 struct file_lock *fl = &lock->fl;
2039 + s32 start, len, end;
2041 if (!(p = xdr_decode_string(p, &lock->caller, &len, NLM_MAXSTRLEN))
2042 || !(p = nlm_decode_fh(p, &lock->fh))
2043 @@ -169,10 +187,16 @@
2044 fl->fl_pid = ntohl(*p++);
2045 fl->fl_flags = FL_POSIX;
2046 fl->fl_type = F_RDLCK; /* as good as anything else */
2047 - fl->fl_start = ntohl(*p++);
2048 + start = ntohl(*p++);
2050 - if (len == 0 || (fl->fl_end = fl->fl_start + len - 1) < 0)
2051 + end = start + len - 1;
2053 + fl->fl_start = s32_to_loff_t(start);
2055 + if (len == 0 || end < 0)
2056 fl->fl_end = OFFSET_MAX;
2058 + fl->fl_end = s32_to_loff_t(end);
2063 nlm_encode_lock(u32 *p, struct nlm_lock *lock)
2065 struct file_lock *fl = &lock->fl;
2068 if (!(p = xdr_encode_string(p, lock->caller, -1))
2069 || !(p = nlm_encode_fh(p, &lock->fh))
2070 @@ -193,12 +218,15 @@
2071 || (fl->fl_end > NLM_OFFSET_MAX && fl->fl_end != OFFSET_MAX))
2074 - *p++ = htonl(fl->fl_pid);
2075 - *p++ = htonl(fl->fl_start);
2076 + start = loff_t_to_s32(fl->fl_start);
2077 if (fl->fl_end == OFFSET_MAX)
2081 - *p++ = htonl(fl->fl_end - fl->fl_start + 1);
2082 + len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1);
2084 + *p++ = htonl(fl->fl_pid);
2085 + *p++ = htonl(start);
2086 + *p++ = htonl(len);
2092 nlm_encode_testres(u32 *p, struct nlm_res *resp)
2096 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
2098 *p++ = resp->status;
2099 @@ -223,11 +253,14 @@
2100 if (!(p = xdr_encode_netobj(p, &resp->lock.oh)))
2103 - *p++ = htonl(fl->fl_start);
2104 + start = loff_t_to_s32(fl->fl_start);
2105 if (fl->fl_end == OFFSET_MAX)
2109 - *p++ = htonl(fl->fl_end - fl->fl_start + 1);
2110 + len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1);
2112 + *p++ = htonl(start);
2113 + *p++ = htonl(len);
2118 resp->status = ntohl(*p++);
2119 if (resp->status == NLM_LCK_DENIED) {
2120 struct file_lock *fl = &resp->lock.fl;
2123 + s32 start, len, end;
2125 memset(&resp->lock, 0, sizeof(resp->lock));
2127 @@ -456,10 +490,15 @@
2129 fl->fl_flags = FL_POSIX;
2130 fl->fl_type = excl? F_WRLCK : F_RDLCK;
2131 - fl->fl_start = ntohl(*p++);
2132 + start = ntohl(*p++);
2134 - if (len == 0 || (fl->fl_end = fl->fl_start + len - 1) < 0)
2135 + end = start + len - 1;
2137 + fl->fl_start = s32_to_loff_t(start);
2138 + if (len == 0 || end < 0)
2139 fl->fl_end = OFFSET_MAX;
2141 + fl->fl_end = s32_to_loff_t(end);
2145 diff -Naur linux/fs/lockd/xdr4.c linux-p/fs/lockd/xdr4.c
2146 --- linux/fs/lockd/xdr4.c Sun Mar 25 18:30:59 2001
2147 +++ linux-p/fs/lockd/xdr4.c Mon Jan 14 23:01:48 2002
2150 #define NLMDBG_FACILITY NLMDBG_XDR
2151 #define NLM_MAXSTRLEN 1024
2152 -#define OFFSET_MAX ((off_t)LONG_MAX)
2154 #define QUADLEN(len) (((len) + 3) >> 2)
2158 typedef struct nlm_args nlm_args;
2160 -static inline off_t
2161 -size_to_off_t(__s64 size)
2162 +static inline loff_t
2163 +s64_to_loff_t(__s64 offset)
2165 - size = (size > (__s64)LONG_MAX) ? (off_t)LONG_MAX : (off_t) size;
2166 - return (size < (__s64)-LONG_MAX) ? (off_t)-LONG_MAX : (off_t) size;
2167 + return (loff_t)offset;
2171 +loff_t_to_s64(loff_t offset)
2174 + if (offset > NLM4_OFFSET_MAX)
2175 + res = NLM4_OFFSET_MAX;
2176 + else if (offset < -NLM4_OFFSET_MAX)
2177 + res = -NLM4_OFFSET_MAX;
2184 @@ -139,11 +150,12 @@
2185 p = xdr_decode_hyper(p, &len);
2186 end = start + len - 1;
2188 - fl->fl_start = size_to_off_t(start);
2189 - fl->fl_end = size_to_off_t(end);
2190 + fl->fl_start = s64_to_loff_t(start);
2192 - if (len == 0 || fl->fl_end < 0)
2193 + if (len == 0 || end < 0)
2194 fl->fl_end = OFFSET_MAX;
2196 + fl->fl_end = s64_to_loff_t(end);
2200 @@ -154,18 +166,26 @@
2201 nlm4_encode_lock(u32 *p, struct nlm_lock *lock)
2203 struct file_lock *fl = &lock->fl;
2206 if (!(p = xdr_encode_string(p, lock->caller, -1))
2207 || !(p = nlm4_encode_fh(p, &lock->fh))
2208 || !(p = nlm4_encode_oh(p, &lock->oh)))
2211 - *p++ = htonl(fl->fl_pid);
2212 - p = xdr_encode_hyper(p, fl->fl_start);
2213 + if (fl->fl_start > NLM4_OFFSET_MAX
2214 + || (fl->fl_end > NLM4_OFFSET_MAX && fl->fl_end != OFFSET_MAX))
2217 + start = loff_t_to_s64(fl->fl_start);
2218 if (fl->fl_end == OFFSET_MAX)
2219 - p = xdr_encode_hyper(p, 0);
2222 - p = xdr_encode_hyper(p, fl->fl_end - fl->fl_start + 1);
2223 + len = loff_t_to_s64(fl->fl_end - fl->fl_start + 1);
2225 + *p++ = htonl(fl->fl_pid);
2226 + p = xdr_encode_hyper(p, start);
2227 + p = xdr_encode_hyper(p, len);
2233 nlm4_encode_testres(u32 *p, struct nlm_res *resp)
2237 dprintk("xdr: before encode_testres (p %p resp %p)\n", p, resp);
2238 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
2239 @@ -192,14 +213,17 @@
2240 if (!(p = xdr_encode_netobj(p, &resp->lock.oh)))
2243 - p = xdr_encode_hyper(p, fl->fl_start);
2244 + start = loff_t_to_s64(fl->fl_start);
2245 if (fl->fl_end == OFFSET_MAX)
2246 - p = xdr_encode_hyper(p, 0);
2249 - p = xdr_encode_hyper(p, fl->fl_end - fl->fl_start + 1);
2250 - 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);
2253 + len = loff_t_to_s64(fl->fl_end - fl->fl_start + 1);
2255 + p = xdr_encode_hyper(p, start);
2256 + p = xdr_encode_hyper(p, len);
2257 + dprintk("xdr: encode_testres (status %d pid %d type %d start %Ld end %Ld)\n",
2258 + resp->status, fl->fl_pid, fl->fl_type,
2259 + fl->fl_start, fl->fl_end);
2262 dprintk("xdr: after encode_testres (p %p resp %p)\n", p, resp);
2263 @@ -435,10 +459,11 @@
2264 p = xdr_decode_hyper(p, &len);
2265 end = start + len - 1;
2267 - fl->fl_start = size_to_off_t(start);
2268 - fl->fl_end = size_to_off_t(end);
2269 - if (len == 0 || fl->fl_end < 0)
2270 + fl->fl_start = s64_to_loff_t(start);
2271 + if (len == 0 || end < 0)
2272 fl->fl_end = OFFSET_MAX;
2274 + fl->fl_end = s64_to_loff_t(end);
2278 diff -Naur linux/fs/locks.c linux-p/fs/locks.c
2279 --- linux/fs/locks.c Fri Nov 2 17:39:08 2001
2280 +++ linux-p/fs/locks.c Mon Jan 14 23:01:48 2002
2281 @@ -111,12 +111,12 @@
2283 #include <asm/uaccess.h>
2285 -#define OFFSET_MAX ((off_t)LONG_MAX) /* FIXME: move elsewhere? */
2287 static int flock_make_lock(struct file *filp, struct file_lock *fl,
2289 -static int posix_make_lock(struct file *filp, struct file_lock *fl,
2290 +static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
2292 +static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
2293 + struct flock64 *l);
2294 static int flock_locks_conflict(struct file_lock *caller_fl,
2295 struct file_lock *sys_fl);
2296 static int posix_locks_conflict(struct file_lock *caller_fl,
2299 if (waiter->fl_prevblock) {
2300 printk(KERN_ERR "locks_insert_block: remove duplicated lock "
2301 - "(pid=%d %ld-%ld type=%d)\n",
2302 + "(pid=%d %Ld-%Ld type=%d)\n",
2303 waiter->fl_pid, waiter->fl_start,
2304 waiter->fl_end, waiter->fl_type);
2305 locks_delete_block(waiter->fl_prevblock, waiter);
2306 @@ -344,9 +344,10 @@
2307 if (!filp->f_dentry || !filp->f_dentry->d_inode || !filp->f_op)
2310 - if (!posix_make_lock(filp, &file_lock, &flock))
2311 + if ((error = flock_to_posix_lock(filp, &file_lock, &flock)))
2315 if (filp->f_op->lock) {
2316 error = filp->f_op->lock(filp, F_GETLK, &file_lock);
2318 @@ -363,6 +364,18 @@
2319 flock.l_type = F_UNLCK;
2321 flock.l_pid = fl->fl_pid;
2322 +#if BITS_PER_LONG == 32
2324 + * Make sure we can represent the posix lock via
2325 + * legacy 32bit flock.
2327 + error = -EOVERFLOW;
2328 + if (fl->fl_start > OFFT_OFFSET_MAX)
2330 + if ((fl->fl_end != OFFSET_MAX)
2331 + && (fl->fl_end > OFFT_OFFSET_MAX))
2334 flock.l_start = fl->fl_start;
2335 flock.l_len = fl->fl_end == OFFSET_MAX ? 0 :
2336 fl->fl_end - fl->fl_start + 1;
2342 - if (!posix_make_lock(filp, &file_lock, &flock))
2343 + if ((error = flock_to_posix_lock(filp, &file_lock, &flock)))
2347 @@ -475,6 +487,169 @@
2351 +#if BITS_PER_LONG == 32
2352 +/* Report the first existing lock that would conflict with l.
2353 + * This implements the F_GETLK command of fcntl().
2355 +int fcntl_getlk64(unsigned int fd, struct flock64 *l)
2357 + struct file *filp;
2358 + struct file_lock *fl,file_lock;
2359 + struct flock64 flock;
2363 + if (copy_from_user(&flock, l, sizeof(flock)))
2366 + if ((flock.l_type != F_RDLCK) && (flock.l_type != F_WRLCK))
2375 + if (!filp->f_dentry || !filp->f_dentry->d_inode || !filp->f_op)
2378 + if (!flock64_to_posix_lock(filp, &file_lock, &flock))
2381 + if (filp->f_op->lock) {
2382 + error = filp->f_op->lock(filp, F_GETLK, &file_lock);
2385 + else if (error == LOCK_USE_CLNT)
2386 + /* Bypass for NFS with no locking - 2.0.36 compat */
2387 + fl = posix_test_lock(filp, &file_lock);
2389 + fl = (file_lock.fl_type == F_UNLCK ? NULL : &file_lock);
2391 + fl = posix_test_lock(filp, &file_lock);
2394 + flock.l_type = F_UNLCK;
2396 + flock.l_pid = fl->fl_pid;
2397 + flock.l_start = fl->fl_start;
2398 + flock.l_len = fl->fl_end == OFFSET_MAX ? 0 :
2399 + fl->fl_end - fl->fl_start + 1;
2400 + flock.l_whence = 0;
2401 + flock.l_type = fl->fl_type;
2404 + if (!copy_to_user(l, &flock, sizeof(flock)))
2413 +/* Apply the lock described by l to an open file descriptor.
2414 + * This implements both the F_SETLK and F_SETLKW commands of fcntl().
2416 +int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l)
2418 + struct file *filp;
2419 + struct file_lock file_lock;
2420 + struct flock64 flock;
2421 + struct dentry * dentry;
2422 + struct inode *inode;
2426 + * This might block, so we do it before checking the inode.
2429 + if (copy_from_user(&flock, l, sizeof(flock)))
2432 + /* Get arguments and validate them ...
2441 + if (!(dentry = filp->f_dentry))
2443 + if (!(inode = dentry->d_inode))
2448 + /* Don't allow mandatory locks on files that may be memory mapped
2451 + if (IS_MANDLOCK(inode) &&
2452 + (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID &&
2454 + struct vm_area_struct *vma = inode->i_mmap;
2457 + if (vma->vm_flags & VM_MAYSHARE)
2459 + } while ((vma = vma->vm_next_share) != NULL);
2463 + if (!flock64_to_posix_lock(filp, &file_lock, &flock))
2467 + switch (flock.l_type) {
2469 + if (!(filp->f_mode & FMODE_READ))
2473 + if (!(filp->f_mode & FMODE_WRITE))
2481 +/* warn a bit for now, but don't overdo it */
2483 + static int count = 0;
2486 + printk(KERN_WARNING
2487 + "fcntl_setlk() called by process %d (%s) with broken flock() emulation\n",
2488 + current->pid, current->comm);
2491 + if (!(filp->f_mode & 3))
2500 + if (filp->f_op->lock != NULL) {
2501 + error = filp->f_op->lock(filp, cmd, &file_lock);
2505 + error = posix_lock_file(filp, &file_lock, cmd == F_SETLKW64);
2512 +#endif /* BITS_PER_LONG == 32 */
2515 * This function is called when the file is being removed
2516 * from the task's fd array.
2517 @@ -655,10 +830,70 @@
2518 /* Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX
2521 -static int posix_make_lock(struct file *filp, struct file_lock *fl,
2523 +static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
2527 + int ret = -EINVAL;
2529 + memset(fl, 0, sizeof(*fl));
2531 + fl->fl_flags = FL_POSIX;
2533 + switch (l->l_type) {
2537 + fl->fl_type = l->l_type;
2543 + switch (l->l_whence) {
2544 + case 0: /*SEEK_SET*/
2547 + case 1: /*SEEK_CUR*/
2548 + start = filp->f_pos;
2550 + case 2: /*SEEK_END*/
2551 + start = filp->f_dentry->d_inode->i_size;
2557 + if (((start += l->l_start) < 0) || (l->l_len < 0))
2559 + fl->fl_end = start + l->l_len - 1;
2560 + if (l->l_len > 0 && fl->fl_end < 0)
2562 + fl->fl_start = start; /* we record the absolute position */
2563 + if (l->l_len != 0) {
2564 + start = fl->fl_end;
2566 + start = fl->fl_start;
2567 + fl->fl_end = OFFSET_MAX;
2570 + if (start > OFFT_OFFSET_MAX)
2573 + fl->fl_file = filp;
2574 + fl->fl_owner = current->files;
2575 + fl->fl_pid = current->pid;
2582 +#if BITS_PER_LONG == 32
2583 +static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
2584 + struct flock64 *l)
2589 memset(fl, 0, sizeof(*fl));
2597 /* Verify a call to flock() and fill in a file_lock structure with
2598 * an appropriate FLOCK lock.
2599 @@ -1218,7 +1454,7 @@
2600 p += sprintf(p, "FLOCK ADVISORY ");
2602 p += sprintf(p, "%s ", (fl->fl_type == F_RDLCK) ? "READ " : "WRITE");
2603 - p += sprintf(p, "%d %s:%ld %ld %ld ",
2604 + p += sprintf(p, "%d %s:%ld %Ld %Ld ",
2606 kdevname(inode->i_dev), inode->i_ino, fl->fl_start,
2608 @@ -1282,6 +1518,3 @@
2610 return (q - buffer);
2615 diff -Naur linux/fs/minix/dir.c linux-p/fs/minix/dir.c
2616 --- linux/fs/minix/dir.c Sun Mar 25 18:30:58 2001
2617 +++ linux-p/fs/minix/dir.c Mon Jan 14 23:01:48 2002
2619 de = (struct minix_dir_entry *) (offset + bh->b_data);
2621 int size = strnlen(de->name, info->s_namelen);
2622 - if (filldir(dirent, de->name, size, filp->f_pos, de->inode) < 0) {
2623 + if (filldir(dirent, de->name, size, filp->f_pos, de->inode, DT_UNKNOWN) < 0) {
2627 diff -Naur linux/fs/minix/file.c linux-p/fs/minix/file.c
2628 --- linux/fs/minix/file.c Sun Mar 25 18:30:58 2001
2629 +++ linux-p/fs/minix/file.c Mon Jan 14 23:01:48 2002
2631 size_t count, loff_t *ppos)
2633 struct inode * inode = filp->f_dentry->d_inode;
2635 - ssize_t written, c;
2637 + ssize_t written, c, m;
2638 struct buffer_head * bh;
2642 pos = inode->i_size;
2646 + /* L-F-S spec 2.2.1.27: */
2647 + if (!(filp->f_flags & O_LARGEFILE)) {
2648 + if (pos >= 0x7fffffffULL) /* pos@2G forbidden */
2651 + if (pos + count > 0x7fffffffULL)
2652 + /* Write only until end of allowed region */
2653 + count = 0x7fffffffULL - pos;
2655 + /* MINIX i-node file-size can't exceed 4G-1 */
2656 + /* With 1k blocks and triple indirection MINIX can have files
2657 + up to 16 GB in size -- filesystem maximum is then 4G*1k = 4T */
2658 + if (pos >= 0xffffffffULL)
2659 + return -EFBIG; /* Absolutely too much! */
2660 + if ((pos + count) >= 0x100000000ULL) /* too much to write! */
2661 + count = 0xffffffffULL - pos;
2664 while (written < count) {
2665 - bh = minix_getblk(inode,pos/BLOCK_SIZE,1);
2666 + bh = minix_getblk(inode, pos >> BLOCK_SIZE_BITS, 1);
2672 - c = BLOCK_SIZE - (pos % BLOCK_SIZE);
2673 + m = pos & (BLOCK_SIZE - 1);
2674 + c = BLOCK_SIZE - m;
2675 if (c > count-written)
2677 if (c != BLOCK_SIZE && !buffer_uptodate(bh)) {
2682 - p = (pos % BLOCK_SIZE) + bh->b_data;
2683 + p = bh->b_data + m;
2684 c -= copy_from_user(p,buf,c);
2687 diff -Naur linux/fs/ncpfs/dir.c linux-p/fs/ncpfs/dir.c
2688 --- linux/fs/ncpfs/dir.c Sun Mar 25 18:30:59 2001
2689 +++ linux-p/fs/ncpfs/dir.c Mon Jan 14 23:01:48 2002
2690 @@ -449,14 +449,14 @@
2692 if (filp->f_pos == 0) {
2693 ncp_invalid_dir_cache(inode);
2694 - if (filldir(dirent, ".", 1, 0, inode->i_ino) < 0) {
2695 + if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0) {
2700 if (filp->f_pos == 1) {
2701 if (filldir(dirent, "..", 2, 1,
2702 - dentry->d_parent->d_inode->i_ino) < 0) {
2703 + dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) {
2708 ino = ncp_invent_inos(1);
2710 if (filldir(dirent, entry->i.entryName, entry->i.nameLen,
2711 - entry->f_pos, ino) < 0) {
2712 + entry->f_pos, ino, DT_UNKNOWN) < 0) {
2715 if ((inode->i_dev != c_dev)
2716 diff -Naur linux/fs/ncpfs/file.c linux-p/fs/ncpfs/file.c
2717 --- linux/fs/ncpfs/file.c Sun Mar 25 18:30:59 2001
2718 +++ linux-p/fs/ncpfs/file.c Mon Jan 14 23:01:48 2002
2720 #include <linux/mm.h>
2721 #include <linux/locks.h>
2722 #include <linux/malloc.h>
2723 +#include <linux/unistd.h>
2725 #include <linux/ncp_fs.h>
2726 #include "ncplib_kernel.h"
2728 /* First read in as much as possible for each bufsize. */
2729 while (already_read < count) {
2731 - size_t to_read = min(bufsize - (pos % bufsize),
2732 + size_t to_read = min(bufsize - (pos & (bufsize-1)),
2733 count - already_read);
2735 error = ncp_read_bounce(NCP_SERVER(inode),
2737 struct dentry *dentry = file->f_dentry;
2738 struct inode *inode = dentry->d_inode;
2739 size_t already_written = 0;
2745 @@ -238,12 +239,18 @@
2747 already_written = 0;
2749 + /* Maximum file size: 2G-1 */
2750 + if (pos >= 0x7fffffffULL)
2752 + if ((pos + count) >= 0x7fffffffULL)
2753 + count = 0x7fffffffULL - pos;
2755 bouncebuffer = kmalloc(bufsize, GFP_NFS);
2757 return -EIO; /* -ENOMEM */
2758 while (already_written < count) {
2759 int written_this_time;
2760 - size_t to_write = min(bufsize - (pos % bufsize),
2761 + size_t to_write = min(bufsize - (pos & (bufsize-1)),
2762 count - already_written);
2764 if (copy_from_user(bouncebuffer, buf, to_write)) {
2765 diff -Naur linux/fs/ncpfs/inode.c linux-p/fs/ncpfs/inode.c
2766 --- linux/fs/ncpfs/inode.c Sun Mar 25 18:30:59 2001
2767 +++ linux-p/fs/ncpfs/inode.c Mon Jan 14 23:01:48 2002
2770 inode->i_blocks = 0;
2771 if ((inode->i_size)&&(inode->i_blksize)) {
2772 - inode->i_blocks = (inode->i_size-1)/(inode->i_blksize)+1;
2773 + inode->i_blocks = ((inode->i_size-1) >> fslog2(inode->i_blksize)) +1;
2776 inode->i_mtime = ncp_date_dos2unix(le16_to_cpu(nwi->modifyTime),
2779 inode->i_blocks = 0;
2780 if ((inode->i_blksize != 0) && (inode->i_size != 0)) {
2782 - (inode->i_size - 1) / inode->i_blksize + 1;
2783 + inode->i_blocks = ((inode->i_size - 1) >> fslog2(inode->i_blksize)) + 1;
2786 inode->i_mtime = ncp_date_dos2unix(le16_to_cpu(nwi->modifyTime),
2787 diff -Naur linux/fs/nfs/dir.c linux-p/fs/nfs/dir.c
2788 --- linux/fs/nfs/dir.c Fri Nov 2 17:39:08 2001
2789 +++ linux-p/fs/nfs/dir.c Mon Jan 14 23:01:48 2002
2791 int plus = NFS_USE_READDIRPLUS(inode);
2794 - dfprintk(VFS, "NFS: nfs_readdir_filler() reading cookie %Lu into page %lu.\n", (long long)desc->entry->cookie, page->offset);
2795 + dfprintk(VFS, "NFS: nfs_readdir_filler() reading cookie %Lu into page %Lu.\n", (long long)desc->entry->cookie, (long long) nfs_page_offset(page));
2798 error = NFS_PROTO(inode)->readdir(inode, cred,
2800 * Note: assumes we have exclusive access to this inode either
2801 * throught inode->i_sem or some other mechanism.
2803 - if (page->offset == 0)
2804 + if (page_index(page) == 0)
2805 invalidate_inode_pages(inode);
2806 nfs_unlock_page(page);
2809 * retrieving the current dirent on the server */
2810 fileid = nfs_fileid_to_ino_t(entry->ino);
2811 res = filldir(dirent, entry->name, entry->len,
2812 - entry->prev_cookie, fileid);
2813 + entry->prev_cookie, fileid, DT_UNKNOWN);
2816 file->f_pos = desc->target = entry->cookie;
2817 diff -Naur linux/fs/nfs/file.c linux-p/fs/nfs/file.c
2818 --- linux/fs/nfs/file.c Sun Mar 25 18:37:38 2001
2819 +++ linux-p/fs/nfs/file.c Mon Jan 14 23:01:48 2002
2822 static int nfs_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to)
2824 + if (!NFS_PROTO(file->f_dentry->d_inode)->bigfiles &&
2825 + page_index(page) > (0x7fffffff>>PAGE_SHIFT))
2827 return nfs_flush_incompatible(file, page);
2830 @@ -232,10 +235,10 @@
2831 struct inode * inode = dentry->d_inode;
2834 - dprintk("NFS: nfs_lock(f=%4x/%ld, t=%x, fl=%x, r=%ld:%ld)\n",
2835 + dprintk("NFS: nfs_lock(f=%4x/%ld, t=%x, fl=%x, r=%Ld:%Ld)\n",
2836 inode->i_dev, inode->i_ino,
2837 fl->fl_type, fl->fl_flags,
2838 - fl->fl_start, fl->fl_end);
2839 + (long long)fl->fl_start, (long long)fl->fl_end);
2843 diff -Naur linux/fs/nfs/inode.c linux-p/fs/nfs/inode.c
2844 --- linux/fs/nfs/inode.c Fri Nov 2 17:39:08 2001
2845 +++ linux-p/fs/nfs/inode.c Mon Jan 14 23:01:48 2002
2847 * Preset the size and mtime, as there's no need
2848 * to invalidate the caches.
2850 - inode->i_size = nfs_size_to_off_t(fattr->size);
2851 + inode->i_size = nfs_size_to_loff_t(fattr->size);
2852 inode->i_mtime = nfs_time_to_secs(fattr->mtime);
2853 inode->i_atime = nfs_time_to_secs(fattr->atime);
2854 inode->i_ctime = nfs_time_to_secs(fattr->ctime);
2855 @@ -773,6 +773,11 @@
2856 if (!S_ISREG(inode->i_mode))
2857 attr->ia_valid &= ~ATTR_SIZE;
2860 + if ((attr->ia_valid & ATTR_SIZE) && !NFS_PROTO(inode)->bigfiles &&
2861 + attr->ia_size > 0x7fffffff)
2864 error = nfs_wb_all(inode);
2867 @@ -831,6 +836,10 @@
2868 struct rpc_cred *cred = rpcauth_lookupcred(auth, 0);
2870 filp->private_data = cred;
2872 + if (!NFS_PROTO(filp->f_dentry->d_inode)->bigfiles)
2873 + filp->f_flags &= ~O_LARGEFILE;
2880 nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
2882 - off_t new_size, new_isize;
2884 + __u64 new_size, new_mtime;
2891 new_mtime = fattr->mtime;
2892 new_size = fattr->size;
2893 - new_isize = nfs_size_to_off_t(fattr->size);
2894 + new_isize = nfs_size_to_loff_t(fattr->size);
2898 diff -Naur linux/fs/nfs/nfs3proc.c linux-p/fs/nfs/nfs3proc.c
2899 --- linux/fs/nfs/nfs3proc.c Sun Mar 25 18:37:38 2001
2900 +++ linux-p/fs/nfs/nfs3proc.c Mon Jan 14 23:01:48 2002
2903 nfs3_proc_read(struct inode *inode, struct rpc_cred *cred,
2904 struct nfs_fattr *fattr, int flags,
2905 - unsigned long offset, unsigned int count,
2906 + loff_t offset, unsigned int count,
2907 void *buffer, int *eofp)
2909 struct nfs_readargs arg = { NFS_FH(inode), offset, count, 1,
2911 struct rpc_message msg = { NFS3PROC_READ, &arg, &res, cred };
2914 - dprintk("NFS call read %d @ %ld\n", count, offset);
2915 + dprintk("NFS call read %d @ %Ld\n", count, (long long) offset);
2917 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
2918 dprintk("NFS reply read: %d\n", status);
2921 nfs3_proc_write(struct inode *inode, struct rpc_cred *cred,
2922 struct nfs_fattr *fattr, int flags,
2923 - unsigned long offset, unsigned int count,
2924 + loff_t offset, unsigned int count,
2925 void *buffer, struct nfs_writeverf *verf)
2927 struct nfs_writeargs arg = { NFS_FH(inode), offset, count,
2929 struct rpc_message msg = { NFS3PROC_WRITE, &arg, &res, cred };
2930 int status, rpcflags = 0;
2932 - dprintk("NFS call write %d @ %ld\n", count, offset);
2933 + dprintk("NFS call write %d @ %Ld\n", count, (long long) offset);
2935 if (flags & NFS_RW_SWAP)
2936 rpcflags |= NFS_RPC_SWAPFLAGS;
2944 diff -Naur linux/fs/nfs/proc.c linux-p/fs/nfs/proc.c
2945 --- linux/fs/nfs/proc.c Sun Mar 25 18:37:38 2001
2946 +++ linux-p/fs/nfs/proc.c Mon Jan 14 23:01:48 2002
2950 nfs_proc_read(struct inode *inode, struct rpc_cred *cred, fattr *fattr,
2951 - int flags, unsigned long offset, unsigned int count,
2952 + int flags, loff_t offset, unsigned int count,
2953 void *buffer, int *eofp)
2955 struct nfs_readargs arg = { NFS_FH(inode), offset, count, 1,
2957 struct rpc_message msg = { NFSPROC_READ, &arg, &res, cred };
2960 - dprintk("NFS call read %d @ %ld\n", count, offset);
2961 + dprintk("NFS call read %d @ %Ld\n", count, (long long) offset);
2963 status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
2968 nfs_proc_write(struct inode *inode, struct rpc_cred *cred, fattr *fattr,
2969 - int how, unsigned long offset, unsigned int count,
2970 + int how, loff_t offset, unsigned int count,
2971 void *buffer, struct nfs_writeverf *verf)
2973 struct nfs_writeargs arg = {NFS_FH(inode), offset, count,
2975 struct rpc_message msg = { NFSPROC_WRITE, &arg, &res, cred };
2976 int status, flags = 0;
2978 - dprintk("NFS call write %d @ %ld\n", count, offset);
2979 + dprintk("NFS call write %d @ %Ld\n", count, (long long) offset);
2981 if (how & NFS_RW_SWAP)
2982 flags |= NFS_RPC_SWAPFLAGS;
2989 diff -Naur linux/fs/nfs/read.c linux-p/fs/nfs/read.c
2990 --- linux/fs/nfs/read.c Sun Mar 25 18:37:38 2001
2991 +++ linux-p/fs/nfs/read.c Mon Jan 14 23:01:48 2002
2994 struct rpc_cred *cred = NULL;
2995 struct nfs_fattr fattr;
2996 - unsigned long offset = nfs_page_offset(page);
2997 + loff_t offset = nfs_page_offset(page);
2998 char *buffer = (char *) page_address(page);
2999 int rsize = NFS_SERVER(inode)->rsize;
3000 int result, refresh = 0;
3001 @@ -112,10 +112,10 @@
3002 if ((chunk = rsize) > count)
3005 - dprintk("NFS: nfs_proc_read(%s, (%x/%Ld), %ld, %d, %p)\n",
3006 + dprintk("NFS: nfs_proc_read(%s, (%x/%Ld), %Ld, %d, %p)\n",
3007 NFS_SERVER(inode)->hostname,
3008 inode->i_dev, (long long)NFS_FILEID(inode),
3009 - offset, chunk, buffer);
3010 + (long long) offset, chunk, buffer);
3012 result = NFS_PROTO(inode)->read(inode, cred, &fattr, flags,
3013 offset, chunk, buffer, &eof);
3014 @@ -439,11 +439,11 @@
3015 set_bit(PG_error, &page->flags);
3016 nfs_unlock_page(page);
3018 - dprintk("NFS: read (%x/%Ld %d@%ld)\n",
3019 + dprintk("NFS: read (%x/%Ld %d@%Ld)\n",
3020 req->wb_inode->i_dev,
3021 (long long)NFS_FILEID(req->wb_inode),
3023 - (nfs_page_offset(page) + req->wb_offset));
3024 + (long long)(nfs_page_offset(page) + req->wb_offset));
3025 nfs_unlock_request(req);
3026 nfs_release_request(req);
3030 inode = file->f_dentry->d_inode;
3032 - dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
3033 - page, PAGE_CACHE_SIZE, page->offset);
3034 + dprintk("NFS: nfs_readpage (%p %ld@%Lu)\n",
3035 + page, PAGE_CACHE_SIZE, (long long) nfs_page_offset(page));
3038 * Try to flush any pending writes to the file
3039 diff -Naur linux/fs/nfs/write.c linux-p/fs/nfs/write.c
3040 --- linux/fs/nfs/write.c Sun Mar 25 18:37:38 2001
3041 +++ linux-p/fs/nfs/write.c Mon Jan 14 23:01:48 2002
3045 nfs_writepage_sync(struct file *file, struct inode *inode, struct page *page,
3046 - unsigned long offset, unsigned int count)
3047 + unsigned int offset, unsigned int count)
3049 struct rpc_cred *cred = NULL;
3050 unsigned int wsize = NFS_SERVER(inode)->wsize;
3051 @@ -152,16 +152,17 @@
3053 struct nfs_fattr fattr;
3054 struct nfs_writeverf verifier;
3058 cred = nfs_file_cred(file);
3060 - dprintk("NFS: nfs_writepage_sync(%x/%Ld %d@%ld)\n",
3061 + dprintk("NFS: nfs_writepage_sync(%x/%Ld %d@%Ld)\n",
3062 inode->i_dev, (long long)NFS_FILEID(inode),
3063 - count, nfs_page_offset(page) + offset);
3064 + count, (long long) (nfs_page_offset(page) + offset));
3066 buffer = (u8 *) page_address(page) + offset;
3067 - offset += nfs_page_offset(page);
3068 + base = nfs_page_offset(page) + offset;
3070 flags = ((IS_SWAPFILE(inode)) ? NFS_RW_SWAP : 0) | NFS_RW_SYNC;
3075 result = NFS_PROTO(inode)->write(inode, cred, &fattr, flags,
3076 - offset, wsize, buffer,
3077 + base, wsize, buffer,
3079 nfs_write_attributes(inode, &fattr);
3081 @@ -184,15 +185,15 @@
3090 * If we've extended the file, update the inode
3091 * now so we don't invalidate the cache.
3093 - if (offset > inode->i_size)
3094 - inode->i_size = offset;
3095 + if (base > inode->i_size)
3096 + inode->i_size = base;
3101 inode = page->inode;
3103 inode = file->f_dentry->d_inode;
3104 - if (page->offset >= inode->i_size)
3105 + if (nfs_page_offset(page) >= inode->i_size)
3107 - if (page->offset + offset > inode->i_size)
3108 + if (nfs_page_offset(page) + offset > inode->i_size)
3109 offset = inode->i_size & (PAGE_CACHE_SIZE-1);
3110 return nfs_writepage_sync(file, inode, page, 0, offset);
3113 region_locked(struct inode *inode, struct nfs_page *req)
3115 struct file_lock *fl;
3116 - unsigned long rqstart, rqend;
3117 + loff_t rqstart, rqend;
3119 /* Don't optimize writes if we don't use NLM */
3120 if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM)
3122 struct nfs_page *req;
3125 - dprintk("NFS: nfs_updatepage(%s/%s %d@%ld, sync=%d)\n",
3126 + dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld, sync=%d)\n",
3127 dentry->d_parent->d_name.name, dentry->d_name.name,
3128 - count, nfs_page_offset(page)+offset, sync);
3129 + count, (long long) (nfs_page_offset(page)+offset), sync);
3132 * If wsize is smaller than page size, update and write
3135 nfs_release_request(req);
3137 - dprintk("NFS: nfs_updatepage returns %d (isize %ld)\n",
3138 - status, inode->i_size);
3139 + dprintk("NFS: nfs_updatepage returns %d (isize %Ld)\n",
3140 + status, (long long) inode->i_size);
3142 clear_bit(PG_uptodate, &page->flags);
3144 @@ -1193,18 +1194,18 @@
3146 struct nfs_page *req;
3147 struct inode *inode;
3148 - unsigned long start, end, len;
3149 + loff_t start, end, len;
3151 /* Set up the RPC argument and reply structs
3152 * NB: take care not to mess about with data->commit et al. */
3156 + start = NFS_OFFSET_MAX;
3157 req = nfs_list_entry(head->next);
3158 inode = req->wb_inode;
3159 while (!list_empty(head)) {
3160 struct nfs_page *req;
3161 - unsigned long rqstart, rqend;
3162 + loff_t rqstart, rqend;
3163 req = nfs_list_entry(head->next);
3164 nfs_list_remove_request(req);
3165 nfs_list_add_request(req, &data->pages);
3166 @@ -1220,7 +1221,7 @@
3167 data->args.fh = NFS_FH(inode);
3168 data->args.offset = start;
3170 - if (end >= inode->i_size || len > (~((u32)0) >> 1))
3171 + if (end >= inode->i_size || len < 0 || len > (~((u32)0) >> 1))
3173 data->res.count = data->args.count = (u32)len;
3174 data->res.fattr = &data->fattr;
3175 @@ -1298,11 +1299,11 @@
3176 req = nfs_list_entry(data->pages.next);
3177 nfs_list_remove_request(req);
3179 - dprintk("NFS: commit (%x/%Ld %d@%ld)",
3180 + dprintk("NFS: commit (%x/%Ld %d@%Ld)",
3181 req->wb_inode->i_dev,
3182 (long long)NFS_FILEID(req->wb_inode),
3184 - nfs_page_offset(req->wb_page) + req->wb_offset);
3185 + (long long) (nfs_page_offset(req->wb_page) + req->wb_offset));
3186 if (task->tk_status < 0) {
3188 req->wb_file->f_error = task->tk_status;
3189 diff -Naur linux/fs/nfsd/nfs3xdr.c linux-p/fs/nfsd/nfs3xdr.c
3190 --- linux/fs/nfsd/nfs3xdr.c Sun Mar 25 18:37:38 2001
3191 +++ linux-p/fs/nfsd/nfs3xdr.c Mon Jan 14 23:01:48 2002
3193 iap->ia_valid |= ATTR_SIZE;
3194 p = xdr_decode_hyper(p, &newsize);
3195 if (newsize <= NFS_OFFSET_MAX)
3196 - iap->ia_size = (u32) newsize;
3197 + iap->ia_size = newsize;
3199 - iap->ia_size = ~(size_t) 0;
3200 + iap->ia_size = NFS_OFFSET_MAX;
3202 if ((tmp = ntohl(*p++)) == 1) { /* set to server time */
3203 iap->ia_valid |= ATTR_ATIME;
3204 @@ -678,11 +678,6 @@
3209 - dprintk("encode_entry(%.*s @%ld%s)\n",
3210 - namlen, name, (long) offset, plus? " plus" : "");
3213 /* truncate filename if too long */
3214 if (namlen > NFS3_MAXNAMLEN)
3215 namlen = NFS3_MAXNAMLEN;
3216 @@ -727,14 +722,14 @@
3219 nfs3svc_encode_entry(struct readdir_cd *cd, const char *name,
3220 - int namlen, off_t offset, ino_t ino)
3221 + int namlen, off_t offset, ino_t ino, unsigned int d_type)
3223 return encode_entry(cd, name, namlen, offset, ino, 0);
3227 nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name,
3228 - int namlen, off_t offset, ino_t ino)
3229 + int namlen, off_t offset, ino_t ino, unsigned int d_type)
3231 return encode_entry(cd, name, namlen, offset, ino, 1);
3233 diff -Naur linux/fs/nfsd/nfsfh.c linux-p/fs/nfsd/nfsfh.c
3234 --- linux/fs/nfsd/nfsfh.c Mon Jan 14 22:59:25 2002
3235 +++ linux-p/fs/nfsd/nfsfh.c Mon Jan 14 23:01:48 2002
3237 * the name matching the specified inode number.
3239 static int filldir_one(void * __buf, const char * name, int len,
3240 - off_t pos, ino_t ino)
3241 + off_t pos, ino_t ino, unsigned int d_type)
3243 struct nfsd_getdents_callback *buf = __buf;
3244 struct qstr *qs = buf->name;
3245 diff -Naur linux/fs/nfsd/nfssvc.c linux-p/fs/nfsd/nfssvc.c
3246 --- linux/fs/nfsd/nfssvc.c Fri Nov 2 17:39:08 2001
3247 +++ linux-p/fs/nfsd/nfssvc.c Mon Jan 14 23:01:48 2002
3249 current->session = 1;
3251 current->fs->umask = 0;
3252 + current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
3254 /* Count active threads */
3255 atomic_inc(&nfsd_active);
3256 diff -Naur linux/fs/nfsd/nfsxdr.c linux-p/fs/nfsd/nfsxdr.c
3257 --- linux/fs/nfsd/nfsxdr.c Sun Mar 25 18:37:38 2001
3258 +++ linux-p/fs/nfsd/nfsxdr.c Mon Jan 14 23:01:48 2002
3262 nfssvc_encode_entry(struct readdir_cd *cd, const char *name,
3263 - int namlen, off_t offset, ino_t ino)
3264 + int namlen, off_t offset, ino_t ino, unsigned int d_type)
3266 u32 *p = cd->buffer;
3268 diff -Naur linux/fs/nfsd/vfs.c linux-p/fs/nfsd/vfs.c
3269 --- linux/fs/nfsd/vfs.c Sun Mar 25 18:37:38 2001
3270 +++ linux-p/fs/nfsd/vfs.c Mon Jan 14 23:01:48 2002
3271 @@ -513,11 +513,11 @@
3273 filp->f_dentry = dentry;
3274 if (access & MAY_WRITE) {
3275 - filp->f_flags = O_WRONLY;
3276 + filp->f_flags = O_WRONLY | O_LARGEFILE;
3277 filp->f_mode = FMODE_WRITE;
3280 - filp->f_flags = O_RDONLY;
3281 + filp->f_flags = O_RDONLY | O_LARGEFILE;
3282 filp->f_mode = FMODE_READ;
3286 /* Write back readahead params */
3288 dprintk("nfsd: raparms %ld %ld %ld %ld %ld\n",
3289 - file.f_reada, file.f_ramax, file.f_raend,
3290 - file.f_ralen, file.f_rawin);
3291 + (u_long)file.f_reada, (u_long)file.f_ramax,
3292 + (u_long)file.f_raend, (u_long)file.f_ralen,
3293 + (u_long)file.f_rawin);
3294 ra->p_reada = file.f_reada;
3295 ra->p_ramax = file.f_ramax;
3296 ra->p_raend = file.f_raend;
3297 diff -Naur linux/fs/ntfs/fs.c linux-p/fs/ntfs/fs.c
3298 --- linux/fs/ntfs/fs.c Fri Nov 2 17:39:08 2001
3299 +++ linux-p/fs/ntfs/fs.c Mon Jan 14 23:01:48 2002
3301 /* filldir expects an off_t rather than an loff_t.
3302 Hope we don't have more than 65535 index records */
3303 error=nf->filldir(nf->dirent,nf->name,nf->namelen,
3304 - (nf->ph<<16)|nf->pl,inum);
3305 + (nf->ph<<16)|nf->pl,inum,DT_UNKNOWN);
3306 ntfs_free(nf->name);
3307 /* Linux filldir errors are negative, other errors positive */
3309 @@ -226,11 +226,11 @@
3311 /* FIXME: Maybe we can return those with the previous call */
3313 - case 0: filldir(dirent,".",1,filp->f_pos,dir->i_ino);
3314 + case 0: filldir(dirent,".",1,filp->f_pos,dir->i_ino,DT_DIR);
3315 filp->f_pos=0xFFFF0001;
3317 /* FIXME: parent directory */
3318 - case 1: filldir(dirent,"..",2,filp->f_pos,0);
3319 + case 1: filldir(dirent,"..",2,filp->f_pos,0,DT_DIR);
3320 filp->f_pos=0xFFFF0002;
3330 ntfs_debug(DEBUG_OTHER, "ntfs_statfs\n");
3331 @@ -831,16 +832,17 @@
3332 fs.f_type=NTFS_SUPER_MAGIC;
3333 fs.f_bsize=vol->clustersize;
3335 - error = ntfs_get_volumesize( NTFS_SB2VOL( sb ), &fs.f_blocks );
3336 + error = ntfs_get_volumesize( NTFS_SB2VOL( sb ), &size );
3339 + fs.f_blocks = size;
3340 fs.f_bfree=ntfs_get_free_cluster_count(vol->bitmap);
3341 fs.f_bavail=fs.f_bfree;
3343 /* Number of files is limited by free space only, so we lie here */
3345 mft=iget(sb,FILE_MFT);
3346 - fs.f_files=mft->i_size/vol->mft_recordsize;
3347 + fs.f_files = (long)mft->i_size / vol->mft_recordsize;
3350 /* should be read from volume */
3351 diff -Naur linux/fs/ntfs/super.c linux-p/fs/ntfs/super.c
3352 --- linux/fs/ntfs/super.c Sun Mar 25 18:31:02 2001
3353 +++ linux-p/fs/ntfs/super.c Mon Jan 14 23:01:48 2002
3355 * Writes the volume size into vol_size. Returns 0 if successful
3358 -int ntfs_get_volumesize(ntfs_volume *vol, long *vol_size )
3359 +int ntfs_get_volumesize(ntfs_volume *vol, ntfs_u64 *vol_size )
3364 ntfs_getput_clusters(vol,0,0,&io);
3365 size=NTFS_GETU64(cluster0+0x28);
3366 ntfs_free(cluster0);
3367 - /* FIXME: more than 2**32 cluster */
3368 - /* FIXME: gcc will emit udivdi3 if we don't truncate it */
3369 - *vol_size = ((unsigned long)size)/vol->clusterfactor;
3374 diff -Naur linux/fs/ntfs/super.h linux-p/fs/ntfs/super.h
3375 --- linux/fs/ntfs/super.h Sun Mar 25 18:31:02 2001
3376 +++ linux-p/fs/ntfs/super.h Mon Jan 14 23:01:48 2002
3378 #define ALLOC_REQUIRE_SIZE 2
3380 int ntfs_get_free_cluster_count(ntfs_inode *bitmap);
3381 -int ntfs_get_volumesize(ntfs_volume *vol, long *vol_size );
3382 +int ntfs_get_volumesize(ntfs_volume *vol, ntfs_u64 *vol_size );
3383 int ntfs_init_volume(ntfs_volume *vol,char *boot);
3384 int ntfs_load_special_files(ntfs_volume *vol);
3385 int ntfs_release_volume(ntfs_volume *vol);
3386 diff -Naur linux/fs/open.c linux-p/fs/open.c
3387 --- linux/fs/open.c Mon Jan 14 22:59:27 2002
3388 +++ linux-p/fs/open.c Mon Jan 14 23:01:48 2002
3391 #include <asm/uaccess.h>
3393 -asmlinkage int sys_statfs(const char * path, struct statfs * buf)
3394 +asmlinkage long sys_statfs(const char * path, struct statfs * buf)
3396 struct dentry * dentry;
3402 -asmlinkage int sys_fstatfs(unsigned int fd, struct statfs * buf)
3403 +asmlinkage long sys_fstatfs(unsigned int fd, struct statfs * buf)
3406 struct inode * inode;
3411 -int do_truncate(struct dentry *dentry, unsigned long length)
3412 +int do_truncate(struct dentry *dentry, loff_t length)
3414 struct inode *inode = dentry->d_inode;
3416 struct iattr newattrs;
3418 - /* Not pretty: "inode->i_size" shouldn't really be "off_t". But it is. */
3419 - if ((off_t) length < 0)
3421 + /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
3426 fs_down(&inode->i_sem);
3427 newattrs.ia_size = length;
3429 inode->i_op->truncate(inode);
3431 fs_up(&inode->i_sem);
3436 -asmlinkage int sys_truncate(const char * path, unsigned long length)
3437 +static inline long do_sys_truncate(const char * path, loff_t length)
3439 struct dentry * dentry;
3440 struct inode * inode;
3441 @@ -136,7 +138,12 @@
3445 -asmlinkage int sys_ftruncate(unsigned int fd, unsigned long length)
3446 +asmlinkage long sys_truncate(const char * path, unsigned long length)
3448 + return do_sys_truncate(path, length);
3451 +static inline long do_sys_ftruncate(unsigned int fd, loff_t length)
3453 struct inode * inode;
3454 struct dentry *dentry;
3455 @@ -171,6 +178,24 @@
3459 +asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
3461 + return do_sys_ftruncate(fd, length);
3464 +/* LFS versions of truncate are only needed on 32 bit machines */
3465 +#if BITS_PER_LONG == 32
3466 +asmlinkage long sys_truncate64(const char * path, loff_t length)
3468 + return do_sys_truncate(path, length);
3471 +asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
3473 + return do_sys_ftruncate(fd, length);
3481 * must be owner or have write permission.
3482 * Else, update from *times, must be owner or super user.
3484 -asmlinkage int sys_utime(char * filename, struct utimbuf * times)
3485 +asmlinkage long sys_utime(char * filename, struct utimbuf * times)
3488 struct dentry * dentry;
3490 * must be owner or have write permission.
3491 * Else, update from *times, must be owner or super user.
3493 -asmlinkage int sys_utimes(char * filename, struct timeval * utimes)
3494 +asmlinkage long sys_utimes(char * filename, struct timeval * utimes)
3497 struct dentry * dentry;
3499 * We do this by temporarily clearing all FS-related capabilities and
3500 * switching the fsuid/fsgid around to the real ones.
3502 -asmlinkage int sys_access(const char * filename, int mode)
3503 +asmlinkage long sys_access(const char * filename, int mode)
3505 struct dentry * dentry;
3506 int old_fsuid, old_fsgid;
3511 -asmlinkage int sys_chdir(const char * filename)
3512 +asmlinkage long sys_chdir(const char * filename)
3515 struct inode *inode;
3520 -asmlinkage int sys_fchdir(unsigned int fd)
3521 +asmlinkage long sys_fchdir(unsigned int fd)
3524 struct dentry *dentry;
3529 -asmlinkage int sys_chroot(const char * filename)
3530 +asmlinkage long sys_chroot(const char * filename)
3533 struct inode *inode;
3538 -asmlinkage int sys_fchmod(unsigned int fd, mode_t mode)
3539 +asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
3541 struct inode * inode;
3542 struct dentry * dentry;
3547 -asmlinkage int sys_chmod(const char * filename, mode_t mode)
3548 +asmlinkage long sys_chmod(const char * filename, mode_t mode)
3550 struct dentry * dentry;
3551 struct inode * inode;
3556 -asmlinkage int sys_chown(const char * filename, uid_t user, gid_t group)
3557 +asmlinkage long sys_chown(const char * filename, uid_t user, gid_t group)
3559 struct dentry * dentry;
3565 -asmlinkage int sys_lchown(const char * filename, uid_t user, gid_t group)
3566 +asmlinkage long sys_lchown(const char * filename, uid_t user, gid_t group)
3568 struct dentry * dentry;
3574 -asmlinkage int sys_fchown(unsigned int fd, uid_t user, gid_t group)
3575 +asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
3577 struct dentry * dentry;
3580 f = get_empty_filp();
3583 +#if BITS_PER_LONG != 32
3584 + flags |= O_LARGEFILE;
3586 f->f_flags = flag = flags;
3587 f->f_mode = (flag+1) & O_ACCMODE;
3590 * For backward compatibility? Maybe this should be moved
3591 * into arch/i386 instead?
3593 -asmlinkage int sys_creat(const char * pathname, int mode)
3594 +asmlinkage long sys_creat(const char * pathname, int mode)
3596 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
3599 * This routine simulates a hangup on the tty, to arrange that users
3600 * are given clean terminals at login time.
3602 -asmlinkage int sys_vhangup(void)
3603 +asmlinkage long sys_vhangup(void)
3607 diff -Naur linux/fs/proc/array.c linux-p/fs/proc/array.c
3608 --- linux/fs/proc/array.c Mon Jan 14 22:59:27 2002
3609 +++ linux-p/fs/proc/array.c Mon Jan 14 23:01:48 2002
3610 @@ -1157,11 +1157,11 @@
3611 * + (index into the line)
3613 /* for systems with sizeof(void*) == 4: */
3614 -#define MAPS_LINE_FORMAT4 "%08lx-%08lx %s %08lx %s %lu"
3615 -#define MAPS_LINE_MAX4 49 /* sum of 8 1 8 1 4 1 8 1 5 1 10 1 */
3616 +#define MAPS_LINE_FORMAT4 "%08lx-%08lx %s %016Lx %s %lu"
3617 +#define MAPS_LINE_MAX4 57 /* sum of 8 1 8 1 4 1 16 1 5 1 10 1 */
3619 /* for systems with sizeof(void*) == 8: */
3620 -#define MAPS_LINE_FORMAT8 "%016lx-%016lx %s %016lx %s %lu"
3621 +#define MAPS_LINE_FORMAT8 "%016lx-%016lx %s %016Lx %s %lu"
3622 #define MAPS_LINE_MAX8 73 /* sum of 16 1 16 1 4 1 16 1 5 1 10 1 */
3624 #define MAPS_LINE_MAX MAPS_LINE_MAX8
3625 diff -Naur linux/fs/proc/fd.c linux-p/fs/proc/fd.c
3626 --- linux/fs/proc/fd.c Sun Mar 25 18:30:58 2001
3627 +++ linux-p/fs/proc/fd.c Mon Jan 14 23:01:48 2002
3631 ino = (ino & 0xffff0000) | PROC_PID_INO;
3632 - if (filldir(dirent, "..", fd+1, fd, ino) < 0)
3633 + if (filldir(dirent, "..", fd+1, fd, ino, DT_DIR) < 0)
3638 read_unlock(&tasklist_lock);
3640 ino = (pid << 16) + PROC_PID_FD_DIR + fd;
3641 - if (filldir(dirent, buf+j, NUMBUF-j, fd+2, ino) < 0)
3642 + if (filldir(dirent, buf+j, NUMBUF-j, fd+2, ino, DT_LNK) < 0)
3645 read_lock(&tasklist_lock);
3646 diff -Naur linux/fs/proc/openpromfs.c linux-p/fs/proc/openpromfs.c
3647 --- linux/fs/proc/openpromfs.c Sun Mar 25 18:30:58 2001
3648 +++ linux-p/fs/proc/openpromfs.c Mon Jan 14 23:01:48 2002
3649 @@ -846,14 +846,14 @@
3653 - if (filldir(dirent, ".", 1, i, ino) < 0) return 0;
3654 + if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0) return 0;
3659 if (filldir(dirent, "..", 2, i,
3660 (NODE(ino).parent == 0xffff) ?
3661 - PROC_ROOT_INO : NODE2INO(NODE(ino).parent)) < 0)
3662 + PROC_ROOT_INO : NODE2INO(NODE(ino).parent), DT_DIR) < 0)
3666 @@ -869,14 +869,14 @@
3667 if (prom_getname (nodes[node].node, buffer, 128) < 0)
3669 if (filldir(dirent, buffer, strlen(buffer),
3670 - filp->f_pos, NODE2INO(node)) < 0)
3671 + filp->f_pos, NODE2INO(node), DT_DIR) < 0)
3674 node = nodes[node].next;
3676 j = NODEP2INO(NODE(ino).first_prop);
3678 - if (filldir(dirent, ".node", 5, filp->f_pos, j) < 0)
3679 + if (filldir(dirent, ".node", 5, filp->f_pos, j, DT_REG) < 0)
3684 if (alias_names [i]) {
3685 if (filldir (dirent, alias_names [i],
3686 strlen (alias_names [i]),
3687 - filp->f_pos, j) < 0) return 0;
3688 + filp->f_pos, j, DT_REG) < 0) return 0;
3695 if (filldir(dirent, p, strlen(p),
3696 - filp->f_pos, j) < 0)
3697 + filp->f_pos, j, DT_REG) < 0)
3703 if (filldir(dirent, d->name,
3705 - filp->f_pos, d->inode) < 0)
3706 + filp->f_pos, d->inode, d->mode >> 12) < 0)
3710 diff -Naur linux/fs/proc/root.c linux-p/fs/proc/root.c
3711 --- linux/fs/proc/root.c Mon Jan 14 22:59:27 2002
3712 +++ linux-p/fs/proc/root.c Mon Jan 14 23:01:48 2002
3713 @@ -910,13 +910,13 @@
3717 - if (filldir(dirent, ".", 1, i, ino) < 0)
3718 + if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
3724 - if (filldir(dirent, "..", 2, i, de->parent->low_ino) < 0)
3725 + if (filldir(dirent, "..", 2, i, de->parent->low_ino, DT_DIR) < 0)
3733 - if (filldir(dirent, de->name, de->namelen, filp->f_pos, ino | de->low_ino) < 0)
3734 + if (filldir(dirent, de->name, de->namelen, filp->f_pos, ino | de->low_ino, de->mode >> 12) < 0)
3738 @@ -1002,7 +1002,7 @@
3742 - if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino) < 0)
3743 + if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino, DT_DIR) < 0)
3747 diff -Naur linux/fs/qnx4/dir.c linux-p/fs/qnx4/dir.c
3748 --- linux/fs/qnx4/dir.c Sun Mar 25 18:30:59 2001
3749 +++ linux-p/fs/qnx4/dir.c Mon Jan 14 23:01:48 2002
3751 QNX4_INODES_PER_BLOCK +
3754 - if (filldir(dirent, de->di_fname, size, filp->f_pos, ino) < 0) {
3755 + if (filldir(dirent, de->di_fname, size, filp->f_pos, ino, DT_UNKNOWN) < 0) {
3759 diff -Naur linux/fs/read_write.c linux-p/fs/read_write.c
3760 --- linux/fs/read_write.c Sun Mar 25 18:37:38 2001
3761 +++ linux-p/fs/read_write.c Mon Jan 14 23:01:48 2002
3764 asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
3767 + off_t retval, oldpos;
3769 struct dentry * dentry;
3770 struct inode * inode;
3772 if (!(dentry = file->f_dentry) ||
3773 !(inode = dentry->d_inode))
3775 + oldpos = file->f_pos;
3778 retval = llseek(file, offset, origin);
3780 + /* Demand L-F-S compliance only from normal files,
3781 + thus raw devices can do whatever they please.. */
3782 + if (!(file->f_flags & O_LARGEFILE) &&
3783 + retval >= 0 && S_ISREG(inode->i_mode) &&
3784 + file->f_pos > 0x7fffffff) {
3785 + file->f_pos = oldpos;
3786 + retval = -EOVERFLOW;
3793 struct dentry * dentry;
3794 struct inode * inode;
3796 + loff_t offset, oldpos;
3804 + oldpos = file->f_pos;
3805 offset = llseek(file, ((loff_t) offset_high << 32) | offset_low,
3808 @@ -105,6 +116,14 @@
3809 if (!copy_to_user(result, &offset, sizeof(offset)))
3812 + if (!(file->f_flags & O_LARGEFILE) && S_ISREG(inode->i_mode) &&
3813 + file->f_pos > 0x7fffffff) {
3814 + /* The target position isn't presentable without
3815 + O_LARGEFILE flag being set --> yield error, and
3816 + restore the file position. */
3817 + file->f_pos = oldpos;
3818 + retval = -EOVERFLOW;
3826 ssize_t (*read)(struct file *, char *, size_t, loff_t *);
3827 + struct inode * inode;
3831 @@ -342,10 +362,13 @@
3836 + inode = file->f_dentry->d_inode;
3838 if (!(file->f_mode & FMODE_READ))
3840 - ret = locks_verify_area(FLOCK_VERIFY_READ, file->f_dentry->d_inode,
3841 - file, pos, count);
3843 + ret = locks_verify_area(FLOCK_VERIFY_READ, inode, file, pos, count);
3850 ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
3851 + struct inode * inode;
3855 @@ -376,8 +400,10 @@
3857 if (!(file->f_mode & FMODE_WRITE))
3859 - ret = locks_verify_area(FLOCK_VERIFY_WRITE, file->f_dentry->d_inode,
3860 - file, pos, count);
3862 + inode = file->f_dentry->d_inode;
3864 + ret = locks_verify_area(FLOCK_VERIFY_WRITE, inode, file, pos, count);
3872 - fs_down(&file->f_dentry->d_inode->i_sem);
3873 + fs_down(&inode->i_sem);
3874 ret = write(file, buf, count, &pos);
3875 - fs_up(&file->f_dentry->d_inode->i_sem);
3876 + fs_up(&inode->i_sem);
3880 diff -Naur linux/fs/readdir.c linux-p/fs/readdir.c
3881 --- linux/fs/readdir.c Sun Mar 25 18:30:59 2001
3882 +++ linux-p/fs/readdir.c Mon Jan 14 23:01:48 2002
3887 -static int fillonedir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino)
3888 +static int fillonedir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino, unsigned int d_type)
3890 struct readdir_callback * buf = (struct readdir_callback *) __buf;
3891 struct old_linux_dirent * dirent;
3896 -static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino)
3897 +static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino, unsigned int d_type)
3899 struct linux_dirent * dirent;
3900 struct getdents_callback * buf = (struct getdents_callback *) __buf;
3901 @@ -187,6 +187,123 @@
3902 lastdirent = buf.previous;
3904 put_user(file->f_pos, &lastdirent->d_off);
3905 + error = count - buf.count;
3917 + * And even better one including d_type field and 64bit d_ino and d_off.
3919 +struct linux_dirent64 {
3922 + unsigned short d_reclen;
3923 + unsigned char d_type;
3927 +#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
3929 +struct getdents_callback64 {
3930 + struct linux_dirent64 * current_dir;
3931 + struct linux_dirent64 * previous;
3936 +static int filldir64(void * __buf, const char * name, int namlen, off_t offset,
3937 + ino_t ino, unsigned int d_type)
3939 + struct linux_dirent64 * dirent, d;
3940 + struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf;
3941 + int reclen = ROUND_UP64(NAME_OFFSET(dirent) + namlen + 1);
3943 + buf->error = -EINVAL; /* only used if we fail.. */
3944 + if (reclen > buf->count)
3946 + dirent = buf->previous;
3948 +#if BITS_PER_LONG < 64
3950 + copy_to_user(&dirent->d_off, &d.d_off, sizeof(d.d_off));
3952 + put_user(offset, &dirent->d_off);
3955 + dirent = buf->current_dir;
3956 + buf->previous = dirent;
3957 + memset(&d, 0, NAME_OFFSET(&d));
3959 + d.d_reclen = reclen;
3960 + d.d_type = d_type;
3961 + copy_to_user(dirent, &d, NAME_OFFSET(&d));
3962 + copy_to_user(dirent->d_name, name, namlen);
3963 + put_user(0, dirent->d_name + namlen);
3964 + ((char *) dirent) += reclen;
3965 + buf->current_dir = dirent;
3966 + buf->count -= reclen;
3970 +asmlinkage int sys_getdents64(unsigned int fd, void * dirent, unsigned int count)
3972 + struct file * file;
3973 + struct dentry * dentry;
3974 + struct inode * inode;
3975 + struct linux_dirent64 * lastdirent;
3976 + struct getdents_callback64 buf;
3985 + dentry = file->f_dentry;
3989 + inode = dentry->d_inode;
3993 + buf.current_dir = (struct linux_dirent64 *) dirent;
3994 + buf.previous = NULL;
3995 + buf.count = count;
3999 + if (!file->f_op || !file->f_op->readdir)
4004 + * Get the inode's semaphore to prevent changes
4005 + * to the directory while we read it.
4007 + down(&inode->i_sem);
4008 + error = file->f_op->readdir(file, &buf, filldir64);
4009 + up(&inode->i_sem);
4012 + error = buf.error;
4013 + lastdirent = buf.previous;
4015 +#if BITS_PER_LONG < 64
4017 + d_off = file->f_pos;
4018 + copy_to_user(&lastdirent->d_off, &d_off, sizeof(d_off));
4020 + put_user(file->f_pos, &lastdirent->d_off);
4022 error = count - buf.count;
4025 diff -Naur linux/fs/romfs/inode.c linux-p/fs/romfs/inode.c
4026 --- linux/fs/romfs/inode.c Sun Mar 25 18:30:59 2001
4027 +++ linux-p/fs/romfs/inode.c Mon Jan 14 23:01:48 2002
4028 @@ -258,6 +258,10 @@
4032 +static unsigned char romfs_dtype_table[] = {
4033 + DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_SOCK, DT_FIFO
4037 romfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
4040 nextfh = ntohl(ri.next);
4041 if ((nextfh & ROMFH_TYPE) == ROMFH_HRD)
4042 ino = ntohl(ri.spec);
4043 - if (filldir(dirent, fsname, j, offset, ino) < 0) {
4044 + if (filldir(dirent, fsname, j, offset, ino,
4045 + romfs_dtype_table[nextfh & ROMFH_TYPE]) < 0) {
4050 buf = page_address(page);
4051 clear_bit(PG_uptodate, &page->flags);
4052 clear_bit(PG_error, &page->flags);
4053 - offset = page->offset;
4054 + offset = pgoff2loff(page->index);
4055 if (offset < inode->i_size) {
4056 avail = inode->i_size-offset;
4057 readlen = min(avail, PAGE_SIZE);
4058 diff -Naur linux/fs/smbfs/cache.c linux-p/fs/smbfs/cache.c
4059 --- linux/fs/smbfs/cache.c Sun Mar 25 18:30:59 2001
4060 +++ linux-p/fs/smbfs/cache.c Mon Jan 14 23:01:48 2002
4062 struct cache_head * cachep;
4064 VERBOSE("finding cache for %s/%s\n", DENTRY_PATH(dentry));
4065 - cachep = (struct cache_head *) get_cached_page(inode, 0, 1);
4066 + cachep = (struct cache_head *) get_cached_page(inode, ulong2pgoff(0), 1);
4071 PARANOIA("cache %s/%s has existing block!\n",
4072 DENTRY_PATH(dentry));
4074 - offset = PAGE_SIZE + (i << PAGE_SHIFT);
4075 - block = (struct cache_block *) get_cached_page(inode,
4077 + /* byte_offset = PAGE_SIZE + (i << PAGE_SHIFT); */
4078 + /* --> page_offset = 1 + i */
4079 + block = (struct cache_block *)
4080 + get_cached_page(inode, ulong2pgoff(i+1), 0);
4083 index->block = block;
4085 struct inode * inode = get_cache_inode(cachep);
4086 struct cache_index * index;
4087 struct cache_block * block;
4088 - unsigned long page_off;
4090 unsigned int nent, offset, len = entry->len;
4091 unsigned int needed = len + sizeof(struct cache_entry);
4093 @@ -180,14 +181,15 @@
4097 - page_off = PAGE_SIZE + (cachep->idx << PAGE_SHIFT);
4098 + /* page_byte_off = PAGE_SIZE + (cachep->idx << PAGE_SHIFT); */
4099 + page_off = ulong2pgoff(1 + cachep->idx);
4100 block = (struct cache_block *) get_cached_page(inode, page_off, 1);
4103 index->block = block;
4104 index->space = PAGE_SIZE;
4105 VERBOSE("inode=%p, pages=%d, block at %ld\n",
4106 - inode, cachep->pages, page_off);
4107 + inode, cachep->pages, (u_long)pgoff2loff(page_off));
4111 diff -Naur linux/fs/smbfs/dir.c linux-p/fs/smbfs/dir.c
4112 --- linux/fs/smbfs/dir.c Sun Mar 25 18:30:59 2001
4113 +++ linux-p/fs/smbfs/dir.c Mon Jan 14 23:01:48 2002
4115 switch ((unsigned int) filp->f_pos)
4118 - if (filldir(dirent, ".", 1, 0, dir->i_ino) < 0)
4119 + if (filldir(dirent, ".", 1, 0, dir->i_ino, DT_DIR) < 0)
4123 if (filldir(dirent, "..", 2, 1,
4124 - dentry->d_parent->d_inode->i_ino) < 0)
4125 + dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
4132 if (filldir(dirent, entry->name, entry->len,
4133 - filp->f_pos, entry->ino) < 0)
4134 + filp->f_pos, entry->ino, DT_UNKNOWN) < 0)
4138 diff -Naur linux/fs/smbfs/file.c linux-p/fs/smbfs/file.c
4139 --- linux/fs/smbfs/file.c Sun Mar 25 18:30:59 2001
4140 +++ linux-p/fs/smbfs/file.c Mon Jan 14 23:01:48 2002
4142 #include <linux/mm.h>
4143 #include <linux/malloc.h>
4144 #include <linux/pagemap.h>
4145 +#include <linux/unistd.h>
4147 #include <asm/uaccess.h>
4148 #include <asm/system.h>
4150 smb_readpage_sync(struct dentry *dentry, struct page *page)
4152 char *buffer = (char *) page_address(page);
4153 - unsigned long offset = page->offset;
4154 + loff_t loffset = pgoff2loff(page->index);
4155 int rsize = smb_get_rsize(server_from_dentry(dentry));
4156 int count = PAGE_SIZE;
4159 clear_bit(PG_error, &page->flags);
4161 - VERBOSE("file %s/%s, count=%d@%ld, rsize=%d\n",
4162 - DENTRY_PATH(dentry), count, offset, rsize);
4163 + VERBOSE("file %s/%s, count=%d@%Ld, rsize=%d\n",
4164 + DENTRY_PATH(dentry), count, loffset, rsize);
4165 result = smb_open(dentry, SMB_O_RDONLY);
4172 - result = smb_proc_read(dentry, offset, rsize, buffer);
4173 + result = smb_proc_read(dentry, loffset, rsize, buffer);
4179 + loffset += result;
4181 dentry->d_inode->i_atime = CURRENT_TIME;
4183 @@ -113,23 +114,36 @@
4184 * Offset is the data offset within the page.
4187 -smb_writepage_sync(struct dentry *dentry, struct page *page,
4188 +smb_writepage_sync(struct file *file, struct page *page,
4189 unsigned long offset, unsigned int count)
4191 + struct dentry * dentry = file->f_dentry;
4192 struct inode *inode = dentry->d_inode;
4193 u8 *buffer = (u8 *) page_address(page) + offset;
4194 int wsize = smb_get_wsize(server_from_dentry(dentry));
4195 int result, written = 0;
4196 + loff_t loffset = pgoff2loff(page->index) + offset;
4198 + VERBOSE("file %s/%s, count=%d@%Ld, wsize=%d\n",
4199 + DENTRY_PATH(dentry), count, loffset, wsize);
4201 - offset += page->offset;
4202 - VERBOSE("file %s/%s, count=%d@%ld, wsize=%d\n",
4203 - DENTRY_PATH(dentry), count, offset, wsize);
4204 + if (!(file->f_flags & O_LARGEFILE)) {
4205 + if (loffset >= 0x7fffffffULL)
4207 + if (loffset + count > 0x7fffffffULL)
4208 + count = 0x7fffffff - loffset;
4211 + if (loffset >= 0xffffffffULL) /* 4G-1 ??? Or 2G-1 ??? */
4213 + if ((loffset + count) > 0xffffffffULL)
4214 + count = 0xffffffffULL - loffset;
4220 - result = smb_proc_write(dentry, offset, wsize, buffer);
4221 + result = smb_proc_write(dentry, loffset, wsize, buffer);
4224 /* N.B. what if result < wsize?? */
4225 @@ -138,29 +152,27 @@
4226 printk(KERN_DEBUG "short write, wsize=%d, result=%d\n",
4237 * Update the inode now rather than waiting for a refresh.
4239 inode->i_mtime = inode->i_atime = CURRENT_TIME;
4240 - if (offset > inode->i_size)
4241 - inode->i_size = offset;
4242 + if (loffset > inode->i_size)
4243 + inode->i_size = loffset;
4244 inode->u.smbfs_i.cache_valid |= SMB_F_LOCALWRITE;
4246 return written ? written : result;
4250 - * Write a page to the server. This will be used for NFS swapping only
4251 - * (for now), and we currently do this synchronously only.
4252 + * Write a page to the server.
4255 smb_writepage(struct file *file, struct page *page)
4257 - struct dentry *dentry = file->f_dentry;
4260 #ifdef SMBFS_PARANOIA
4263 set_bit(PG_locked, &page->flags);
4264 atomic_inc(&page->count);
4265 - result = smb_writepage_sync(dentry, page, 0, PAGE_SIZE);
4266 + result = smb_writepage_sync(file, page, 0, PAGE_SIZE);
4267 smb_unlock_page(page);
4268 free_page(page_address(page));
4270 @@ -180,10 +192,10 @@
4272 struct dentry *dentry = file->f_dentry;
4274 - DEBUG1("(%s/%s %d@%ld, sync=%d)\n",
4275 - DENTRY_PATH(dentry), count, page->offset+offset, sync);
4276 + DEBUG1("(%s/%s %d@%Ld, sync=%d)\n",
4277 + DENTRY_PATH(dentry), count, pgoff2loff(page->index)+offset, sync);
4279 - return smb_writepage_sync(dentry, page, offset, count);
4280 + return smb_writepage_sync(file, page, offset, count);
4285 struct dentry * dentry = file->f_dentry;
4288 - VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry),
4289 - (unsigned long) count, (unsigned long) *ppos);
4290 + VERBOSE("file %s/%s, count=%lu@%Lu\n", DENTRY_PATH(dentry),
4291 + (unsigned long) count, *ppos);
4293 status = smb_revalidate_inode(dentry);
4296 struct dentry * dentry = file->f_dentry;
4299 - VERBOSE("file %s/%s, count=%lu@%lu, pages=%ld\n", DENTRY_PATH(dentry),
4300 - (unsigned long) count, (unsigned long) *ppos,
4301 + VERBOSE("file %s/%s, count=%lu@%Lu, pages=%ld\n", DENTRY_PATH(dentry),
4302 + (unsigned long) count, *ppos,
4303 dentry->d_inode->i_nrpages);
4305 result = smb_revalidate_inode(dentry);
4309 result = generic_file_write(file, buf, count, ppos);
4310 - VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n",
4311 - (long) file->f_pos, dentry->d_inode->i_size,
4312 + VERBOSE("pos=%Ld, size=%Ld, mtime=%ld, atime=%ld\n",
4313 + file->f_pos, dentry->d_inode->i_size,
4314 dentry->d_inode->i_mtime, dentry->d_inode->i_atime);
4317 diff -Naur linux/fs/smbfs/proc.c linux-p/fs/smbfs/proc.c
4318 --- linux/fs/smbfs/proc.c Fri Nov 2 17:39:08 2001
4319 +++ linux-p/fs/smbfs/proc.c Mon Jan 14 23:01:48 2002
4320 @@ -1084,13 +1084,16 @@
4321 file-id would not be valid after a reconnection. */
4324 -smb_proc_read(struct dentry *dentry, off_t offset, int count, char *data)
4325 +smb_proc_read(struct dentry *dentry, loff_t offset, int count, char *data)
4327 struct smb_sb_info *server = server_from_dentry(dentry);
4328 __u16 returned_count, data_len;
4332 + if (offset > 0xffffffff)
4335 smb_lock_server(server);
4336 smb_setup_header(server, SMBread, 5, 0);
4337 buf = server->packet;
4338 @@ -1133,13 +1136,16 @@
4342 -smb_proc_write(struct dentry *dentry, off_t offset, int count, const char *data)
4343 +smb_proc_write(struct dentry *dentry, loff_t offset, int count, const char *data)
4345 struct smb_sb_info *server = server_from_dentry(dentry);
4349 - VERBOSE("file %s/%s, count=%d@%ld, packet_size=%d\n",
4350 + if (offset > 0xffffffff)
4353 + VERBOSE("file %s/%s, count=%d@%Ld, packet_size=%d\n",
4354 DENTRY_PATH(dentry), count, offset, server->packet_size);
4356 smb_lock_server(server);
4357 diff -Naur linux/fs/stat.c linux-p/fs/stat.c
4358 --- linux/fs/stat.c Sun Mar 25 18:30:58 2001
4359 +++ linux-p/fs/stat.c Mon Jan 14 23:01:48 2002
4361 tmp.st_uid = inode->i_uid;
4362 tmp.st_gid = inode->i_gid;
4363 tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
4364 +#if BITS_PER_LONG == 32
4365 + if (inode->i_size > 0x7fffffff)
4366 + return -EOVERFLOW;
4368 tmp.st_size = inode->i_size;
4369 tmp.st_atime = inode->i_atime;
4370 tmp.st_mtime = inode->i_mtime;
4372 tmp.st_uid = inode->i_uid;
4373 tmp.st_gid = inode->i_gid;
4374 tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
4375 +#if BITS_PER_LONG == 32
4376 + if (inode->i_size > 0x7fffffff)
4377 + return -EOVERFLOW;
4379 tmp.st_size = inode->i_size;
4380 tmp.st_atime = inode->i_atime;
4381 tmp.st_mtime = inode->i_mtime;
4382 @@ -280,3 +288,127 @@
4388 +/* ---------- LFS-64 ----------- */
4389 +#if !defined(__alpha__)
4391 +static long cp_new_stat64(struct inode * inode, struct stat64 * statbuf)
4393 + struct stat64 tmp;
4394 + unsigned int blocks, indirect;
4396 + memset(&tmp, 0, sizeof(tmp));
4397 + tmp.st_dev = kdev_t_to_nr(inode->i_dev);
4398 + tmp.st_ino = inode->i_ino;
4399 +#ifdef STAT64_HAS_BROKEN_ST_INO
4400 + tmp.__st_ino = inode->i_ino;
4402 + tmp.st_mode = inode->i_mode;
4403 + tmp.st_nlink = inode->i_nlink;
4404 + tmp.st_uid = inode->i_uid;
4405 + tmp.st_gid = inode->i_gid;
4406 + tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
4407 + tmp.st_atime = inode->i_atime;
4408 + tmp.st_mtime = inode->i_mtime;
4409 + tmp.st_ctime = inode->i_ctime;
4410 + tmp.st_size = inode->i_size;
4412 + * st_blocks and st_blksize are approximated with a simple algorithm if
4413 + * they aren't supported directly by the filesystem. The minix and msdos
4414 + * filesystems don't keep track of blocks, so they would either have to
4415 + * be counted explicitly (by delving into the file itself), or by using
4416 + * this simple algorithm to get a reasonable (although not 100% accurate)
4421 + * Use minix fs values for the number of direct and indirect blocks. The
4422 + * count is now exact for the minix fs except that it counts zero blocks.
4423 + * Everything is in units of BLOCK_SIZE until the assignment to
4427 +#define I_B (BLOCK_SIZE / sizeof(unsigned short))
4429 + if (!inode->i_blksize) {
4430 + blocks = (tmp.st_size + BLOCK_SIZE - 1) >> BLOCK_SIZE_BITS;
4431 + if (blocks > D_B) {
4432 + indirect = (blocks - D_B + I_B - 1) / I_B;
4433 + blocks += indirect;
4434 + if (indirect > 1) {
4435 + indirect = (indirect - 1 + I_B - 1) / I_B;
4436 + blocks += indirect;
4441 + tmp.st_blocks = (BLOCK_SIZE / 512) * blocks;
4442 + tmp.st_blksize = BLOCK_SIZE;
4444 + tmp.st_blocks = inode->i_blocks;
4445 + tmp.st_blksize = inode->i_blksize;
4447 + return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
4450 +asmlinkage long sys_stat64(char * filename, struct stat64 * statbuf, long flags)
4452 + struct dentry * dentry;
4456 + dentry = namei(filename);
4458 + error = PTR_ERR(dentry);
4459 + if (!IS_ERR(dentry)) {
4460 + error = do_revalidate(dentry);
4462 + error = cp_new_stat64(dentry->d_inode, statbuf);
4470 +asmlinkage long sys_lstat64(char * filename, struct stat64 * statbuf, long flags)
4472 + struct dentry * dentry;
4476 + dentry = lnamei(filename);
4478 + error = PTR_ERR(dentry);
4479 + if (!IS_ERR(dentry)) {
4480 + error = do_revalidate(dentry);
4482 + error = cp_new_stat64(dentry->d_inode, statbuf);
4490 +asmlinkage long sys_fstat64(unsigned long fd, struct stat64 * statbuf, long flags)
4498 + struct dentry * dentry = f->f_dentry;
4500 + err = do_revalidate(dentry);
4502 + err = cp_new_stat64(dentry->d_inode, statbuf);
4509 +#endif /* LFS-64 */
4510 diff -Naur linux/fs/sysv/dir.c linux-p/fs/sysv/dir.c
4511 --- linux/fs/sysv/dir.c Sun Mar 25 18:30:59 2001
4512 +++ linux-p/fs/sysv/dir.c Mon Jan 14 23:01:48 2002
4514 inode->i_ino, (off_t) filp->f_pos, sde.inode);
4516 i = strnlen(sde.name, SYSV_NAMELEN);
4517 - if (filldir(dirent, sde.name, i, filp->f_pos, sde.inode) < 0) {
4518 + if (filldir(dirent, sde.name, i, filp->f_pos, sde.inode, DT_UNKNOWN) < 0) {
4522 diff -Naur linux/fs/sysv/file.c linux-p/fs/sysv/file.c
4523 --- linux/fs/sysv/file.c Sun Mar 25 18:30:59 2001
4524 +++ linux-p/fs/sysv/file.c Mon Jan 14 23:01:48 2002
4527 struct inode * inode = filp->f_dentry->d_inode;
4528 struct super_block * sb = inode->i_sb;
4532 struct buffer_head * bh;
4534 @@ -232,6 +232,21 @@
4539 + /* L-F-S spec 2.2.1.27: */
4540 + if (!(filp->f_flags & O_LARGEFILE)) {
4541 + if (pos >= 0x7fffffffULL) /* pos@2G forbidden */
4544 + if (pos + count > 0x7fffffffULL)
4545 + /* Write only until end of allowed region */
4546 + count = 0x7fffffffULL - pos;
4548 + if (pos >= 0xffffffffULL)
4549 + return -EFBIG; /* Only up to 4G-1! */
4550 + if ((pos + count) > 0xffffffffULL)
4551 + count = 0xffffffffULL - pos;
4553 while (written<count) {
4554 bh = sysv_getblk (inode, pos >> sb->sv_block_size_bits, 1);
4556 diff -Naur linux/fs/ufs/balloc.c linux-p/fs/ufs/balloc.c
4557 --- linux/fs/ufs/balloc.c Sun Mar 25 18:30:59 2001
4558 +++ linux-p/fs/ufs/balloc.c Mon Jan 14 23:01:48 2002
4560 struct ufs_sb_private_info * uspi;
4561 struct ufs_super_block_first * usb1;
4562 struct ufs_cylinder_group * ucg;
4563 - unsigned start, length, location, result;
4564 - unsigned possition, fragsize, blockmap, mask;
4566 + unsigned int start, length, location, result;
4567 + unsigned int possition, fragsize, blockmap, mask;
4568 + unsigned int swab;
4570 UFSD(("ENTER, cg %u, goal %u, count %u\n", ucpi->c_cgx, goal, count))
4574 start = ucpi->c_frotor >> 3;
4576 - length = howmany(uspi->s_fpg, 8) - start;
4577 + length = ((uspi->s_fpg + 7) >> 3) - start;
4578 location = ubh_scanc(UCPI_UBH, ucpi->c_freeoff + start, length,
4579 (uspi->s_fpb == 8) ? ufs_fragtable_8fpb : ufs_fragtable_other,
4580 1 << (count - 1 + (uspi->s_fpb & 7)));
4581 diff -Naur linux/fs/ufs/dir.c linux-p/fs/ufs/dir.c
4582 --- linux/fs/ufs/dir.c Sun Mar 25 18:30:59 2001
4583 +++ linux-p/fs/ufs/dir.c Mon Jan 14 23:01:48 2002
4586 #include <linux/fs.h>
4587 #include <linux/ufs_fs.h>
4588 +#include <linux/unistd.h>
4592 @@ -124,11 +125,14 @@
4593 * not the directory has been modified
4594 * during the copy operation. */
4595 unsigned long version = inode->i_version;
4596 + unsigned char d_type = DT_UNKNOWN;
4598 UFSD(("filldir(%s,%u)\n", de->d_name, SWAB32(de->d_ino)))
4599 UFSD(("namlen %u\n", ufs_get_de_namlen(de)))
4600 + if ((flags & UFS_DE_MASK) == UFS_DE_44BSD)
4601 + d_type = de->d_u.d_44.d_type;
4602 error = filldir(dirent, de->d_name, ufs_get_de_namlen(de),
4603 - filp->f_pos, SWAB32(de->d_ino));
4604 + filp->f_pos, SWAB32(de->d_ino), d_type);
4607 if (version != inode->i_version)
4609 error_msg = "inode out of bounds";
4611 if (error_msg != NULL)
4612 - ufs_error (sb, function, "bad entry in directory #%lu, size %lu: %s - "
4613 + ufs_error (sb, function, "bad entry in directory #%lu, size %Lu: %s - "
4614 "offset=%lu, inode=%lu, reclen=%d, namlen=%d",
4615 dir->i_ino, dir->i_size, error_msg, offset,
4616 (unsigned long) SWAB32(de->d_ino),
4617 diff -Naur linux/fs/ufs/file.c linux-p/fs/ufs/file.c
4618 --- linux/fs/ufs/file.c Sun Mar 25 18:30:59 2001
4619 +++ linux-p/fs/ufs/file.c Mon Jan 14 23:01:48 2002
4623 struct inode * inode = filp->f_dentry->d_inode;
4629 @@ -177,11 +177,14 @@
4633 - /* Check for overflow.. */
4634 - if (pos > (__u32) (pos + count)) {
4635 - count = ~pos; /* == 0xFFFFFFFF - pos */
4637 + /* L-F-S spec 2.2.1.27: */
4638 + if (!(filp->f_flags & O_LARGEFILE)) {
4639 + if (pos >= 0x7fffffffULL) /* pos@2G forbidden */
4642 + if (pos + count > 0x7fffffffULL)
4643 + /* Write only until end of allowed region */
4644 + count = 0x7fffffffULL - pos;
4648 diff -Naur linux/fs/ufs/inode.c linux-p/fs/ufs/inode.c
4649 --- linux/fs/ufs/inode.c Sun Mar 25 18:30:59 2001
4650 +++ linux-p/fs/ufs/inode.c Mon Jan 14 23:01:48 2002
4653 unsigned swab = inode->i_sb->u.ufs_sb.s_swab;
4654 printk("ino %lu mode 0%6.6o nlink %d uid %d uid32 %u"
4655 - " gid %d gid32 %u size %lu blocks %lu\n",
4656 + " gid %d gid32 %u size %Lu blocks %lu\n",
4657 inode->i_ino, inode->i_mode, inode->i_nlink,
4658 inode->i_uid, inode->u.ufs_i.i_uid, inode->i_gid,
4659 inode->u.ufs_i.i_gid, inode->i_size, inode->i_blocks);
4660 @@ -213,13 +213,14 @@
4663 limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
4664 - if (limit < RLIM_INFINITY) {
4665 + if (limit != RLIM_INFINITY) {
4666 limit >>= sb->s_blocksize_bits;
4667 if (new_fragment >= limit) {
4668 send_sig(SIGXFSZ, current, 0);
4673 lastblock = ufs_fragstoblks (lastfrag);
4674 lastblockoff = ufs_fragnum (lastfrag);
4680 - if (!create || new_fragment >= (current->rlim[RLIMIT_FSIZE].rlim_cur >> sb->s_blocksize)) {
4681 + if (!create || (current->rlim[RLIMIT_FSIZE].rlim_cur != RLIM_INFINITY &&
4682 + new_fragment >= (current->rlim[RLIMIT_FSIZE].rlim_cur >> sb->s_blocksize))) {
4686 @@ -497,13 +499,10 @@
4690 - * Linux i_size can be 32 on some architectures. We will mark
4691 - * big files as read only and let user access first 32 bits.
4692 + * Linux i_size used to be 32 bits on some architectures.
4693 + * These days we allow access to the entire file as is..
4695 - inode->u.ufs_i.i_size = SWAB64(ufs_inode->ui_size);
4696 - inode->i_size = (off_t) inode->u.ufs_i.i_size;
4697 - if (sizeof(off_t) == 4 && (inode->u.ufs_i.i_size >> 32))
4698 - inode->i_size = (__u32)-1;
4699 + inode->i_size = SWAB64(ufs_inode->ui_size);
4701 inode->i_atime = SWAB32(ufs_inode->ui_atime.tv_sec);
4702 inode->i_ctime = SWAB32(ufs_inode->ui_ctime.tv_sec);
4704 inode->u.ufs_i.i_gen = SWAB32(ufs_inode->ui_gen);
4705 inode->u.ufs_i.i_shadow = SWAB32(ufs_inode->ui_u3.ui_sun.ui_shadow);
4706 inode->u.ufs_i.i_oeftflag = SWAB32(ufs_inode->ui_u3.ui_sun.ui_oeftflag);
4707 - inode->u.ufs_i.i_lastfrag = howmany (inode->i_size, uspi->s_fsize);
4708 + inode->u.ufs_i.i_lastfrag = (inode->i_size + uspi->s_fsize -1) >> uspi->s_fshift;
4710 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
4711 inode->i_rdev = to_kdev_t(SWAB32(ufs_inode->ui_u2.ui_addr.ui_db[0]));
4712 diff -Naur linux/fs/ufs/super.c linux-p/fs/ufs/super.c
4713 --- linux/fs/ufs/super.c Sun Mar 25 18:30:59 2001
4714 +++ linux-p/fs/ufs/super.c Mon Jan 14 23:01:48 2002
4718 size = uspi->s_cssize;
4719 - blks = howmany(size, uspi->s_fsize);
4720 + blks = (size + uspi->s_fsize-1) >> uspi->s_fshift;
4721 base = space = kmalloc(size, GFP_KERNEL);
4725 uspi = sb->u.ufs_sb.s_uspi;
4727 size = uspi->s_cssize;
4728 - blks = howmany(size, uspi->s_fsize);
4729 + blks = (size + uspi->s_fsize-1) >> uspi->s_fshift;
4730 base = space = (char*) sb->u.ufs_sb.s_csp[0];
4731 for (i = 0; i < blks; i += uspi->s_fpb) {
4732 size = uspi->s_bsize;
4733 diff -Naur linux/fs/ufs/truncate.c linux-p/fs/ufs/truncate.c
4734 --- linux/fs/ufs/truncate.c Sun Mar 25 18:30:59 2001
4735 +++ linux-p/fs/ufs/truncate.c Mon Jan 14 23:01:48 2002
4740 -#define DIRECT_BLOCK howmany (inode->i_size, uspi->s_bsize)
4741 -#define DIRECT_FRAGMENT howmany (inode->i_size, uspi->s_fsize)
4742 +#define DIRECT_BLOCK ((inode->i_size + uspi->s_bsize -1) >> uspi->s_bshift)
4743 +#define DIRECT_FRAGMENT ((inode->i_size + uspi->s_fsize -1) >> uspi->s_fshift)
4745 static int ufs_trunc_direct (struct inode * inode)
4751 -static int ufs_trunc_indirect (struct inode * inode, unsigned offset, u32 * p)
4752 +static int ufs_trunc_indirect (struct inode * inode, u_long offset, u32 * p)
4754 struct super_block * sb;
4755 struct ufs_sb_private_info * uspi;
4757 struct super_block * sb;
4758 struct ufs_sb_private_info * uspi;
4759 struct ufs_buffer_head * dind_bh;
4760 - unsigned i, tmp, dindirect_block;
4761 + unsigned int i, tmp, dindirect_block;
4766 swab = sb->u.ufs_sb.s_swab;
4767 uspi = sb->u.ufs_sb.s_uspi;
4769 - dindirect_block = (DIRECT_BLOCK > offset)
4770 - ? ((DIRECT_BLOCK - offset) / uspi->s_apb) : 0;
4771 + dindirect_block = ((DIRECT_BLOCK > offset) ?
4772 + ((DIRECT_BLOCK - offset) >> uspi->s_apbshift) : 0);
4779 tindirect_block = (DIRECT_BLOCK > (UFS_NDADDR + uspi->s_apb + uspi->s_2apb))
4780 - ? ((DIRECT_BLOCK - UFS_NDADDR - uspi->s_apb - uspi->s_2apb) / uspi->s_2apb) : 0;
4781 + ? ((DIRECT_BLOCK - UFS_NDADDR - uspi->s_apb - uspi->s_2apb) >> uspi->s_2apbshift) : 0;
4782 p = inode->u.ufs_i.i_u1.i_data + UFS_TIND_BLOCK;
4783 if (!(tmp = SWAB32(*p)))
4788 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
4789 - inode->u.ufs_i.i_lastfrag = howmany (inode->i_size, uspi->s_fsize);
4790 + inode->u.ufs_i.i_lastfrag =
4791 + (inode->i_size + uspi->s_fsize -1) >> uspi->s_fshift;
4792 mark_inode_dirty(inode);
4795 diff -Naur linux/fs/ufs/util.h linux-p/fs/ufs/util.h
4796 --- linux/fs/ufs/util.h Sun Mar 25 18:30:59 2001
4797 +++ linux-p/fs/ufs/util.h Mon Jan 14 23:01:48 2002
4799 * some useful macros
4801 #define in_range(b,first,len) ((b)>=(first)&&(b)<(first)+(len))
4802 -#define howmany(x,y) (((x)+(y)-1)/(y))
4803 #define min(x,y) ((x)<(y)?(x):(y))
4804 #define max(x,y) ((x)>(y)?(x):(y))
4806 diff -Naur linux/fs/umsdos/dir.c linux-p/fs/umsdos/dir.c
4807 --- linux/fs/umsdos/dir.c Sun Mar 25 18:30:59 2001
4808 +++ linux-p/fs/umsdos/dir.c Mon Jan 14 23:01:48 2002
4810 if (d->count == 0) {
4811 PRINTK ((KERN_DEBUG "dir_once :%.*s: offset %Ld\n",
4812 len, name, offset));
4813 - ret = d->filldir (d->dirbuf, name, len, offset, ino);
4814 + ret = d->filldir (d->dirbuf, name, len, offset, ino, DT_UNKNOWN);
4820 Printk ((KERN_WARNING "umsdos_readdir_x: pseudo_root thing UMSDOS_SPECIAL_DIRFPOS\n"));
4821 if (filldir (dirbuf, "DOS", 3,
4822 - UMSDOS_SPECIAL_DIRFPOS, UMSDOS_ROOT_INO) == 0) {
4823 + UMSDOS_SPECIAL_DIRFPOS, UMSDOS_ROOT_INO, DT_DIR) == 0) {
4828 if (inode != pseudo_root &&
4829 (internal_read || !(entry.flags & UMSDOS_HIDDEN))) {
4830 if (filldir (dirbuf, entry.name, entry.name_len,
4831 - cur_f_pos, inode->i_ino) < 0) {
4832 + cur_f_pos, inode->i_ino, DT_UNKNOWN) < 0) {
4833 new_filp.f_pos = cur_f_pos;
4835 Printk(("umsdos_readdir_x: got %s/%s, ino=%ld\n",
4836 diff -Naur linux/fs/umsdos/rdir.c linux-p/fs/umsdos/rdir.c
4837 --- linux/fs/umsdos/rdir.c Sun Mar 25 18:30:59 2001
4838 +++ linux-p/fs/umsdos/rdir.c Mon Jan 14 23:01:48 2002
4845 + unsigned int d_type)
4848 struct RDIR_FILLDIR *d = (struct RDIR_FILLDIR *) buf;
4850 /* Make sure the .. entry points back to the pseudo_root */
4851 ino = pseudo_root->i_ino;
4853 - ret = d->filldir (d->dirbuf, name, name_len, offset, ino);
4854 + ret = d->filldir (d->dirbuf, name, name_len, offset, ino, DT_UNKNOWN);
4857 /* Any DOS directory */
4858 - ret = d->filldir (d->dirbuf, name, name_len, offset, ino);
4859 + ret = d->filldir (d->dirbuf, name, name_len, offset, ino, DT_UNKNOWN);
4863 diff -Naur linux/include/asm-alpha/fcntl.h linux-p/include/asm-alpha/fcntl.h
4864 --- linux/include/asm-alpha/fcntl.h Sun Mar 25 18:31:06 2001
4865 +++ linux-p/include/asm-alpha/fcntl.h Mon Jan 14 23:01:48 2002
4867 #define O_DIRECT 040000 /* direct disk access - should check with OSF/1 */
4868 #define O_DIRECTORY 0100000 /* must be a directory */
4869 #define O_NOFOLLOW 0200000 /* don't follow links */
4870 +#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */
4872 #define F_DUPFD 0 /* dup */
4873 #define F_GETFD 1 /* get f_flags */
4875 __kernel_off_t l_len;
4876 __kernel_pid_t l_pid;
4880 +#define flock64 flock
4884 diff -Naur linux/include/asm-alpha/unistd.h linux-p/include/asm-alpha/unistd.h
4885 --- linux/include/asm-alpha/unistd.h Sun Mar 25 18:31:06 2001
4886 +++ linux-p/include/asm-alpha/unistd.h Mon Jan 14 23:01:48 2002
4888 #define __NR_pivot_root 374 /* implemented in 2.3 */
4889 #define __NR_mincore 375 /* implemented in 2.3 */
4890 #define __NR_pciconfig_iobase 376
4891 +#define __NR_getdents64 377
4893 #if defined(__GNUC__)
4895 diff -Naur linux/include/asm-arm/fcntl.h linux-p/include/asm-arm/fcntl.h
4896 --- linux/include/asm-arm/fcntl.h Sun Mar 25 18:31:10 2001
4897 +++ linux-p/include/asm-arm/fcntl.h Mon Jan 14 23:01:48 2002
4899 #define FASYNC 020000 /* fcntl, for BSD compatibility */
4900 #define O_DIRECTORY 040000 /* must be a directory */
4901 #define O_NOFOLLOW 0100000 /* don't follow links */
4902 +#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
4903 +#define O_LARGEFILE 0400000
4905 #define F_DUPFD 0 /* dup */
4906 #define F_GETFD 1 /* get f_flags */
4908 #define F_SETSIG 10 /* for sockets. */
4909 #define F_GETSIG 11 /* for sockets. */
4911 +#define F_GETLK64 12 /* using 'struct flock64' */
4912 +#define F_SETLK64 13
4913 +#define F_SETLKW64 14
4915 /* for F_[GET|SET]FL */
4916 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
4933 diff -Naur linux/include/asm-arm/stat.h linux-p/include/asm-arm/stat.h
4934 --- linux/include/asm-arm/stat.h Sun Mar 25 18:31:10 2001
4935 +++ linux-p/include/asm-arm/stat.h Mon Jan 14 23:01:48 2002
4937 unsigned long __unused5;
4940 +/* Someone please add a glibc/arm compatible stat64 struct here. */
4942 diff -Naur linux/include/asm-arm/unistd.h linux-p/include/asm-arm/unistd.h
4943 --- linux/include/asm-arm/unistd.h Sun Mar 25 18:31:10 2001
4944 +++ linux-p/include/asm-arm/unistd.h Mon Jan 14 23:01:48 2002
4945 @@ -198,6 +198,13 @@
4948 #define __NR_vfork (__NR_SYSCALL_BASE+190)
4949 +/* #define __NR_getrlimit (__NR_SYSCALL_BASE+191) */
4950 +#define __NR_mmap2 (__NR_SYSCALL_BASE+192)
4951 +#define __NR_truncate64 (__NR_SYSCALL_BASE+193)
4952 +#define __NR_ftruncate64 (__NR_SYSCALL_BASE+194)
4953 +#define __NR_stat64 (__NR_SYSCALL_BASE+195)
4954 +#define __NR_lstat64 (__NR_SYSCALL_BASE+196)
4955 +#define __NR_fstat64 (__NR_SYSCALL_BASE+197)
4957 #define __sys2(x) #x
4958 #define __sys1(x) __sys2(x)
4959 diff -Naur linux/include/asm-i386/fcntl.h linux-p/include/asm-i386/fcntl.h
4960 --- linux/include/asm-i386/fcntl.h Sun Mar 25 18:31:05 2001
4961 +++ linux-p/include/asm-i386/fcntl.h Mon Jan 14 23:01:48 2002
4963 #define F_SETSIG 10 /* for sockets. */
4964 #define F_GETSIG 11 /* for sockets. */
4966 +#define F_GETLK64 12 /* using 'struct flock64' */
4967 +#define F_SETLK64 13
4968 +#define F_SETLKW64 14
4970 /* for F_[GET|SET]FL */
4971 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
4988 diff -Naur linux/include/asm-i386/stat.h linux-p/include/asm-i386/stat.h
4989 --- linux/include/asm-i386/stat.h Sun Mar 25 18:31:05 2001
4990 +++ linux-p/include/asm-i386/stat.h Mon Jan 14 23:01:48 2002
4992 unsigned long __unused5;
4995 +/* This matches struct stat64 in glibc2.1, hence the absolutely
4996 + * insane amounts of padding around dev_t's.
4999 + unsigned short st_dev;
5000 + unsigned char __pad0[10];
5002 +#define STAT64_HAS_BROKEN_ST_INO 1
5003 + unsigned long __st_ino;
5005 + unsigned int st_mode;
5006 + unsigned int st_nlink;
5008 + unsigned long st_uid;
5009 + unsigned long st_gid;
5011 + unsigned short st_rdev;
5012 + unsigned char __pad3[10];
5014 + long long st_size;
5015 + unsigned long st_blksize;
5017 + unsigned long st_blocks; /* Number 512-byte blocks allocated. */
5018 + unsigned long __pad4; /* future possible st_blocks high bits */
5020 + unsigned long st_atime;
5021 + unsigned long __pad5;
5023 + unsigned long st_mtime;
5024 + unsigned long __pad6;
5026 + unsigned long st_ctime;
5027 + unsigned long __pad7; /* will be high 32 bits of ctime someday */
5029 + unsigned long long st_ino;
5033 diff -Naur linux/include/asm-i386/unistd.h linux-p/include/asm-i386/unistd.h
5034 --- linux/include/asm-i386/unistd.h Sun Mar 25 18:31:05 2001
5035 +++ linux-p/include/asm-i386/unistd.h Mon Jan 14 23:01:48 2002
5037 #define __NR_sigpending 73
5038 #define __NR_sethostname 74
5039 #define __NR_setrlimit 75
5040 -#define __NR_getrlimit 76
5041 +#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
5042 #define __NR_getrusage 77
5043 #define __NR_gettimeofday 78
5044 #define __NR_settimeofday 79
5045 @@ -195,8 +195,42 @@
5046 #define __NR_getpmsg 188 /* some people actually want streams */
5047 #define __NR_putpmsg 189 /* some people actually want streams */
5048 #define __NR_vfork 190
5049 +/* #define __NR_ugetrlimit 191 SuS compliant getrlimit */
5050 +#define __NR_mmap2 192
5051 +#define __NR_truncate64 193
5052 +#define __NR_ftruncate64 194
5053 +#define __NR_stat64 195
5054 +#define __NR_lstat64 196
5055 +#define __NR_fstat64 197
5057 +#define __NR_lchown32 198
5058 +#define __NR_getuid32 199
5059 +#define __NR_getgid32 200
5060 +#define __NR_geteuid32 201
5061 +#define __NR_getegid32 202
5062 +#define __NR_setreuid32 203
5063 +#define __NR_setregid32 204
5064 +#define __NR_getgroups32 205
5065 +#define __NR_setgroups32 206
5066 +#define __NR_fchown32 207
5067 +#define __NR_setresuid32 208
5068 +#define __NR_getresuid32 209
5069 +#define __NR_setresgid32 210
5070 +#define __NR_getresgid32 211
5071 +#define __NR_chown32 212
5072 +#define __NR_setuid32 213
5073 +#define __NR_setgid32 214
5074 +#define __NR_setfsuid32 215
5075 +#define __NR_setfsgid32 216
5076 +#define __NR_pivot_root 217
5077 +#define __NR_mincore 218
5078 +#define __NR_madvise 219
5079 +#define __NR_madvise1 219 /* delete when C lib stub is removed */
5081 +#define __NR_getdents64 220
5082 +#define __NR_fcntl64 221
5084 -/* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */
5085 +/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
5087 #define __syscall_return(type, res) \
5089 @@ -269,6 +303,19 @@
5091 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
5092 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
5093 +__syscall_return(type,__res); \
5096 +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
5097 + type5,arg5,type6,arg6) \
5098 +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
5101 +__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \
5103 + : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
5104 + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \
5105 + "0" ((long)(arg6))); \
5106 __syscall_return(type,__res); \
5109 diff -Naur linux/include/asm-m68k/fcntl.h linux-p/include/asm-m68k/fcntl.h
5110 --- linux/include/asm-m68k/fcntl.h Sun Mar 25 18:31:07 2001
5111 +++ linux-p/include/asm-m68k/fcntl.h Mon Jan 14 23:01:48 2002
5113 #define F_SETSIG 10 /* for sockets. */
5114 #define F_GETSIG 11 /* for sockets. */
5116 +#define F_GETLK64 12 /* using 'struct flock64' */
5117 +#define F_SETLK64 13
5118 +#define F_SETLKW64 14
5120 /* for F_[GET|SET]FL */
5121 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5137 #endif /* _M68K_FCNTL_H */
5138 diff -Naur linux/include/asm-m68k/stat.h linux-p/include/asm-m68k/stat.h
5139 --- linux/include/asm-m68k/stat.h Sun Mar 25 18:31:07 2001
5140 +++ linux-p/include/asm-m68k/stat.h Mon Jan 14 23:01:48 2002
5142 unsigned long __unused5;
5145 +/* stat64 struct goes here -- someone please make
5146 + * it mesh with whatever glibc does in userland on
5149 #endif /* _M68K_STAT_H */
5150 diff -Naur linux/include/asm-m68k/unistd.h linux-p/include/asm-m68k/unistd.h
5151 --- linux/include/asm-m68k/unistd.h Sun Mar 25 18:31:07 2001
5152 +++ linux-p/include/asm-m68k/unistd.h Mon Jan 14 23:01:48 2002
5154 #define __NR_sigpending 73
5155 #define __NR_sethostname 74
5156 #define __NR_setrlimit 75
5157 -#define __NR_getrlimit 76
5158 +#define __NR_getrlimit 76
5159 #define __NR_getrusage 77
5160 #define __NR_gettimeofday 78
5161 #define __NR_settimeofday 79
5162 @@ -194,6 +194,13 @@
5163 #define __NR_getpmsg 188 /* some people actually want streams */
5164 #define __NR_putpmsg 189 /* some people actually want streams */
5165 #define __NR_vfork 190
5166 +/* #define __NR_getrlimit 191 */
5167 +#define __NR_mmap2 192
5168 +#define __NR_truncate64 193
5169 +#define __NR_ftruncate64 194
5170 +#define __NR_stat64 195
5171 +#define __NR_lstat64 196
5172 +#define __NR_fstat64 197
5174 /* user-visible error numbers are in the range -1 - -122: see
5175 <asm-m68k/errno.h> */
5176 diff -Naur linux/include/asm-mips/fcntl.h linux-p/include/asm-mips/fcntl.h
5177 --- linux/include/asm-mips/fcntl.h Sun Mar 25 18:31:06 2001
5178 +++ linux-p/include/asm-mips/fcntl.h Mon Jan 14 23:01:48 2002
5180 #define F_SETSIG 10 /* for sockets. */
5181 #define F_GETSIG 11 /* for sockets. */
5183 +#define F_GETLK64 33 /* using 'struct flock64' */
5184 +#define F_SETLK64 34
5185 +#define F_SETLKW64 35
5187 /* for F_[GET|SET]FL */
5188 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5191 __kernel_pid_t l_pid;
5192 long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
5195 +typedef struct flock64 {
5203 #endif /* __ASM_MIPS_FCNTL_H */
5204 diff -Naur linux/include/asm-ppc/fcntl.h linux-p/include/asm-ppc/fcntl.h
5205 --- linux/include/asm-ppc/fcntl.h Sun Mar 25 18:31:08 2001
5206 +++ linux-p/include/asm-ppc/fcntl.h Mon Jan 14 23:01:48 2002
5208 #define FASYNC 020000 /* fcntl, for BSD compatibility */
5209 #define O_DIRECTORY 040000 /* must be a directory */
5210 #define O_NOFOLLOW 0100000 /* don't follow links */
5211 +#define O_LARGEFILE 0200000
5212 +#define O_DIRECT 0400000 /* direct disk access hint - currently ignored */
5214 #define F_DUPFD 0 /* dup */
5215 #define F_GETFD 1 /* get f_flags */
5217 #define F_SETSIG 10 /* for sockets. */
5218 #define F_GETSIG 11 /* for sockets. */
5220 +#define F_GETLK64 12 /* using 'struct flock64' */
5221 +#define F_SETLK64 13
5222 +#define F_SETLKW64 14
5224 /* for F_[GET|SET]FL */
5225 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5242 diff -Naur linux/include/asm-ppc/stat.h linux-p/include/asm-ppc/stat.h
5243 --- linux/include/asm-ppc/stat.h Sun Mar 25 18:31:08 2001
5244 +++ linux-p/include/asm-ppc/stat.h Mon Jan 14 23:01:48 2002
5246 unsigned long __unused5;
5249 +/* This matches struct stat64 in glibc2.1.
5252 + unsigned long long st_dev; /* Device. */
5253 + unsigned long long st_ino; /* File serial number. */
5254 + unsigned int st_mode; /* File mode. */
5255 + unsigned int st_nlink; /* Link count. */
5256 + unsigned int st_uid; /* User ID of the file's owner. */
5257 + unsigned int st_gid; /* Group ID of the file's group. */
5258 + unsigned long long st_rdev; /* Device number, if device. */
5259 + unsigned short int __pad2;
5260 + long long st_size; /* Size of file, in bytes. */
5261 + long st_blksize; /* Optimal block size for I/O. */
5263 + long long st_blocks; /* Number 512-byte blocks allocated. */
5264 + long st_atime; /* Time of last access. */
5265 + unsigned long int __unused1;
5266 + long st_mtime; /* Time of last modification. */
5267 + unsigned long int __unused2;
5268 + long st_ctime; /* Time of last status change. */
5269 + unsigned long int __unused3;
5270 + unsigned long int __unused4;
5271 + unsigned long int __unused5;
5275 diff -Naur linux/include/asm-ppc/unistd.h linux-p/include/asm-ppc/unistd.h
5276 --- linux/include/asm-ppc/unistd.h Sun Mar 25 18:31:08 2001
5277 +++ linux-p/include/asm-ppc/unistd.h Mon Jan 14 23:01:48 2002
5278 @@ -194,11 +194,18 @@
5279 #define __NR_getpmsg 187 /* some people actually want streams */
5280 #define __NR_putpmsg 188 /* some people actually want streams */
5281 #define __NR_vfork 189
5283 +#define __NR_mmap2 192
5284 +#define __NR_truncate64 193
5285 +#define __NR_ftruncate64 194
5286 +#define __NR_stat64 195
5287 +#define __NR_lstat64 196
5288 +#define __NR_fstat64 197
5289 #define __NR_pciconfig_read 198
5290 #define __NR_pciconfig_write 199
5291 #define __NR_pciconfig_iobase 200
5292 #define __NR_multiplexer 201
5293 +#define __NR_getdents64 202
5294 +#define __NR_fcntl64 204
5298 diff -Naur linux/include/asm-sparc/fcntl.h linux-p/include/asm-sparc/fcntl.h
5299 --- linux/include/asm-sparc/fcntl.h Sun Mar 25 18:31:07 2001
5300 +++ linux-p/include/asm-sparc/fcntl.h Mon Jan 14 23:01:48 2002
5302 #define O_NOCTTY 0x8000 /* not fcntl */
5303 #define O_DIRECTORY 0x10000 /* must be a directory */
5304 #define O_NOFOLLOW 0x20000 /* don't follow links */
5305 +#define O_LARGEFILE 0x40000 /* LFS */
5307 #define F_DUPFD 0 /* dup */
5308 #define F_GETFD 1 /* get f_flags */
5311 #define F_SETSIG 10 /* for sockets. */
5312 #define F_GETSIG 11 /* for sockets. */
5313 +#define F_GETLK64 12
5314 +#define F_SETLK64 13
5315 +#define F_SETLKW64 14
5317 /* for F_[GET|SET]FL */
5318 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5335 diff -Naur linux/include/asm-sparc/stat.h linux-p/include/asm-sparc/stat.h
5336 --- linux/include/asm-sparc/stat.h Sun Mar 25 18:31:07 2001
5337 +++ linux-p/include/asm-sparc/stat.h Mon Jan 14 23:01:48 2002
5341 #ifndef _SPARC_STAT_H
5342 #define _SPARC_STAT_H
5347 unsigned long __unused4[2];
5351 + unsigned char __pad0[6];
5352 + unsigned short st_dev;
5354 + unsigned long long st_ino;
5356 + unsigned int st_mode;
5357 + unsigned int st_nlink;
5359 + unsigned int st_uid;
5360 + unsigned int st_gid;
5362 + unsigned char __pad2[6];
5363 + unsigned short st_rdev;
5365 + unsigned char __pad3[8];
5367 + long long st_size;
5368 + unsigned int st_blksize;
5370 + unsigned char __pad4[8];
5371 + unsigned int st_blocks;
5373 + unsigned int st_atime;
5374 + unsigned int __unused1;
5376 + unsigned int st_mtime;
5377 + unsigned int __unused2;
5379 + unsigned int st_ctime;
5380 + unsigned int __unused3;
5382 + unsigned int __unused4;
5383 + unsigned int __unused5;
5387 diff -Naur linux/include/asm-sparc/unistd.h linux-p/include/asm-sparc/unistd.h
5388 --- linux/include/asm-sparc/unistd.h Sun Mar 25 18:37:39 2001
5389 +++ linux-p/include/asm-sparc/unistd.h Mon Jan 14 23:01:48 2002
5391 /* #define __NR_mctl 53 SunOS specific */
5392 #define __NR_ioctl 54 /* Common */
5393 #define __NR_reboot 55 /* Common */
5394 -/* #define __NR_ni_syscall 56 ENOSYS under SunOS */
5395 +#define __NR_mmap2 56 /* Linux sparc32 Specific */
5396 #define __NR_symlink 57 /* Common */
5397 #define __NR_readlink 58 /* Common */
5398 #define __NR_execve 59 /* Common */
5399 #define __NR_umask 60 /* Common */
5400 #define __NR_chroot 61 /* Common */
5401 #define __NR_fstat 62 /* Common */
5402 -/* #define __NR_ni_syscall 63 ENOSYS under SunOS */
5403 +#define __NR_fstat64 63 /* Linux sparc32 Specific */
5404 #define __NR_getpagesize 64 /* Common */
5405 #define __NR_msync 65 /* Common in newer 1.3.x revs... */
5406 #define __NR_vfork 66 /* Common */
5408 #define __NR_mprotect 74 /* Common */
5409 /* #define __NR_madvise 75 SunOS Specific */
5410 #define __NR_vhangup 76 /* Common */
5411 -/* #define __NR_ni_syscall 77 ENOSYS under SunOS */
5412 +#define __NR_truncate64 77 /* Linux sparc32 Specific */
5413 /* #define __NR_mincore 78 SunOS Specific */
5414 #define __NR_getgroups 79 /* Common */
5415 #define __NR_setgroups 80 /* Common */
5416 #define __NR_getpgrp 81 /* Common */
5417 /* #define __NR_setpgrp 82 setpgid, same difference... */
5418 #define __NR_setitimer 83 /* Common */
5419 -/* #define __NR_ni_syscall 84 ENOSYS under SunOS */
5420 +#define __NR_ftruncate64 84 /* Linux sparc32 Specific */
5421 #define __NR_swapon 85 /* Common */
5422 #define __NR_getitimer 86 /* Common */
5423 /* #define __NR_gethostname 87 SunOS Specific */
5424 @@ -147,14 +147,14 @@
5425 #define __NR_truncate 129 /* Common */
5426 #define __NR_ftruncate 130 /* Common */
5427 #define __NR_flock 131 /* Common */
5428 -/* #define __NR_ni_syscall 132 ENOSYS under SunOS */
5429 +#define __NR_lstat64 132 /* Linux sparc32 Specific */
5430 #define __NR_sendto 133 /* Common */
5431 #define __NR_shutdown 134 /* Common */
5432 #define __NR_socketpair 135 /* Common */
5433 #define __NR_mkdir 136 /* Common */
5434 #define __NR_rmdir 137 /* Common */
5435 #define __NR_utimes 138 /* SunOS Specific */
5436 -/* #define __NR_ni_syscall 139 ENOSYS under SunOS */
5437 +#define __NR_stat64 139 /* Linux sparc32 Specific */
5438 /* #define __NR_adjtime 140 SunOS Specific */
5439 #define __NR_getpeername 141 /* Common */
5440 /* #define __NR_gethostid 142 SunOS Specific */
5442 /* #define __NR_getmsg 151 SunOS Specific */
5443 /* #define __NR_putmsg 152 SunOS Specific */
5444 #define __NR_poll 153 /* Common */
5445 -/* #define __NR_getdents64 154 Linux Sparc32 Specific */
5446 -/* #define __NR_fcntl64 155 Linux Sparc32 Specific */
5447 +#define __NR_getdents64 154 /* Linux Sparc32 Specific */
5448 +#define __NR_fcntl64 155 /* Linux Sparc32 Specific */
5449 /* #define __NR_getdirentries 156 SunOS Specific */
5450 #define __NR_statfs 157 /* Common */
5451 #define __NR_fstatfs 158 /* Common */
5452 diff -Naur linux/include/asm-sparc64/fcntl.h linux-p/include/asm-sparc64/fcntl.h
5453 --- linux/include/asm-sparc64/fcntl.h Sun Mar 25 18:31:09 2001
5454 +++ linux-p/include/asm-sparc64/fcntl.h Mon Jan 14 23:01:48 2002
5456 #define O_NOCTTY 0x8000 /* not fcntl */
5457 #define O_DIRECTORY 0x10000 /* must be a directory */
5458 #define O_NOFOLLOW 0x20000 /* don't follow links */
5459 +#define O_LARGEFILE 0x40000
5461 #define F_DUPFD 0 /* dup */
5462 #define F_GETFD 1 /* get f_flags */
5465 #define F_SETSIG 10 /* for sockets. */
5466 #define F_GETSIG 11 /* for sockets. */
5468 +#define F_GETLK64 12
5469 +#define F_SETLK64 13
5470 +#define F_SETLKW64 14
5473 /* for F_[GET|SET]FL */
5474 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
5484 __kernel_pid_t32 l_pid;
5488 +struct flock32_64 {
5491 + __kernel_loff_t32 l_start;
5492 + __kernel_loff_t32 l_len;
5493 + __kernel_pid_t32 l_pid;
5497 +#define flock64 flock
5500 #endif /* !(_SPARC64_FCNTL_H) */
5501 diff -Naur linux/include/asm-sparc64/stat.h linux-p/include/asm-sparc64/stat.h
5502 --- linux/include/asm-sparc64/stat.h Sun Mar 25 18:31:09 2001
5503 +++ linux-p/include/asm-sparc64/stat.h Mon Jan 14 23:01:48 2002
5507 #ifndef _SPARC64_STAT_H
5508 #define _SPARC64_STAT_H
5512 unsigned long __unused4[2];
5516 +/* This is sparc32 stat64 structure. */
5519 + unsigned char __pad0[6];
5520 + unsigned short st_dev;
5522 + unsigned long long st_ino;
5524 + unsigned int st_mode;
5525 + unsigned int st_nlink;
5527 + unsigned int st_uid;
5528 + unsigned int st_gid;
5530 + unsigned char __pad2[6];
5531 + unsigned short st_rdev;
5533 + unsigned char __pad3[8];
5535 + long long st_size;
5536 + unsigned int st_blksize;
5538 + unsigned char __pad4[8];
5539 + unsigned int st_blocks;
5541 + unsigned int st_atime;
5542 + unsigned int __unused1;
5544 + unsigned int st_mtime;
5545 + unsigned int __unused2;
5547 + unsigned int st_ctime;
5548 + unsigned int __unused3;
5550 + unsigned int __unused4;
5551 + unsigned int __unused5;
5557 diff -Naur linux/include/asm-sparc64/unistd.h linux-p/include/asm-sparc64/unistd.h
5558 --- linux/include/asm-sparc64/unistd.h Sun Mar 25 18:37:40 2001
5559 +++ linux-p/include/asm-sparc64/unistd.h Mon Jan 14 23:01:48 2002
5561 /* #define __NR_mctl 53 SunOS specific */
5562 #define __NR_ioctl 54 /* Common */
5563 #define __NR_reboot 55 /* Common */
5564 -/* #define __NR_ni_syscall 56 ENOSYS under SunOS */
5565 +/* #define __NR_mmap2 56 Linux sparc32 Specific */
5566 #define __NR_symlink 57 /* Common */
5567 #define __NR_readlink 58 /* Common */
5568 #define __NR_execve 59 /* Common */
5569 #define __NR_umask 60 /* Common */
5570 #define __NR_chroot 61 /* Common */
5571 #define __NR_fstat 62 /* Common */
5572 -/* #define __NR_ni_syscall 63 ENOSYS under SunOS */
5573 +/* #define __NR_fstat64 63 Linux sparc32 Specific */
5574 #define __NR_getpagesize 64 /* Common */
5575 #define __NR_msync 65 /* Common in newer 1.3.x revs... */
5576 #define __NR_vfork 66 /* Common */
5578 #define __NR_mprotect 74 /* Common */
5579 /* #define __NR_madvise 75 SunOS Specific */
5580 #define __NR_vhangup 76 /* Common */
5581 -/* #define __NR_ni_syscall 77 ENOSYS under SunOS */
5582 +/* #define __NR_truncate64 77 Linux sparc32 Specific */
5583 /* #define __NR_mincore 78 SunOS Specific */
5584 #define __NR_getgroups 79 /* Common */
5585 #define __NR_setgroups 80 /* Common */
5586 #define __NR_getpgrp 81 /* Common */
5587 /* #define __NR_setpgrp 82 setpgid, same difference... */
5588 #define __NR_setitimer 83 /* Common */
5589 -/* #define __NR_ni_syscall 84 ENOSYS under SunOS */
5590 +/* #define __NR_ftruncate64 84 Linux sparc32 Specific */
5591 #define __NR_swapon 85 /* Common */
5592 #define __NR_getitimer 86 /* Common */
5593 /* #define __NR_gethostname 87 SunOS Specific */
5594 @@ -147,19 +147,19 @@
5595 #define __NR_truncate 129 /* Common */
5596 #define __NR_ftruncate 130 /* Common */
5597 #define __NR_flock 131 /* Common */
5598 -/* #define __NR_ni_syscall 132 ENOSYS under SunOS */
5599 +/* #define __NR_lstat64 132 Linux sparc32 Specific */
5600 #define __NR_sendto 133 /* Common */
5601 #define __NR_shutdown 134 /* Common */
5602 #define __NR_socketpair 135 /* Common */
5603 #define __NR_mkdir 136 /* Common */
5604 #define __NR_rmdir 137 /* Common */
5605 #define __NR_utimes 138 /* SunOS Specific */
5606 -/* #define __NR_ni_syscall 139 ENOSYS under SunOS */
5607 +/* #define __NR_stat64 139 Linux sparc32 Specific */
5608 /* #define __NR_adjtime 140 SunOS Specific */
5609 #define __NR_getpeername 141 /* Common */
5610 /* #define __NR_gethostid 142 SunOS Specific */
5611 /* #define __NR_ni_syscall 143 ENOSYS under SunOS */
5612 -#define __NR_getrlimit 144 /* Common */
5613 +#define __NR_getrlimit 144 /* Common */
5614 #define __NR_setrlimit 145 /* Common */
5615 /* #define __NR_killpg 146 SunOS Specific */
5616 #define __NR_prctl 147 /* ENOSYS under SunOS */
5617 diff -Naur linux/include/linux/dirent.h linux-p/include/linux/dirent.h
5618 --- linux/include/linux/dirent.h Sun Mar 25 18:31:03 2001
5619 +++ linux-p/include/linux/dirent.h Mon Jan 14 23:01:48 2002
5621 char d_name[256]; /* We must not include limits.h! */
5627 + unsigned short d_reclen;
5628 + unsigned char d_type;
5633 diff -Naur linux/include/linux/ext2_fs_i.h linux-p/include/linux/ext2_fs_i.h
5634 --- linux/include/linux/ext2_fs_i.h Sun Mar 25 18:31:03 2001
5635 +++ linux-p/include/linux/ext2_fs_i.h Mon Jan 14 23:01:48 2002
5637 __u32 i_next_alloc_goal;
5638 __u32 i_prealloc_block;
5639 __u32 i_prealloc_count;
5640 - __u32 i_high_size;
5641 int i_new_inode:1; /* Is a freshly allocated inode */
5644 diff -Naur linux/include/linux/fs.h linux-p/include/linux/fs.h
5645 --- linux/include/linux/fs.h Mon Jan 14 22:59:27 2002
5646 +++ linux-p/include/linux/fs.h Mon Jan 14 23:01:48 2002
5647 @@ -267,6 +267,25 @@
5648 #define buffer_page(bh) (mem_map + MAP_NR((bh)->b_data))
5649 #define touch_buffer(bh) set_bit(PG_referenced, &buffer_page(bh)->flags)
5651 +/* log of base-2 for filesystem uses, in case their super-blocks
5652 + don't have the shift counts readily calculated.. -- presuming
5653 + the divisors in question are power-of-two values! */
5654 +static int fslog2(unsigned long val) __attribute__ ((const));
5655 +static __inline__ int fslog2(unsigned long val)
5658 + for (i = 0; val != 0; ++i, val >>= 1) {
5659 + if (val & 1) return i;
5664 +static int off_t_presentable(loff_t) __attribute((const));
5665 +static __inline__ int off_t_presentable(loff_t loff)
5667 + return loff >= 0 && loff <= (~0UL >> 1);
5670 #include <linux/pipe_fs_i.h>
5671 #include <linux/minix_fs_i.h>
5672 #include <linux/ext2_fs_i.h>
5694 unsigned int f_count, f_flags;
5695 - unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;
5696 + loff_t f_reada, f_ramax, f_raend, f_ralen, f_rawin;
5697 struct fown_struct f_owner;
5698 unsigned int f_uid, f_gid;
5701 struct file *fl_file;
5702 unsigned char fl_flags;
5703 unsigned char fl_type;
5709 void (*fl_notify)(struct file_lock *); /* unblock callback */
5710 void (*fl_insert)(struct file_lock *); /* lock insertion callback */
5715 +#define OFFSET_MAX ((loff_t)((~0ULL)>>1))
5716 +#define OFFT_OFFSET_MAX ((off_t)((~0UL)>>1))
5718 extern struct file_lock *file_lock_table;
5720 #include <linux/fcntl.h>
5722 extern int fcntl_getlk(unsigned int fd, struct flock *l);
5723 extern int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l);
5725 +extern int fcntl_getlk64(unsigned int fd, struct flock64 *l);
5726 +extern int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l);
5729 extern void locks_remove_posix(struct file *, fl_owner_t id);
5730 extern void locks_remove_flock(struct file *);
5731 @@ -609,12 +634,25 @@
5732 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
5737 +#define DT_UNKNOWN 0
5748 * This is the "filldir" function type, used by readdir() to let
5749 * the kernel specify what kind of dirent layout it wants to have.
5750 * This allows the kernel to read directories into kernel space or
5751 * to have different dirent layouts depending on the binary type.
5753 -typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t);
5754 +typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t, unsigned);
5756 struct file_operations {
5757 loff_t (*llseek) (struct file *, loff_t, int);
5760 asmlinkage int sys_open(const char *, int, int);
5761 asmlinkage int sys_close(unsigned int); /* yes, it's really unsigned */
5762 -extern int do_truncate(struct dentry *, unsigned long);
5763 +extern int do_truncate(struct dentry *, loff_t);
5765 extern struct file *filp_open(const char *, int, int);
5766 extern int filp_close(struct file *, fl_owner_t id);
5767 diff -Naur linux/include/linux/mm.h linux-p/include/linux/mm.h
5768 --- linux/include/linux/mm.h Sun Mar 25 18:31:03 2001
5769 +++ linux-p/include/linux/mm.h Mon Jan 14 23:01:48 2002
5771 struct vm_area_struct **vm_pprev_share;
5773 struct vm_operations_struct * vm_ops;
5774 - unsigned long vm_offset;
5776 struct file * vm_file;
5777 unsigned long vm_pte; /* shared mem */
5779 @@ -106,9 +106,46 @@
5780 unsigned long (*wppage)(struct vm_area_struct * area, unsigned long address,
5781 unsigned long page);
5782 int (*swapout)(struct vm_area_struct *, struct page *);
5783 - pte_t (*swapin)(struct vm_area_struct *, unsigned long, unsigned long);
5784 + pte_t (*swapin)(struct vm_area_struct *, loff_t, unsigned long);
5789 + * pgoff_t type -- a complex one, and its simple alternate.
5790 + * The complex one has type that compiler can trap at compile
5791 + * time, but the simple one does simpler code (?)
5795 +typedef struct pgoff_t {
5796 + unsigned long pgoff;
5799 +#define pgoff2ulong(pgof) ((pgof).pgoff)
5800 +extern __inline__ pgoff_t ulong2pgoff(unsigned long ul) {
5806 +#define pgoff2loff(pgof) (((loff_t)(pgof).pgoff) << PAGE_SHIFT)
5807 +#define loff2pgoff(loff) ulong2pgoff((loff) >> PAGE_SHIFT)
5809 +#else /* Integer scalars -- simpler code.. */
5811 +typedef unsigned long pgoff_t;
5813 +#define pgoff2ulong(pgof) (pgof)
5814 +#define ulong2pgoff(pgof) (pgof)
5816 +#define pgoff2loff(pgof) (((loff_t)(pgof)) << PAGE_SHIFT)
5817 +#define loff2pgoff(loff) ulong2pgoff((loff) >> PAGE_SHIFT)
5821 +#define PAGE_MASK_loff ((loff_t)(long)(PAGE_MASK))
5825 * Try to keep the most commonly accessed fields in single cache lines
5826 * here (16 bytes or greater). This ordering should be particularly
5827 @@ -117,12 +154,13 @@
5828 * The first line is data used in page cache lookup, the second line
5829 * is used for linear searches (eg. clock algorithm scans).
5832 typedef struct page {
5833 /* these must be first (free area handling) */
5837 struct inode *inode;
5838 - unsigned long offset;
5839 struct page *next_hash;
5841 unsigned long flags; /* atomic flags, some possibly updated asynchronously */
5843 extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot);
5844 extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot);
5846 -extern void vmtruncate(struct inode * inode, unsigned long offset);
5847 +extern void vmtruncate(struct inode * inode, loff_t offset);
5848 extern int handle_mm_fault(struct task_struct *tsk,struct vm_area_struct *vma, unsigned long address, int write_access);
5849 extern int make_pages_present(unsigned long addr, unsigned long end);
5851 @@ -311,16 +349,22 @@
5852 extern void exit_mmap(struct mm_struct *);
5853 extern unsigned long get_unmapped_area(unsigned long, unsigned long);
5855 -extern unsigned long do_mmap(struct file *, unsigned long, unsigned long,
5856 - unsigned long, unsigned long, unsigned long);
5857 +extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
5858 + unsigned long len, unsigned long prot,
5859 + unsigned long flag, unsigned long pgoff);
5861 +extern unsigned long do_mmap(struct file *, unsigned long,
5862 + unsigned long, unsigned long,
5863 + unsigned long, unsigned long);
5865 extern int do_munmap(unsigned long, size_t);
5868 extern void remove_inode_page(struct page *);
5869 extern unsigned long page_unuse(struct page *);
5870 extern int shrink_mmap(int, int);
5871 -extern void truncate_inode_pages(struct inode *, unsigned long);
5872 -extern unsigned long get_cached_page(struct inode *, unsigned long, int);
5873 +extern void truncate_inode_pages(struct inode *, loff_t);
5874 +extern unsigned long get_cached_page(struct inode *, pgoff_t, int);
5875 extern void put_cached_page(unsigned long);
5878 diff -Naur linux/include/linux/nfs.h linux-p/include/linux/nfs.h
5879 --- linux/include/linux/nfs.h Sun Mar 25 18:37:40 2001
5880 +++ linux-p/include/linux/nfs.h Mon Jan 14 23:01:48 2002
5882 #define NFS_MNTPROC_MNT 1
5883 #define NFS_MNTPROC_UMNT 3
5886 - * This is really a general kernel constant, but since nothing like
5887 - * this is defined in the kernel headers, I have to do it here.
5889 -#define NFS_OFFSET_MAX LONG_MAX
5890 +#define NFS_OFFSET_MAX ((__s64)((~(__u64)0) >> 1))
5893 * These data types are used exlusively by the NFS client implementation.
5894 diff -Naur linux/include/linux/nfs_fs.h linux-p/include/linux/nfs_fs.h
5895 --- linux/include/linux/nfs_fs.h Fri Nov 2 17:39:09 2001
5896 +++ linux-p/include/linux/nfs_fs.h Mon Jan 14 23:01:48 2002
5897 @@ -113,15 +113,15 @@
5901 -unsigned long nfs_page_offset(struct page *page)
5902 +loff_t nfs_page_offset(struct page *page)
5904 - return page->offset;
5905 + return ((loff_t)page->index) << PAGE_CACHE_SHIFT;
5909 unsigned long page_index(struct page *page)
5911 - return page->offset >> PAGE_CACHE_SHIFT;
5912 + return page->index;
5916 @@ -284,6 +284,15 @@
5917 nfs_size_to_off_t(__u64 size)
5919 return (size > (__u64)LONG_MAX) ? (off_t)LONG_MAX : (off_t) size;
5922 +static inline loff_t
5923 +nfs_size_to_loff_t(__u64 size)
5925 + loff_t maxsz = (((loff_t) ULONG_MAX) << PAGE_CACHE_SHIFT) + PAGE_CACHE_SIZE - 1;
5928 + return (loff_t) size;
5932 diff -Naur linux/include/linux/nfs_xdr.h linux-p/include/linux/nfs_xdr.h
5933 --- linux/include/linux/nfs_xdr.h Fri Nov 2 17:39:09 2001
5934 +++ linux-p/include/linux/nfs_xdr.h Mon Jan 14 23:02:57 2002
5935 @@ -329,11 +329,11 @@
5936 int (*readlink)(struct inode *, void *buffer, unsigned int buflen);
5937 int (*read)(struct inode *, struct rpc_cred *,
5939 - int flags, unsigned long offset,
5940 + int flags, loff_t offset,
5941 unsigned int count, void *buffer, int *eofp);
5942 int (*write)(struct inode *, struct rpc_cred *,
5944 - int flags, unsigned long offset,
5945 + int flags, loff_t offset,
5946 unsigned int count, void *buffer,
5947 struct nfs_writeverf *verfp);
5948 int (*commit)(struct inode *, struct nfs_fattr *,
5950 int (*statfs)(struct nfs_server *, struct nfs_fh *,
5951 struct nfs_fsinfo *);
5952 __u32 * (*decode_dirent)(__u32 *, struct nfs_entry *, int plus);
5957 diff -Naur linux/include/linux/nfsd/nfsd.h linux-p/include/linux/nfsd/nfsd.h
5958 --- linux/include/linux/nfsd/nfsd.h Sun Mar 25 18:37:40 2001
5959 +++ linux-p/include/linux/nfsd/nfsd.h Mon Jan 14 23:01:51 2002
5963 typedef int (*encode_dent_fn)(struct readdir_cd *, const char *,
5964 - int, off_t, ino_t);
5965 + int, off_t, ino_t, unsigned int);
5966 typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
5969 diff -Naur linux/include/linux/nfsd/xdr.h linux-p/include/linux/nfsd/xdr.h
5970 --- linux/include/linux/nfsd/xdr.h Sun Mar 25 18:31:04 2001
5971 +++ linux-p/include/linux/nfsd/xdr.h Mon Jan 14 23:01:51 2002
5973 int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *);
5975 int nfssvc_encode_entry(struct readdir_cd *, const char *name,
5976 - int namlen, off_t offset, ino_t ino);
5977 + int namlen, off_t offset, ino_t ino, unsigned int d_type);
5979 int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
5981 diff -Naur linux/include/linux/nfsd/xdr3.h linux-p/include/linux/nfsd/xdr3.h
5982 --- linux/include/linux/nfsd/xdr3.h Sun Mar 25 18:37:40 2001
5983 +++ linux-p/include/linux/nfsd/xdr3.h Mon Jan 14 23:01:51 2002
5985 int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *,
5986 struct nfsd3_fhandle_pair *);
5987 int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
5988 - int namlen, off_t offset, ino_t ino);
5989 + int namlen, off_t offset, ino_t ino, unsigned int d_type);
5990 int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
5991 - int namlen, off_t offset, ino_t ino);
5992 + int namlen, off_t offset, ino_t ino, unsigned int d_type);
5995 #endif /* _LINUX_NFSD_XDR3_H */
5996 diff -Naur linux/include/linux/pagemap.h linux-p/include/linux/pagemap.h
5997 --- linux/include/linux/pagemap.h Sun Mar 25 18:31:04 2001
5998 +++ linux-p/include/linux/pagemap.h Mon Jan 14 23:01:51 2002
6000 #define PAGE_CACHE_SHIFT PAGE_SHIFT
6001 #define PAGE_CACHE_SIZE PAGE_SIZE
6002 #define PAGE_CACHE_MASK PAGE_MASK
6003 +#define PAGE_CACHE_MASK_loff PAGE_MASK_loff
6005 #define page_cache_alloc() __get_free_page(GFP_USER)
6006 #define page_cache_free(x) free_page(x)
6008 * inode pointer and offsets are distributed (ie, we
6009 * roughly know which bits are "significant")
6011 -static inline unsigned long _page_hashfn(struct inode * inode, unsigned long offset)
6012 +static inline unsigned long _page_hashfn(struct inode * inode, pgoff_t index)
6014 #define i (((unsigned long) inode)/(sizeof(struct inode) & ~ (sizeof(struct inode) - 1)))
6015 -#define o ((offset >> PAGE_SHIFT) + (offset & ~PAGE_MASK))
6016 +#define o (index + (index >> PAGE_HASH_BITS))
6017 return ((i+o) & PAGE_HASH_MASK);
6022 #define page_hash(inode,offset) (page_hash_table+_page_hashfn(inode,offset))
6024 -static inline struct page * __find_page(struct inode * inode, unsigned long offset, struct page *page)
6025 +static inline struct page * __find_page(struct inode * inode, pgoff_t index, struct page *page)
6031 if (page->inode != inode)
6033 - if (page->offset == offset)
6034 + if (pgoff2ulong(page->index) == pgoff2ulong(index))
6037 /* Found the page. */
6042 -static inline struct page *find_page(struct inode * inode, unsigned long offset)
6043 +static inline struct page *find_page(struct inode * inode, pgoff_t poffset)
6045 - return __find_page(inode, offset, *page_hash(inode, offset));
6046 + return __find_page(inode, poffset, *page_hash(inode, poffset));
6049 static inline void remove_page_from_hash_queue(struct page * page)
6051 page->pprev_hash = p;
6054 -static inline void add_page_to_hash_queue(struct page * page, struct inode * inode, unsigned long offset)
6055 +static inline void add_page_to_hash_queue(struct page * page, struct inode * inode, pgoff_t poffset)
6057 - __add_page_to_hash_queue(page, page_hash(inode,offset));
6058 + __add_page_to_hash_queue(page, page_hash(inode,poffset));
6061 static inline void remove_page_from_inode_queue(struct page * page)
6063 __wait_on_page(page);
6066 -extern void update_vm_cache_conditional(struct inode *, unsigned long, const char *, int, unsigned long);
6067 -extern void update_vm_cache(struct inode *, unsigned long, const char *, int);
6068 +extern void update_vm_cache_conditional(struct inode *, loff_t, const char *, int, unsigned long);
6069 +extern void update_vm_cache(struct inode *, loff_t, const char *, int);
6071 typedef int filler_t(void *, struct page*);
6073 diff -Naur linux/include/linux/sched.h linux-p/include/linux/sched.h
6074 --- linux/include/linux/sched.h Mon Jan 14 22:59:27 2002
6075 +++ linux-p/include/linux/sched.h Mon Jan 14 23:01:51 2002
6077 int keep_capabilities:1;
6078 struct user_struct *user;
6080 - struct rlimit rlim[RLIM_NLIMITS];
6081 + struct rlimit rlim[RLIM_NLIMITS];
6082 unsigned short used_math;
6084 /* file system info */
6085 diff -Naur linux/include/linux/smb_fs.h linux-p/include/linux/smb_fs.h
6086 --- linux/include/linux/smb_fs.h Sun Mar 25 18:31:04 2001
6087 +++ linux-p/include/linux/smb_fs.h Mon Jan 14 23:01:51 2002
6089 void smb_close_dentry(struct dentry *);
6090 int smb_close_fileid(struct dentry *, __u16);
6091 int smb_open(struct dentry *, int);
6092 -int smb_proc_read(struct dentry *, off_t, int, char *);
6093 -int smb_proc_write(struct dentry *, off_t, int, const char *);
6094 +int smb_proc_read(struct dentry *, loff_t, int, char *);
6095 +int smb_proc_write(struct dentry *, loff_t, int, const char *);
6096 int smb_proc_create(struct dentry *, __u16, time_t, __u16 *);
6097 int smb_proc_mv(struct dentry *, struct dentry *);
6098 int smb_proc_mkdir(struct dentry *);
6099 diff -Naur linux/include/linux/swap.h linux-p/include/linux/swap.h
6100 --- linux/include/linux/swap.h Sun Mar 25 18:31:04 2001
6101 +++ linux-p/include/linux/swap.h Mon Jan 14 23:01:51 2002
6103 extern unsigned int nr_swapfiles;
6104 extern struct swap_info_struct swap_info[];
6105 void si_swapinfo(struct sysinfo *);
6106 -unsigned long get_swap_page(void);
6107 +extern unsigned long get_swap_page(void);
6108 extern void FASTCALL(swap_free(unsigned long));
6109 struct swap_list_t {
6110 int head; /* head of priority-ordered swapfile list */
6112 extern inline unsigned long in_swap_cache(struct page *page)
6114 if (PageSwapCache(page))
6115 - return page->offset;
6116 + return pgoff2ulong(page->index);
6122 count = atomic_read(&page->count);
6123 if (PageSwapCache(page))
6124 - count += swap_count(page->offset) - 2;
6125 + count += swap_count(pgoff2ulong(page->index)) - 2;
6126 if (PageFreeAfter(page))
6129 diff -Naur linux/include/linux/ufs_fs_i.h linux-p/include/linux/ufs_fs_i.h
6130 --- linux/include/linux/ufs_fs_i.h Sun Mar 25 18:31:04 2001
6131 +++ linux-p/include/linux/ufs_fs_i.h Mon Jan 14 23:01:51 2002
6134 __u8 i_symlink[4*15];
6140 diff -Naur linux/kernel/ksyms.c linux-p/kernel/ksyms.c
6141 --- linux/kernel/ksyms.c Mon Jan 14 22:59:27 2002
6142 +++ linux-p/kernel/ksyms.c Mon Jan 14 23:01:51 2002
6145 /* process memory management */
6146 EXPORT_SYMBOL(do_mmap);
6147 +EXPORT_SYMBOL(do_mmap_pgoff);
6148 EXPORT_SYMBOL(do_munmap);
6149 EXPORT_SYMBOL(exit_mm);
6150 EXPORT_SYMBOL(exit_files);
6151 diff -Naur linux/lib/vsprintf.c linux-p/lib/vsprintf.c
6152 --- linux/lib/vsprintf.c Mon Jan 14 22:59:27 2002
6153 +++ linux-p/lib/vsprintf.c Mon Jan 14 23:01:51 2002
6154 @@ -67,10 +67,106 @@
6155 #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
6157 #define do_div(n,base) ({ \
6159 -__res = ((unsigned long) n) % (unsigned) base; \
6160 -n = ((unsigned long) n) / (unsigned) base; \
6163 + __res = ((unsigned long) n) % (unsigned) base; \
6164 + n = ((unsigned long) n) / (unsigned) base; \
6167 +#if BITS_PER_LONG < 64
6169 +/* Note: do_ldiv assumes that unsigned long long is a 64 bit long
6170 + * and unsigned long is at least a 32 bits long.
6172 +#define do_ldiv(n, base) \
6174 + unsigned long long value = n; \
6175 + unsigned long long leftover; \
6176 + unsigned long temp; \
6177 + unsigned long result_div1, result_div2, result_div3, result_mod; \
6179 + temp = value >> 32; \
6180 + result_div1 = temp/(base); \
6181 + result_mod = temp%(base); \
6183 + temp = (result_mod << 24) | ((value >> 8) & 0xFFFFFF); \
6184 + result_div2 = temp/(base); \
6185 + result_mod = temp%(base); \
6187 + temp = (result_mod << 8) | (value & 0xFF); \
6188 + result_div3 = temp/(base); \
6189 + result_mod = temp%(base);\
6191 + leftover = ((unsigned long long)result_div1 << 32) | \
6192 + ((unsigned long long)result_div2 << 8) | (result_div3); \
6199 +static char * lnumber(char * str, long long num, int base, int size,
6200 + int precision, int type)
6202 + char c,sign,tmp[66];
6203 + const char *digits="0123456789abcdef";
6207 + digits = "0123456789ABCDEF";
6210 + if (base < 2 || base > 36)
6212 + c = (type & ZEROPAD) ? '0' : ' ';
6214 + if (type & SIGN) {
6219 + } else if (type & PLUS) {
6222 + } else if (type & SPACE) {
6227 + if (type & SPECIAL) {
6234 + else while (num != 0)
6235 + tmp[i++] = digits[do_ldiv(num,base)];
6236 + if (i > precision)
6238 + size -= precision;
6239 + if (!(type&(ZEROPAD+LEFT)))
6244 + if (type & SPECIAL) {
6247 + *str++ = digits[33];
6250 + if (!(type & LEFT))
6251 + while (size-- > 0)
6253 + while (i < precision--)
6257 + while (size-- > 0)
6263 static char * number(char * str, long num, int base, int size, int precision
6265 @@ -207,7 +303,10 @@
6266 /* get the conversion qualifier */
6268 if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
6270 + if (*fmt == 'l' && qualifier == 'l')
6277 @@ -296,7 +395,22 @@
6281 - if (qualifier == 'l')
6282 + if (qualifier == 'L') {
6284 +#if BITS_PER_LONG < 64
6285 + /* 64-bit printout in 32-bit systems !!
6286 + Needed at some point for 64-bit file offsets and
6287 + mmap() reporting functions. */
6289 + unsigned long long lnum;
6290 + lnum = va_arg(args, unsigned long long);
6291 + str = lnumber(str, lnum, base, field_width,
6292 + precision, flags);
6295 + num = va_arg(args, unsigned long); /* 64-bit longs..*/
6297 + } else if (qualifier == 'l')
6298 num = va_arg(args, unsigned long);
6299 else if (qualifier == 'h') {
6300 num = (unsigned short) va_arg(args, int);
6301 diff -Naur linux/mm/filemap.c linux-p/mm/filemap.c
6302 --- linux/mm/filemap.c Sun Mar 25 18:37:40 2001
6303 +++ linux-p/mm/filemap.c Mon Jan 14 23:01:51 2002
6305 * Truncate the page cache at a set offset, removing the pages
6306 * that are beyond that offset (and zeroing out partial pages).
6308 -void truncate_inode_pages(struct inode * inode, unsigned long start)
6309 +void truncate_inode_pages(struct inode * inode, loff_t start)
6315 p = &inode->i_pages;
6316 while ((page = *p) != NULL) {
6317 - unsigned long offset = page->offset;
6318 + loff_t loffset = pgoff2loff(page->index);
6320 /* page wholly truncated - free it */
6321 - if (offset >= start) {
6322 + if (loffset >= start) {
6323 if (PageLocked(page)) {
6326 @@ -104,9 +104,10 @@
6330 - offset = start - offset;
6331 + loffset = start - loffset;
6332 /* partial truncate, clear end of page */
6333 - if (offset < PAGE_CACHE_SIZE) {
6334 + if (loffset < PAGE_CACHE_SIZE) {
6335 + unsigned int offset = loffset; /* truncate ok */
6336 unsigned long address = page_address(page);
6337 memset((void *) (offset + address), 0, PAGE_CACHE_SIZE - offset);
6338 flush_page_to_ram(address);
6340 * were to be marked referenced..
6342 if (PageSwapCache(page)) {
6343 - if (referenced && swap_count(page->offset) != 1)
6345 + swap_count(pgoff2ulong(page->index)) != 1)
6347 delete_from_swap_cache(page);
6349 @@ -238,11 +240,12 @@
6350 * memory maps. --sct
6353 -void update_vm_cache_conditional(struct inode * inode, unsigned long pos, const char * buf, int count, unsigned long source_address)
6354 +void update_vm_cache_conditional(struct inode * inode, loff_t pos, const char * buf, int count, unsigned long source_address)
6356 unsigned long offset, len;
6357 + pgoff_t pgoff = loff2pgoff(pos);
6359 - offset = (pos & ~PAGE_CACHE_MASK);
6360 + offset = ((unsigned long)pos & ~PAGE_CACHE_MASK);
6361 pos = pos & PAGE_CACHE_MASK;
6362 len = PAGE_CACHE_SIZE - offset;
6368 - page = find_page(inode, pos);
6369 + page = find_page(inode, pgoff);
6371 char *dest = (char*) (offset + page_address(page));
6373 @@ -270,19 +273,20 @@
6377 -void update_vm_cache(struct inode * inode, unsigned long pos, const char * buf, int count)
6378 +void update_vm_cache(struct inode * inode, loff_t pos, const char * buf, int count)
6380 update_vm_cache_conditional(inode, pos, buf, count, 0);
6384 static inline void add_to_page_cache(struct page * page,
6385 - struct inode * inode, unsigned long offset,
6386 - struct page **hash)
6387 + struct inode * inode,
6389 + struct page **hash)
6391 atomic_inc(&page->count);
6392 page->flags = page->flags & ~((1 << PG_uptodate) | (1 << PG_error) | (1 << PG_referenced));
6393 - page->offset = offset;
6394 + page->index = pgoff;
6395 add_page_to_inode_queue(inode, page);
6396 __add_page_to_hash_queue(page, hash);
6398 @@ -293,29 +297,32 @@
6399 * this is all overlapped with the IO on the previous page finishing anyway)
6401 static unsigned long try_to_read_ahead(struct file * file,
6402 - unsigned long offset, unsigned long page_cache)
6403 + pgoff_t pgoff, unsigned long page_cache)
6405 struct inode *inode = file->f_dentry->d_inode;
6406 - struct page * page;
6407 - struct page ** hash;
6410 - offset &= PAGE_CACHE_MASK;
6411 - switch (page_cache) {
6413 + /* Calculate file size in 'pages' -- if even one byte (according to
6414 + the 'i_size') exceeds the final page-size block, round up. */
6415 + pg_size = loff2pgoff(inode->i_size+(PAGE_SIZE-1));
6417 + if (!page_cache) {
6418 page_cache = page_cache_alloc();
6422 - if (offset >= inode->i_size)
6424 - hash = page_hash(inode, offset);
6425 - page = __find_page(inode, offset, *hash);
6426 + return 0; /* Can't allocate! */
6428 + /* Ok, we have a page, make sure it is in the page cache */
6429 + if (pgoff2ulong(pgoff) < pgoff2ulong(pg_size)) {
6430 + struct page * page;
6431 + struct page ** hash;
6432 + hash = page_hash(inode, pgoff);
6433 + page = __find_page(inode, pgoff, *hash);
6436 * Ok, add the new page to the hash-queues...
6438 page = page_cache_entry(page_cache);
6439 - add_to_page_cache(page, inode, offset, hash);
6440 + add_to_page_cache(page, inode, pgoff, hash);
6441 inode->i_op->readpage(file, page);
6444 @@ -369,11 +376,11 @@
6446 #define PROFILE_MAXREADCOUNT 1000
6448 -static unsigned long total_reada;
6449 -static unsigned long total_async;
6450 -static unsigned long total_ramax;
6451 -static unsigned long total_ralen;
6452 -static unsigned long total_rawin;
6453 +static u_long total_reada;
6454 +static u_long total_async;
6455 +static u_long total_ramax;
6456 +static u_long total_ralen;
6457 +static u_long total_rawin;
6459 static void profile_readahead(int async, struct file *filp)
6461 @@ -481,13 +488,13 @@
6463 static inline unsigned long generic_file_readahead(int reada_ok,
6464 struct file * filp, struct inode * inode,
6465 - unsigned long ppos, struct page * page, unsigned long page_cache)
6466 + loff_t ppos, struct page * page, unsigned long page_cache)
6468 - unsigned long max_ahead, ahead;
6469 - unsigned long raend;
6470 + loff_t max_ahead, ahead;
6472 int max_readahead = get_max_readahead(inode);
6474 - raend = filp->f_raend & PAGE_CACHE_MASK;
6475 + raend = filp->f_raend & PAGE_CACHE_MASK_loff;
6481 while (ahead < max_ahead) {
6482 ahead += PAGE_CACHE_SIZE;
6483 - page_cache = try_to_read_ahead(filp, raend + ahead,
6484 + page_cache = try_to_read_ahead(filp, loff2pgoff(raend + ahead),
6488 @@ -612,14 +619,14 @@
6489 struct dentry *dentry = filp->f_dentry;
6490 struct inode *inode = dentry->d_inode;
6491 unsigned long page_cache;
6492 - size_t pos, pgpos;
6495 int max_readahead = get_max_readahead(inode);
6500 - pgpos = pos & PAGE_CACHE_MASK;
6501 + posp = pos & PAGE_CACHE_MASK_loff;
6503 * If the current position is outside the previous read-ahead window,
6504 * we reset the current read-ahead context and set read ahead max to zero
6506 * otherwise, we assume that the file accesses are sequential enough to
6507 * continue read-ahead.
6509 - if (pgpos > filp->f_raend || pgpos + filp->f_rawin < filp->f_raend) {
6510 + if (posp > filp->f_raend || posp + filp->f_rawin < filp->f_raend) {
6514 @@ -643,12 +650,12 @@
6515 * Then, at least MIN_READAHEAD if read ahead is ok,
6516 * and at most MAX_READAHEAD in all cases.
6518 - if (pos + desc->count <= (PAGE_CACHE_SIZE >> 1)) {
6519 + if (pos + desc->count <= (loff_t)(PAGE_CACHE_SIZE >> 1)) {
6522 - unsigned long needed;
6525 - needed = ((pos + desc->count) & PAGE_CACHE_MASK) - pgpos;
6526 + needed = ((pos + desc->count) & PAGE_CACHE_MASK) - posp;
6528 if (filp->f_ramax < needed)
6529 filp->f_ramax = needed;
6533 struct page *page, **hash;
6536 if (pos >= inode->i_size)
6540 * Try to find the data in the page cache..
6542 - hash = page_hash(inode, pos & PAGE_CACHE_MASK);
6543 - page = __find_page(inode, pos & PAGE_CACHE_MASK, *hash);
6544 + pgoff = loff2pgoff(pos);
6545 + hash = page_hash(inode, pgoff);
6546 + page = __find_page(inode, pgoff, *hash);
6548 goto no_cached_page;
6551 * the page has been rewritten.
6553 if (PageUptodate(page) || PageLocked(page))
6554 - page_cache = generic_file_readahead(reada_ok, filp, inode, pos & PAGE_CACHE_MASK, page, page_cache);
6555 + page_cache = generic_file_readahead(reada_ok, filp, inode, pos & PAGE_CACHE_MASK_loff, page, page_cache);
6556 else if (reada_ok && filp->f_ramax > MIN_READAHEAD)
6557 filp->f_ramax = MIN_READAHEAD;
6560 flush_dcache_page(page_address(page));
6562 offset = pos & ~PAGE_CACHE_MASK;
6563 - nr = PAGE_CACHE_SIZE - offset;
6564 - if (nr > inode->i_size - pos)
6565 + nr = PAGE_CACHE_SIZE - offset; /* small value */
6566 + if ((loff_t)nr > (inode->i_size - pos))
6567 nr = inode->i_size - pos;
6572 page = page_cache_entry(page_cache);
6574 - add_to_page_cache(page, inode, pos & PAGE_CACHE_MASK, hash);
6575 + add_to_page_cache(page, inode, pgoff, hash);
6578 * Error handling is tricky. If we get a read error,
6579 @@ -829,10 +838,26 @@
6580 ssize_t generic_file_read(struct file * filp, char * buf, size_t count, loff_t *ppos)
6583 + struct inode *inode = filp->f_dentry->d_inode;
6585 + if (((ssize_t) count) < 0)
6589 if (access_ok(VERIFY_WRITE, buf, count)) {
6592 + /* L-F-S spec 2.2.1.25: */
6593 + if (!(filp->f_flags & O_LARGEFILE) &&
6594 + S_ISREG(inode->i_mode) &&
6595 + (*ppos < inode->i_size) && count) {
6596 + if (*ppos >= 0x7fffffff) /* pos@2G forbidden */
6597 + return -EOVERFLOW;
6598 + if (*ppos + count > 0x7fffffff)
6599 + /* Read only until end of allowed region */
6600 + count = 0x7fffffff - *ppos;
6604 read_descriptor_t desc;
6607 struct file * in_file, * out_file;
6608 struct inode * in_inode, * out_inode;
6610 + if (((ssize_t) count) < 0)
6616 @@ -974,20 +1002,25 @@
6617 struct file * file = area->vm_file;
6618 struct dentry * dentry = file->f_dentry;
6619 struct inode * inode = dentry->d_inode;
6620 - unsigned long offset, reada, i;
6622 + pgoff_t pgoff, reada;
6624 struct page * page, **hash;
6625 unsigned long old_page, new_page;
6628 - offset = (address & PAGE_MASK) - area->vm_start + area->vm_offset;
6629 + offset = ((loff_t)((address & PAGE_MASK) - area->vm_start) +
6632 if (offset >= inode->i_size && (area->vm_flags & VM_SHARED) && area->vm_mm == current->mm)
6636 * Do we have something in the page cache already?
6638 - hash = page_hash(inode, offset);
6639 - page = __find_page(inode, offset, *hash);
6640 + pgoff = loff2pgoff(offset);
6641 + hash = page_hash(inode, pgoff);
6642 + page = __find_page(inode, pgoff, *hash);
6644 goto no_cached_page;
6646 @@ -1038,11 +1071,12 @@
6648 * Try to read in an entire cluster at once.
6651 - reada >>= PAGE_CACHE_SHIFT + page_cluster;
6652 - reada <<= PAGE_CACHE_SHIFT + page_cluster;
6653 + reada = loff2pgoff(offset);
6654 + /* Mask lowest 'page_cluster' worth of the lowest bits */
6655 + reada = ulong2pgoff(pgoff2ulong(reada) & ((~(0UL)) << page_cluster));
6657 - for (i = 1 << page_cluster; i > 0; --i, reada += PAGE_CACHE_SIZE)
6658 + for (i = 1 << page_cluster; i > 0;
6659 + --i, reada = ulong2pgoff(pgoff2ulong(reada)+1))
6660 new_page = try_to_read_ahead(file, reada, new_page);
6663 @@ -1056,7 +1090,7 @@
6664 * cache.. The page we just got may be useful if we
6665 * can't share, so don't get rid of it here.
6667 - page = find_page(inode, offset);
6668 + page = find_page(inode, pgoff);
6672 @@ -1065,7 +1099,7 @@
6674 page = page_cache_entry(new_page);
6676 - add_to_page_cache(page, inode, offset, hash);
6677 + add_to_page_cache(page, inode, pgoff, hash);
6679 if (inode->i_op->readpage(file, page) != 0)
6681 @@ -1114,10 +1148,10 @@
6682 * if the disk is full.
6684 static inline int do_write_page(struct inode * inode, struct file * file,
6685 - const char * page, unsigned long offset)
6686 + const char * page, loff_t offset)
6689 - unsigned long size;
6691 loff_t loff = offset;
6692 mm_segment_t old_fs;
6694 @@ -1141,7 +1175,7 @@
6697 static int filemap_write_page(struct vm_area_struct * vma,
6698 - unsigned long offset,
6703 @@ -1175,7 +1209,7 @@
6705 int filemap_swapout(struct vm_area_struct * vma, struct page * page)
6707 - return filemap_write_page(vma, page->offset, page_address(page));
6708 + return filemap_write_page(vma, pgoff2loff(page->index), page_address(page));
6711 static inline int filemap_sync_pte(pte_t * ptep, struct vm_area_struct *vma,
6712 @@ -1539,7 +1573,7 @@
6714 struct dentry *dentry = file->f_dentry;
6715 struct inode *inode = dentry->d_inode;
6716 - unsigned long pos = *ppos;
6717 + loff_t pos = *ppos;
6718 unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
6719 struct page *page, **hash;
6720 unsigned long page_cache = 0;
6721 @@ -1555,6 +1589,9 @@
6725 + if (((ssize_t) count) < 0)
6728 sync = file->f_flags & O_SYNC;
6731 @@ -1565,31 +1602,39 @@
6732 * Check whether we've reached the file size limit.
6735 - if (pos >= limit) {
6736 + if (limit != RLIM_INFINITY && pos >= limit) {
6737 send_sig(SIGXFSZ, current, 0);
6742 + if (!(file->f_flags & O_LARGEFILE) &&
6743 + S_ISREG(inode->i_mode) && count) {
6744 + if (pos >= 0x7fffffff) /* pos@2G forbidden */
6747 + if (pos + count > 0x7fffffff)
6748 + count = 0x7fffffff - pos;
6753 * Check whether to truncate the write,
6754 * and send the signal if we do.
6756 - if (count > limit - pos) {
6757 - send_sig(SIGXFSZ, current, 0);
6758 + if (limit != RLIM_INFINITY && count > limit - pos)
6759 count = limit - pos;
6763 - unsigned long bytes, pgpos, offset;
6764 + unsigned long bytes, offset;
6765 + pgoff_t pgpos = loff2pgoff(pos);
6769 * Try to find the page in the cache. If it isn't there,
6770 * allocate a free page.
6772 - offset = (pos & ~PAGE_CACHE_MASK);
6773 - pgpos = pos & PAGE_CACHE_MASK;
6774 + offset = ((unsigned long)pos & ~PAGE_CACHE_MASK);
6775 bytes = PAGE_CACHE_SIZE - offset;
6778 @@ -1667,15 +1712,14 @@
6779 * Note: we don't have to worry about races here, as the caller
6780 * is holding the inode semaphore.
6782 -unsigned long get_cached_page(struct inode * inode, unsigned long offset,
6784 +unsigned long get_cached_page(struct inode * inode, pgoff_t pgoff, int new)
6787 struct page ** hash;
6788 unsigned long page_cache = 0;
6790 - hash = page_hash(inode, offset);
6791 - page = __find_page(inode, offset, *hash);
6792 + hash = page_hash(inode, pgoff);
6793 + page = __find_page(inode, pgoff, *hash);
6797 @@ -1684,7 +1728,7 @@
6799 clear_page(page_cache);
6800 page = page_cache_entry(page_cache);
6801 - add_to_page_cache(page, inode, offset, hash);
6802 + add_to_page_cache(page, inode, pgoff, hash);
6804 if (atomic_read(&page->count) != 2)
6805 printk(KERN_ERR "get_cached_page: page count=%d\n",
6806 diff -Naur linux/mm/memory.c linux-p/mm/memory.c
6807 --- linux/mm/memory.c Mon Jan 14 22:59:26 2002
6808 +++ linux-p/mm/memory.c Mon Jan 14 23:01:51 2002
6811 if (!PageSwapCache(page_map))
6813 - if (swap_count(page_map->offset) != 1)
6814 + if (swap_count(pgoff2ulong(page_map->index)) != 1)
6816 delete_from_swap_cache(page_map);
6819 * between the file and the memory map for a potential last
6820 * incomplete page. Ugly, but necessary.
6822 -void vmtruncate(struct inode * inode, unsigned long offset)
6823 +void vmtruncate(struct inode * inode, loff_t offset)
6825 truncate_inode_pages(inode, offset);
6827 diff -Naur linux/mm/mmap.c linux-p/mm/mmap.c
6828 --- linux/mm/mmap.c Mon Jan 14 22:59:27 2002
6829 +++ linux-p/mm/mmap.c Mon Jan 14 23:01:51 2002
6830 @@ -169,11 +169,25 @@
6834 -unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len,
6835 - unsigned long prot, unsigned long flags, unsigned long off)
6836 +unsigned long do_mmap(struct file *file, unsigned long addr,
6837 + unsigned long len, unsigned long prot,
6838 + unsigned long flag, unsigned long offset)
6840 + unsigned long ret = -EINVAL;
6841 + if ((offset + PAGE_ALIGN(len)) < offset)
6843 + if (!(offset & ~PAGE_MASK))
6844 + ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
6849 +unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned long len,
6850 + unsigned long prot, unsigned long flags, unsigned long pg_off)
6852 struct mm_struct * mm = current->mm;
6853 struct vm_area_struct * vma;
6854 + loff_t off = (loff_t)pg_off << PAGE_SHIFT;
6857 if (file && (!file->f_op || !file->f_op->mmap))
6859 * the offsets must be contiguous..
6861 if ((mpnt->vm_file != NULL) || (mpnt->vm_flags & VM_SHM)) {
6862 - unsigned long off = prev->vm_offset+prev->vm_end-prev->vm_start;
6863 + loff_t off = (prev->vm_offset +
6864 + (loff_t)(prev->vm_end - prev->vm_start));
6865 if (off != mpnt->vm_offset)
6868 diff -Naur linux/mm/page_alloc.c linux-p/mm/page_alloc.c
6869 --- linux/mm/page_alloc.c Sun Mar 25 18:37:41 2001
6870 +++ linux-p/mm/page_alloc.c Mon Jan 14 23:01:51 2002
6872 add_mem_queue(area, list(map_nr));
6874 static void free_local_pages(struct page * page) {
6875 - unsigned long order = page->offset;
6876 + unsigned long order = page->index;
6877 unsigned int type = PageDMA(page) ? 1 : 0;
6878 struct free_area_struct *area;
6879 unsigned long map_nr = page - mem_map;
6882 page = mem_map + map_nr;
6883 list_add((struct list_head *) page, ¤t->local_pages);
6884 - page->offset = order;
6885 + page->index = order;
6886 current->nr_local_pages++;
6889 diff -Naur linux/mm/page_io.c linux-p/mm/page_io.c
6890 --- linux/mm/page_io.c Sun Mar 25 18:31:03 2001
6891 +++ linux-p/mm/page_io.c Mon Jan 14 23:01:51 2002
6893 * as if it were: we are not allowed to manipulate the inode
6894 * hashing for locked pages.
6896 - if (page->offset != entry) {
6897 + if (pgoff2ulong(page->index) != entry) {
6898 printk ("swap entry mismatch");
6902 printk("VM: swap page is not in swap cache\n");
6905 - if (page->offset != entry) {
6906 - printk ("swap entry mismatch");
6907 + if (pgoff2ulong(page->index) != entry) {
6908 + printk ("VM: swap entry mismatch");
6911 rw_swap_page_base(rw, entry, page, wait);
6912 @@ -291,12 +291,12 @@
6913 printk ("VM: read_swap_page: page already in page cache!\n");
6916 - page->inode = &swapper_inode;
6917 - page->offset = entry;
6918 + page->inode = &swapper_inode;
6919 + page->index = ulong2pgoff(entry);
6920 atomic_inc(&page->count); /* Protect from shrink_mmap() */
6921 rw_swap_page(rw, entry, buffer, 1);
6922 atomic_dec(&page->count);
6925 clear_bit(PG_swap_cache, &page->flags);
6928 diff -Naur linux/mm/swap_state.c linux-p/mm/swap_state.c
6929 --- linux/mm/swap_state.c Sun Mar 25 18:37:41 2001
6930 +++ linux-p/mm/swap_state.c Mon Jan 14 23:01:51 2002
6932 if (PageTestandSetSwapCache(page)) {
6933 printk(KERN_ERR "swap_cache: replacing non-empty entry %08lx "
6935 - page->offset, page_address(page));
6936 + pgoff2ulong(page->index), page_address(page));
6941 atomic_inc(&page->count);
6942 page->flags = page->flags & ~((1 << PG_uptodate) | (1 << PG_error) | (1 << PG_referenced));
6943 page->inode = &swapper_inode;
6944 - page->offset = entry;
6945 - add_page_to_hash_queue(page, &swapper_inode, entry);
6946 + page->index = ulong2pgoff(entry);
6947 + add_page_to_hash_queue(page, &swapper_inode, ulong2pgoff(entry));
6948 add_page_to_inode_queue(&swapper_inode, page);
6953 void delete_from_swap_cache(struct page *page)
6955 - long entry = page->offset;
6956 + long entry = pgoff2ulong(page->index);
6958 #ifdef SWAP_CACHE_INFO
6959 swap_cache_del_total++;
6961 swap_cache_find_total++;
6964 - found = find_page(&swapper_inode, entry);
6965 + found = find_page(&swapper_inode, ulong2pgoff(entry));
6968 if (found->inode != &swapper_inode || !PageSwapCache(found))
6969 diff -Naur linux/mm/vmscan.c linux-p/mm/vmscan.c
6970 --- linux/mm/vmscan.c Sun Mar 25 18:37:41 2001
6971 +++ linux-p/mm/vmscan.c Mon Jan 14 23:01:51 2002
6973 * memory, and we should just continue our scan.
6975 if (PageSwapCache(page_map)) {
6976 - entry = page_map->offset;
6977 + entry = pgoff2ulong(page_map->index);
6978 swap_duplicate(entry);
6979 set_pte(page_table, __pte(entry));
6981 --- linux/fs/jfs/jfs_dtree.c Mon Jan 14 23:08:34 2002
6982 +++ linux-p/fs/jfs/jfs_dtree.c Mon Jan 14 23:27:22 2002
6983 @@ -3082,9 +3082,7 @@
6986 if (filldir(dirent, ".", 1, 0, ip->i_ino
6993 @@ -3093,9 +3091,7 @@
6996 if (filldir(dirent, "..", 2, 1, PARENT(ip)
7003 @@ -3127,9 +3123,7 @@
7004 /* build "." entry */
7006 if (filldir(dirent, ".", 1, filp->f_pos, ip->i_ino
7012 dtoffset->index = 1;
7013 @@ -3141,9 +3135,7 @@
7015 if (filldir(dirent, "..", 2, filp->f_pos,
7023 @@ -3220,9 +3212,7 @@
7025 if (filldir(dirent, d_name, d_namlen, filp->f_pos,
7026 le32_to_cpu(d->inumber)
7033 diff -Naur linux/fs/jfs/jfs_metapage.c linux-p/fs/jfs/jfs_metapage.c
7034 --- linux/fs/jfs/jfs_metapage.c Tue Jan 15 00:08:19 2002
7035 +++ linux-p/fs/jfs/jfs_metapage.c Tue Jan 15 00:05:21 2002
7037 clear_bit(PG_uptodate, &mp->page->flags);
7038 clear_bit(PG_error, &mp->page->flags);
7039 set_bit(PG_referenced, &mp->page->flags);
7040 - mp->page->offset = offset;
7041 + mp->page->index = offset;
7042 add_page_to_inode_queue(mapping, mp->page);
7043 __add_page_to_hash_queue(mp->page, page_hash);
7047 if (test_bit(META_absolute, &mp->flag)) {
7048 for (i = 0; i < nbufs; i++)
7049 - b[i] = mp->page->offset + i;
7050 + b[i] = mp->page->index + i;
7058 - rc = xtLookup(ip, mp->page->offset + i,
7059 + rc = xtLookup(ip, mp->page->index + i,
7060 nbufs - i, &xflag, &xaddr, &xlen, 0);
7062 jERROR(1,("__write_metapage: xtLookup failed with rc = %d\n", rc));
7063 diff -Naur linux/fs/reiserfs/dir.c linux-p/fs/reiserfs/dir.c
7064 --- linux/fs/reiserfs/dir.c Tue Jan 15 00:08:15 2002
7065 +++ linux-p/fs/reiserfs/dir.c Tue Jan 15 00:05:44 2002
7067 // user space buffer is swapped out. At that time
7068 // entry can move to somewhere else
7069 memcpy (local_buf, d_name, d_reclen);
7070 - if (filldir (dirent, local_buf, d_reclen, d_off, d_ino) < 0) {
7071 + if (filldir (dirent, local_buf, d_reclen, d_off, d_ino, DT_UNKNOWN) < 0) {
7072 pathrelse (&path_to_entry);
7073 filp->f_pos = next_pos;
7074 if (local_buf != small_buf) {
7075 diff -Naur linux/fs/reiserfs/inode.c linux-p/fs/reiserfs/inode.c
7076 --- linux.orig/fs/reiserfs/inode.c Fri May 3 19:26:06 2002
7077 +++ linux/fs/reiserfs/inode.c Fri May 3 19:39:28 2002
7078 @@ -220,10 +220,10 @@
7079 inode = file->f_dentry->d_inode;
7081 increment_i_read_sync_counter(inode) ;
7082 - if (has_tail (inode) && (tail_offset (inode) & PAGE_MASK) == page->offset) {
7083 + if (has_tail (inode) && (tail_offset (inode) & PAGE_MASK) == page->index) {
7084 /* there is a tail and it is in this page */
7085 memset ((char *)page_address (page), 0, PAGE_SIZE);
7086 - read_file_tail (inode, page->offset, (char *)page_address (page), PAGE_SIZE);
7087 + read_file_tail (inode, page->index, (char *)page_address (page), PAGE_SIZE);
7088 set_bit (PG_uptodate, &page->flags);
7091 diff -Naur linux/fs/udf/dir.c linux-p/fs/udf/dir.c
7092 --- linux/fs/udf/dir.c Tue Jan 15 00:08:16 2002
7093 +++ linux-p/fs/udf/dir.c Tue Jan 15 00:05:54 2002
7096 if ( filp->f_pos == 0 )
7098 - if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino))
7099 + if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR))
7105 if (!lfi) /* parent directory */
7107 - if (filldir(dirent, "..", 2, filp->f_pos, filp->f_dentry->d_parent->d_inode->i_ino))
7108 + if (filldir(dirent, "..", 2, filp->f_pos, filp->f_dentry->d_parent->d_inode->i_ino, DT_DIR))
7110 if (fibh.sbh != fibh.ebh)
7111 udf_release_data(fibh.ebh);
7114 if ((flen = udf_get_filename(nameptr, fname, lfi)))
7116 - if (filldir(dirent, fname, flen, filp->f_pos, iblock))
7117 + if (filldir(dirent, fname, flen, filp->f_pos, iblock, DT_UNKNOWN))
7119 if (fibh.sbh != fibh.ebh)
7120 udf_release_data(fibh.ebh);