svn commit: samba r15103 - branches/SAMBA_3_0/source/smbd
trunk/source/smbd
vlendec at samba.org
vlendec at samba.org
Mon Apr 17 12:27:35 GMT 2006
Author: vlendec
Date: 2006-04-17 12:27:35 +0000 (Mon, 17 Apr 2006)
New Revision: 15103
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15103
Log:
Okay, looking closer: Samba4 tdb not exporting u32 is a bug in samba4's
tdb. tdb_open_ex needs it. Can someone from samba4 tell me how this should be
handled?
Thanks,
Volker
Modified:
branches/SAMBA_3_0/source/smbd/mangle_hash2.c
branches/SAMBA_3_0/source/smbd/statcache.c
trunk/source/smbd/mangle_hash2.c
trunk/source/smbd/statcache.c
Changeset:
Modified: branches/SAMBA_3_0/source/smbd/mangle_hash2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/mangle_hash2.c 2006-04-17 12:23:38 UTC (rev 15102)
+++ branches/SAMBA_3_0/source/smbd/mangle_hash2.c 2006-04-17 12:27:35 UTC (rev 15103)
@@ -101,7 +101,7 @@
hashing the resulting cache entry to match the known hash
*/
static char **prefix_cache;
-static uint32 *prefix_cache_hashes;
+static u32 *prefix_cache_hashes;
/* these are the characters we use in the 8.3 hash. Must be 36 chars long */
static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -119,10 +119,10 @@
this hash needs to be fast with a low collision rate (what hash doesn't?)
*/
-static uint32 mangle_hash(const char *key, unsigned int length)
+static u32 mangle_hash(const char *key, unsigned int length)
{
- uint32 value;
- uint32 i;
+ u32 value;
+ u32 i;
fstring str;
/* we have to uppercase here to ensure that the mangled name
@@ -139,8 +139,8 @@
/* Set the initial value from the key size. */
for (value = FNV1_INIT, i=0; i < length; i++) {
- value *= (uint32)FNV1_PRIME;
- value ^= (uint32)(str[i]);
+ value *= (u32)FNV1_PRIME;
+ value ^= (u32)(str[i]);
}
/* note that we force it to a 31 bit hash, to keep within the limits
@@ -162,7 +162,7 @@
return False;
}
- prefix_cache_hashes = SMB_CALLOC_ARRAY(uint32, MANGLE_CACHE_SIZE);
+ prefix_cache_hashes = SMB_CALLOC_ARRAY(u32, MANGLE_CACHE_SIZE);
if (!prefix_cache_hashes) {
return False;
}
@@ -173,7 +173,7 @@
/*
insert an entry into the prefix cache. The string might not be null
terminated */
-static void cache_insert(const char *prefix, int length, uint32 hash)
+static void cache_insert(const char *prefix, int length, u32 hash)
{
int i = hash % MANGLE_CACHE_SIZE;
@@ -188,7 +188,7 @@
/*
lookup an entry in the prefix cache. Return NULL if not found.
*/
-static const char *cache_lookup(uint32 hash)
+static const char *cache_lookup(u32 hash)
{
int i = hash % MANGLE_CACHE_SIZE;
@@ -372,7 +372,7 @@
*/
static BOOL check_cache(char *name, size_t maxlen, int snum)
{
- uint32 hash, multiplier;
+ u32 hash, multiplier;
unsigned int i;
const char *prefix;
char extension[4];
@@ -386,7 +386,7 @@
/* we need to extract the hash from the 8.3 name */
hash = base_reverse[(unsigned char)name[7]];
for (multiplier=36, i=5;i>=mangle_prefix;i--) {
- uint32 v = base_reverse[(unsigned char)name[i]];
+ u32 v = base_reverse[(unsigned char)name[i]];
hash += multiplier * v;
multiplier *= 36;
}
@@ -517,7 +517,7 @@
char extension[4];
unsigned int extension_length, i;
unsigned int prefix_len;
- uint32 hash, v;
+ u32 hash, v;
char new_name[13];
/* reserved names are handled specially */
Modified: branches/SAMBA_3_0/source/smbd/statcache.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/statcache.c 2006-04-17 12:23:38 UTC (rev 15102)
+++ branches/SAMBA_3_0/source/smbd/statcache.c 2006-04-17 12:27:35 UTC (rev 15103)
@@ -291,12 +291,12 @@
JRA. Use a djb-algorithm hash for speed.
***************************************************************/
-uint32 fast_string_hash(TDB_DATA *key)
+u32 fast_string_hash(TDB_DATA *key)
{
- uint32 n = 0;
+ u32 n = 0;
const char *p;
for (p = key->dptr; *p != '\0'; p++) {
- n = ((n << 5) + n) ^ (uint32)(*p);
+ n = ((n << 5) + n) ^ (u32)(*p);
}
return n;
}
Modified: trunk/source/smbd/mangle_hash2.c
===================================================================
--- trunk/source/smbd/mangle_hash2.c 2006-04-17 12:23:38 UTC (rev 15102)
+++ trunk/source/smbd/mangle_hash2.c 2006-04-17 12:27:35 UTC (rev 15103)
@@ -101,7 +101,7 @@
hashing the resulting cache entry to match the known hash
*/
static char **prefix_cache;
-static uint32 *prefix_cache_hashes;
+static u32 *prefix_cache_hashes;
/* these are the characters we use in the 8.3 hash. Must be 36 chars long */
static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -119,10 +119,10 @@
this hash needs to be fast with a low collision rate (what hash doesn't?)
*/
-static uint32 mangle_hash(const char *key, unsigned int length)
+static u32 mangle_hash(const char *key, unsigned int length)
{
- uint32 value;
- uint32 i;
+ u32 value;
+ u32 i;
fstring str;
/* we have to uppercase here to ensure that the mangled name
@@ -139,8 +139,8 @@
/* Set the initial value from the key size. */
for (value = FNV1_INIT, i=0; i < length; i++) {
- value *= (uint32)FNV1_PRIME;
- value ^= (uint32)(str[i]);
+ value *= (u32)FNV1_PRIME;
+ value ^= (u32)(str[i]);
}
/* note that we force it to a 31 bit hash, to keep within the limits
@@ -162,7 +162,7 @@
return False;
}
- prefix_cache_hashes = SMB_CALLOC_ARRAY(uint32, MANGLE_CACHE_SIZE);
+ prefix_cache_hashes = SMB_CALLOC_ARRAY(u32, MANGLE_CACHE_SIZE);
if (!prefix_cache_hashes) {
return False;
}
@@ -173,7 +173,7 @@
/*
insert an entry into the prefix cache. The string might not be null
terminated */
-static void cache_insert(const char *prefix, int length, uint32 hash)
+static void cache_insert(const char *prefix, int length, u32 hash)
{
int i = hash % MANGLE_CACHE_SIZE;
@@ -188,7 +188,7 @@
/*
lookup an entry in the prefix cache. Return NULL if not found.
*/
-static const char *cache_lookup(uint32 hash)
+static const char *cache_lookup(u32 hash)
{
int i = hash % MANGLE_CACHE_SIZE;
@@ -372,7 +372,7 @@
*/
static BOOL check_cache(char *name, size_t maxlen, int snum)
{
- uint32 hash, multiplier;
+ u32 hash, multiplier;
unsigned int i;
const char *prefix;
char extension[4];
@@ -386,7 +386,7 @@
/* we need to extract the hash from the 8.3 name */
hash = base_reverse[(unsigned char)name[7]];
for (multiplier=36, i=5;i>=mangle_prefix;i--) {
- uint32 v = base_reverse[(unsigned char)name[i]];
+ u32 v = base_reverse[(unsigned char)name[i]];
hash += multiplier * v;
multiplier *= 36;
}
@@ -517,7 +517,7 @@
char extension[4];
unsigned int extension_length, i;
unsigned int prefix_len;
- uint32 hash, v;
+ u32 hash, v;
char new_name[13];
/* reserved names are handled specially */
Modified: trunk/source/smbd/statcache.c
===================================================================
--- trunk/source/smbd/statcache.c 2006-04-17 12:23:38 UTC (rev 15102)
+++ trunk/source/smbd/statcache.c 2006-04-17 12:27:35 UTC (rev 15103)
@@ -291,12 +291,12 @@
JRA. Use a djb-algorithm hash for speed.
***************************************************************/
-uint32 fast_string_hash(TDB_DATA *key)
+u32 fast_string_hash(TDB_DATA *key)
{
- uint32 n = 0;
+ u32 n = 0;
const char *p;
for (p = key->dptr; *p != '\0'; p++) {
- n = ((n << 5) + n) ^ (uint32)(*p);
+ n = ((n << 5) + n) ^ (u32)(*p);
}
return n;
}
More information about the samba-cvs
mailing list