]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - include/libxfs.h
libxfs: remove libxfs_physmem
[thirdparty/xfsprogs-dev.git] / include / libxfs.h
index bd51df0d7418e9a2b27913605779393f1751f072..0cc0820b5da3b0fbe2d25a4cffee9b4d8bd330fd 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
  */
 
 #ifndef __LIBXFS_H__
@@ -28,7 +16,7 @@
 #include "cache.h"
 #include "bitops.h"
 #include "kmem.h"
-#include "radix-tree.h"
+#include "libfrog/radix-tree.h"
 #include "atomic.h"
 
 #include "xfs_types.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"
@@ -60,6 +45,8 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);
 #include "xfs_bit.h"
 #include "xfs_sb.h"
 #include "xfs_mount.h"
+#include "xfs_defer.h"
+#include "xfs_errortag.h"
 #include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_dir2.h"
@@ -76,6 +63,11 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);
 #include "xfs_bmap.h"
 #include "xfs_trace.h"
 #include "xfs_trans.h"
+#include "xfs_ag.h"
+#include "xfs_rmap_btree.h"
+#include "xfs_rmap.h"
+#include "xfs_refcount_btree.h"
+#include "xfs_refcount.h"
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -85,12 +77,12 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);
 #define XFS_SUPER_MAGIC 0x58465342
 #endif
 
-#define xfs_isset(a,i) ((a)[(i)/(sizeof((a))*NBBY)] & (1<<((i)%(sizeof((a))*NBBY))))
+#define xfs_isset(a,i) ((a)[(i)/(sizeof(*(a))*NBBY)] & (1ULL<<((i)%(sizeof(*(a))*NBBY))))
 
 /*
  * Argument structure for libxfs_init().
  */
-typedef struct {
+typedef struct libxfs_xinit {
                                /* input parameters */
        char            *volname;       /* pathname of volume */
        char            *dname;         /* pathname of data "subvolume" */
@@ -139,12 +131,10 @@ extern int        libxfs_init (libxfs_init_t *);
 extern void    libxfs_destroy (void);
 extern int     libxfs_device_to_fd (dev_t);
 extern dev_t   libxfs_device_open (char *, int, int, int);
-extern void    libxfs_device_zero(struct xfs_buftarg *, xfs_daddr_t, uint);
 extern void    libxfs_device_close (dev_t);
 extern int     libxfs_device_alignment (void);
 extern void    libxfs_report(FILE *);
 extern void    platform_findsizes(char *path, int fd, long long *sz, int *bsz);
-extern int     platform_nproc(void);
 
 /* check or write log footer: specify device, log size in blocks & uuid */
 typedef char   *(libxfs_get_block_t)(char *, int, void *);
@@ -160,14 +150,9 @@ 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);
-extern int     libxfs_bmap_finish(xfs_trans_t **, xfs_bmap_free_t *, int *);
-
-extern void    libxfs_fs_repair_cmn_err(int, struct xfs_mount *, char *, ...);
-extern void    libxfs_fs_cmn_err(int, struct xfs_mount *, char *, ...);
 
 /* XXX: this is messy and needs fixing */
 #ifndef __LIBXFS_INTERNAL_XFS_H__
@@ -175,10 +160,6 @@ extern void cmn_err(int, char *, ...);
 enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC };
 #endif
 
-
-extern int             libxfs_nproc(void);
-extern unsigned long   libxfs_physmem(void);   /* in kilobytes */
-
 #include "xfs_ialloc.h"
 
 #include "xfs_attr_leaf.h"
@@ -206,28 +187,26 @@ xfs_inobt_is_sparse_disk(
 
 static inline void
 libxfs_bmbt_disk_get_all(
-       struct xfs_bmbt_rec     *rp,
+       struct xfs_bmbt_rec     *rec,
        struct xfs_bmbt_irec    *irec)
 {
-       struct xfs_bmbt_rec_host hrec;
-
-       hrec.l0 = get_unaligned_be64(&rp->l0);
-       hrec.l1 = get_unaligned_be64(&rp->l1);
-       libxfs_bmbt_get_all(&hrec, irec);
+       uint64_t                l0 = get_unaligned_be64(&rec->l0);
+       uint64_t                l1 = get_unaligned_be64(&rec->l1);
+
+       irec->br_startoff = (l0 & xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
+       irec->br_startblock = ((l0 & xfs_mask64lo(9)) << 43) | (l1 >> 21);
+       irec->br_blockcount = l1 & xfs_mask64lo(21);
+       if (l0 >> (64 - BMBT_EXNTFLAG_BITLEN))
+               irec->br_state = XFS_EXT_UNWRITTEN;
+       else
+               irec->br_state = XFS_EXT_NORM;
 }
 
 /* XXX: this is clearly a bug - a shared header needs to export this */
 /* xfs_rtalloc.c */
 int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t);
+bool libxfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
 
-/* XXX: need parts of xfs_attr.h in userspace */
-#define LIBXFS_ATTR_ROOT       0x0002  /* use attrs in root namespace */
-#define LIBXFS_ATTR_SECURE     0x0008  /* use attrs in security namespace */
-#define LIBXFS_ATTR_CREATE     0x0010  /* create, but fail if attr exists */
-#define LIBXFS_ATTR_REPLACE    0x0020  /* set, but fail if attr not exists */
-
-int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags);
-int xfs_attr_set(struct xfs_inode *dp, const unsigned char *name,
-                unsigned char *value, int valuelen, int flags);
+#include "xfs_attr.h"
 
 #endif /* __LIBXFS_H__ */