Browse Source

Forgot comitting patches

SVN-Revision: 7142
Florian Fainelli 19 years ago
parent
commit
820555812e

+ 0 - 0
package/shfs/patches/101-kmod_build.patch → package/shfs/patches/100-kmod_build.patch


+ 156 - 0
package/shfs/patches/101-shfs_0.35_2.6.18_dentry.patch

@@ -0,0 +1,156 @@
+--- shfs-0.35.orig/shfs/Linux-2.6/inode.c
++++ shfs-0.35/shfs/Linux-2.6/inode.c
+@@ -341,12 +341,21 @@ out:
+ 	return -EINVAL;
+ }
+ 
++#ifdef NEW_VFS_DENTRY_API
++static int
++shfs_get_sb(struct file_system_type *fs_type,
++	    int flags, const char *dev_name, void *data, struct vfsmount *mnt)
++{
++	return get_sb_nodev(fs_type, flags, data, shfs_read_super, mnt);
++}
++#else
+ static struct super_block *
+ shfs_get_sb(struct file_system_type *fs_type,
+ 	    int flags, const char *dev_name, void *data)
+ {
+ 	return get_sb_nodev(fs_type, flags, data, shfs_read_super);
+ }
++#endif
+ 
+ static struct file_system_type sh_fs_type = {
+ 	.owner		= THIS_MODULE,
+--- shfs-0.35.orig/shfs/Linux-2.6/file.c
++++ shfs-0.35/shfs/Linux-2.6/file.c
+@@ -199,7 +199,7 @@ shfs_file_open(struct inode *inode, stru
+ }
+ 
+ static int
+-shfs_file_flush(struct file *f)
++do_file_flush(struct file *f)
+ {
+ 	struct dentry *dentry = f->f_dentry;
+ 	struct shfs_sb_info *info = info_from_dentry(dentry);
+@@ -222,6 +222,16 @@ shfs_file_flush(struct file *f)
+ }
+ 
+ static int
++#ifdef FLUSH_HAS_LOCK_OWNER
++shfs_file_flush(struct file *f, fl_owner_t id)
++#else
++shfs_file_flush(struct file *f)
++#endif
++{
++	return do_file_flush(f);
++}
++
++static int
+ shfs_file_release(struct inode *inode, struct file *f)
+ {
+ 	struct dentry *dentry = f->f_dentry;
+@@ -311,7 +321,7 @@ shfs_slow_write(struct file *f, const ch
+ 	DEBUG("\n");
+ 	written = generic_file_write(f, buf, count, offset);
+ 	if (written > 0) {
+-		result = shfs_file_flush(f);
++		result = do_file_flush(f);
+ 		written = result < 0 ? result: written;
+ 	}
+ 	
+Index: shfs-0.35/shfs/Linux-2.6/proc.c
+===================================================================
+--- shfs-0.35.orig/shfs/Linux-2.6/proc.c
++++ shfs-0.35/shfs/Linux-2.6/proc.c
+@@ -570,6 +570,16 @@ error:
+ 	return result;
+ }
+ 
++#ifdef NEW_VFS_DENTRY_API
++int
++shfs_statfs(struct dentry *dentry, struct kstatfs *attr)
++{
++	struct shfs_sb_info *info = info_from_sb(dentry->d_sb);
++
++	DEBUG("\n");
++	return info->fops.statfs(info, attr);
++}
++#else
+ int
+ shfs_statfs(struct super_block *sb, struct kstatfs *attr)
+ {
+@@ -578,4 +588,5 @@ shfs_statfs(struct super_block *sb, stru
+ 	DEBUG("\n");
+ 	return info->fops.statfs(info, attr);
+ }
++#endif
+ 
+--- shfs-0.35.orig/shfs/Linux-2.6/shfs_fs.h
++++ shfs-0.35/shfs/Linux-2.6/shfs_fs.h
+@@ -9,6 +9,12 @@
+ 
+ #include <linux/ioctl.h>
+ #include <linux/pagemap.h>
++#include <linux/version.h>
++
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
++#define NEW_VFS_DENTRY_API
++#define FLUSH_HAS_LOCK_OWNER
++#endif
+ 
+ #define SHFS_MAX_AGE(info)	(((info)->ttl * HZ) / 1000)
+ #define SOCKBUF_SIZE		(SHFS_PATH_MAX * 10)
+@@ -100,7 +106,12 @@ int reply(char *s);
+ void set_garbage(struct shfs_sb_info *info, int write, int count);
+ int get_name(struct dentry *d, char *name);
+ int shfs_notify_change(struct dentry *dentry, struct iattr *attr);
++
++#ifdef NEW_VFS_DENTRY_API
++int shfs_statfs(struct dentry *dentry, struct kstatfs *attr);
++#else
+ int shfs_statfs(struct super_block *sb, struct kstatfs *attr);
++#endif
+ 	
+ /* shfs/inode.c */
+ void shfs_set_inode_attr(struct inode *inode, struct shfs_fattr *fattr);
+--- shfs-0.35.orig/shfs/Linux-2.6/symlink.c
++++ shfs-0.35/shfs/Linux-2.6/symlink.c
+@@ -41,7 +41,7 @@ error:
+ 	return result;
+ }
+ 
+-static int
++static void *
+ shfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+ {
+ 	struct shfs_sb_info *info = info_from_dentry(dentry);
+@@ -61,7 +61,7 @@ shfs_follow_link(struct dentry *dentry, 
+ 	DEBUG("%s\n", real_name);
+ 	result = vfs_follow_link(nd, real_name);
+ error:
+-	return result;
++	return NULL;
+ }
+ 
+ struct inode_operations shfs_symlink_inode_operations = {
+--- shfs-0.35.orig/shfs/Linux-2.6/dcache.c	2004-06-01 15:16:19.000000000 +0200
++++ shfs-0.35/shfs/Linux-2.6/dcache.c	2006-02-17 17:36:02.000000000 +0100
+@@ -68,7 +68,7 @@
+ 	spin_lock(&dcache_lock);
+ 	next = parent->d_subdirs.next;
+ 	while (next != &parent->d_subdirs) {
+-		dentry = list_entry(next, struct dentry, d_child);
++		dentry = list_entry(next, struct dentry, d_u.d_child);
+ 		dentry->d_fsdata = NULL;
+ 		shfs_age_dentry(info, dentry);
+ 		next = next->next;
+@@ -101,7 +101,7 @@
+ 	spin_lock(&dcache_lock);
+ 	next = parent->d_subdirs.next;
+ 	while (next != &parent->d_subdirs) {
+-		dent = list_entry(next, struct dentry, d_child);
++		dent = list_entry(next, struct dentry, d_u.d_child);
+ 		if ((unsigned long)dent->d_fsdata == fpos) {
+ 			if (dent->d_inode)
+ 				dget_locked(dent);

+ 20 - 0
package/shfs/patches/102-shfs_0.35_clean_inode_clear.patch

@@ -0,0 +1,20 @@
+--- shfs-0.35.orig/shfs/Linux-2.6/inode.c.orig	2006-01-04 16:23:11.000000000 -0600
++++ shfs-0.35/shfs/Linux-2.6/inode.c	2006-01-04 16:24:45.000000000 -0600
+@@ -8,6 +8,7 @@
+ #include <linux/modversions.h>
+ #endif
+ 
++#include <linux/version.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
+@@ -118,6 +119,9 @@
+ 	}
+ 	KMEM_FREE("inode", inode_cache, i);
+ out:
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13))
++   truncate_inode_pages(&inode->i_data, 0);
++#endif
+ 	clear_inode(inode);
+ }
+ 

+ 0 - 21
package/shfs/patches/103-dentry.patch

@@ -1,21 +0,0 @@
-diff -urN shfs-0.35.orig/shfs/Linux-2.6/dcache.c shfs-0.35/shfs/Linux-2.6/dcache.c
---- shfs-0.35.orig/shfs/Linux-2.6/dcache.c	2004-06-01 09:16:19.000000000 -0400
-+++ shfs-0.35/shfs/Linux-2.6/dcache.c	2006-03-25 07:08:57.950752296 -0500
-@@ -68,7 +68,7 @@
- 	spin_lock(&dcache_lock);
- 	next = parent->d_subdirs.next;
- 	while (next != &parent->d_subdirs) {
--		dentry = list_entry(next, struct dentry, d_child);
-+		dentry = list_entry(next, struct dentry, d_u.d_child);
- 		dentry->d_fsdata = NULL;
- 		shfs_age_dentry(info, dentry);
- 		next = next->next;
-@@ -101,7 +101,7 @@
- 	spin_lock(&dcache_lock);
- 	next = parent->d_subdirs.next;
- 	while (next != &parent->d_subdirs) {
--		dent = list_entry(next, struct dentry, d_child);
-+		dent = list_entry(next, struct dentry, d_u.d_child);
- 		if ((unsigned long)dent->d_fsdata == fpos) {
- 			if (dent->d_inode)
- 				dget_locked(dent);

+ 0 - 2
package/shfs/patches/102-gcc4_fix.patch → package/shfs/patches/103-shfs_0.35_gcc4.patch

@@ -1,4 +1,3 @@
-diff -ur shfs-0.35/shfs/Linux-2.6/dir.c shfs-0.35-new/shfs/Linux-2.6/dir.c
 --- shfs-0.35/shfs/Linux-2.6/dir.c	2004-06-01 09:16:19.000000000 -0400
 +++ shfs-0.35-new/shfs/Linux-2.6/dir.c	2005-02-11 18:12:00.000000000 -0500
 @@ -19,6 +19,8 @@
@@ -10,7 +9,6 @@ diff -ur shfs-0.35/shfs/Linux-2.6/dir.c shfs-0.35-new/shfs/Linux-2.6/dir.c
  static int
  shfs_dir_open(struct inode *inode, struct file *filp)
  {
-diff -ur shfs-0.35/shfs/Linux-2.6/shfs_fs.h shfs-0.35-new/shfs/Linux-2.6/shfs_fs.h
 --- shfs-0.35/shfs/Linux-2.6/shfs_fs.h	2004-06-01 09:16:19.000000000 -0400
 +++ shfs-0.35-new/shfs/Linux-2.6/shfs_fs.h	2005-02-11 18:12:03.000000000 -0500
 @@ -50,7 +50,6 @@

+ 0 - 202
package/shfs/patches/104-linux_2.6.19.patch

@@ -1,202 +0,0 @@
-diff -urN shfs-0.35/shfs/Linux-2.6/dir.c shfs-0.35.new/shfs/Linux-2.6/dir.c
---- shfs-0.35/shfs/Linux-2.6/dir.c	2007-01-11 14:59:49.000000000 +0100
-+++ shfs-0.35.new/shfs/Linux-2.6/dir.c	2007-01-11 14:55:21.000000000 +0100
-@@ -302,8 +302,8 @@
- 	
- 	shfs_invalid_dir_cache(dir);
- 	result = shfs_instantiate(dentry);
--	if (forced_write && dentry->d_inode && dentry->d_inode->u.generic_ip)
--		((struct shfs_inode_info *)dentry->d_inode->u.generic_ip)->unset_write_on_close = 1;
-+	if (forced_write && dentry->d_inode && dentry->d_inode->i_private)
-+		((struct shfs_inode_info *)dentry->d_inode->i_private)->unset_write_on_close = 1;
- 	return result;
- }
- 
-diff -urN shfs-0.35/shfs/Linux-2.6/fcache.c shfs-0.35.new/shfs/Linux-2.6/fcache.c
---- shfs-0.35/shfs/Linux-2.6/fcache.c	2004-06-01 15:16:19.000000000 +0200
-+++ shfs-0.35.new/shfs/Linux-2.6/fcache.c	2007-01-11 14:55:21.000000000 +0100
-@@ -100,7 +100,7 @@
- 		VERBOSE("dir in file cache?\n");
- 		return -EINVAL;
- 	}
--	p = (struct shfs_inode_info *)inode->u.generic_ip;
-+	p = (struct shfs_inode_info *)inode->i_private;
- 	if (!p) {
- 		VERBOSE("inode without info\n");
- 		return -EINVAL;
-@@ -127,7 +127,7 @@
- 		VERBOSE("dir in file cache?\n");
- 		return -EINVAL;
- 	}
--	p = (struct shfs_inode_info *)inode->u.generic_ip;
-+	p = (struct shfs_inode_info *)inode->i_private;
- 	if (!p) {
- 		VERBOSE("inode without info\n");
- 		return -EINVAL;
-@@ -160,7 +160,7 @@
- 	if (result == 0) {
- 		struct shfs_inode_info *p;
- 
--		p = (struct shfs_inode_info *)f->f_dentry->d_inode->u.generic_ip;
-+		p = (struct shfs_inode_info *)f->f_dentry->d_inode->i_private;
- 		if (!p) {
- 			VERBOSE("inode without info\n");
- 			return -EINVAL;
-@@ -184,7 +184,7 @@
- 		return -EINVAL;
- 	}
- 	DEBUG("ino: %lu\n", inode->i_ino);
--	p = (struct shfs_inode_info *)inode->u.generic_ip;
-+	p = (struct shfs_inode_info *)inode->i_private;
- 	if (!p) {
- 		VERBOSE("inode without info\n");
- 		return -EINVAL;
-@@ -226,7 +226,7 @@
- 		VERBOSE("dir in file cache?\n");
- 		return -EINVAL;
- 	}
--	p = (struct shfs_inode_info *)inode->u.generic_ip;
-+	p = (struct shfs_inode_info *)inode->i_private;
- 	if (!p) {
- 		VERBOSE("inode without info\n");
- 		return -EINVAL;
-@@ -327,7 +327,7 @@
- 		VERBOSE("dir in file cache?\n");
- 		return -EINVAL;
- 	}
--	p = (struct shfs_inode_info *)inode->u.generic_ip;
-+	p = (struct shfs_inode_info *)inode->i_private;
- 	if (!p) {
- 		VERBOSE("inode without info\n");
- 		return -EINVAL;
-diff -urN shfs-0.35/shfs/Linux-2.6/file.c shfs-0.35.new/shfs/Linux-2.6/file.c
---- shfs-0.35/shfs/Linux-2.6/file.c	2004-06-01 15:16:19.000000000 +0200
-+++ shfs-0.35.new/shfs/Linux-2.6/file.c	2007-01-11 14:55:21.000000000 +0100
-@@ -9,6 +9,7 @@
- #include <asm/fcntl.h>
- #include <linux/smp_lock.h>
- #include <linux/stat.h>
-+#include <linux/fs.h>
- 
- #include "shfs_fs.h"
- #include "shfs_fs_sb.h"
-@@ -90,7 +91,7 @@
- 	struct dentry *dentry = f->f_dentry;
- 	struct shfs_sb_info *info = info_from_dentry(dentry);
- 	struct inode *inode = p->mapping->host;
--	struct shfs_inode_info *i = (struct shfs_inode_info *)inode->u.generic_ip;
-+	struct shfs_inode_info *i = (struct shfs_inode_info *)inode->i_private;
- 	char *buffer = kmap(p) + offset;
- 	int written = 0, result;
- 	unsigned count = to - offset;
-@@ -242,8 +243,8 @@
- 		}
- 	}
- 	/* if file was forced to be writeable, change attrs back on close */
--	if (dentry->d_inode && dentry->d_inode->u.generic_ip) {
--		if  (((struct shfs_inode_info *)dentry->d_inode->u.generic_ip)->unset_write_on_close) {
-+	if (dentry->d_inode && dentry->d_inode->i_private) {
-+		if  (((struct shfs_inode_info *)dentry->d_inode->i_private)->unset_write_on_close) {
- 			char name[SHFS_PATH_MAX];
- 
- 			if (get_name(dentry, name) < 0)
-@@ -320,8 +321,8 @@
- 
- struct file_operations shfs_file_operations = {
- 	.llseek		= generic_file_llseek,
--	.read		= generic_file_read,
--	.write		= generic_file_write,
-+	.read		= generic_file_aio_read,
-+	.write		= generic_file_aio_write,
- 	.ioctl		= shfs_ioctl,
- 	.mmap		= generic_file_mmap,
- 	.open		= shfs_file_open,
-diff -urN shfs-0.35/shfs/Linux-2.6/inode.c shfs-0.35.new/shfs/Linux-2.6/inode.c
---- shfs-0.35/shfs/Linux-2.6/inode.c	2004-06-01 15:16:19.000000000 +0200
-+++ shfs-0.35.new/shfs/Linux-2.6/inode.c	2007-01-11 14:55:21.000000000 +0100
-@@ -35,7 +35,7 @@
- shfs_set_inode_attr(struct inode *inode, struct shfs_fattr *fattr)
- {
- 	struct shfs_sb_info *info = info_from_inode(inode);
--	struct shfs_inode_info *i = inode->u.generic_ip;
-+	struct shfs_inode_info *i = inode->i_private;
- 	struct timespec last_time = inode->i_mtime;
- 	loff_t last_size = inode->i_size;
- 
-@@ -52,7 +52,6 @@
- 	inode->i_ctime	= fattr->f_ctime;
- 	inode->i_atime	= fattr->f_atime;
- 	inode->i_mtime	= fattr->f_mtime;
--	inode->i_blksize= fattr->f_blksize;
- 	inode->i_blocks	= fattr->f_blocks;
- 	inode->i_size	= fattr->f_size;
- 
-@@ -75,7 +74,7 @@
- 	if (!inode)
- 		return NULL;
- 	inode->i_ino = fattr->f_ino;
--	i = inode->u.generic_ip = (struct shfs_inode_info *)KMEM_ALLOC("inode", inode_cache, GFP_KERNEL);
-+	i = inode->i_private = (struct shfs_inode_info *)KMEM_ALLOC("inode", inode_cache, GFP_KERNEL);
- 	if (!i)
- 		return NULL;
- 	i->cache = NULL;
-@@ -107,7 +106,7 @@
- 	struct shfs_inode_info *i;
- 
- 	DEBUG("ino: %lu\n", inode->i_ino);
--	i = (struct shfs_inode_info *)inode->u.generic_ip;
-+	i = (struct shfs_inode_info *)inode->i_private;
- 	if (!i) {
- 		VERBOSE("invalid inode\n");
- 		goto out;
-@@ -172,7 +171,7 @@
- {
- 	struct shfs_sb_info *info = info_from_dentry(dentry);
- 	struct inode *inode = dentry->d_inode;
--	struct shfs_inode_info *i = (struct shfs_inode_info *)inode->u.generic_ip;
-+	struct shfs_inode_info *i = (struct shfs_inode_info *)inode->i_private;
- 	int result;
- 
-         DEBUG("%s\n", dentry->d_name.name);
-@@ -339,9 +338,9 @@
- 
- static struct super_block *
- shfs_get_sb(struct file_system_type *fs_type,
--	    int flags, const char *dev_name, void *data)
-+	    int flags, const char *dev_name, void *data, struct vfsmount *mnt)
- {
--	return get_sb_nodev(fs_type, flags, data, shfs_read_super);
-+	return get_sb_nodev(fs_type, flags, data, shfs_read_super, mnt);
- }
- 
- static struct file_system_type sh_fs_type = {
-diff -urN shfs-0.35/shfs/Linux-2.6/proc.c shfs-0.35.new/shfs/Linux-2.6/proc.c
---- shfs-0.35/shfs/Linux-2.6/proc.c	2004-06-01 15:16:19.000000000 +0200
-+++ shfs-0.35.new/shfs/Linux-2.6/proc.c	2007-01-11 14:55:21.000000000 +0100
-@@ -178,7 +178,7 @@
- 
- 		vec[0].iov_base = (void *)buffer;
- 		vec[0].iov_len = c;
--		result = f->f_op->writev(f, (const struct iovec *) &vec, 1, &f->f_pos);
-+		result = f->f_op->aio_write(f, (const struct iovec *) &vec, 1, &f->f_pos);
- 		if (result < 0) {
- 			DEBUG("error: %d\n", result);
- 			if (result == -EAGAIN)
-@@ -261,7 +261,7 @@
- 
- 		vec[0].iov_base = buffer;
- 		vec[0].iov_len = c;
--		result = f->f_op->readv(f, (const struct iovec *)&vec, 1, &f->f_pos);
-+		result = f->f_op->aio_read(f, (const struct iovec *)&vec, 1, &f->f_pos);
- 		if (!result) {
- 			/*  peer has closed socket */
- 			result = -EIO;
-@@ -350,7 +350,7 @@
- 
- 		vec[0].iov_base = BUFFER+LEN;
- 		vec[0].iov_len = c;
--		result = f->f_op->readv(f, (const struct iovec *)&vec, 1, &f->f_pos);
-+		result = f->f_op->aio_read(f, (const struct iovec *)&vec, 1, &f->f_pos);
- 		SIGLOCK(flags);
- 		if (result == -EPIPE && !sigpipe) {
- 			sigdelset(&current->pending.signal, SIGPIPE);

+ 367 - 0
package/shfs/patches/104-shfs_0.35_inode_and_fs.patch

@@ -0,0 +1,367 @@
+--- shfs-0.35.orig/shfs/Linux-2.6/fcache.c	2007-01-03 22:29:26.000000000 -0600
++++ shfs-0.35/shfs/Linux-2.6/fcache.c	2007-01-03 22:34:21.000000000 -0600
+@@ -100,7 +100,11 @@
+ 		VERBOSE("dir in file cache?\n");
+ 		return -EINVAL;
+ 	}
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	p = (struct shfs_inode_info *)inode->i_private;
++#else
+ 	p = (struct shfs_inode_info *)inode->u.generic_ip;
++#endif
+ 	if (!p) {
+ 		VERBOSE("inode without info\n");
+ 		return -EINVAL;
+@@ -127,7 +131,11 @@
+ 		VERBOSE("dir in file cache?\n");
+ 		return -EINVAL;
+ 	}
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	p = (struct shfs_inode_info *)inode->i_private;
++#else
+ 	p = (struct shfs_inode_info *)inode->u.generic_ip;
++#endif
+ 	if (!p) {
+ 		VERBOSE("inode without info\n");
+ 		return -EINVAL;
+@@ -160,7 +168,11 @@
+ 	if (result == 0) {
+ 		struct shfs_inode_info *p;
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++		p = (struct shfs_inode_info *)f->f_dentry->d_inode->i_private;
++#else
+ 		p = (struct shfs_inode_info *)f->f_dentry->d_inode->u.generic_ip;
++#endif
+ 		if (!p) {
+ 			VERBOSE("inode without info\n");
+ 			return -EINVAL;
+@@ -184,7 +196,11 @@
+ 		return -EINVAL;
+ 	}
+ 	DEBUG("ino: %lu\n", inode->i_ino);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	p = (struct shfs_inode_info *)inode->i_private;
++#else
+ 	p = (struct shfs_inode_info *)inode->u.generic_ip;
++#endif
+ 	if (!p) {
+ 		VERBOSE("inode without info\n");
+ 		return -EINVAL;
+@@ -226,7 +242,11 @@
+ 		VERBOSE("dir in file cache?\n");
+ 		return -EINVAL;
+ 	}
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	p = (struct shfs_inode_info *)inode->i_private;
++#else
+ 	p = (struct shfs_inode_info *)inode->u.generic_ip;
++#endif
+ 	if (!p) {
+ 		VERBOSE("inode without info\n");
+ 		return -EINVAL;
+@@ -327,7 +347,11 @@
+ 		VERBOSE("dir in file cache?\n");
+ 		return -EINVAL;
+ 	}
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	p = (struct shfs_inode_info *)inode->i_private;
++#else
+ 	p = (struct shfs_inode_info *)inode->u.generic_ip;
++#endif
+ 	if (!p) {
+ 		VERBOSE("inode without info\n");
+ 		return -EINVAL;
+--- shfs-0.35.orig/shfs/Linux-2.6/inode.c	2004-06-01 08:16:19.000000000 -0500
++++ shfs-0.35/shfs/Linux-2.6/inode.c	2007-01-03 22:39:44.000000000 -0600
+@@ -35,7 +36,11 @@
+ shfs_set_inode_attr(struct inode *inode, struct shfs_fattr *fattr)
+ {
+ 	struct shfs_sb_info *info = info_from_inode(inode);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	struct shfs_inode_info *i = inode->i_private;
++#else
+ 	struct shfs_inode_info *i = inode->u.generic_ip;
++#endif
+ 	struct timespec last_time = inode->i_mtime;
+ 	loff_t last_size = inode->i_size;
+ 
+@@ -52,7 +57,9 @@
+ 	inode->i_ctime	= fattr->f_ctime;
+ 	inode->i_atime	= fattr->f_atime;
+ 	inode->i_mtime	= fattr->f_mtime;
++#ifdef STRUCT_INODE_HAS_I_BLKSIZE
+ 	inode->i_blksize= fattr->f_blksize;
++#endif
+ 	inode->i_blocks	= fattr->f_blocks;
+ 	inode->i_size	= fattr->f_size;
+ 
+@@ -75,7 +82,11 @@
+ 	if (!inode)
+ 		return NULL;
+ 	inode->i_ino = fattr->f_ino;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	i = inode->i_private = (struct shfs_inode_info *)KMEM_ALLOC("inode", inode_cache, GFP_KERNEL);
++#else
+ 	i = inode->u.generic_ip = (struct shfs_inode_info *)KMEM_ALLOC("inode", inode_cache, GFP_KERNEL);
++#endif
+ 	if (!i)
+ 		return NULL;
+ 	i->cache = NULL;
+@@ -107,7 +118,11 @@
+ 	struct shfs_inode_info *i;
+ 
+ 	DEBUG("ino: %lu\n", inode->i_ino);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	i = (struct shfs_inode_info *)inode->i_private;
++#else
+ 	i = (struct shfs_inode_info *)inode->u.generic_ip;
++#endif
+ 	if (!i) {
+ 		VERBOSE("invalid inode\n");
+ 		goto out;
+@@ -172,7 +190,11 @@
+ {
+ 	struct shfs_sb_info *info = info_from_dentry(dentry);
+ 	struct inode *inode = dentry->d_inode;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	struct shfs_inode_info *i = (struct shfs_inode_info *)inode->i_private;
++#else
+ 	struct shfs_inode_info *i = (struct shfs_inode_info *)inode->u.generic_ip;
++#endif
+ 	int result;
+ 
+         DEBUG("%s\n", dentry->d_name.name);
+--- shfs-0.35.orig/shfs/Linux-2.6/dir.c	2007-01-03 22:38:23.000000000 -0600
++++ shfs-0.35/shfs/Linux-2.6/dir.c	2007-01-03 22:39:06.000000000 -0600
+@@ -302,8 +302,13 @@
+ 	
+ 	shfs_invalid_dir_cache(dir);
+ 	result = shfs_instantiate(dentry);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	if (forced_write && dentry->d_inode && dentry->d_inode->i_private)
++		((struct shfs_inode_info *)dentry->d_inode->i_private)->unset_write_on_close = 1;
++#else
+ 	if (forced_write && dentry->d_inode && dentry->d_inode->u.generic_ip)
+ 		((struct shfs_inode_info *)dentry->d_inode->u.generic_ip)->unset_write_on_close = 1;
++#endif
+ 	return result;
+ }
+ 
+--- shfs-0.35.orig/shfs/Linux-2.6/file.c	2007-01-03 22:40:24.000000000 -0600
++++ shfs-0.35/shfs/Linux-2.6/file.c	2007-01-03 22:45:11.000000000 -0600
+@@ -90,7 +90,11 @@
+ 	struct dentry *dentry = f->f_dentry;
+ 	struct shfs_sb_info *info = info_from_dentry(dentry);
+ 	struct inode *inode = p->mapping->host;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	struct shfs_inode_info *i = (struct shfs_inode_info *)inode->i_private;
++#else
+ 	struct shfs_inode_info *i = (struct shfs_inode_info *)inode->u.generic_ip;
++#endif
+ 	char *buffer = kmap(p) + offset;
+ 	int written = 0, result;
+ 	unsigned count = to - offset;
+@@ -252,8 +256,13 @@
+ 		}
+ 	}
+ 	/* if file was forced to be writeable, change attrs back on close */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	if (dentry->d_inode && dentry->d_inode->i_private) {
++		if  (((struct shfs_inode_info *)dentry->d_inode->i_private)->unset_write_on_close) {
++#else
+ 	if (dentry->d_inode && dentry->d_inode->u.generic_ip) {
+ 		if  (((struct shfs_inode_info *)dentry->d_inode->u.generic_ip)->unset_write_on_close) {
++#endif
+ 			char name[SHFS_PATH_MAX];
+ 
+ 			if (get_name(dentry, name) < 0)
+@@ -302,7 +311,8 @@
+ 		goto error;
+ 	}
+ 	if (result != 0) {
+-		copy_to_user(buf, (char *)page, result);
++		if (copy_to_user(buf, (char *)page, result))
++			goto error;
+ 		*ppos += result;
+ 	}
+ error:
+@@ -315,11 +325,15 @@
+ static ssize_t 
+ shfs_slow_write(struct file *f, const char *buf, size_t count, loff_t *offset)
+ {
+-	int written = 0;
++	ssize_t written = 0;
+ 	int result;
+ 	
+ 	DEBUG("\n");
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	written = do_sync_write(f, buf, count, offset);
++#else
+ 	written = generic_file_write(f, buf, count, offset);
++#endif
+ 	if (written > 0) {
+ 		result = do_file_flush(f);
+ 		written = result < 0 ? result: written;
+@@ -330,14 +344,23 @@
+ 
+ struct file_operations shfs_file_operations = {
+ 	.llseek		= generic_file_llseek,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	.read		= do_sync_read,
++	.write		= do_sync_write,
++#else
+ 	.read		= generic_file_read,
+ 	.write		= generic_file_write,
++#endif
+ 	.ioctl		= shfs_ioctl,
+ 	.mmap		= generic_file_mmap,
+ 	.open		= shfs_file_open,
+ 	.flush		= shfs_file_flush,
+ 	.release	= shfs_file_release,
+ 	.fsync		= shfs_file_sync,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	.aio_read	= generic_file_aio_read,
++	.aio_write	= generic_file_aio_write,
++#endif
+ };
+ 
+ struct file_operations shfs_slow_operations = {
+--- shfs-0.35.orig/shfs/Linux-2.6/proc.c	2007-01-03 22:45:32.000000000 -0600
++++ shfs-0.35/shfs/Linux-2.6/proc.c	2007-01-03 22:57:17.000000000 -0600
+@@ -149,7 +149,12 @@
+ {
+ 	struct file *f = info->sock;
+ 	mm_segment_t fs;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	ssize_t result = 0;
++	loff_t begin;
++#else
+ 	int c, result = 0;
++#endif
+ 	unsigned long flags, sigpipe;
+ 	sigset_t old_set;
+ 
+@@ -161,7 +166,9 @@
+ 			return result;
+ 	}
+ 	
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ 	c = count;
++#endif
+ 
+ 	fs = get_fs();
+ 	set_fs(get_ds());
+@@ -173,6 +180,16 @@
+ 	SIGRECALC;
+ 	SIGUNLOCK(flags);
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	begin = f->f_pos;
++	result = do_sync_write(f, buffer, count, &f->f_pos);
++
++	if (result < 0) {
++		DEBUG("error: %d\n", result);
++		fput(f);
++		info->sock = NULL;
++	}
++#else
+ 	do {
+ 		struct iovec vec[1];
+ 
+@@ -190,6 +207,7 @@
+ 		buffer += result;
+ 		c -= result;
+ 	} while (c > 0);
++#endif
+ 
+ 	SIGLOCK(flags);
+ 	if (result == -EPIPE && !sigpipe) {
+@@ -204,7 +222,11 @@
+ 
+ 	DEBUG(">%d\n", result);
+ 	if (result < 0)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++		set_garbage(info, 1, count - (f->f_pos - begin));
++#else
+ 		set_garbage(info, 1, c);
++#endif
+ 	else
+ 		result = count;
+ 	return result;
+@@ -222,6 +244,9 @@
+ 	int c, result = 0;
+ 	unsigned long flags, sigpipe;
+ 	sigset_t old_set;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	loff_t begin;
++#endif
+ 
+ 	if (!f)
+ 		return -EIO;
+@@ -256,6 +281,20 @@
+ 	fs = get_fs();
+ 	set_fs(get_ds());
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++	begin = f->f_pos;
++	result = do_sync_read(f, buffer, c, &f->f_pos);
++
++	if (!result) {
++		/* peer has closed socket */
++		result = -EIO;
++	}
++	if (result < 0) {
++		DEBUG("error: %d\n", result);
++		fput(f);
++		info->sock = NULL;
++	}
++#else
+ 	do {
+ 		struct iovec vec[1];
+ 
+@@ -277,6 +316,7 @@
+ 		buffer += result;
+ 		c -= result;
+ 	} while (c > 0);
++#endif
+ 
+ 	SIGLOCK(flags);
+ 	if (result == -EPIPE && !sigpipe) {
+@@ -291,7 +331,11 @@
+ 	
+ 	DEBUG("<%d\n", result);
+ 	if (result < 0)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++		set_garbage(info, 0, count - (f->f_pos - begin));
++#else
+ 		set_garbage(info, 0, c);
++#endif
+ 	else
+ 		result = count;
+ 	return result;
+@@ -316,8 +360,10 @@
+ 			return result;
+ 	}
+ 	while (1) {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ 		struct iovec vec[1];
+ 
++#endif
+ 		nl = memchr(BUFFER, '\n', LEN);
+ 		if (nl) {
+ 			*nl = '\0';
+@@ -348,9 +394,13 @@
+ 		fs = get_fs();
+ 		set_fs(get_ds());
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
++		result = do_sync_read(f, BUFFER+LEN, c, &f->f_pos);
++#else
+ 		vec[0].iov_base = BUFFER+LEN;
+ 		vec[0].iov_len = c;
+ 		result = f->f_op->readv(f, (const struct iovec *)&vec, 1, &f->f_pos);
++#endif
+ 		SIGLOCK(flags);
+ 		if (result == -EPIPE && !sigpipe) {
+ 			sigdelset(&current->pending.signal, SIGPIPE);

+ 66 - 0
package/shfs/patches/105-space_chars.patch

@@ -0,0 +1,66 @@
+--- shfs-0.35.orig/shfs/Linux-2.4/shell.c	31 May 2004 16:32:13 -0000	1.6
++++ shfs-0.35/shfs/Linux-2.4/shell.c	3 Jun 2004 09:09:54 -0000
+@@ -213,6 +213,7 @@
+ 	int c = 0;
+ 	int is_space = 1;
+ 	int device = 0;
++	char *start = s;
+ 
+ 	while (*s) {
+ 		if (c == DIR_COLS)
+@@ -227,17 +228,20 @@
+ 						s++;
+ 				}
+ 				*s = '\0';
++				start = s+1;
+ 				is_space = 1;
++			} else {
++				if (c != DIR_NAME)
++					start = s+1;
+ 			}
+ 		} else {
+ 			if (is_space) {
+ 				/* (b)lock/(c)haracter device hack */
+-				col[c++] = s;
++				col[c++] = start;
+ 				is_space = 0;
+ 				if ((c-1 == DIR_PERM) && ((*s == 'b')||(*s == 'c'))) {
+ 					device = 1;
+ 				}
+-
+ 			}
+ 		}
+ 		s++;
+--- shfs-0.35.orig/shfs/Linux-2.6/shell.c	31 May 2004 16:32:13 -0000	1.7
++++ shfs-0.35/shfs/Linux-2.6/shell.c	3 Jun 2004 09:09:57 -0000
+@@ -225,6 +225,7 @@
+ 	int c = 0;
+ 	int is_space = 1;
+ 	int device = 0;
++	char *start = s;
+ 
+ 	while (*s) {
+ 		if (c == DIR_COLS)
+@@ -239,17 +240,20 @@
+ 						s++;
+ 				}
+ 				*s = '\0';
++				start = s+1;
+ 				is_space = 1;
++			} else {
++				if (c != DIR_NAME)
++					start = s+1;
+ 			}
+ 		} else {
+ 			if (is_space) {
+ 				/* (b)lock/(c)haracter device hack */
+-				col[c++] = s;
++				col[c++] = start;
+ 				is_space = 0;
+ 				if ((c-1 == DIR_PERM) && ((*s == 'b')||(*s == 'c'))) {
+ 					device = 1;
+ 				}
+-
+ 			}
+ 		}
+ 		s++;

+ 34 - 0
package/shfs/patches/106-uidgid32.patch

@@ -0,0 +1,34 @@
+--- shfs-0.35.orig/shfs/Linux-2.4/shfs_fs_sb.h	24 Mar 2004 13:40:02 -0000	1.2
++++ shfs-0.35/shfs/Linux-2.4/shfs_fs_sb.h	3 Jun 2004 17:12:28 -0000
+@@ -38,10 +38,10 @@
+ 	struct shfs_fileops fops;
+ 	int version;
+ 	int ttl;
+-	__kernel_uid_t uid;
+-	__kernel_gid_t gid;
+-	__kernel_mode_t root_mode;
+-	__kernel_mode_t fmask;
++	uid_t uid;
++	gid_t gid;
++	mode_t root_mode;
++	mode_t fmask;
+ 	char mount_point[SHFS_PATH_MAX];
+ 	struct semaphore sock_sem;	/* next 4 vars are guarded */
+ 	struct file *sock;
+--- shfs-0.35.orig/shfs/Linux-2.6/shfs_fs_sb.h	24 Mar 2004 13:40:02 -0000	1.2
++++ shfs-0.35/shfs/Linux-2.6/shfs_fs_sb.h	3 Jun 2004 17:12:28 -0000
+@@ -38,10 +38,10 @@
+ 	struct shfs_fileops fops;
+ 	int version;
+ 	int ttl;
+-	__kernel_uid_t uid;
+-	__kernel_gid_t gid;
+-	__kernel_mode_t root_mode;
+-	__kernel_mode_t fmask;
++	uid_t uid;
++	gid_t gid;
++	mode_t root_mode;
++	mode_t fmask;
+ 	char mount_point[SHFS_PATH_MAX];
+ 	struct semaphore sock_sem;	/* next 4 vars are guarded */
+ 	struct file *sock;

+ 34 - 0
package/shfs/patches/107-df.patch

@@ -0,0 +1,34 @@
+--- shfs-0.35.orig/shfs/Linux-2.4/shell.c	3 Jun 2004 13:20:44 -0000	1.8
++++ shfs-0.35/shfs/Linux-2.4/shell.c	18 Jun 2004 12:19:52 -0000
+@@ -961,11 +961,11 @@
+ 
+ 	s = info->sockbuf;
+ 	if ((p = strsep(&s, " ")))
+-		attr->f_blocks = simple_strtoull(p, NULL, 10);
++		attr->f_blocks = simple_strtoull(p, NULL, 10) >> 2;
+ 	if ((p = strsep(&s, " ")))
+-		attr->f_bfree = attr->f_blocks - simple_strtoull(p, NULL, 10);
++		attr->f_bfree = attr->f_blocks - (simple_strtoull(p, NULL, 10) >> 2);
+ 	if ((p = strsep(&s, " ")))
+-		attr->f_bavail = simple_strtoull(p, NULL, 10);
++		attr->f_bavail = simple_strtoull(p, NULL, 10) >> 2;
+ 
+ 	result = sock_readln(info, info->sockbuf, SOCKBUF_SIZE);
+ 	if (result < 0)
+--- shfs-0.35.orig/shfs/Linux-2.6/shell.c	3 Jun 2004 13:20:47 -0000	1.9
++++ shfs-0.35/shfs/Linux-2.6/shell.c	18 Jun 2004 12:19:53 -0000
+@@ -974,11 +974,11 @@
+ 
+ 	s = info->sockbuf;
+ 	if ((p = strsep(&s, " ")))
+-		attr->f_blocks = simple_strtoull(p, NULL, 10);
++		attr->f_blocks = simple_strtoull(p, NULL, 10) >> 2;
+ 	if ((p = strsep(&s, " ")))
+-		attr->f_bfree = attr->f_blocks - simple_strtoull(p, NULL, 10);
++		attr->f_bfree = attr->f_blocks - (simple_strtoull(p, NULL, 10) >> 2);
+ 	if ((p = strsep(&s, " ")))
+-		attr->f_bavail = simple_strtoull(p, NULL, 10);
++		attr->f_bavail = simple_strtoull(p, NULL, 10) >> 2;
+ 
+ 	result = sock_readln(info, info->sockbuf, SOCKBUF_SIZE);
+ 	if (result < 0)

+ 24 - 0
package/shfs/patches/108-no_update_mtab.patch

@@ -0,0 +1,24 @@
+--- shfs-0.35.orig/shfsmount/shfsmount.c	2004-06-01 14:16:19.000000000 +0100
++++ shfs-0.35/shfsmount/shfsmount.c	2007-03-28 21:23:47.194043034 +0100
+@@ -74,7 +74,7 @@
+ static int have_uid = 0;
+ 
+ /* do not update /etc/mtab */
+-static int nomtab = 0;
++static int nomtab = 1;
+ 
+ /* preserve owner of files */
+ static int preserve = 0;
+--- shfs-0.35.orig/shfsmount/shfsumount.c	2004-06-01 14:16:19.000000000 +0100
++++ shfs-0.35/shfsmount/shfsumount.c	2007-03-28 21:49:28.937840351 +0100
+@@ -67,10 +67,6 @@
+ 	FILE *new_mtab;
+ 	struct mntent *ment;
+ 
+-        if ((fd = open(MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) == -1) {
+-                fprintf(stderr, "Can't get "MOUNTED"~ lock file");
+-                return 0;
+-        }
+         close(fd);
+         if ((mtab = setmntent(MOUNTED, "r")) == NULL) {
+                 fprintf(stderr, "Can't open " MOUNTED ": %s\n", strerror(errno));