diff --git a/tgt.changes b/tgt.changes index 4857653..1d236a0 100644 --- a/tgt.changes +++ b/tgt.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Aug 9 19:12:28 CEST 2007 - olh@suse.de + +- remove inclusion of linux/hash.h, include it directly + ------------------------------------------------------------------- Wed Apr 4 11:21:52 CEST 2007 - hare@suse.de diff --git a/tgt.hash.patch b/tgt.hash.patch new file mode 100644 index 0000000..641ed53 --- /dev/null +++ b/tgt.hash.patch @@ -0,0 +1,73 @@ +--- + usr/target.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 58 insertions(+), 1 deletion(-) + +--- a/usr/target.h ++++ b/usr/target.h +@@ -3,8 +3,65 @@ + + #include + #define BITS_PER_LONG (ULONG_MAX == 0xFFFFFFFFUL ? 32 : 64) +-#include + ++#ifndef _LINUX_HASH_H ++#define _LINUX_HASH_H ++/* Fast hashing routine for a long. ++ (C) 2002 William Lee Irwin III, IBM */ ++ ++/* ++ * Knuth recommends primes in approximately golden ratio to the maximum ++ * integer representable by a machine word for multiplicative hashing. ++ * Chuck Lever verified the effectiveness of this technique: ++ * http://www.citi.umich.edu/techreports/reports/citi-tr-00-1.pdf ++ * ++ * These primes are chosen to be bit-sparse, that is operations on ++ * them can use shifts and additions instead of multiplications for ++ * machines where multiplications are slow. ++ */ ++#if BITS_PER_LONG == 32 ++/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ ++#define GOLDEN_RATIO_PRIME 0x9e370001UL ++#elif BITS_PER_LONG == 64 ++/* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ ++#define GOLDEN_RATIO_PRIME 0x9e37fffffffc0001UL ++#else ++#error Define GOLDEN_RATIO_PRIME for your wordsize. ++#endif ++ ++static inline unsigned long hash_long(unsigned long val, unsigned int bits) ++{ ++ unsigned long hash = val; ++ ++#if BITS_PER_LONG == 64 ++ /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ ++ unsigned long n = hash; ++ n <<= 18; ++ hash -= n; ++ n <<= 33; ++ hash -= n; ++ n <<= 3; ++ hash += n; ++ n <<= 3; ++ hash -= n; ++ n <<= 4; ++ hash += n; ++ n <<= 2; ++ hash += n; ++#else ++ /* On some cpus multiply is faster, on others gcc will do shifts */ ++ hash *= GOLDEN_RATIO_PRIME; ++#endif ++ ++ /* High bits are more random, so use them. */ ++ return hash >> (BITS_PER_LONG - bits); ++} ++ ++static inline unsigned long hash_ptr(void *ptr, unsigned int bits) ++{ ++ return hash_long((unsigned long)ptr, bits); ++} ++#endif /* _LINUX_HASH_H */ + #define HASH_ORDER 4 + #define hashfn(val) hash_long((unsigned long) (val), HASH_ORDER) + diff --git a/tgt.spec b/tgt.spec index 7b523fa..48e9fb4 100644 --- a/tgt.spec +++ b/tgt.spec @@ -14,12 +14,12 @@ Name: tgt BuildRequires: libaio-devel openssl-devel Obsoletes: iscsitarget URL: http://stgt.berlios.de -License: GNU General Public License (GPL) +License: GPL v2 or later Group: System/Daemons Prereq: %fillup_prereq %insserv_prereq Autoreqprov: on Version: 0.1 -Release: 1 +Release: 23 Requires: kernel Summary: Generic Linux target framework (tgt) Source: %{name}-r849.tar.bz2 @@ -31,6 +31,7 @@ Patch2: %{name}-mmc-read-toc-swapped-args Patch10: %{name}-update-scsi-header-file Patch11: %{name}-fix-build Patch12: %{name}-ibmvio-build-local +Patch13: tgt.hash.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -55,9 +56,10 @@ Authors: %patch10 -p1 %patch11 -p1 %patch12 -p1 -cp %{S:2} usr/scsi_tgt_if.h +%patch13 -p1 %build +cp %{S:2} usr/scsi_tgt_if.h cd usr %ifarch ppc ppc64 IBMVIO=1 @@ -73,7 +75,7 @@ install -vD -m 755 %{S:1} ${RPM_BUILD_ROOT}/etc/init.d/tgtd install -vD %{S:3} ${RPM_BUILD_ROOT}/etc/sysconfig/SuSEfirewall2.d/services/iscsitarget %clean -[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT} +rm -rf ${RPM_BUILD_ROOT} rm -f filelist %post @@ -90,6 +92,8 @@ rm -f filelist %doc README doc/README.iscsi doc/TODO %changelog +* Thu Aug 09 2007 - olh@suse.de +- remove inclusion of linux/hash.h, include it directly * Wed Apr 04 2007 - hare@suse.de - Added service definition for SUSEFirewall2 (#251679) * Wed Apr 04 2007 - hare@suse.de