tgt_1.0.12.bb: Update the posix_fallocate fix patch for uclibc
authorKhem Raj <raj.khem@gmail.com>
Tue, 18 Jan 2011 02:06:26 +0000 (18:06 -0800)
committerKhem Raj <raj.khem@gmail.com>
Tue, 18 Jan 2011 02:06:26 +0000 (18:06 -0800)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
recipes/tgt/tgt-1.0.12/stub-out-posix-fallocate-uclibc.patch [new file with mode: 0644]
recipes/tgt/tgt-1.0.12/use-ftruncate-on-uclibc.patch [deleted file]
recipes/tgt/tgt_1.0.12.bb

diff --git a/recipes/tgt/tgt-1.0.12/stub-out-posix-fallocate-uclibc.patch b/recipes/tgt/tgt-1.0.12/stub-out-posix-fallocate-uclibc.patch
new file mode 100644 (file)
index 0000000..35b0071
--- /dev/null
@@ -0,0 +1,89 @@
+Delivered-To: raj.khem@gmail.com\r
+Received: by 10.90.55.10 with SMTP id d10cs170645aga;\r
+        Sun, 16 Jan 2011 19:40:57 -0800 (PST)\r
+Received: by 10.42.167.73 with SMTP id r9mr3888746icy.26.1295235656555;\r
+        Sun, 16 Jan 2011 19:40:56 -0800 (PST)\r
+Return-Path: <fujita.tomonori@lab.ntt.co.jp>\r
+Received: from sh.osrg.net (sh.osrg.net [192.16.179.4])\r
+        by mx.google.com with ESMTPS id i2si10061956icv.26.2011.01.16.19.40.55\r
+        (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+        Sun, 16 Jan 2011 19:40:56 -0800 (PST)\r
+Received-SPF: neutral (google.com: 192.16.179.4 is neither permitted nor denied by best guess record for domain of fujita.tomonori@lab.ntt.co.jp) client-ip=192.16.179.4;\r
+Authentication-Results: mx.google.com; spf=neutral (google.com: 192.16.179.4 is neither permitted nor denied by best guess record for domain of fujita.tomonori@lab.ntt.co.jp) smtp.mail=fujita.tomonori@lab.ntt.co.jp\r
+Received: from localhost (rose.osrg.net [10.76.0.1])\r
+       by sh.osrg.net (8.14.3/8.14.3/OSRG-NET) with ESMTP id p0H3erYQ001827;\r
+       Mon, 17 Jan 2011 12:40:53 +0900\r
+Date: Mon, 17 Jan 2011 12:40:53 +0900\r
+To: paulepanter@users.sourceforge.net\r
+Cc: stgt@vger.kernel.org, raj.khem@gmail.com\r
+Subject: Re: [PATCH] usr/tgtimg.c: use `ftruncate` to fix build with uClibc\r
+From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>\r
+In-Reply-To: <1295181691.5847.39.camel@mattotaupa>\r
+References: <1295181691.5847.39.camel@mattotaupa>\r
+Mime-Version: 1.0\r
+Content-Type: Text/Plain; charset=us-ascii\r
+Content-Transfer-Encoding: 7bit\r
+Message-Id: <20110117122804H.fujita.tomonori@lab.ntt.co.jp>\r
+Lines: 58\r
+X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (sh.osrg.net [192.16.179.4]); Mon, 17 Jan 2011 12:40:54 +0900 (JST)\r
+X-Virus-Scanned: clamav-milter 0.96.5 at sh\r
+X-Virus-Status: Clean\r
+\r
+On Sun, 16 Jan 2011 13:41:31 +0100\r
+Paul Menzel <paulepanter@users.sourceforge.net> wrote:\r
+\r
+> From: Khem Raj <raj.khem@gmail.com>\r
+> Date: Sat Jan 15 16:37:19 2011 -0800\r
+> \r
+> uClibc does not provide `posix_fallocate` so use `ftruncate`.\r
+\r
+Hmm, what posix_fallocate does is identical to what ftruncate does in\r
+this situation?\r
+\r
+We avoid to adding #ifdef to *.c like linux kernel coding\r
+style. Please add #ifdef to *.h instead.\r
+\r
+You can do something like this:\r
+\r
+diff --git a/usr/tgtimg.c b/usr/tgtimg.c\r
+index 169207a..8ca2a4d 100644\r
+--- a/usr/tgtimg.c\r
++++ b/usr/tgtimg.c\r
+@@ -38,6 +38,7 @@\r
+ #include "ssc.h"\r
+ #include "libssc.h"\r
+ #include "scsi.h"\r
++#include "util.h"\r
\r
+ #define NO_LOGGING\r
+ #include "log.h"\r
+@@ -438,7 +439,7 @@ static int sbc_new(int op, char *path, char *capacity, char *media_type)\r
+                       perror("Failed creating file");\r
+                       exit(2);\r
+               }\r
+-              if (posix_fallocate(fd, 0, size*1024*1024LL) == -1) {\r
++              if (__fallocate(fd, 0, size*1024*1024LL) == -1) {\r
+                       perror("posix_fallocate failed.");\r
+                       exit(3);\r
+               }\r
+diff --git a/usr/util.h b/usr/util.h\r
+index 9530d2a..4a0e303 100644\r
+--- a/usr/util.h\r
++++ b/usr/util.h\r
+@@ -159,4 +159,16 @@ struct signalfd_siginfo {\r
+ };\r
+ #endif\r
\r
++#ifndef __UCLIBC__\r
++static inline int __fallocate(int fd, off_t offset, off_t len)\r
++{\r
++      return posix_fallocate(fd, offset, len);\r
++}\r
++#else\r
++static inline int __fallocate(int fd, off_t offset, off_t len)\r
++{\r
++      return 0\r
++}\r
++#endif\r
++\r
+ #endif\r
diff --git a/recipes/tgt/tgt-1.0.12/use-ftruncate-on-uclibc.patch b/recipes/tgt/tgt-1.0.12/use-ftruncate-on-uclibc.patch
deleted file mode 100644 (file)
index e9b6e38..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: tgt-1.0.12/usr/tgtimg.c
-===================================================================
---- tgt-1.0.12.orig/usr/tgtimg.c       2011-01-15 16:28:30.488656000 -0800
-+++ tgt-1.0.12/usr/tgtimg.c    2011-01-15 16:35:14.958656001 -0800
-@@ -438,8 +438,13 @@
-                       perror("Failed creating file");
-                       exit(2);
-               }
-+#ifndef __UCLIBC__
-               if (posix_fallocate(fd, 0, size*1024*1024LL) == -1) {
-                       perror("posix_fallocate failed.");
-+#else
-+              if (ftruncate (fd, size*1024*1024LL) == -1) {
-+                      perror("ftruncate failed.");
-+#endif
-                       exit(3);
-               }
index 0288b16..c9e90fe 100644 (file)
@@ -3,10 +3,10 @@ HOMEPAGE = "http://stgt.berlios.de/"
 LICENSE = "GPLv2"
 DEPENDS = "openssl"
 RDEPENDS_${PN} = "iscsi-target"
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "http://stgt.berlios.de/releases/tgt-${PV}.tar.gz \
-          file://use-ftruncate-on-uclibc.patch \
+          file://stub-out-posix-fallocate-uclibc.patch \
          "
 SRC_URI[md5sum] = "d3bc4098d0ec6f4418e574ea7fdd18eb"
 SRC_URI[sha256sum] = "4d90567997e16194b86cc3ab0a55c7aa5c5054681176b60c6635b20a1feaffe2"