diff -Naur -X exclude-files ac_cur/arch/um/fs/hostfs/Makefile ac/arch/um/fs/hostfs/Makefile --- ac_cur/arch/um/fs/hostfs/Makefile Sat Sep 15 16:46:07 2001 +++ ac/arch/um/fs/hostfs/Makefile Sat Sep 15 18:37:05 2001 @@ -7,13 +7,8 @@ # to __st_ino. It stayed in the same place, so as long as the correct name # is used, hostfs compiled on 2.2 should work on 2.4 and vice versa. -STAT64_INO_FIELD := __st_ino - -HOST_VER := $(shell uname -r | sed 's/^\(2\.[0-9]\)\..*/\1/') - -ifeq ($(HOST_VER), 2.2) - STAT64_INO_FIELD := st_ino -endif +STAT64_INO_FIELD := $(shell grep -q __st_ino /usr/include/bits/stat.h && \ + echo __)st_ino USER_CFLAGS := $(USER_CFLAGS) -DSTAT64_INO_FIELD=$(STAT64_INO_FIELD) @@ -28,7 +23,8 @@ O_TARGET := hostfs.o endif -obj-$(CONFIG_HOSTFS) += hostfs_kern.o hostfs_user.o +obj-y += hostfs_kern.o hostfs_user.o +obj-m += $(O_TARGET) override CFLAGS = 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 Sat Sep 15 15:56:11 2001 +++ ac/arch/um/fs/hostfs/hostfs.h Sat Sep 15 17:11:42 2001 @@ -53,7 +53,7 @@ extern void close_dir(void *stream); extern int read_file(int fd, unsigned long long *offset, char *buf, int len); extern int write_file(int fd, unsigned long long *offset, const char *buf, - int len, int append); + int len); extern int lseek_file(int fd, long long offset, int whence); extern int file_create(char *name, int ur, int uw, int ux, int gr, int gw, int gx, int or, int ow, int ox); 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 Sat Sep 15 15:56:11 2001 +++ ac/arch/um/fs/hostfs/hostfs_kern.c Sat Sep 15 18:35:06 2001 @@ -237,36 +237,6 @@ return(-EINVAL); } -#ifdef notdef -ssize_t hostfs_write(struct file *file, const char *buf, size_t len, - loff_t *start) -{ - unsigned long page = __get_free_page(GFP_KERNEL); - int ret, one_len, n; - - if(page == 0) return(-ENOMEM); - ret = 0; - while(len > 0){ - one_len = (len < PAGE_SIZE) ? len : PAGE_SIZE; - if(copy_from_user((void *) page, &buf[ret], one_len)){ - ret = -EFAULT; - break; - } - n = write_file(file_hostfs_i(file)->fd, start, (void *) page, - one_len, file->f_flags & O_APPEND); - if(n < 0){ - ret = n; - break; - } - ret += n; - len -= n; - if(n < one_len) break; - } - free_page(page); - return(ret); -} -#endif - static struct file_operations hostfs_file_fops = { owner: NULL, read: generic_file_read, @@ -306,7 +276,7 @@ buffer = kmap(page); base = ((unsigned long long) page->index) << PAGE_CACHE_SHIFT; - err = write_file(inode->u.hostfs_i.fd, &base, buffer, count, 0); + err = write_file(inode->u.hostfs_i.fd, &base, buffer, count); if(err != count){ ClearPageUptodate(page); goto out; @@ -385,7 +355,7 @@ start = (long long) (page->index << PAGE_CACHE_SHIFT) + from; buffer = kmap(page); err = write_file(file_hostfs_i(file)->fd, &start, buffer + from, - to - from, 0); + to - from); if(err > 0) err = 0; if(!err && (start > inode->i_size)) inode->i_size = start; 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 Sat Sep 15 15:56:11 2001 +++ ac/arch/um/fs/hostfs/hostfs_user.c Sat Sep 15 17:11:42 2001 @@ -115,31 +115,19 @@ { int n; - if(lseek64(fd, *offset, SEEK_SET) != *offset) - return(-errno); - n = read(fd, buf, len); + n = pread64(fd, buf, len, *offset); if(n < 0) return(-errno); *offset += n; return(n); } -int write_file(int fd, unsigned long long *offset, const char *buf, int len, - int append) +int write_file(int fd, unsigned long long *offset, const char *buf, int len) { - unsigned long long off; - int n, where; + int n; - off = *offset; - where = SEEK_SET; - if(append){ - where = SEEK_END; - off = 0; - } - if((off = lseek64(fd, off, where)) == (off_t) -1) - return(-errno); - n = write(fd, buf, len); + n = pwrite64(fd, buf, len, *offset); if(n < 0) return(-errno); - *offset = off + n; + *offset += n; return(n); } 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 Sat Sep 15 15:56:11 2001 +++ ac/arch/um/kernel/user_syms.c Sat Sep 15 18:35:45 2001 @@ -93,6 +93,13 @@ EXPORT_SYMBOL(seekdir); EXPORT_SYMBOL(telldir); +extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, + __off64_t __offset); +extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n, + __off64_t __offset); +EXPORT_SYMBOL(pread64); +EXPORT_SYMBOL(pwrite64); + EXPORT_SYMBOL(statfs); EXPORT_SYMBOL(statfs64);