lib/util Move bitmap.c to lib/util
authorAndrew Bartlett <abartlet@samba.org>
Thu, 7 Jul 2011 11:04:31 +0000 (21:04 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 8 Jul 2011 09:23:23 +0000 (11:23 +0200)
15 files changed:
lib/util/bitmap.c [moved from source3/lib/bitmap.c with 96% similarity]
lib/util/bitmap.h [new file with mode: 0644]
lib/util/wscript_build
source3/Makefile.in
source3/include/proto.h
source3/include/smb.h
source3/modules/vfs_acl_common.c
source3/modules/vfs_full_audit.c
source3/param/loadparm.c
source3/passdb/pdb_get_set.c
source3/smbd/conn.c
source3/smbd/dir.c
source3/smbd/files.c
source3/smbd/smb2_server.c
source3/wscript_build

similarity index 96%
rename from source3/lib/bitmap.c
rename to lib/util/bitmap.c
index a58b9e953b03ce0514f29cc6c2e15d42c38b8587..7defd778409f4c1eb4886961122a644c3dc134ba 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "includes.h"
+#include "lib/util/bitmap.h"
 
 /* these functions provide a simple way to allocate integers from a
    pool without repetition */
@@ -34,7 +35,7 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n)
        if (!bm) return NULL;
 
        bm->n = n;
-       bm->b = talloc_zero_array(bm, uint32, (n+31)/32);
+       bm->b = talloc_zero_array(bm, uint32_t, (n+31)/32);
        if (!bm->b) {
                TALLOC_FREE(bm);
                return NULL;
@@ -51,7 +52,7 @@ int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src)
         int count = MIN(dst->n, src->n);
 
         SMB_ASSERT(dst->b != src->b);
-       memcpy(dst->b, src->b, sizeof(uint32)*((count+31)/32));
+       memcpy(dst->b, src->b, sizeof(uint32_t)*((count+31)/32));
 
         return count;
 }
diff --git a/lib/util/bitmap.h b/lib/util/bitmap.h
new file mode 100644 (file)
index 0000000..cf7aa1b
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+   Unix SMB/CIFS implementation.
+   simple bitmap functions
+   Copyright (C) Andrew Tridgell 1992-1998
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* The following definitions come from lib/bitmap.c  */
+
+struct bitmap {
+       uint32_t *b;
+       unsigned int n;
+};
+
+struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
+int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
+bool bitmap_set(struct bitmap *bm, unsigned i);
+bool bitmap_clear(struct bitmap *bm, unsigned i);
+bool bitmap_query(struct bitmap *bm, unsigned i);
+int bitmap_find(struct bitmap *bm, unsigned ofs);
index bdc9d1015096e11ed0fe2edfa6580d32a0b6581d..f8386fa73f4ceeddbcf3eed3c5429ff943607bdc 100755 (executable)
@@ -84,5 +84,11 @@ bld.SAMBA_LIBRARY('tdb-wrap',
                   deps='tdb_compat talloc samba-util',
                   private_library=True,
                   local_include=False
-                  )
+                 )
+
+bld.SAMBA_LIBRARY('bitmap',
+                 source='bitmap.c',
+                 deps='talloc samba-util',
+                  local_include=False,
+                 private_library=True)
 
index 92613abdfde53444b51d2060b20e7b8c9fe8ca60..e348509655f19e2346e310652956e795d1dccc3e 100644 (file)
@@ -456,7 +456,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) $(LIBTSOCKET_OBJ) \
          lib/username.o \
          ../libds/common/flag_mapping.o \
          lib/access.o lib/smbrun.o \
-         lib/bitmap.o ../lib/util/dprintf.o $(UTIL_REG_OBJ) \
+         ../lib/util/bitmap.o ../lib/util/dprintf.o $(UTIL_REG_OBJ) \
          lib/wins_srv.o lib/string_init.o \
          lib/util_str.o ../lib/util/util_str_common.o \
          ../lib/util/util_str.o \
index d719bd908967258a3875630abb5e57f75b26e14f..daa7490d55ac9300bc8a1c84befc01786a032fb1 100644 (file)
@@ -61,15 +61,6 @@ const char *audit_description_str(uint32 category);
 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
 
-/* The following definitions come from lib/bitmap.c  */
-
-struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
-int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
-bool bitmap_set(struct bitmap *bm, unsigned i);
-bool bitmap_clear(struct bitmap *bm, unsigned i);
-bool bitmap_query(struct bitmap *bm, unsigned i);
-int bitmap_find(struct bitmap *bm, unsigned ofs);
-
 /* The following definitions come from lib/charcnv.c  */
 
 void gfree_charcnv(void);
index d41d36342d01fa33a56d2816868633d49ac39463..0c1a76eaf716bd4463e6a110b64992b20b2a9cc3 100644 (file)
@@ -705,11 +705,6 @@ struct connections_data {
        uint32 unused_compatitibility_field;
 };
 
-struct bitmap {
-       uint32 *b;
-       unsigned int n;
-};
-
 /* offsets into message for common items */
 #define smb_com 8
 #define smb_rcls 9
index bee7966dfc93d87f30de3edf6bf5824a1fd3e4db..b01fd18b9b58fb199feb7806eeae56217c6c0278 100644 (file)
@@ -23,6 +23,7 @@
 #include "system/filesys.h"
 #include "../libcli/security/security.h"
 #include "../librpc/gen_ndr/ndr_security.h"
+#include "../lib/util/bitmap.h"
 
 static NTSTATUS create_acl_blob(const struct security_descriptor *psd,
                        DATA_BLOB *pblob,
index 362749a90fa3463f624dd3e096ddf95def520103..19092c4df0b7dbbc8404e6dff4d2ab71f103794a 100644 (file)
@@ -65,6 +65,7 @@
 #include "auth.h"
 #include "ntioctl.h"
 #include "lib/param/loadparm.h"
+#include "lib/util/bitmap.h"
 
 static int vfs_full_audit_debug_level = DBGC_VFS;
 
index e143726f66b3f26a1bdc5b843f40f8fafc714615..e162ab960f2cff5b534f6218ad6fc80073e869fb 100644 (file)
@@ -67,6 +67,7 @@
 #include "smb_signing.h"
 #include "dbwrap.h"
 #include "smbldap.h"
+#include "../lib/util/bitmap.h"
 
 #ifdef HAVE_SYS_SYSCTL_H
 #include <sys/sysctl.h>
index eec82f9c9840c864cd7a77caa66a2a283ec08dd4..4ff13808c368e6bdd430abe6085440abe4d5f649 100644 (file)
@@ -25,6 +25,7 @@
 #include "passdb.h"
 #include "../libcli/auth/libcli_auth.h"
 #include "../libcli/security/security.h"
+#include "../lib/util/bitmap.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_PASSDB
index a3f66b36be7f5b50e614354edcf3aca544c9e57a..f9ccfd96f564d22d184a115c83566ea5732b3c2b 100644 (file)
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
+#include "lib/util/bitmap.h"
 
 /* The connections bitmap is expanded in increments of BITMAP_BLOCK_SZ. The
  * maximum size of the bitmap is the largest positive integer, but you will hit
index fda7c34c5783306dfcea380fded215c6fb46e482..fc74eea76cdba114828743bd6dc753803eb5170d 100644 (file)
@@ -23,6 +23,7 @@
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
 #include "libcli/security/security.h"
+#include "lib/util/bitmap.h"
 
 /*
    This module implements directory related functions for Samba.
index b8a25c1d5b6feec2f2dc2c0faabded97c7c4ac9b..66ccb288da17d1e6682d8c30513b7d98fca62a99 100644 (file)
@@ -23,6 +23,7 @@
 #include "libcli/security/security.h"
 #include "util_tdb.h"
 #include <ccan/hash/hash.h>
+#include "lib/util/bitmap.h"
 
 #define VALID_FNUM(fnum)   (((fnum) >= 0) && ((fnum) < real_max_open_files))
 
index 58825721624e4a401272c01bb40fdb643f2ae99d..ca03c8d762235024c95271e0395db6a2a2a26e6d 100644 (file)
@@ -26,6 +26,7 @@
 #include "../lib/tsocket/tsocket.h"
 #include "../lib/util/tevent_ntstatus.h"
 #include "smbprofile.h"
+#include "../lib/util/bitmap.h"
 
 #define OUTVEC_ALLOC_SIZE (SMB2_HDR_BODY + 9)
 
index 3ae7759796c98e4ee1b4a50f7d38ef93c8b934b7..b471445c94cbc295726068dab29888b40de8b733 100755 (executable)
@@ -1039,11 +1039,6 @@ bld.SAMBA3_LIBRARY('util_sec',
                    deps='samba-util',
                    private_library=True)
 
-bld.SAMBA3_LIBRARY('bitmap',
-                   source='lib/bitmap.c',
-                   deps='samba-util',
-                   private_library=True)
-
 bld.SAMBA3_LIBRARY('namearray',
                    source='lib/namearray.c',
                    deps='samba-util',