r1053: Make tdb build standalone:
authorTim Potter <tpot@samba.org>
Mon, 7 Jun 2004 01:51:04 +0000 (01:51 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:56:34 +0000 (12:56 -0500)
  - #include <stdint.h>

  - uint_t isn't a valid type, change back to unsigned int
(This used to be commit f690325565d2393bba3cb9f6e7cdf3753cbd4423)

source4/lib/tdb/Makefile.tdb
source4/lib/tdb/common/spinlock.c
source4/lib/tdb/common/tdb.c
source4/lib/tdb/include/spinlock.h

index db697e9379be20cedf8662598e9b91019043615e..35e208256cbad45c4b17ffd380ed44341c98447f 100644 (file)
@@ -26,4 +26,4 @@ bin/tdbbackup: tools/tdbbackup.o $(TDB_OBJ)
        $(CC) $(CFLAGS) -o tdbbackup tools/tdbbackup.o $(TDB_OBJ)
 
 clean:
-       rm -f $(PROGS) common/*.o *~ *.bak */*~ */*.bak *% core test.db test.tdb test.gdbm
+       rm -f $(PROGS) common/*.o tools/*.o *~ *.bak */*~ */*.bak *% core test.db test.tdb test.gdbm
index ee3eff1b317c5f62224ccbef0d5bf11a56fbae47..27481e221c1f7cc6ccd8e75ce01e8c99b20ac0d7 100644 (file)
@@ -55,7 +55,7 @@
 
 static inline int __spin_trylock(spinlock_t *lock)
 {
-       uint_t result;
+       unsigned int result;
 
        asm volatile("ldstub    [%1], %0"
                : "=r" (result)
@@ -85,7 +85,7 @@ static inline int __spin_is_locked(spinlock_t *lock)
 
 static inline int __spin_trylock(spinlock_t *lock)
 {
-       uint_t result;
+       unsigned int result;
 
        __asm__ __volatile__(
 "1:    lwarx           %0,0,%1\n\
@@ -167,7 +167,7 @@ static inline int __spin_is_locked(spinlock_t *lock)
 /* Returns 0 if the lock is acquired, EBUSY otherwise. */
 static inline int __spin_trylock(spinlock_t *lock)
 {
-        uint_t val;
+        unsigned int val;
         val = __lock_test_and_set(lock, 1);
         return val == 0 ? 0 : EBUSY;
 }
@@ -185,16 +185,16 @@ static inline void __spin_lock_init(spinlock_t *lock)
 /* Returns 1 if the lock is held, 0 otherwise. */
 static inline int __spin_is_locked(spinlock_t *lock)
 {
-        uint_t val;
+        unsigned int val;
         val = __add_and_fetch(lock, 0);
        return val;
 }
 
 #elif defined(MIPS_SPINLOCKS) 
 
-static inline uint_t load_linked(unsigned long addr)
+static inline unsigned int load_linked(unsigned long addr)
 {
-       uint_t res;
+       unsigned int res;
 
        __asm__ __volatile__("ll\t%0,(%1)"
                : "=r" (res)
@@ -203,9 +203,9 @@ static inline uint_t load_linked(unsigned long addr)
        return res;
 }
 
-static inline uint_t store_conditional(unsigned long addr, uint_t value)
+static inline unsigned int store_conditional(unsigned long addr, unsigned int value)
 {
-       uint_t res;
+       unsigned int res;
 
        __asm__ __volatile__("sc\t%0,(%2)"
                : "=r" (res)
@@ -215,7 +215,7 @@ static inline uint_t store_conditional(unsigned long addr, uint_t value)
 
 static inline int __spin_trylock(spinlock_t *lock)
 {
-       uint_t mw;
+       unsigned int mw;
 
        do {
                mw = load_linked(lock);
@@ -418,9 +418,9 @@ int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type)
        return 0;
 }
 
-int tdb_create_rwlocks(int fd, uint_t hash_size)
+int tdb_create_rwlocks(int fd, unsigned int hash_size)
 {
-       uint_t size, i;
+       unsigned int size, i;
        tdb_rwlock_t *rwlocks;
 
        size = TDB_SPINLOCK_SIZE(hash_size);
@@ -446,7 +446,7 @@ int tdb_create_rwlocks(int fd, uint_t hash_size)
 int tdb_clear_spinlocks(TDB_CONTEXT *tdb)
 {
        tdb_rwlock_t *rwlocks;
-       uint_t i;
+       unsigned int i;
 
        if (tdb->header.rwlocks == 0) return 0;
        if (!tdb->map_ptr) return -1;
@@ -460,7 +460,7 @@ int tdb_clear_spinlocks(TDB_CONTEXT *tdb)
        return 0;
 }
 #else
-int tdb_create_rwlocks(int fd, uint_t hash_size) { return 0; }
+int tdb_create_rwlocks(int fd, unsigned int hash_size) { return 0; }
 int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type) { return -1; }
 int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type) { return -1; }
 
index d4c0928217d70dd5e64b872e7d7e1c887acc3eee..ef13955fab5c97bbe7ee00377aebae04aef07963 100644 (file)
@@ -53,6 +53,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
@@ -541,7 +542,7 @@ static tdb_off tdb_dump_record(TDB_CONTEXT *tdb, tdb_off offset)
 
        if (tailer != rec.rec_len + sizeof(rec)) {
                printf("ERROR: tailer does not match record! tailer=%u totalsize=%u\n",
-                               (uint_t)tailer, (uint_t)(rec.rec_len + sizeof(rec)));
+                               (unsigned int)tailer, (unsigned int)(rec.rec_len + sizeof(rec)));
        }
        return rec.next;
 }
index 1255d455de4f10311bc523a9252031a0b5aa25e7..967fe37457fb9a69b754c3ef50fc860d729a7963 100644 (file)
@@ -36,7 +36,7 @@ typedef struct {
 
 int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type);
 int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type);
-int tdb_create_rwlocks(int fd, uint_t hash_size);
+int tdb_create_rwlocks(int fd, unsigned int hash_size);
 int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
 
 #define TDB_SPINLOCK_SIZE(hash_size) (((hash_size) + 1) * sizeof(tdb_rwlock_t))
@@ -49,7 +49,7 @@ int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
 #else
 int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type);
 int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type);
-int tdb_create_rwlocks(int fd, uint_t hash_size);
+int tdb_create_rwlocks(int fd, unsigned int hash_size);
 #endif
 int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
 #define TDB_SPINLOCK_SIZE(hash_size) 0