diff -Naur -X exclude-files ac_cur/arch/um/Makefile ac/arch/um/Makefile --- ac_cur/arch/um/Makefile Mon Jul 9 13:03:09 2001 +++ ac/arch/um/Makefile Mon Jul 9 13:05:03 2001 @@ -35,9 +35,7 @@ NESTING = 0 CFLAGS += $(DEBUG) $(PROFILE) $(ARCH_CFLAGS) -D__arch_um__ \ - -DSUBARCH=\"$(SUBARCH)\" -DNESTING=$(NESTING) - -#-D_FILE_OFFSET_BITS=64 + -DSUBARCH=\"$(SUBARCH)\" -DNESTING=$(NESTING) -D_LARGEFILE64_SOURCE LINKFLAGS += -r diff -Naur -X exclude-files ac_cur/arch/um/drivers/ubd_user.c ac/arch/um/drivers/ubd_user.c --- ac_cur/arch/um/drivers/ubd_user.c Mon Jul 9 13:03:09 2001 +++ ac/arch/um/drivers/ubd_user.c Mon Jul 9 13:05:03 2001 @@ -20,11 +20,11 @@ { int fd; - if((fd = open(file, *openflags, 0)) < 0){ + if((fd = open64(file, *openflags, 0)) < 0){ if((*openflags != O_RDWR) || ((errno != EROFS) && (errno != EACCES))) return(-errno); *openflags = O_RDONLY; - if((fd = open(file, *openflags, 0)) < 0) return(-errno); + if((fd = open64(file, *openflags, 0)) < 0) return(-errno); } return(fd); } @@ -41,9 +41,9 @@ int ubd_is_dir(char *file) { - struct stat buf; + struct stat64 buf; - if(stat(file, &buf) < 0) return(0); + if(stat64(file, &buf) < 0) return(0); return(S_ISDIR(buf.st_mode)); } @@ -51,7 +51,7 @@ { int n; - if(lseek(req->fd, req->offset, SEEK_SET) < 0){ + if(lseek64(req->fd, req->offset, SEEK_SET) < 0){ printk("do_io - lseek failed : errno = %d\n", errno); return(-1); diff -Naur -X exclude-files ac_cur/arch/um/fs/hostfs/hostfs.h ac/arch/um/fs/hostfs/hostfs.h --- ac_cur/arch/um/fs/hostfs/hostfs.h Mon Jul 9 13:03:09 2001 +++ ac/arch/um/fs/hostfs/hostfs.h Mon Jul 9 13:05:03 2001 @@ -37,12 +37,12 @@ unsigned int ia_attr_flags; }; -extern int stat_file(const char *path, int *dev_out, unsigned long *inode_out, +extern int stat_file(const char *path, int *dev_out, unsigned long long *inode_out, int *mode_out, int *nlink_out, int *uid_out, - int *gid_out, unsigned long *size_out, + int *gid_out, unsigned long long *size_out, unsigned long *atime_out, unsigned long *mtime_out, unsigned long *ctime_out, int *blksize_out, - int *blocks_out); + unsigned long long *blocks_out); extern int access_file(char *path, int r, int w, int x); extern int open_file(char *path, int r, int w); extern int file_type(const char *path, int *rdev); @@ -65,9 +65,9 @@ extern int link_file(const char *from, const char *to); extern int do_readlink(char *file, char *buf, int size); extern int rename_file(char *from, char *to); -extern int do_statfs(char *root, long *bsize_out, long *blocks_out, - long *bfree_out, long *bavail_out, long *files_out, - long *ffree_out, void *fsid_out, int fsid_size, +extern int do_statfs(char *root, long *bsize_out, long long *blocks_out, + long long *bfree_out, long long *bavail_out, long long *files_out, + long long *ffree_out, void *fsid_out, int fsid_size, long *namelen_out, long *spare_out); #endif diff -Naur -X exclude-files ac_cur/arch/um/fs/hostfs/hostfs_kern.c ac/arch/um/fs/hostfs/hostfs_kern.c --- ac_cur/arch/um/fs/hostfs/hostfs_kern.c Mon Jul 9 13:03:09 2001 +++ ac/arch/um/fs/hostfs/hostfs_kern.c Mon Jul 9 13:05:03 2001 @@ -78,13 +78,15 @@ * in and having them treated as int * breaks on big-endian machines */ int err; - - int i_dev, i_mode, i_nlink, i_blksize, i_blocks; - unsigned long i_size; - err = stat_file(name, &i_dev, &ino->i_ino, &i_mode, &i_nlink, + int i_dev, i_mode, i_nlink, i_blksize; + unsigned long long i_size; + unsigned long long i_ino; + unsigned long long i_blocks; + err = stat_file(name, &i_dev, &i_ino, &i_mode, &i_nlink, &ino->i_uid, &ino->i_gid, &i_size, &ino->i_atime, &ino->i_mtime, &ino->i_ctime, &i_blksize, &i_blocks); if(err) return(err); + ino->i_ino = i_ino; ino->i_dev = i_dev; ino->i_mode = i_mode; ino->i_nlink = i_nlink; @@ -117,13 +119,27 @@ int hostfs_statfs(struct super_block *sb, struct statfs *sf) { + /* do_statfs uses struct statfs64 internally, but the linux kernel + * struct statfs still has 32-bit versions for most of these fields, + * so we convert them here + */ int err; + long long f_blocks; + long long f_bfree; + long long f_bavail; + long long f_files; + long long f_ffree; err = do_statfs(sb->s_root->d_inode->u.generic_ip, &sf->f_bsize, - &sf->f_blocks, &sf->f_bfree, &sf->f_bavail, - &sf->f_files, &sf->f_ffree, &sf->f_fsid, - sizeof(sf->f_fsid), &sf->f_namelen, sf->f_spare); + &f_blocks, &f_bfree, &f_bavail, &f_files, &f_ffree, + &sf->f_fsid, sizeof(sf->f_fsid), &sf->f_namelen, + sf->f_spare); if(err) return(err); + sf->f_blocks = f_blocks; + sf->f_bfree = f_bfree; + sf->f_bavail = f_bavail; + sf->f_files = f_files; + sf->f_ffree = f_ffree; sf->f_type = HOSTFS_SUPER_MAGIC; return(0); } @@ -277,7 +293,7 @@ long long start; int err = 0; - start = page->index << PAGE_CACHE_SHIFT; + start = (long long) page->index << PAGE_CACHE_SHIFT; buffer = kmap(page); err = read_file((int) file->private_data, &start, buffer, PAGE_CACHE_SIZE); diff -Naur -X exclude-files ac_cur/arch/um/fs/hostfs/hostfs_user.c ac/arch/um/fs/hostfs/hostfs_user.c --- ac_cur/arch/um/fs/hostfs/hostfs_user.c Mon Jul 9 13:03:09 2001 +++ ac/arch/um/fs/hostfs/hostfs_user.c Mon Jul 9 13:05:03 2001 @@ -16,15 +16,15 @@ #include "kern_util.h" #include "user.h" -int stat_file(const char *path, int *dev_out, unsigned long *inode_out, +int stat_file(const char *path, int *dev_out, unsigned long long *inode_out, int *mode_out, int *nlink_out, int *uid_out, int *gid_out, - unsigned long *size_out, unsigned long *atime_out, + unsigned long long *size_out, unsigned long *atime_out, unsigned long *mtime_out, unsigned long *ctime_out, - int *blksize_out, int *blocks_out) + int *blksize_out, unsigned long long *blocks_out) { - struct stat buf; + struct stat64 buf; - if(lstat(path, &buf) < 0) + if(lstat64(path, &buf) < 0) return(-errno); if(dev_out != NULL) *dev_out = buf.st_dev; if(inode_out != NULL) *inode_out = buf.st_ino; @@ -43,9 +43,9 @@ int file_type(const char *path, int *rdev) { - struct stat buf; + struct stat64 buf; - if(lstat(path, &buf) < 0) return(-errno); + if(lstat64(path, &buf) < 0) return(-errno); *rdev = buf.st_rdev; if(S_ISDIR(buf.st_mode)) return(HOSTFS_DIR); else if(S_ISLNK(buf.st_mode)) return(HOSTFS_SYMLINK); @@ -75,7 +75,7 @@ else if(!r && w) mode = O_WRONLY; else if(r && w) mode = O_RDWR; else panic("Impossible mode in open_file"); - fd = open(path, mode); + fd = open64(path, mode); if(fd < 0) return(-errno); else return(fd); } @@ -107,7 +107,7 @@ { int n; - if(lseek(fd, *offset, SEEK_SET) != *offset) + if(lseek64(fd, *offset, SEEK_SET) != *offset) return(-errno); n = read(fd, buf, len); if(n < 0) return(-errno); @@ -118,7 +118,8 @@ int write_file(int fd, unsigned long long *offset, const char *buf, int len, int append) { - int n, where, off; + unsigned long long off; + int n, where; off = *offset; where = SEEK_SET; @@ -126,7 +127,7 @@ where = SEEK_END; off = 0; } - if((off = lseek(fd, off, where)) == (off_t) -1) + if((off = lseek64(fd, off, where)) == (off_t) -1) return(-errno); n = write(fd, buf, len); if(n < 0) return(-errno); @@ -138,7 +139,7 @@ { int ret; - ret = lseek(fd, (int) offset, whence); + ret = lseek64(fd, offset, whence); if(ret < 0) return(-errno); return(0); } @@ -168,7 +169,7 @@ mode |= or ? S_IROTH : 0; mode |= ow ? S_IWOTH : 0; mode |= ox ? S_IXOTH : 0; - fd = open(name, O_CREAT, mode); + fd = open64(name, O_CREAT, mode); if(fd < 0) return(-errno); close(fd); return(0); @@ -298,15 +299,15 @@ return(0); } -int do_statfs(char *root, long *bsize_out, long *blocks_out, long *bfree_out, - long *bavail_out, long *files_out, long *ffree_out, +int do_statfs(char *root, long *bsize_out, long long *blocks_out, long long *bfree_out, + long long *bavail_out, long long *files_out, long long *ffree_out, void *fsid_out, int fsid_size, long *namelen_out, long *spare_out) { - struct statfs buf; + struct statfs64 buf; int err; - err = statfs(root, &buf); + err = statfs64(root, &buf); if(err < 0) return(-errno); *bsize_out = buf.f_bsize; *blocks_out = buf.f_blocks; diff -Naur -X exclude-files ac_cur/arch/um/kernel/um_arch.c ac/arch/um/kernel/um_arch.c --- ac_cur/arch/um/kernel/um_arch.c Mon Jul 9 13:03:09 2001 +++ ac/arch/um/kernel/um_arch.c Mon Jul 9 13:05:03 2001 @@ -170,7 +170,7 @@ int size; size = file_size(initrd); - if(size == -1) return; + if(size < 0) return; area = alloc_bootmem(size); if(area == NULL) return; if(load_initrd(initrd, area, size) == -1) return; diff -Naur -X exclude-files ac_cur/arch/um/kernel/user_syms.c ac/arch/um/kernel/user_syms.c --- ac_cur/arch/um/kernel/user_syms.c Mon Jul 9 13:03:09 2001 +++ ac/arch/um/kernel/user_syms.c Mon Jul 9 13:05:03 2001 @@ -63,12 +63,15 @@ EXPORT_SYMBOL(access); EXPORT_SYMBOL(open); +EXPORT_SYMBOL(open64); EXPORT_SYMBOL(close); EXPORT_SYMBOL(read); EXPORT_SYMBOL(write); EXPORT_SYMBOL(__xstat); EXPORT_SYMBOL(__lxstat); +EXPORT_SYMBOL(__lxstat64); EXPORT_SYMBOL(lseek); +EXPORT_SYMBOL(lseek64); EXPORT_SYMBOL(chown); EXPORT_SYMBOL(truncate); EXPORT_SYMBOL(utime); @@ -90,6 +93,7 @@ EXPORT_SYMBOL(telldir); EXPORT_SYMBOL(statfs); +EXPORT_SYMBOL(statfs64); EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(getuid); diff -Naur -X exclude-files ac_cur/arch/um/kernel/user_util.c ac/arch/um/kernel/user_util.c --- ac_cur/arch/um/kernel/user_util.c Mon Jul 9 13:03:09 2001 +++ ac/arch/um/kernel/user_util.c Mon Jul 9 13:05:03 2001 @@ -155,25 +155,26 @@ __u64 file_size(char *file) { - struct stat buf; + struct stat64 buf; - if(stat(file, &buf) == -1){ + if(stat64(file, &buf) == -1){ printk("Couldn't stat \"%s\" : errno = %d\n", file, errno); - return(-1); + return(-errno); } if(S_ISBLK(buf.st_mode)){ - int size, fd; + long long size; + int fd; - if((fd = open(file, O_RDONLY)) < 0){ + if((fd = open64(file, O_RDONLY)) < 0){ printk("Couldn't open \"%s\", errno = %d\n", file, errno); - return(-1); + return(-errno); } if(ioctl(fd, BLKGETSIZE, &size) < 0){ printk("Couldn't get the block size of \"%s\", " "errno = %d\n", file, errno); close(fd); - return(-1); + return(-errno); } size *= 512; close(fd);