Whamcloud - gitweb
LU-6245 libcfs: remove bitops wrappers for libcfs 99/13899/5
authorJames Simmons <uja.ornl@gmail.com>
Sat, 11 Apr 2015 14:47:56 +0000 (10:47 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 28 Apr 2015 05:17:40 +0000 (05:17 +0000)
The libcfs layer contains wrappers to provide bitop
wrappers to user land. Since libcfs is no longer
built for user land we can remove the wrappers. Also
remove user-crypto.h since it is not used at all.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I310cfc99d0cff3f527f656f4127e105883127338
Reviewed-on: http://review.whamcloud.com/13899
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/include/libcfs/Makefile.am
libcfs/include/libcfs/bitmap.h
libcfs/include/libcfs/libcfs.h
libcfs/include/libcfs/user-bitops.h [deleted file]
libcfs/include/libcfs/user-crypto.h [deleted file]
lustre/utils/llog_reader.c

index ac5d2a0..10967f6 100644 (file)
@@ -27,6 +27,4 @@ EXTRA_DIST = \
        libcfs_workitem.h \
        list.h \
        types.h \
-       user-bitops.h \
-       user-crypto.h \
        user-time.h
index bcf7c8c..e6f156e 100644 (file)
 #ifndef _LIBCFS_BITMAP_H_
 #define _LIBCFS_BITMAP_H_
 
-#ifndef __KERNEL__
-#define DIV_ROUND_UP(n, d)     (((n) + (d) - 1) / (d))
-#define BITS_TO_LONGS(nr)      DIV_ROUND_UP(nr, 8 * sizeof(long))
-
-#define DECLARE_BITMAP(name, bits) \
-       unsigned long name[BITS_TO_LONGS(bits)]
-#endif /* !__KERNEL__ */
-
 typedef struct {
        unsigned int  size;
        unsigned long data[0];
index 70be5ca..6c8dba3 100644 (file)
@@ -63,7 +63,6 @@
 # include <sys/time.h>
 # include <sys/types.h>
 # include <libcfs/user-time.h>
-# include <libcfs/user-bitops.h>
 #endif /* __KERNEL__ */
 
 #include "curproc.h"
@@ -235,8 +234,8 @@ void cfs_get_random_bytes(void *buf, int size);
 #include <libcfs/err.h>
 #include <libcfs/libcfs_debug.h>
 #include <libcfs/libcfs_private.h>
-#include <libcfs/bitmap.h>
 #ifdef __KERNEL__
+# include <libcfs/bitmap.h>
 # include <libcfs/libcfs_cpu.h>
 # include <libcfs/libcfs_ioctl.h>
 # include <libcfs/libcfs_prim.h>
diff --git a/libcfs/include/libcfs/user-bitops.h b/libcfs/include/libcfs/user-bitops.h
deleted file mode 100644 (file)
index 1b16ca7..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * 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 version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * libcfs/include/libcfs/user-bitops.h
- *
- * Author: Nikita Danilov <nikita@clusterfs.com>
- */
-
-#ifndef __LIBCFS_USER_BITOPS_H__
-#define __LIBCFS_USER_BITOPS_H__
-
-/* test if bit nr is set in bitmap addr; returns previous value of bit nr */
-static inline int test_and_set_bit(int nr, unsigned long *addr)
-{
-        unsigned long mask;
-
-        addr += nr / BITS_PER_LONG;
-        mask = 1UL << (nr & (BITS_PER_LONG - 1));
-        nr = (mask & *addr) != 0;
-        *addr |= mask;
-        return nr;
-}
-
-#define set_bit(n, a) test_and_set_bit(n, a)
-
-/* clear bit nr in bitmap addr; returns previous value of bit nr*/
-static inline int test_and_clear_bit(int nr, unsigned long *addr)
-{
-        unsigned long mask;
-
-        addr += nr / BITS_PER_LONG;
-        mask = 1UL << (nr & (BITS_PER_LONG - 1));
-        nr = (mask & *addr) != 0;
-        *addr &= ~mask;
-        return nr;
-}
-
-#define clear_bit(n, a) test_and_clear_bit(n, a)
-
-static inline int test_bit(int nr, const unsigned long *addr)
-{
-        return ((1UL << (nr & (BITS_PER_LONG - 1))) &
-                ((addr)[nr / BITS_PER_LONG])) != 0;
-}
-
-/* using binary seach */
-static __inline__ unsigned long fls(long data)
-{
-       int pos = 32;
-
-       if (!data)
-               return 0;
-
-#if BITS_PER_LONG == 64
-        /* If any bit of the high 32 bits are set, shift the high
-         * 32 bits down and pretend like it is a 32-bit value. */
-        if ((data & 0xFFFFFFFF00000000llu)) {
-                data >>= 32;
-                pos += 32;
-        }
-#endif
-
-       if (!(data & 0xFFFF0000u)) {
-               data <<= 16;
-               pos -= 16;
-       }
-       if (!(data & 0xFF000000u)) {
-               data <<= 8;
-               pos -= 8;
-       }
-       if (!(data & 0xF0000000u)) {
-               data <<= 4;
-               pos -= 4;
-       }
-       if (!(data & 0xC0000000u)) {
-               data <<= 2;
-               pos -= 2;
-       }
-       if (!(data & 0x80000000u)) {
-               data <<= 1;
-               pos -= 1;
-       }
-       return pos;
-}
-
-static __inline__ unsigned long __cfs_ffs(long data)
-{
-        int pos = 0;
-
-#if BITS_PER_LONG == 64
-        if ((data & 0xFFFFFFFF) == 0) {
-                pos += 32;
-                data >>= 32;
-        }
-#endif
-        if ((data & 0xFFFF) == 0) {
-                pos += 16;
-                data >>= 16;
-        }
-        if ((data & 0xFF) == 0) {
-                pos += 8;
-                data >>= 8;
-        }
-        if ((data & 0xF) == 0) {
-                pos += 4;
-                data >>= 4;
-        }
-        if ((data & 0x3) == 0) {
-                pos += 2;
-                data >>= 2;
-        }
-        if ((data & 0x1) == 0)
-                pos += 1;
-
-        return pos;
-}
-
-#define ffz(x)         ffs(~(x))
-#define flz(x)         fls(~(x))
-
-unsigned long find_next_bit(unsigned long *addr,
-                           unsigned long size, unsigned long offset);
-
-unsigned long find_next_zero_bit(unsigned long *addr,
-                                unsigned long size, unsigned long offset);
-
-#define find_first_bit(addr, size)       find_next_bit((addr), (size),0)
-#define find_first_zero_bit(addr, size)  find_next_zero_bit((addr), (size),0)
-
-#endif
diff --git a/libcfs/include/libcfs/user-crypto.h b/libcfs/include/libcfs/user-crypto.h
deleted file mode 100644 (file)
index 4e76e7f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * 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 version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see http://www.gnu.org/licenses
- *
- * Please  visit http://www.xyratex.com/contact if you need additional
- * information or have any questions.
- *
- * GPL HEADER END
- */
-
-/*
- * Copyright 2012 Xyratex Technology Limited
- *
- * Copyright (c) 2012, Intel Corporation.
- *
- */
-
-#if (defined i386) || (defined __amd64__)
-unsigned int crc32_pclmul_le_16(unsigned char const *buffer, size_t len,
-                               unsigned int crc32) __attribute__((regparm(3)));
-
-unsigned int crc32_pclmul_le(unsigned int crc, unsigned char const *p,
-                            size_t len);
-
-int crc32_pclmul_init(void);
-#endif
index e2cd538..9794033 100644 (file)
@@ -56,7 +56,9 @@ static inline int ext2_test_bit(int nr, const void *addr)
        const unsigned char *tmp = addr;
        return (tmp[nr >> 3] >> (nr & 7)) & 1;
 #else
-       return test_bit(nr, addr);
+       const unsigned long *tmp = addr;
+       return ((1UL << (nr & (BITS_PER_LONG - 1))) &
+               ((tmp)[nr / BITS_PER_LONG])) != 0;
 #endif
 }