summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in2
-rw-r--r--source3/include/proto.h9
-rw-r--r--source3/include/smb.h5
-rw-r--r--source3/lib/bitmap.c136
-rw-r--r--source3/modules/vfs_acl_common.c1
-rw-r--r--source3/modules/vfs_full_audit.c1
-rw-r--r--source3/param/loadparm.c1
-rw-r--r--source3/passdb/pdb_get_set.c1
-rw-r--r--source3/smbd/conn.c1
-rw-r--r--source3/smbd/dir.c1
-rw-r--r--source3/smbd/files.c1
-rw-r--r--source3/smbd/smb2_server.c1
-rwxr-xr-xsource3/wscript_build5
13 files changed, 9 insertions, 156 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 92613abdfd..e348509655 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -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 \
diff --git a/source3/include/proto.h b/source3/include/proto.h
index d719bd9089..daa7490d55 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index d41d36342d..0c1a76eaf7 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -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
diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c
deleted file mode 100644
index a58b9e953b..0000000000
--- a/source3/lib/bitmap.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- 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/>.
-*/
-
-#include "includes.h"
-
-/* these functions provide a simple way to allocate integers from a
- pool without repetition */
-
-/****************************************************************************
-talloc a bitmap
-****************************************************************************/
-struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n)
-{
- struct bitmap *bm;
-
- bm = talloc(mem_ctx, struct bitmap);
-
- if (!bm) return NULL;
-
- bm->n = n;
- bm->b = talloc_zero_array(bm, uint32, (n+31)/32);
- if (!bm->b) {
- TALLOC_FREE(bm);
- return NULL;
- }
- return bm;
-}
-
-/****************************************************************************
-copy as much of the source bitmap as will fit in the destination bitmap.
-****************************************************************************/
-
-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));
-
- return count;
-}
-
-/****************************************************************************
-set a bit in a bitmap
-****************************************************************************/
-bool bitmap_set(struct bitmap *bm, unsigned i)
-{
- if (i >= bm->n) {
- DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n",
- i, bm->n));
- return false;
- }
- bm->b[i/32] |= (1<<(i%32));
- return true;
-}
-
-/****************************************************************************
-clear a bit in a bitmap
-****************************************************************************/
-bool bitmap_clear(struct bitmap *bm, unsigned i)
-{
- if (i >= bm->n) {
- DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n",
- i, bm->n));
- return false;
- }
- bm->b[i/32] &= ~(1<<(i%32));
- return true;
-}
-
-/****************************************************************************
-query a bit in a bitmap
-****************************************************************************/
-bool bitmap_query(struct bitmap *bm, unsigned i)
-{
- if (i >= bm->n) return false;
- if (bm->b[i/32] & (1<<(i%32))) {
- return true;
- }
- return false;
-}
-
-/****************************************************************************
-find a zero bit in a bitmap starting at the specified offset, with
-wraparound
-****************************************************************************/
-int bitmap_find(struct bitmap *bm, unsigned ofs)
-{
- unsigned int i, j;
-
- if (ofs > bm->n) ofs = 0;
-
- i = ofs;
- while (i < bm->n) {
- if (~(bm->b[i/32])) {
- j = i;
- do {
- if (!bitmap_query(bm, j)) return j;
- j++;
- } while (j & 31 && j < bm->n);
- }
- i += 32;
- i &= ~31;
- }
-
- i = 0;
- while (i < ofs) {
- if (~(bm->b[i/32])) {
- j = i;
- do {
- if (!bitmap_query(bm, j)) return j;
- j++;
- } while (j & 31 && j < bm->n);
- }
- i += 32;
- i &= ~31;
- }
-
- return -1;
-}
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index bee7966dfc..b01fd18b9b 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -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,
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 362749a90f..19092c4df0 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -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;
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index e143726f66..e162ab960f 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -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>
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index eec82f9c98..4ff13808c3 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -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
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index a3f66b36be..f9ccfd96f5 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -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
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index fda7c34c57..fc74eea76c 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -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.
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index b8a25c1d5b..66ccb288da 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -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))
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 5882572162..ca03c8d762 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -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)
diff --git a/source3/wscript_build b/source3/wscript_build
index 3ae7759796..b471445c94 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -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',