]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: move libxfs_log2_roundup to libfrog
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 6 Dec 2017 15:17:07 +0000 (09:17 -0600)
committerEric Sandeen <sandeen@redhat.com>
Wed, 6 Dec 2017 15:17:07 +0000 (09:17 -0600)
Move libxfs_log2_roundup to libfrog and remove the 'libxfs_' prefix.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/libfrog.h [new file with mode: 0644]
include/libxfs.h
libfrog/Makefile
libfrog/util.c [new file with mode: 0644]
libxfs/util.c
mkfs/Makefile
mkfs/maxtrres.c
mkfs/xfs_mkfs.c
repair/Makefile
repair/sb.c

diff --git a/include/libfrog.h b/include/libfrog.h
new file mode 100644 (file)
index 0000000..2d8055b
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * 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
+ */
+#ifndef __LIBFROG_UTIL_H_
+#define __LIBFROG_UTIL_H_
+
+unsigned int   log2_roundup(unsigned int i);
+
+#endif /* __LIBFROG_UTIL_H_ */
index abb01cb697b2b7bce2b0e19be0e32ed263716576..e392e527c6194080036edc7f28cc2f0f8ea96f9e 100644 (file)
@@ -165,7 +165,6 @@ extern int  libxfs_log_header(char *, uuid_t *, int, int, int, xfs_lsn_t,
 
 
 /* Shared utility routines */
-extern unsigned int    libxfs_log2_roundup(unsigned int i);
 
 extern int     libxfs_alloc_file_space (struct xfs_inode *, xfs_off_t,
                                xfs_off_t, int, int);
index 231a73402a60089893e3dc3f7c1dd75b8a88764e..6d9ed076a91860e231207580e7e85ffa651f6ac5 100644 (file)
@@ -10,7 +10,8 @@ LT_CURRENT = 0
 LT_REVISION = 0
 LT_AGE = 0
 
-CFILES =
+CFILES = \
+util.c
 
 default: ltdepend $(LTLIBRARY)
 
diff --git a/libfrog/util.c b/libfrog/util.c
new file mode 100644 (file)
index 0000000..4896e4b
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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 "platform_defs.h"
+#include "libfrog.h"
+
+/*
+ * libfrog is a collection of miscellaneous userspace utilities.
+ * It's a library of Funny Random Oddball Gunk <cough>.
+ */
+
+unsigned int
+log2_roundup(unsigned int i)
+{
+       unsigned int    rval;
+
+       for (rval = 0; rval < NBBY * sizeof(i); rval++) {
+               if ((1 << rval) >= i)
+                       break;
+       }
+       return rval;
+}
index 3b11ac4899cfbbb3ac84300ba49fdd734ba18ad3..6d8cb5e655a4f67d9a331b6fb254932291dd9ac4 100644 (file)
@@ -631,18 +631,6 @@ error0:    /* Cancel bmap, cancel trans */
        return error;
 }
 
-unsigned int
-libxfs_log2_roundup(unsigned int i)
-{
-       unsigned int    rval;
-
-       for (rval = 0; rval < NBBY * sizeof(i); rval++) {
-               if ((1 << rval) >= i)
-                       break;
-       }
-       return rval;
-}
-
 /*
  * Wrapper around call to libxfs_ialloc. Takes care of committing and
  * allocating a new transaction as needed.
index c13b9032eaec39eb1aa925bb5cb1b3c21840ea67..e2dc1d4f4711667315139f65688c54ce77a11824 100644 (file)
@@ -10,8 +10,9 @@ LTCOMMAND = mkfs.xfs
 HFILES =
 CFILES = maxtrres.c proto.c xfs_mkfs.c
 
-LLDLIBS += $(LIBXFS) $(LIBXCMD) $(LIBRT) $(LIBPTHREAD) $(LIBBLKID) $(LIBUUID)
-LTDEPENDENCIES += $(LIBXFS) $(LIBXCMD)
+LLDLIBS += $(LIBXFS) $(LIBXCMD) $(LIBFROG) $(LIBRT) $(LIBPTHREAD) $(LIBBLKID) \
+       $(LIBUUID)
+LTDEPENDENCIES += $(LIBXFS) $(LIBXCMD) $(LIBFROG)
 LLDFLAGS = -static-libtool-libs
 
 default: depend $(LTCOMMAND)
index 04028bf8ae5864b25b5a2832af1708f4707163fd..0fa18c8f27140c460f55aa635f919efa1a9fc367 100644 (file)
@@ -23,7 +23,7 @@
  * of sector size, block size, inode size, directory version, and
  * directory block size.
  */
-
+#include "libfrog.h"
 #include "libxfs.h"
 #include "xfs_multidisk.h"
 
@@ -55,7 +55,7 @@ max_trans_res(
        sbp->sb_blocklog = blocklog;
        sbp->sb_blocksize = 1 << blocklog;
        sbp->sb_agblocks = agsize;
-       sbp->sb_agblklog = (uint8_t)libxfs_log2_roundup((unsigned int)agsize);
+       sbp->sb_agblklog = (uint8_t)log2_roundup((unsigned int)agsize);
        sbp->sb_inodelog = inodelog;
        sbp->sb_inopblog = blocklog - inodelog;
        sbp->sb_inodesize = 1 << inodelog;
index 5bfec038b61a50e8c67d55210887c12bec485901..cade04cc396818b852de64c729f2172c0cb0128e 100644 (file)
@@ -15,7 +15,7 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
+#include "libfrog.h"
 #include "libxfs.h"
 #include <ctype.h>
 #include "xfs_multidisk.h"
@@ -2720,7 +2720,7 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
        memset(mp, 0, sizeof(xfs_mount_t));
        sbp->sb_blocklog = (uint8_t)blocklog;
        sbp->sb_sectlog = (uint8_t)sectorlog;
-       sbp->sb_agblklog = (uint8_t)libxfs_log2_roundup((unsigned int)agsize);
+       sbp->sb_agblklog = (uint8_t)log2_roundup((unsigned int)agsize);
        sbp->sb_agblocks = (xfs_agblock_t)agsize;
        mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT;
        mp->m_sectbb_log = sbp->sb_sectlog - BBSHIFT;
index b7e8fd5c8aa4cc47c259b8df1c07ce0457de46bb..4184a70f6254b9093f8e0906e6deb1e92129cc5a 100644 (file)
@@ -20,9 +20,9 @@ CFILES = agheader.c attr_repair.c avl.c avl64.c bmap.c btree.c \
        progress.c prefetch.c rmap.c rt.c sb.c scan.c slab.c threads.c \
        versions.c xfs_repair.c
 
-LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBXCMD) $(LIBUUID) \
-       $(LIBRT) $(LIBPTHREAD) $(LIBBLKID)
-LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) $(LIBXCMD)
+LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBXCMD) $(LIBFROG) $(LIBUUID) $(LIBRT) \
+       $(LIBPTHREAD) $(LIBBLKID)
+LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) $(LIBXCMD) $(LIBFROG)
 LLDFLAGS = -static-libtool-libs
 
 default: depend $(LTCOMMAND)
index acc9283959214e1985f143890bfeaedf16beafcd..f40cdeab2d1d3e8dc7e4d88d6355b72c3db502e9 100644 (file)
@@ -15,7 +15,7 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
+#include "libfrog.h"
 #include "libxfs.h"
 #include "libxcmd.h"
 #include "libxlog.h"
@@ -399,7 +399,7 @@ verify_sb(char *sb_buf, xfs_sb_t *sb, int is_primary_sb)
                sb->sb_dblocks < XFS_MIN_DBLOCKS(sb))
                return(XR_BAD_FS_SIZE_DATA);
 
-       if (sb->sb_agblklog != (uint8_t)libxfs_log2_roundup(sb->sb_agblocks))
+       if (sb->sb_agblklog != (uint8_t)log2_roundup(sb->sb_agblocks))
                return(XR_BAD_FS_SIZE_DATA);
 
        if (sb->sb_inodesize < XFS_DINODE_MIN_SIZE                     ||