fix compile for new kernel (bug #157111)
authorSaleem Abdulrasool <compnerd@gentoo.org>
Thu, 4 Jan 2007 05:28:14 +0000 (05:28 +0000)
committerSaleem Abdulrasool <compnerd@gentoo.org>
Thu, 4 Jan 2007 05:28:14 +0000 (05:28 +0000)
Package-Manager: portage-2.1.2_rc4-r5

net-fs/shfs/ChangeLog
net-fs/shfs/Manifest
net-fs/shfs/files/0.35/shfs-0.35-inode-and-fs.patch [new file with mode: 0644]
net-fs/shfs/files/digest-shfs-0.35-r4 [new file with mode: 0644]
net-fs/shfs/shfs-0.35-r4.ebuild [new file with mode: 0644]

index 4343c0b31412585adc2822b0104c5bcfb644898c..f67054871f77cd25ab492ede7738071021a88eec 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for net-fs/shfs
 # Copyright 2000-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-fs/shfs/ChangeLog,v 1.39 2007/01/04 05:19:43 compnerd Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-fs/shfs/ChangeLog,v 1.40 2007/01/04 05:28:14 compnerd Exp $
+
+*shfs-0.35-r4 (04 Jan 2007)
+
+  04 Jan 2007; Saleem Abdulrasool <compnerd@gentoo.org>
+  +files/0.35/shfs-0.35-inode-and-fs.patch, +shfs-0.35-r4.ebuild:
+  Revbump to unstable, add a new patch to allow compiling with kernels <2.6.19
+  (bug #157111).
 
   04 Jan 2007; Saleem Abdulrasool <compnerd@gentoo.org>
   -shfs-0.35-r1.ebuild, -shfs-0.35-r2.ebuild:
index 1ed3438e269d7b5eae32bd1f49a8a48bcffe43a7..6e0104e5a9760383791581d4cca5bbe19fdfc2be 100644 (file)
@@ -14,6 +14,10 @@ AUX 0.35/shfs-0.35-gcc4.patch 1008 RMD160 364fd4820d5041211809293131d1850bc5f657
 MD5 aa8bade7210ab4840af4a009378a96c3 files/0.35/shfs-0.35-gcc4.patch 1008
 RMD160 364fd4820d5041211809293131d1850bc5f6577a files/0.35/shfs-0.35-gcc4.patch 1008
 SHA256 62dece02a5bec68f34e0d9b5eb4bc69d087772bb983ec6f3ab91c1ca1f899414 files/0.35/shfs-0.35-gcc4.patch 1008
+AUX 0.35/shfs-0.35-inode-and-fs.patch 9871 RMD160 f96a10616f4613b3b0963683f82ebffee2250ee7 SHA1 7af82b98495551991dea704e064a08a6d63991f0 SHA256 fcef3ed44a63b8a722e552f4886f7f19aeaf62656ea5aed10f77677ab5c9b126
+MD5 ce9993ac4e4881959578501fbfc33691 files/0.35/shfs-0.35-inode-and-fs.patch 9871
+RMD160 f96a10616f4613b3b0963683f82ebffee2250ee7 files/0.35/shfs-0.35-inode-and-fs.patch 9871
+SHA256 fcef3ed44a63b8a722e552f4886f7f19aeaf62656ea5aed10f77677ab5c9b126 files/0.35/shfs-0.35-inode-and-fs.patch 9871
 AUX 0.35/space_chars.patch 1276 RMD160 6f68980f39716570772ed3b340c70220fdcd66ed SHA1 674b396a588a7ed4efec2fdca1afff2e47775cfd SHA256 e071e9fed81cbb5c4ecd7e62574136014fec1916a79277216d036233700fd859
 MD5 e5f37f793e95acdfd8e89affe9949160 files/0.35/space_chars.patch 1276
 RMD160 6f68980f39716570772ed3b340c70220fdcd66ed files/0.35/space_chars.patch 1276
@@ -43,10 +47,14 @@ EBUILD shfs-0.35-r3.ebuild 2980 RMD160 d82568c38f109a4649d25925899133fb464dbcd1
 MD5 77ad145c5356c5dd76c5680560b5d5d0 shfs-0.35-r3.ebuild 2980
 RMD160 d82568c38f109a4649d25925899133fb464dbcd1 shfs-0.35-r3.ebuild 2980
 SHA256 df3233ba0aeba64098b8212c66c40d8732b8295d4fcb89c9374c5b76151a5ef6 shfs-0.35-r3.ebuild 2980
-MISC ChangeLog 5952 RMD160 ac7d57d862cec0b2c9aa94e9327ba13196d5c93c SHA1 0430a480284c689c2629716c5c650b3cefe10ca1 SHA256 6f86039ba4dd703c8d5294e0bd2001d4f565a719cda6360476d4d946c19a887f
-MD5 085faf23564b20906b1479e24da1ed99 ChangeLog 5952
-RMD160 ac7d57d862cec0b2c9aa94e9327ba13196d5c93c ChangeLog 5952
-SHA256 6f86039ba4dd703c8d5294e0bd2001d4f565a719cda6360476d4d946c19a887f ChangeLog 5952
+EBUILD shfs-0.35-r4.ebuild 2978 RMD160 3a4aeae2c781cf09d2255f371fed39510e553a9c SHA1 28ff6e6e2a78d716f43280e7c94632a48d125522 SHA256 8da31293270fba7fed91a4e3d444fd2344e5b2f0e0b3df560e8021d61a9896b5
+MD5 41b6c6c309153a352c9115cc56dff566 shfs-0.35-r4.ebuild 2978
+RMD160 3a4aeae2c781cf09d2255f371fed39510e553a9c shfs-0.35-r4.ebuild 2978
+SHA256 8da31293270fba7fed91a4e3d444fd2344e5b2f0e0b3df560e8021d61a9896b5 shfs-0.35-r4.ebuild 2978
+MISC ChangeLog 6200 RMD160 960de60041ff35bcb028737ca539e217f1ae748a SHA1 af09e218fbb01a3c8b0b6a39f33d757d3149c2ff SHA256 e38cd65f8f6c806c7964c9abeff42eb7718305e31ffa0ae81925b8a838a160e1
+MD5 27158308f8dc6a149a9f5ad84ccdd340 ChangeLog 6200
+RMD160 960de60041ff35bcb028737ca539e217f1ae748a ChangeLog 6200
+SHA256 e38cd65f8f6c806c7964c9abeff42eb7718305e31ffa0ae81925b8a838a160e1 ChangeLog 6200
 MISC metadata.xml 316 RMD160 30fe60772d122936494f213695185bb0813573cd SHA1 61bd32ae3070498a6de3293057e635857ebd02d9 SHA256 b35b4409d798f1bbed76ec77c74cd92f7a039d9ce6a46a354d923dadaacbf5f2
 MD5 b66027267bc1b372e656d834984ad137 metadata.xml 316
 RMD160 30fe60772d122936494f213695185bb0813573cd metadata.xml 316
@@ -54,3 +62,6 @@ SHA256 b35b4409d798f1bbed76ec77c74cd92f7a039d9ce6a46a354d923dadaacbf5f2 metadata
 MD5 75f65e3cf2f6e55b656d19c95e20e8a7 files/digest-shfs-0.35-r3 229
 RMD160 aab2140106e569b8d91bc8a8db139f638258a6ae files/digest-shfs-0.35-r3 229
 SHA256 7614062a06a4db97cf760425cf5ba053774a670dc17f455c426f6213c38671f5 files/digest-shfs-0.35-r3 229
+MD5 75f65e3cf2f6e55b656d19c95e20e8a7 files/digest-shfs-0.35-r4 229
+RMD160 aab2140106e569b8d91bc8a8db139f638258a6ae files/digest-shfs-0.35-r4 229
+SHA256 7614062a06a4db97cf760425cf5ba053774a670dc17f455c426f6213c38671f5 files/digest-shfs-0.35-r4 229
diff --git a/net-fs/shfs/files/0.35/shfs-0.35-inode-and-fs.patch b/net-fs/shfs/files/0.35/shfs-0.35-inode-and-fs.patch
new file mode 100644 (file)
index 0000000..7bdee20
--- /dev/null
@@ -0,0 +1,367 @@
+--- shfs/Linux-2.6/fcache.c    2007-01-03 22:29:26.000000000 -0600
++++ 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/Linux-2.6/inode.c     2004-06-01 08:16:19.000000000 -0500
++++ 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/Linux-2.6/dir.c       2007-01-03 22:38:23.000000000 -0600
++++ 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/Linux-2.6/file.c      2007-01-03 22:40:24.000000000 -0600
++++ 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/Linux-2.6/proc.c      2007-01-03 22:45:32.000000000 -0600
++++ 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);
diff --git a/net-fs/shfs/files/digest-shfs-0.35-r4 b/net-fs/shfs/files/digest-shfs-0.35-r4
new file mode 100644 (file)
index 0000000..5d55d11
--- /dev/null
@@ -0,0 +1,3 @@
+MD5 016f49d71bc32eee2b5d11fc1600cfbe shfs-0.35.tar.gz 128656
+RMD160 84bc1c1d6bf5bd722fe1e4b3a4055843b11eda7a shfs-0.35.tar.gz 128656
+SHA256 0d48ffe4d801180c15466f20aaa5802adb9d22067e8941e051dc3c64717ec3c2 shfs-0.35.tar.gz 128656
diff --git a/net-fs/shfs/shfs-0.35-r4.ebuild b/net-fs/shfs/shfs-0.35-r4.ebuild
new file mode 100644 (file)
index 0000000..2d03100
--- /dev/null
@@ -0,0 +1,118 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/shfs/shfs-0.35-r4.ebuild,v 1.1 2007/01/04 05:28:14 compnerd Exp $
+
+inherit linux-mod eutils
+
+DESCRIPTION="Secure Shell File System"
+HOMEPAGE="http://shfs.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~sparc ~x86"
+IUSE="X amd doc"
+
+RDEPEND="virtual/modutils
+               net-misc/openssh
+               amd? ( net-fs/am-utils )"
+DEPEND="virtual/linux-sources
+               sys-apps/sed
+               ${RDEPEND}"
+PDEPEND="X? ( net-misc/x11-ssh-askpass )"
+
+CONFIG_CHECK="@SH_FS:shfs"
+SH_FS_ERROR="SHFS is built into the kernel.  Only userland utilities will be provided."
+
+pkg_setup() {
+       linux-mod_pkg_setup
+
+       # Setup the Kernel module build
+       BUILD_PARAMS="-j1 KERNEL_SOURCES=${KV_DIR}"
+
+       # List the kernel modules that will be built
+       MODULE_NAMES="shfs(misc/fs:${S}/shfs/Linux-${KV_MAJOR}.${KV_MINOR})"
+
+       case "${KV_MAJOR}.${KV_MINOR}" in
+               "2.4") BUILD_TARGETS="all" ;;
+               "2.6") BUILD_TARGETS="default" ;;
+       esac
+}
+
+src_unpack() {
+       unpack ${A}
+       cd ${S}
+
+       epatch ${FILESDIR}/0.35/*.patch
+
+       # Take care of 2.6 Kernels <= 2.6.6
+       if [[ "${KV_MAJOR}.${KV_MINOR}" == "2.6" ]]  ; then
+               convert_to_m ${S}/shfs/Linux-2.6/Makefile
+       fi
+
+       # 2.6.16 has a modified dentry struct.  Patch by Miroslav Spousta
+       # <qiq@ucw.cz>.  Submitted by Torsten Krah (bug #127092).
+       if kernel_is ge 2 6 16 ; then
+               epatch ${FILESDIR}/${PN}-0.35-2.6.16-dentry.patch
+       fi
+}
+
+src_compile() {
+       linux-mod_src_compile
+
+       cd ${S}/shfsmount
+       emake || die "failed to build userland utilities"
+}
+
+src_install() {
+       # Install kernel module
+       linux-mod_src_install
+
+       # Install userland utilities
+       cd ${S}/shfsmount
+       dobin shfsmount
+       dobin shfsumount
+
+       if use amd ; then
+               insinto /etc/amd
+               doins ${FILESDIR}/amd.conf
+               doins ${FILESDIR}/amd.shfs
+
+               exeinto /etc/amd
+               doexe ${FILESDIR}/shfs.mount
+               dosym /etc/amd/shfs.mount /etc/amd/shfs.unmount
+       fi
+
+       # Setup permissions
+       einfo "Setting SUID bit on /usr/bin executables..."
+       fperms 4511 /usr/bin/shfsmount
+       fperms 4511 /usr/bin/shfsumount
+
+       # Create symlinks to support mount(8)
+       einfo "Adding /sbin/mount.shfs symlink..."
+       dodir /sbin
+       dosym /usr/bin/shfsmount /sbin/mount.shfs
+
+       # Install docs
+       doman ${S}/docs/manpages/shfsmount.8 ${S}/docs/manpages/shfsumount.8
+       use doc && dohtml -r ${S}/docs/html
+}
+
+pkg_postinst() {
+       linux-mod_pkg_postinst
+
+       echo
+       einfo "Use either 'shfsmount' or 'mount -t shfs' to mount remote"
+       einfo "filesystems into your local filesystem."
+       echo
+       einfo "Note the following:"
+       einfo
+       einfo " 1. The shfs kernel module has to be loaded first before you can"
+       einfo "    start mounting filesystems."
+       einfo "    Try: 'modprobe shfs' as root."
+       einfo
+       einfo " 2. When mouting, you must enter the absolute path of the remote"
+       einfo "    filesystem without any special characters such as tilde (~),"
+       einfo "    for example as they will not be evaluated."
+       echo
+}