Whamcloud - gitweb
LU-6245 libcfs: create userland and kernel string operations
[fs/lustre-release.git] / libcfs / include / libcfs / bitmap.h
index 94fa75d..bcf7c8c 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -66,6 +66,16 @@ cfs_bitmap_t *CFS_ALLOCATE_BITMAP(int size)
        RETURN(ptr);
 }
 
+static inline void CFS_RESET_BITMAP(cfs_bitmap_t *bitmap)
+{
+       if (bitmap->size > 0) {
+               int nbits = bitmap->size;
+
+               memset(bitmap, 0, CFS_BITMAP_SIZE(nbits));
+               bitmap->size = nbits;
+       }
+}
+
 #define CFS_FREE_BITMAP(ptr)   LIBCFS_FREE(ptr, CFS_BITMAP_SIZE(ptr->size))
 
 static inline