]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - libxfs/libxfs_priv.h
libfrog: move crc32c code out of libxfs
[thirdparty/xfsprogs-dev.git] / libxfs / libxfs_priv.h
index 9829bc88c92abd0456d362dccd2cef008d46dc36..2f2ca06f1bb18a4712b95975cd24b7c40755852d 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2000-2005 Silicon Graphics, Inc.
  * All Rights Reserved.
- *
- * 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.
- *
- * This program is distributed in the hope that it would 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, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
 #include "xfs_arch.h"
 
 #include "xfs_fs.h"
+#include "crc32c.h"
 
 /* CRC stuff, buffer API dependent on it */
-extern uint32_t crc32_le(uint32_t crc, unsigned char const *p, size_t len);
-extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);
-
-#define crc32(c,p,l)   crc32_le((c),(unsigned char const *)(p),(l))
 #define crc32c(c,p,l)  crc32c_le((c),(unsigned char const *)(p),(l))
 
 #include "xfs_cksum.h"
@@ -128,18 +113,22 @@ enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC };
 
 #define xfs_notice(mp,fmt,args...)             cmn_err(CE_NOTE,fmt, ## args)
 #define xfs_warn(mp,fmt,args...)               cmn_err(CE_WARN,fmt, ## args)
+#define xfs_err(mp,fmt,args...)                        cmn_err(CE_ALERT,fmt, ## args)
+#define xfs_alert(mp,fmt,args...)              cmn_err(CE_ALERT,fmt, ## args)
+#define xfs_alert_tag(mp,tag,fmt,args...)      cmn_err(CE_ALERT,fmt, ## args)
+
 #define xfs_hex_dump(d,n)              ((void) 0)
 
 #define xfs_force_shutdown(d,n)                ((void) 0)
 
 /* stop unused var warnings by assigning mp to itself */
 
-#define xfs_corruption_error(fu,e,l,mp,fi,ln,fa)       do { \
+#define xfs_corruption_error(e,l,mp,b,sz,fi,ln,fa)     do { \
        (mp) = (mp); \
        cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e));  \
 } while (0)
 
-#define XFS_CORRUPTION_ERROR(e,l,mp,m) do { \
+#define XFS_CORRUPTION_ERROR(e, lvl, mp, buf, bufsize) do { \
        (mp) = (mp); \
        cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e));  \
 } while (0)
@@ -424,10 +413,6 @@ roundup_64(uint64_t x, uint32_t y)
 })
 #define xfs_buf_readahead_map(a,b,c,ops)       ((void) 0)      /* no readahead */
 
-#define xfs_warn(mp,fmt,args...)               cmn_err(CE_WARN,fmt, ## args)
-#define xfs_alert(mp,fmt,args...)              cmn_err(CE_ALERT,fmt, ## args)
-#define xfs_alert_tag(mp,tag,fmt,args...)      cmn_err(CE_ALERT,fmt, ## args)
-
 #define xfs_sort                                       qsort
 
 #define xfs_ilock(ip,mode)                             ((void) 0)
@@ -579,6 +564,8 @@ bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t);
 
 typedef unsigned char u8;
 unsigned int hweight8(unsigned int w);
+unsigned int hweight32(unsigned int w);
+unsigned int hweight64(__u64 w);
 
 #define BIT_MASK(nr)   (1UL << ((nr) % BITS_PER_LONG))
 #define BIT_WORD(nr)   ((nr) / BITS_PER_LONG)