]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: directly include libxfs headers
authorDave Chinner <dchinner@redhat.com>
Fri, 5 Jun 2015 00:13:58 +0000 (10:13 +1000)
committerDave Chinner <david@fromorbit.com>
Fri, 5 Jun 2015 00:13:58 +0000 (10:13 +1000)
As a step closer to the kernel code, have the libxfs code explicitly
include the headers they require to compile. This causes lots of
churn in the include files but starts to bring sanity to current
include mess.

IOWs, this is the first step towards libxfs having a clean
internal/external API demarkation for userspace. The internal libxfs
build is controlled through libxfs/xfs.h, and that defines the
functions that are exported by the library via the libxfs_*
namespace. This also starts moving the internal header structure to
the same layout and dependencies as the kernel code so that we can
separate out include/libxfs.h so that it only needs to include other
header files and doesn't ave to provide lots of "work around kernel
oddities" and export function prototypes that the internal libxfs
code does not define prototypes for.

There's still lots of follow patches to make this a reality, but
this is the first major step in cleaning up the mess.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
57 files changed:
include/Makefile
include/libxfs.h
include/libxlog.h
include/xfs_inode.h [new file with mode: 0644]
include/xfs_mount.h [new file with mode: 0644]
include/xfs_trans.h [new file with mode: 0644]
libxfs/Makefile
libxfs/cache.c
libxfs/crc32.c
libxfs/init.c
libxfs/kmem.c
libxfs/libxfs_io.h [new file with mode: 0644]
libxfs/linux.c
libxfs/logitem.c
libxfs/radix-tree.c
libxfs/rdwr.c
libxfs/trans.c
libxfs/util.c
libxfs/xfs.h
libxfs/xfs_alloc.c
libxfs/xfs_alloc_btree.c
libxfs/xfs_attr.c
libxfs/xfs_attr_leaf.c
libxfs/xfs_attr_leaf.h
libxfs/xfs_attr_remote.c
libxfs/xfs_bmap.c
libxfs/xfs_bmap_btree.c
libxfs/xfs_btree.c
libxfs/xfs_da_btree.c
libxfs/xfs_da_format.c
libxfs/xfs_dir2.c
libxfs/xfs_dir2_block.c
libxfs/xfs_dir2_data.c
libxfs/xfs_dir2_leaf.c
libxfs/xfs_dir2_node.c
libxfs/xfs_dir2_sf.c
libxfs/xfs_dquot_buf.c
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc_btree.c
libxfs/xfs_inode_buf.c
libxfs/xfs_inode_fork.c
libxfs/xfs_log_rlimit.c
libxfs/xfs_rtbitmap.c
libxfs/xfs_sb.c
libxfs/xfs_symlink_remote.c
libxfs/xfs_trans_resv.c
libxlog/util.c
libxlog/xfs_log_recover.c
logprint/log_copy.c
logprint/log_dump.c
logprint/log_misc.c
logprint/log_print_all.c
logprint/log_print_trans.c
logprint/logprint.c
logprint/logprint.h
repair/phase2.c
repair/xfs_repair.c

index 7976bf5d150a5f2042fa984b8e328e44a3375691..70e43a05be08d12c092fe7ba683bd865ffda39dd 100644 (file)
@@ -23,9 +23,12 @@ QAHFILES = libxfs.h libxlog.h \
        swab.h \
        xfs_arch.h \
        xfs_btree_trace.h \
+       xfs_inode.h \
        xfs_log_recover.h \
        xfs_metadump.h \
-       xfs_trace.h
+       xfs_mount.h \
+       xfs_trace.h \
+       xfs_trans.h
 
 HFILES = handle.h jdm.h xqm.h xfs.h
 HFILES += $(PKG_PLATFORM).h
index 934156378c71196b3c25f09c36774190c2c98e58..22f5e35bf9dc7da4f8614de6850feccc41b47857 100644 (file)
 #include <xfs/xfs_quota_defs.h>
 #include <xfs/xfs_trans_resv.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/xfs_cksum.h>
+
+/*
+ * This mirrors the kernel include for xfs_buf.h - it's implicitly included in
+ * every files via a similar include in the kernel xfs_linux.h.
+ */
+#include <xfs/libxfs_io.h>
+
 #include <xfs/xfs_bit.h>
 #include <xfs/xfs_sb.h>
+#include <xfs/xfs_mount.h>
 #include <xfs/xfs_da_format.h>
 #include <xfs/xfs_da_btree.h>
 #include <xfs/xfs_dir2.h>
 #include <xfs/xfs_attr_sf.h>
 #include <xfs/xfs_inode_fork.h>
 #include <xfs/xfs_inode_buf.h>
+#include <xfs/xfs_inode.h>
 #include <xfs/xfs_alloc.h>
 #include <xfs/xfs_btree.h>
 #include <xfs/xfs_btree_trace.h>
 #include <xfs/xfs_bmap.h>
 #include <xfs/xfs_trace.h>
-
+#include <xfs/xfs_trans.h>
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 #define xfs_isset(a,i) ((a)[(i)/(sizeof((a))*NBBY)] & (1<<((i)%(sizeof((a))*NBBY))))
 
-#define __round_mask(x, y) ((__typeof__(x))((y)-1))
-#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
-#define round_down(x, y) ((x) & ~__round_mask(x, y))
-
 /*
  * Argument structure for libxfs_init().
  */
@@ -118,19 +132,6 @@ typedef struct {
 #define LIBXFS_EXCLUSIVELY     0x0010  /* disallow other accesses (O_EXCL) */
 #define LIBXFS_DIRECT          0x0020  /* can use direct I/O, not buffered */
 
-/*
- * IO verifier callbacks need the xfs_mount pointer, so we have to behave
- * somewhat like the kernel now for userspace IO in terms of having buftarg
- * based devices...
- */
-struct xfs_buftarg {
-       struct xfs_mount        *bt_mount;
-       dev_t                   dev;
-};
-
-extern void    libxfs_buftarg_init(struct xfs_mount *mp, dev_t ddev,
-                                   dev_t logdev, dev_t rtdev);
-
 extern char    *progname;
 extern int     libxfs_init (libxfs_init_t *);
 extern void    libxfs_destroy (void);
@@ -152,517 +153,28 @@ extern int       libxfs_log_header (xfs_caddr_t, uuid_t *, int, int, int,
                                libxfs_get_block_t *, void *);
 
 
-/*
- * Define a user-level mount structure with all we need
- * in order to make use of the numerous XFS_* macros.
- */
-typedef struct xfs_mount {
-       xfs_sb_t                m_sb;           /* copy of fs superblock */
-#define m_icount       m_sb.sb_icount
-#define m_ifree                m_sb.sb_ifree
-#define m_fdblocks     m_sb.sb_fdblocks
-       char                    *m_fsname;      /* filesystem name */
-       int                     m_bsize;        /* fs logical block size */
-       xfs_agnumber_t          m_agfrotor;     /* last ag where space found */
-       xfs_agnumber_t          m_agirotor;     /* last ag dir inode alloced */
-       xfs_agnumber_t          m_maxagi;       /* highest inode alloc group */
-       uint                    m_rsumlevels;   /* rt summary levels */
-       uint                    m_rsumsize;     /* size of rt summary, bytes */
-       struct xfs_inode        *m_rbmip;       /* pointer to bitmap inode */
-       struct xfs_inode        *m_rsumip;      /* pointer to summary inode */
-       struct xfs_buftarg      *m_ddev_targp;
-       struct xfs_buftarg      *m_logdev_targp;
-       struct xfs_buftarg      *m_rtdev_targp;
-#define m_dev          m_ddev_targp
-#define m_logdev       m_logdev_targp
-#define m_rtdev                m_rtdev_targp
-       __uint8_t               m_dircook_elog; /* log d-cookie entry bits */
-       __uint8_t               m_blkbit_log;   /* blocklog + NBBY */
-       __uint8_t               m_blkbb_log;    /* blocklog - BBSHIFT */
-       __uint8_t               m_sectbb_log;   /* sectorlog - BBSHIFT */
-       __uint8_t               m_agno_log;     /* log #ag's */
-       __uint8_t               m_agino_log;    /* #bits for agino in inum */
-       uint                    m_inode_cluster_size;/* min inode buf size */
-       uint                    m_blockmask;    /* sb_blocksize-1 */
-       uint                    m_blockwsize;   /* sb_blocksize in words */
-       uint                    m_blockwmask;   /* blockwsize-1 */
-       uint                    m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */
-       uint                    m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */
-       uint                    m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */
-       uint                    m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */
-       uint                    m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */
-       uint                    m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */
-       uint                    m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
-       uint                    m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
-       uint                    m_in_maxlevels; /* XFS_IN_MAXLEVELS */
-       struct radix_tree_root  m_perag_tree;
-       uint                    m_flags;        /* global mount flags */
-       uint                    m_qflags;       /* quota status flags */
-       uint                    m_attroffset;   /* inode attribute offset */
-       int                     m_ialloc_inos;  /* inodes in inode allocation */
-       int                     m_ialloc_blks;  /* blocks in inode allocation */
-       int                     m_litino;       /* size of inode union area */
-       int                     m_inoalign_mask;/* mask sb_inoalignmt if used */
-       struct xfs_trans_resv   m_resv;         /* precomputed res values */
-       __uint64_t              m_maxicount;    /* maximum inode count */
-       int                     m_dalign;       /* stripe unit */
-       int                     m_swidth;       /* stripe width */
-       int                     m_sinoalign;    /* stripe unit inode alignmnt */
-       const struct xfs_nameops *m_dirnameops; /* vector of dir name ops */
-
-       struct xfs_da_geometry  *m_dir_geo;     /* directory block geometry */
-       struct xfs_da_geometry  *m_attr_geo;    /* attribute block geometry */
-       const struct xfs_dir_ops *m_dir_inode_ops; /* vector of dir inode ops */
-       const struct xfs_dir_ops *m_nondir_inode_ops; /* !dir inode ops */
-#define M_DIROPS(mp)   ((mp)->m_dir_inode_ops)
-
-       /*
-        * anonymous struct to allow xfs_dquot_buf.c to compile.
-        * Pointer is always null in userspace, so code does not use it at all
-        */
-       struct {
-               int     qi_dqperchunk;
-       }                       *m_quotainfo;
-
-} xfs_mount_t;
-
-/*
- * Per-ag incore structure, copies of information in agf and agi,
- * to improve the performance of allocation group selection.
- */
-typedef struct xfs_perag {
-       struct xfs_mount *pag_mount;    /* owner filesystem */
-       xfs_agnumber_t  pag_agno;       /* AG this structure belongs to */
-       atomic_t        pag_ref;        /* perag reference count */
-       char            pagf_init;      /* this agf's entry is initialized */
-       char            pagi_init;      /* this agi's entry is initialized */
-       char            pagf_metadata;  /* the agf is preferred to be metadata */
-       char            pagi_inodeok;   /* The agi is ok for inodes */
-       __uint8_t       pagf_levels[XFS_BTNUM_AGF];
-                                       /* # of levels in bno & cnt btree */
-       __uint32_t      pagf_flcount;   /* count of blocks in freelist */
-       xfs_extlen_t    pagf_freeblks;  /* total free blocks */
-       xfs_extlen_t    pagf_longest;   /* longest free space */
-       __uint32_t      pagf_btreeblks; /* # of blocks held in AGF btrees */
-       xfs_agino_t     pagi_freecount; /* number of free inodes */
-       xfs_agino_t     pagi_count;     /* number of allocated inodes */
-
-       /*
-        * Inode allocation search lookup optimisation.
-        * If the pagino matches, the search for new inodes
-        * doesn't need to search the near ones again straight away
-        */
-       xfs_agino_t     pagl_pagino;
-       xfs_agino_t     pagl_leftrec;
-       xfs_agino_t     pagl_rightrec;
-       int             pagb_count;     /* pagb slots in use */
-} xfs_perag_t;
-
-#define LIBXFS_MOUNT_DEBUGGER          0x0001
-#define LIBXFS_MOUNT_32BITINODES       0x0002
-#define LIBXFS_MOUNT_32BITINOOPT       0x0004
-#define LIBXFS_MOUNT_COMPAT_ATTR       0x0008
-#define LIBXFS_MOUNT_ATTR2             0x0010
-
-#define LIBXFS_BHASHSIZE(sbp)          (1<<10)
-
-extern xfs_mount_t     *libxfs_mount (xfs_mount_t *, xfs_sb_t *,
-                               dev_t, dev_t, dev_t, int);
-extern void    libxfs_umount (xfs_mount_t *);
-extern void    libxfs_rtmount_destroy (xfs_mount_t *);
-
-/*
- * Simple I/O interface
- */
-#define XB_PAGES        2
-
-struct xfs_buf_map {
-       xfs_daddr_t             bm_bn;  /* block number for I/O */
-       int                     bm_len; /* size of I/O */
-};
-
-#define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \
-       struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) };
-
-struct xfs_buf_ops {
-       void (*verify_read)(struct xfs_buf *);
-       void (*verify_write)(struct xfs_buf *);
-};
-
-typedef struct xfs_buf {
-       struct cache_node       b_node;
-       unsigned int            b_flags;
-       xfs_daddr_t             b_bn;
-       unsigned                b_bcount;
-       unsigned int            b_length;
-       struct xfs_buftarg      *b_target;
-#define b_dev          b_target->dev
-       pthread_mutex_t         b_lock;
-       pthread_t               b_holder;
-       unsigned int            b_recur;
-       void                    *b_fspriv;
-       void                    *b_fsprivate2;
-       void                    *b_fsprivate3;
-       void                    *b_addr;
-       int                     b_error;
-       const struct xfs_buf_ops *b_ops;
-       struct xfs_perag        *b_pag;
-       struct xfs_buf_map      *b_map;
-       int                     b_nmaps;
-#ifdef XFS_BUF_TRACING
-       struct list_head        b_lock_list;
-       const char              *b_func;
-       const char              *b_file;
-       int                     b_line;
-#endif
-} xfs_buf_t;
-
-enum xfs_buf_flags_t { /* b_flags bits */
-       LIBXFS_B_EXIT           = 0x0001,       /* ==LIBXFS_EXIT_ON_FAILURE */
-       LIBXFS_B_DIRTY          = 0x0002,       /* buffer has been modified */
-       LIBXFS_B_STALE          = 0x0004,       /* buffer marked as invalid */
-       LIBXFS_B_UPTODATE       = 0x0008,       /* buffer is sync'd to disk */
-       LIBXFS_B_DISCONTIG      = 0x0010,       /* discontiguous buffer */
-       LIBXFS_B_UNCHECKED      = 0x0020,       /* needs verification */
-};
-
-#define XFS_BUF_DADDR_NULL             ((xfs_daddr_t) (-1LL))
-
-#define XFS_BUF_PTR(bp)                        ((char *)(bp)->b_addr)
-#define xfs_buf_offset(bp, offset)     (XFS_BUF_PTR(bp) + (offset))
-#define XFS_BUF_ADDR(bp)               ((bp)->b_bn)
-#define XFS_BUF_SIZE(bp)               ((bp)->b_bcount)
-#define XFS_BUF_COUNT(bp)              ((bp)->b_bcount)
-#define XFS_BUF_TARGET(bp)             ((bp)->b_dev)
-#define XFS_BUF_SET_PTR(bp,p,cnt)      ({      \
-       (bp)->b_addr = (char *)(p);             \
-       XFS_BUF_SET_COUNT(bp,cnt);              \
-})
-
-#define XFS_BUF_SET_ADDR(bp,blk)       ((bp)->b_bn = (blk))
-#define XFS_BUF_SET_COUNT(bp,cnt)      ((bp)->b_bcount = (cnt))
-
-#define XFS_BUF_FSPRIVATE(bp,type)     ((type)(bp)->b_fspriv)
-#define XFS_BUF_SET_FSPRIVATE(bp,val)  (bp)->b_fspriv = (void *)(val)
-#define XFS_BUF_FSPRIVATE2(bp,type)    ((type)(bp)->b_fsprivate2)
-#define XFS_BUF_SET_FSPRIVATE2(bp,val) (bp)->b_fsprivate2 = (void *)(val)
-#define XFS_BUF_FSPRIVATE3(bp,type)    ((type)(bp)->b_fsprivate3)
-#define XFS_BUF_SET_FSPRIVATE3(bp,val) (bp)->b_fsprivate3 = (void *)(val)
-
-#define XFS_BUF_SET_PRIORITY(bp,pri)   cache_node_set_priority( \
-                                               libxfs_bcache, \
-                                               (struct cache_node *)(bp), \
-                                               (pri))
-#define XFS_BUF_PRIORITY(bp)           (cache_node_get_priority( \
-                                               (struct cache_node *)(bp)))
-#define xfs_buf_set_ref(bp,ref)                ((void) 0)
-#define xfs_buf_ioerror(bp,err)                ((bp)->b_error = (err))
-
-#define xfs_daddr_to_agno(mp,d) \
-       ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
-#define xfs_daddr_to_agbno(mp,d) \
-       ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
-
-/* Buffer Cache Interfaces */
-
-extern struct cache    *libxfs_bcache;
-extern struct cache_operations libxfs_bcache_operations;
-
-#define LIBXFS_GETBUF_TRYLOCK  (1 << 0)
-
-#ifdef XFS_BUF_TRACING
-
-#define libxfs_readbuf(dev, daddr, len, flags, ops) \
-       libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \
-                           (dev), (daddr), (len), (flags), (ops))
-#define libxfs_readbuf_map(dev, map, nmaps, flags, ops) \
-       libxfs_trace_readbuf_map(__FUNCTION__, __FILE__, __LINE__, \
-                           (dev), (map), (nmaps), (flags), (ops))
-#define libxfs_writebuf(buf, flags) \
-       libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \
-                             (buf), (flags))
-#define libxfs_getbuf(dev, daddr, len) \
-       libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \
-                           (dev), (daddr), (len))
-#define libxfs_getbuf_map(dev, map, nmaps, flags) \
-       libxfs_trace_getbuf_map(__FUNCTION__, __FILE__, __LINE__, \
-                           (dev), (map), (nmaps), (flags))
-#define libxfs_getbuf_flags(dev, daddr, len, flags) \
-       libxfs_trace_getbuf_flags(__FUNCTION__, __FILE__, __LINE__, \
-                           (dev), (daddr), (len), (flags))
-#define libxfs_putbuf(buf) \
-       libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf))
-
-extern xfs_buf_t *libxfs_trace_readbuf(const char *, const char *, int,
-                       struct xfs_buftarg *, xfs_daddr_t, int, int,
-                       const struct xfs_buf_ops *);
-extern xfs_buf_t *libxfs_trace_readbuf_map(const char *, const char *, int,
-                       struct xfs_buftarg *, struct xfs_buf_map *, int, int,
-                       const struct xfs_buf_ops *);
-extern int     libxfs_trace_writebuf(const char *, const char *, int,
-                       xfs_buf_t *, int);
-extern xfs_buf_t *libxfs_trace_getbuf(const char *, const char *, int,
-                       struct xfs_buftarg *, xfs_daddr_t, int);
-extern xfs_buf_t *libxfs_trace_getbuf_map(const char *, const char *, int,
-                       struct xfs_buftarg *, struct xfs_buf_map *, int, int);
-extern xfs_buf_t *libxfs_trace_getbuf_flags(const char *, const char *, int,
-                       struct xfs_buftarg *, xfs_daddr_t, int, unsigned int);
-extern void    libxfs_trace_putbuf (const char *, const char *, int,
-                       xfs_buf_t *);
-
-#else
-
-extern xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, int,
-                       const struct xfs_buf_ops *);
-extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *,
-                       int, int, const struct xfs_buf_ops *);
-extern int     libxfs_writebuf(xfs_buf_t *, int);
-extern xfs_buf_t *libxfs_getbuf(struct xfs_buftarg *, xfs_daddr_t, int);
-extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *,
-                       struct xfs_buf_map *, int, int);
-extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t,
-                       int, unsigned int);
-extern void    libxfs_putbuf (xfs_buf_t *);
-
-#endif
-
-extern void    libxfs_readbuf_verify(struct xfs_buf *bp,
-                       const struct xfs_buf_ops *ops);
-extern xfs_buf_t *libxfs_getsb(xfs_mount_t *, int);
-extern void    libxfs_bcache_purge(void);
-extern void    libxfs_bcache_flush(void);
-extern void    libxfs_purgebuf(xfs_buf_t *);
-extern int     libxfs_bcache_overflowed(void);
-extern int     libxfs_bcache_usage(void);
-
-/* Buffer (Raw) Interfaces */
-extern xfs_buf_t *libxfs_getbufr(struct xfs_buftarg *, xfs_daddr_t, int);
-extern void    libxfs_putbufr(xfs_buf_t *);
-
-extern int     libxfs_writebuf_int(xfs_buf_t *, int);
-extern int     libxfs_writebufr(struct xfs_buf *);
-extern int     libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t *, int, int);
-extern int     libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *, int);
-
-extern int libxfs_bhash_size;
-
-#define LIBXFS_BREAD   0x1
-#define LIBXFS_BWRITE  0x2
-#define LIBXFS_BZERO   0x4
-
-extern void    libxfs_iomove (xfs_buf_t *, uint, int, void *, int);
-
-/*
- * Transaction interface
- */
-
-typedef struct xfs_log_item {
-       struct xfs_log_item_desc        *li_desc;       /* ptr to current desc*/
-       struct xfs_mount                *li_mountp;     /* ptr to fs mount */
-       uint                            li_type;        /* item type */
-       xfs_lsn_t                       li_lsn;
-} xfs_log_item_t;
-
-typedef struct xfs_inode_log_item {
-       xfs_log_item_t          ili_item;               /* common portion */
-       struct xfs_inode        *ili_inode;             /* inode pointer */
-       unsigned short          ili_flags;              /* misc flags */
-       unsigned int            ili_fields;             /* fields to be logged */
-       unsigned int            ili_last_fields;        /* fields when flushed*/
-       xfs_inode_log_format_t  ili_format;             /* logged structure */
-} xfs_inode_log_item_t;
-
-typedef struct xfs_buf_log_item {
-       xfs_log_item_t          bli_item;       /* common item structure */
-       struct xfs_buf          *bli_buf;       /* real buffer pointer */
-       unsigned int            bli_flags;      /* misc flags */
-       unsigned int            bli_recur;      /* recursion count */
-       xfs_buf_log_format_t    bli_format;     /* in-log header */
-} xfs_buf_log_item_t;
-
-#define XFS_BLI_DIRTY                  (1<<0)
-#define XFS_BLI_HOLD                   (1<<1)
-#define XFS_BLI_STALE                  (1<<2)
-#define XFS_BLI_INODE_ALLOC_BUF                (1<<3)
-
-typedef struct xfs_dq_logitem {
-       xfs_log_item_t          qli_item;       /* common portion */
-       struct xfs_dquot        *qli_dquot;     /* dquot ptr */
-       xfs_lsn_t               qli_flush_lsn;  /* lsn at last flush */
-       xfs_dq_logformat_t      qli_format;     /* logged structure */
-} xfs_dq_logitem_t;
-
-typedef struct xfs_qoff_logitem {
-       xfs_log_item_t          qql_item;       /* common portion */
-       struct xfs_qoff_logitem *qql_start_lip; /* qoff-start logitem, if any */
-       xfs_qoff_logformat_t    qql_format;     /* logged structure */
-} xfs_qoff_logitem_t;
-
-typedef struct xfs_trans {
-       unsigned int    t_type;                 /* transaction type */
-       unsigned int    t_log_res;              /* amt of log space resvd */
-       unsigned int    t_log_count;            /* count for perm log res */
-       xfs_mount_t     *t_mountp;              /* ptr to fs mount struct */
-       unsigned int    t_flags;                /* misc flags */
-       long            t_icount_delta;         /* superblock icount change */
-       long            t_ifree_delta;          /* superblock ifree change */
-       long            t_fdblocks_delta;       /* superblock fdblocks chg */
-       long            t_frextents_delta;      /* superblock freextents chg */
-       struct list_head        t_items;        /* first log item desc chunk */
-} xfs_trans_t;
-
-extern void    xfs_trans_init(struct xfs_mount *);
-extern int     xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
-
-extern xfs_trans_t     *libxfs_trans_alloc (xfs_mount_t *, int);
-extern xfs_trans_t     *libxfs_trans_dup (xfs_trans_t *);
-extern int     libxfs_trans_reserve(struct xfs_trans *, struct xfs_trans_res *,
-                                    uint, uint);
-extern int     libxfs_trans_commit (xfs_trans_t *, uint);
-extern void    libxfs_trans_cancel (xfs_trans_t *, int);
-extern xfs_buf_t       *libxfs_trans_getsb (xfs_trans_t *, xfs_mount_t *, int);
-
-extern int     libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
-                               uint, uint, struct xfs_inode **);
-extern void    libxfs_trans_ijoin (xfs_trans_t *, struct xfs_inode *, uint);
-extern void    libxfs_trans_ijoin_ref(xfs_trans_t *, struct xfs_inode *, int);
-extern void    libxfs_trans_log_inode (xfs_trans_t *, struct xfs_inode *,
-                               uint);
-
-extern void    libxfs_trans_brelse (xfs_trans_t *, struct xfs_buf *);
-extern void    libxfs_trans_binval (xfs_trans_t *, struct xfs_buf *);
-extern void    libxfs_trans_bjoin (xfs_trans_t *, struct xfs_buf *);
-extern void    libxfs_trans_bhold (xfs_trans_t *, struct xfs_buf *);
-extern void    libxfs_trans_log_buf (xfs_trans_t *, struct xfs_buf *,
-                               uint, uint);
-/*
-extern xfs_buf_t       *libxfs_trans_get_buf (xfs_trans_t *, dev_t,
-                               xfs_daddr_t, int, uint);
-extern int     libxfs_trans_read_buf (xfs_mount_t *, xfs_trans_t *, dev_t,
-                               xfs_daddr_t, int, uint, struct xfs_buf **);
-*/
-
-struct xfs_buf *libxfs_trans_get_buf_map(struct xfs_trans *tp,
-                                       struct xfs_buftarg *btp,
-                                       struct xfs_buf_map *map, int nmaps,
-                                       uint flags);
-
-static inline struct xfs_buf *
-libxfs_trans_get_buf(
-       struct xfs_trans        *tp,
-       struct xfs_buftarg      *btp,
-       xfs_daddr_t             blkno,
-       int                     numblks,
-       uint                    flags)
-{
-       DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
-       return libxfs_trans_get_buf_map(tp, btp, &map, 1, flags);
-}
-
-int            libxfs_trans_read_buf_map(struct xfs_mount *mp,
-                                      struct xfs_trans *tp,
-                                      struct xfs_buftarg *btp,
-                                      struct xfs_buf_map *map, int nmaps,
-                                      uint flags, struct xfs_buf **bpp,
-                                      const struct xfs_buf_ops *ops);
-
-static inline int
-libxfs_trans_read_buf(
-       struct xfs_mount        *mp,
-       struct xfs_trans        *tp,
-       struct xfs_buftarg      *btp,
-       xfs_daddr_t             blkno,
-       int                     numblks,
-       uint                    flags,
-       struct xfs_buf          **bpp,
-       const struct xfs_buf_ops *ops)
-{
-       DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
-       return libxfs_trans_read_buf_map(mp, tp, btp, &map, 1,
-                                     flags, bpp, ops);
-}
-
-/*
- * Inode interface
- */
-typedef struct xfs_inode {
-       struct cache_node       i_node;
-       xfs_mount_t             *i_mount;       /* fs mount struct ptr */
-       xfs_ino_t               i_ino;          /* inode number (agno/agino) */
-       struct xfs_imap         i_imap;         /* location for xfs_imap() */
-       struct xfs_buftarg      i_dev;          /* dev for this inode */
-       xfs_ifork_t             *i_afp;         /* attribute fork pointer */
-       xfs_ifork_t             i_df;           /* data fork */
-       xfs_trans_t             *i_transp;      /* ptr to owning transaction */
-       xfs_inode_log_item_t    *i_itemp;       /* logging information */
-       unsigned int            i_delayed_blks; /* count of delay alloc blks */
-       xfs_icdinode_t          i_d;            /* most of ondisk inode */
-       xfs_fsize_t             i_size;         /* in-memory size */
-       const struct xfs_dir_ops *d_ops;        /* directory ops vector */
-} xfs_inode_t;
-
 #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 */
 
-/*
- * Project quota id helpers (previously projid was 16bit only and using two
- * 16bit values to hold new 32bit projid was chosen to retain compatibility with
- * "old" filesystems).
- *
- * Copied here from xfs_inode.h because it has to be defined after the struct
- * xfs_inode...
- */
-static inline prid_t
-xfs_get_projid(struct xfs_icdinode *id)
-{
-       return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo;
-}
-
-static inline void
-xfs_set_projid(struct xfs_icdinode *id, prid_t projid)
-{
-       id->di_projid_hi = (__uint16_t) (projid >> 16);
-       id->di_projid_lo = (__uint16_t) (projid & 0xffff);
-}
-
-typedef struct cred {
-       uid_t   cr_uid;
-       gid_t   cr_gid;
-} cred_t;
-
-extern int     libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t,
-                               nlink_t, xfs_dev_t, struct cred *,
-                               struct fsxattr *, xfs_inode_t **);
-extern void    libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *);
-
-extern void    libxfs_trans_ichgtime(struct xfs_trans *,
-                                       struct xfs_inode *, int);
-extern int     libxfs_iflush_int (xfs_inode_t *, xfs_buf_t *);
-
-/* Inode Cache Interfaces */
-extern int     libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
-                               uint, xfs_inode_t **, xfs_daddr_t);
-extern void    libxfs_iput (xfs_inode_t *);
-
-#define IRELE(ip) libxfs_iput(ip)
-
 /* Shared utility routines */
 extern unsigned int    libxfs_log2_roundup(unsigned int i);
 
-extern int     libxfs_alloc_file_space (xfs_inode_t *, xfs_off_t,
+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__
 extern void cmn_err(int, char *, ...);
 enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC };
+#endif
 
 
-#define LIBXFS_BBTOOFF64(bbs)  (((xfs_off_t)(bbs)) << BBSHIFT)
 extern int             libxfs_nproc(void);
 extern unsigned long   libxfs_physmem(void);   /* in kilobytes */
 
@@ -675,35 +187,6 @@ extern unsigned long       libxfs_physmem(void);   /* in kilobytes */
 #define XFS_INOBT_IS_FREE_DISK(rp,i)           \
                        ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0)
 
-#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_alert(mp,fmt,args...)              cmn_err(CE_ALERT,fmt, ## args)
-#define xfs_hex_dump(d,n)              ((void) 0)
-
-/* CRC wrappers */
-
-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/xfs_cksum.h>
-
-static inline int
-xfs_buf_verify_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
-{
-       return xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length),
-                               cksum_offset);
-}
-
-static inline void
-xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
-{
-       xfs_update_cksum(bp->b_addr, BBTOB(bp->b_length),
-                        cksum_offset);
-}
-
 /*
  * public xfs kernel routines to be called as libxfs_*
  *
@@ -715,7 +198,7 @@ xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
  * these declarations can go away, and so there's documentation in the kernel
  * code base that certain functions are shared with userspace.
  */
-#ifndef __LIBXFS_INTERNAL_XFS_H
+#ifndef __LIBXFS_INTERNAL_XFS_H__
 
 /* xfs_sb.h */
 void   libxfs_log_sb(struct xfs_trans *tp);
@@ -736,6 +219,8 @@ int libxfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
 void   libxfs_bmap_cancel(struct xfs_bmap_free *flist);
 int    libxfs_bmap_last_offset(struct xfs_inode *ip,
                xfs_fileoff_t *unused, int whichfork);
+int    libxfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist,
+               int *committed);
 
 /* xfs_dir2.h */
 int    libxfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp,
@@ -812,7 +297,7 @@ int libxfs_attr_set(struct xfs_inode *, const unsigned char *,
 int libxfs_attr_remove(struct xfs_inode *, const unsigned char *, int);
 
 /* xfs_bmap.c */
-xfs_bmbt_rec_host_t *xfs_bmap_search_extents(xfs_inode_t *, xfs_fileoff_t,
+xfs_bmbt_rec_host_t *xfs_bmap_search_extents(struct xfs_inode *, xfs_fileoff_t,
                                int, int *, xfs_extnum_t *, xfs_bmbt_irec_t *,
                                xfs_bmbt_irec_t *);
 void libxfs_bmbt_get_all(struct xfs_bmbt_rec_host *r, struct xfs_bmbt_irec *s);
@@ -840,7 +325,7 @@ bool libxfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino,
 #define libxfs_buf_verify_cksum        xfs_buf_verify_cksum
 #define libxfs_buf_update_cksum        xfs_buf_update_cksum
 
-#endif /* __LIBXFS_INTERNAL_XFS_H */
+#endif /* __LIBXFS_INTERNAL_XFS_H__ */
 
 /* XXX: this is clearly a bug - a shared header needs to export this */
 /* xfs_rtalloc.c */
index a61e437e67a6ed649ae22d01c735c446330e6c85..d6ba9a50b07366b400a1fb05ec8c1d8d80531ca6 100644 (file)
@@ -17,8 +17,6 @@
 #ifndef LIBXLOG_H
 #define LIBXLOG_H
 
-#include <xfs/libxfs.h>
-
 /*
  * define the userlevel xlog_t to be the subset of the kernel's
  * xlog_t that we actually need to get our work done, avoiding
@@ -51,6 +49,8 @@ struct xlog {
 
 /*
  * macros mapping kernel code to user code
+ *
+ * XXX: this is duplicated stuff - should be shared with libxfs.
  */
 #ifndef EFSCORRUPTED
 #define EFSCORRUPTED                    990
@@ -65,6 +65,12 @@ struct xlog {
 #define XFS_CORRUPTION_ERROR(e,l,mp,m) ((void) 0)
 #define XFS_MOUNT_WAS_CLEAN            0x1
 #define unlikely(x)                    (x)
+#define xfs_alert(mp,fmt,args...)      cmn_err(CE_ALERT,fmt, ## args)
+#define xfs_warn(mp,fmt,args...)       cmn_err(CE_WARN,fmt, ## args)
+#define xfs_hex_dump(d,n)              ((void) 0)
+#define __round_mask(x, y) ((__typeof__(x))((y)-1))
+#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
+#define round_down(x, y) ((x) & ~__round_mask(x, y))
 
 extern void xlog_warn(char *fmt,...);
 extern void xlog_exit(char *fmt,...);
diff --git a/include/xfs_inode.h b/include/xfs_inode.h
new file mode 100644 (file)
index 0000000..8acff7b
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * 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 __XFS_INODE_H__
+#define __XFS_INODE_H__
+
+/* These match kernel side includes */
+#include <xfs/xfs_inode_buf.h>
+#include <xfs/xfs_inode_fork.h>
+
+struct xfs_trans;
+struct xfs_mount;
+struct xfs_inode_log_item;
+struct xfs_dir_ops;
+
+/*
+ * Inode interface
+ */
+typedef struct xfs_inode {
+       struct cache_node       i_node;
+       struct xfs_mount        *i_mount;       /* fs mount struct ptr */
+       xfs_ino_t               i_ino;          /* inode number (agno/agino) */
+       struct xfs_imap         i_imap;         /* location for xfs_imap() */
+       struct xfs_buftarg      i_dev;          /* dev for this inode */
+       struct xfs_ifork        *i_afp;         /* attribute fork pointer */
+       struct xfs_ifork        i_df;           /* data fork */
+       struct xfs_trans        *i_transp;      /* ptr to owning transaction */
+       struct xfs_inode_log_item *i_itemp;     /* logging information */
+       unsigned int            i_delayed_blks; /* count of delay alloc blks */
+       struct xfs_icdinode     i_d;            /* most of ondisk inode */
+       xfs_fsize_t             i_size;         /* in-memory size */
+       const struct xfs_dir_ops *d_ops;        /* directory ops vector */
+} xfs_inode_t;
+
+/*
+ * For regular files we only update the on-disk filesize when actually
+ * writing data back to disk.  Until then only the copy in the VFS inode
+ * is uptodate.
+ */
+static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
+{
+       if (S_ISREG(ip->i_d.di_mode))
+               return ip->i_size;
+       return ip->i_d.di_size;
+}
+#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
+
+/*
+ * Project quota id helpers (previously projid was 16bit only and using two
+ * 16bit values to hold new 32bit projid was chosen to retain compatibility with
+ * "old" filesystems).
+ *
+ * Copied here from xfs_inode.h because it has to be defined after the struct
+ * xfs_inode...
+ */
+static inline prid_t
+xfs_get_projid(struct xfs_icdinode *id)
+{
+       return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo;
+}
+
+static inline void
+xfs_set_projid(struct xfs_icdinode *id, prid_t projid)
+{
+       id->di_projid_hi = (__uint16_t) (projid >> 16);
+       id->di_projid_lo = (__uint16_t) (projid & 0xffff);
+}
+
+typedef struct cred {
+       uid_t   cr_uid;
+       gid_t   cr_gid;
+} cred_t;
+
+extern int     libxfs_inode_alloc (struct xfs_trans **, struct xfs_inode *,
+                               mode_t, nlink_t, xfs_dev_t, struct cred *,
+                               struct fsxattr *, struct xfs_inode **);
+extern void    libxfs_trans_inode_alloc_buf (struct xfs_trans *,
+                               struct xfs_buf *);
+
+extern void    libxfs_trans_ichgtime(struct xfs_trans *,
+                               struct xfs_inode *, int);
+extern int     libxfs_iflush_int (struct xfs_inode *, struct xfs_buf *);
+
+/* Inode Cache Interfaces */
+extern int     libxfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
+                               uint, struct xfs_inode **, xfs_daddr_t);
+extern void    libxfs_iput(struct xfs_inode *);
+
+#define IRELE(ip) libxfs_iput(ip)
+
+#endif /* __XFS_INODE_H__ */
diff --git a/include/xfs_mount.h b/include/xfs_mount.h
new file mode 100644 (file)
index 0000000..70bdea0
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * 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 __XFS_MOUNT_H__
+#define __XFS_MOUNT_H__
+
+struct xfs_inode;
+struct xfs_buftarg;
+struct xfs_dir_ops;
+struct xfs_da_geometry;
+
+/*
+ * Define a user-level mount structure with all we need
+ * in order to make use of the numerous XFS_* macros.
+ */
+typedef struct xfs_mount {
+       xfs_sb_t                m_sb;           /* copy of fs superblock */
+#define m_icount       m_sb.sb_icount
+#define m_ifree                m_sb.sb_ifree
+#define m_fdblocks     m_sb.sb_fdblocks
+       char                    *m_fsname;      /* filesystem name */
+       int                     m_bsize;        /* fs logical block size */
+       xfs_agnumber_t          m_agfrotor;     /* last ag where space found */
+       xfs_agnumber_t          m_agirotor;     /* last ag dir inode alloced */
+       xfs_agnumber_t          m_maxagi;       /* highest inode alloc group */
+       uint                    m_rsumlevels;   /* rt summary levels */
+       uint                    m_rsumsize;     /* size of rt summary, bytes */
+       struct xfs_inode        *m_rbmip;       /* pointer to bitmap inode */
+       struct xfs_inode        *m_rsumip;      /* pointer to summary inode */
+       struct xfs_buftarg      *m_ddev_targp;
+       struct xfs_buftarg      *m_logdev_targp;
+       struct xfs_buftarg      *m_rtdev_targp;
+#define m_dev          m_ddev_targp
+#define m_logdev       m_logdev_targp
+#define m_rtdev                m_rtdev_targp
+       __uint8_t               m_dircook_elog; /* log d-cookie entry bits */
+       __uint8_t               m_blkbit_log;   /* blocklog + NBBY */
+       __uint8_t               m_blkbb_log;    /* blocklog - BBSHIFT */
+       __uint8_t               m_sectbb_log;   /* sectorlog - BBSHIFT */
+       __uint8_t               m_agno_log;     /* log #ag's */
+       __uint8_t               m_agino_log;    /* #bits for agino in inum */
+       uint                    m_inode_cluster_size;/* min inode buf size */
+       uint                    m_blockmask;    /* sb_blocksize-1 */
+       uint                    m_blockwsize;   /* sb_blocksize in words */
+       uint                    m_blockwmask;   /* blockwsize-1 */
+       uint                    m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */
+       uint                    m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */
+       uint                    m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */
+       uint                    m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */
+       uint                    m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */
+       uint                    m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */
+       uint                    m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
+       uint                    m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
+       uint                    m_in_maxlevels; /* XFS_IN_MAXLEVELS */
+       struct radix_tree_root  m_perag_tree;
+       uint                    m_flags;        /* global mount flags */
+       uint                    m_qflags;       /* quota status flags */
+       uint                    m_attroffset;   /* inode attribute offset */
+       int                     m_ialloc_inos;  /* inodes in inode allocation */
+       int                     m_ialloc_blks;  /* blocks in inode allocation */
+       int                     m_litino;       /* size of inode union area */
+       int                     m_inoalign_mask;/* mask sb_inoalignmt if used */
+       struct xfs_trans_resv   m_resv;         /* precomputed res values */
+       __uint64_t              m_maxicount;    /* maximum inode count */
+       int                     m_dalign;       /* stripe unit */
+       int                     m_swidth;       /* stripe width */
+       int                     m_sinoalign;    /* stripe unit inode alignmnt */
+       const struct xfs_nameops *m_dirnameops; /* vector of dir name ops */
+
+       struct xfs_da_geometry  *m_dir_geo;     /* directory block geometry */
+       struct xfs_da_geometry  *m_attr_geo;    /* attribute block geometry */
+       const struct xfs_dir_ops *m_dir_inode_ops; /* vector of dir inode ops */
+       const struct xfs_dir_ops *m_nondir_inode_ops; /* !dir inode ops */
+#define M_DIROPS(mp)   ((mp)->m_dir_inode_ops)
+
+       /*
+        * anonymous struct to allow xfs_dquot_buf.c to compile.
+        * Pointer is always null in userspace, so code does not use it at all
+        */
+       struct {
+               int     qi_dqperchunk;
+       }                       *m_quotainfo;
+
+} xfs_mount_t;
+
+/*
+ * Per-ag incore structure, copies of information in agf and agi,
+ * to improve the performance of allocation group selection.
+ */
+typedef struct xfs_perag {
+       struct xfs_mount *pag_mount;    /* owner filesystem */
+       xfs_agnumber_t  pag_agno;       /* AG this structure belongs to */
+       atomic_t        pag_ref;        /* perag reference count */
+       char            pagf_init;      /* this agf's entry is initialized */
+       char            pagi_init;      /* this agi's entry is initialized */
+       char            pagf_metadata;  /* the agf is preferred to be metadata */
+       char            pagi_inodeok;   /* The agi is ok for inodes */
+       __uint8_t       pagf_levels[XFS_BTNUM_AGF];
+                                       /* # of levels in bno & cnt btree */
+       __uint32_t      pagf_flcount;   /* count of blocks in freelist */
+       xfs_extlen_t    pagf_freeblks;  /* total free blocks */
+       xfs_extlen_t    pagf_longest;   /* longest free space */
+       __uint32_t      pagf_btreeblks; /* # of blocks held in AGF btrees */
+       xfs_agino_t     pagi_freecount; /* number of free inodes */
+       xfs_agino_t     pagi_count;     /* number of allocated inodes */
+
+       /*
+        * Inode allocation search lookup optimisation.
+        * If the pagino matches, the search for new inodes
+        * doesn't need to search the near ones again straight away
+        */
+       xfs_agino_t     pagl_pagino;
+       xfs_agino_t     pagl_leftrec;
+       xfs_agino_t     pagl_rightrec;
+       int             pagb_count;     /* pagb slots in use */
+} xfs_perag_t;
+
+#define LIBXFS_MOUNT_DEBUGGER          0x0001
+#define LIBXFS_MOUNT_32BITINODES       0x0002
+#define LIBXFS_MOUNT_32BITINOOPT       0x0004
+#define LIBXFS_MOUNT_COMPAT_ATTR       0x0008
+#define LIBXFS_MOUNT_ATTR2             0x0010
+
+#define LIBXFS_BHASHSIZE(sbp)          (1<<10)
+
+extern xfs_mount_t     *libxfs_mount (xfs_mount_t *, xfs_sb_t *,
+                               dev_t, dev_t, dev_t, int);
+extern void    libxfs_umount (xfs_mount_t *);
+extern void    libxfs_rtmount_destroy (xfs_mount_t *);
+
+#endif /* __XFS_MOUNT_H__ */
+
diff --git a/include/xfs_trans.h b/include/xfs_trans.h
new file mode 100644 (file)
index 0000000..302af35
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * 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 __XFS_TRANS_H__
+#define __XFS_TRANS_H__
+
+struct xfs_mount;
+struct xfs_buftarg;
+struct xfs_buf;
+struct xfs_buf_map;
+
+/*
+ * Userspace Transaction interface
+ */
+
+typedef struct xfs_log_item {
+       struct xfs_log_item_desc        *li_desc;       /* ptr to current desc*/
+       struct xfs_mount                *li_mountp;     /* ptr to fs mount */
+       uint                            li_type;        /* item type */
+       xfs_lsn_t                       li_lsn;
+} xfs_log_item_t;
+
+typedef struct xfs_inode_log_item {
+       xfs_log_item_t          ili_item;               /* common portion */
+       struct xfs_inode        *ili_inode;             /* inode pointer */
+       unsigned short          ili_flags;              /* misc flags */
+       unsigned int            ili_fields;             /* fields to be logged */
+       unsigned int            ili_last_fields;        /* fields when flushed*/
+       xfs_inode_log_format_t  ili_format;             /* logged structure */
+} xfs_inode_log_item_t;
+
+typedef struct xfs_buf_log_item {
+       xfs_log_item_t          bli_item;       /* common item structure */
+       struct xfs_buf          *bli_buf;       /* real buffer pointer */
+       unsigned int            bli_flags;      /* misc flags */
+       unsigned int            bli_recur;      /* recursion count */
+       xfs_buf_log_format_t    bli_format;     /* in-log header */
+} xfs_buf_log_item_t;
+
+#define XFS_BLI_DIRTY                  (1<<0)
+#define XFS_BLI_HOLD                   (1<<1)
+#define XFS_BLI_STALE                  (1<<2)
+#define XFS_BLI_INODE_ALLOC_BUF                (1<<3)
+
+typedef struct xfs_dq_logitem {
+       xfs_log_item_t          qli_item;       /* common portion */
+       struct xfs_dquot        *qli_dquot;     /* dquot ptr */
+       xfs_lsn_t               qli_flush_lsn;  /* lsn at last flush */
+       xfs_dq_logformat_t      qli_format;     /* logged structure */
+} xfs_dq_logitem_t;
+
+typedef struct xfs_qoff_logitem {
+       xfs_log_item_t          qql_item;       /* common portion */
+       struct xfs_qoff_logitem *qql_start_lip; /* qoff-start logitem, if any */
+       xfs_qoff_logformat_t    qql_format;     /* logged structure */
+} xfs_qoff_logitem_t;
+
+typedef struct xfs_trans {
+       unsigned int    t_type;                 /* transaction type */
+       unsigned int    t_log_res;              /* amt of log space resvd */
+       unsigned int    t_log_count;            /* count for perm log res */
+       struct xfs_mount *t_mountp;             /* ptr to fs mount struct */
+       unsigned int    t_flags;                /* misc flags */
+       long            t_icount_delta;         /* superblock icount change */
+       long            t_ifree_delta;          /* superblock ifree change */
+       long            t_fdblocks_delta;       /* superblock fdblocks chg */
+       long            t_frextents_delta;      /* superblock freextents chg */
+       struct list_head        t_items;        /* first log item desc chunk */
+} xfs_trans_t;
+
+void   xfs_trans_init(struct xfs_mount *);
+int    xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
+
+xfs_trans_t    *libxfs_trans_alloc(struct xfs_mount *, int);
+xfs_trans_t    *libxfs_trans_dup(struct xfs_trans *);
+int    libxfs_trans_reserve(struct xfs_trans *, struct xfs_trans_res *,
+                                    uint, uint);
+int    libxfs_trans_commit(struct xfs_trans *, uint);
+void   libxfs_trans_cancel(struct xfs_trans *, int);
+struct xfs_buf *libxfs_trans_getsb(struct xfs_trans *, struct xfs_mount *, int);
+
+int    libxfs_trans_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
+                               uint, uint, struct xfs_inode **);
+void   libxfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *, uint);
+void   libxfs_trans_ijoin_ref(struct xfs_trans *, struct xfs_inode *, int);
+void   libxfs_trans_log_inode (struct xfs_trans *, struct xfs_inode *,
+                               uint);
+
+void   libxfs_trans_brelse(struct xfs_trans *, struct xfs_buf *);
+void   libxfs_trans_binval(struct xfs_trans *, struct xfs_buf *);
+void   libxfs_trans_bjoin(struct xfs_trans *, struct xfs_buf *);
+void   libxfs_trans_bhold(struct xfs_trans *, struct xfs_buf *);
+void   libxfs_trans_log_buf(struct xfs_trans *, struct xfs_buf *,
+                               uint, uint);
+
+struct xfs_buf *libxfs_trans_get_buf_map(struct xfs_trans *tp,
+                                       struct xfs_buftarg *btp,
+                                       struct xfs_buf_map *map, int nmaps,
+                                       uint flags);
+
+int    libxfs_trans_read_buf_map(struct xfs_mount *mp, struct xfs_trans *tp,
+                                 struct xfs_buftarg *btp,
+                                 struct xfs_buf_map *map, int nmaps,
+                                 uint flags, struct xfs_buf **bpp,
+                                 const struct xfs_buf_ops *ops);
+static inline struct xfs_buf *
+libxfs_trans_get_buf(
+       struct xfs_trans        *tp,
+       struct xfs_buftarg      *btp,
+       xfs_daddr_t             blkno,
+       int                     numblks,
+       uint                    flags)
+{
+       DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
+       return libxfs_trans_get_buf_map(tp, btp, &map, 1, flags);
+}
+
+static inline int
+libxfs_trans_read_buf(
+       struct xfs_mount        *mp,
+       struct xfs_trans        *tp,
+       struct xfs_buftarg      *btp,
+       xfs_daddr_t             blkno,
+       int                     numblks,
+       uint                    flags,
+       struct xfs_buf          **bpp,
+       const struct xfs_buf_ops *ops)
+{
+       DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
+       return libxfs_trans_read_buf_map(mp, tp, btp, &map, 1, flags, bpp, ops);
+}
+
+#endif /* __XFS_TRANS_H__ */
index 0b67ea008c1e2d871194ffe88ab21f939926ff44..51b98ec6736c0daf4174d765582eea888b524890 100644 (file)
@@ -45,7 +45,8 @@ QAHFILES = xfs_alloc.h \
        xfs_sb.h \
        xfs_shared.h \
        xfs_trans_resv.h \
-       xfs_trans_space.h
+       xfs_trans_space.h \
+       libxfs_io.h
 
 CFILES = cache.c \
        crc32.c \
index 7509d950b6122cfa034434ee43930cb7cbd9dc1d..105d2f9769bb48df0e3d73682d62a42c1d4a2ce4 100644 (file)
 #include <unistd.h>
 #include <pthread.h>
 
-#include <xfs/platform_defs.h>
-#include <xfs/list.h>
-#include <xfs/cache.h>
-#include <xfs/libxfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_bit.h"
 
 #define CACHE_DEBUG 1
 #undef CACHE_DEBUG
index 0f847d21372457f859e6fc1cb335d595aca7f6a6..0a8d3093f155a599d47932381a71354a3436add2 100644 (file)
  * match the hardware acceleration available on Intel CPUs.
  */
 
-#include <libxfs.h>
+//#include <libxfs.h>
+#include <xfs/platform_defs.h>
+#include <xfs/swab.h>
+#include <xfs/xfs_arch.h>
 #include "crc32defs.h"
 
 /* types specifc to this file */
index 98054484f138bc768919cc79afc16593d1b98487..42fa7af66dbceef637bc84639929b262c852caa3 100644 (file)
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs.h>
 #include <sys/stat.h>
 #include "init.h"
 
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_inode_buf.h"
+#include "xfs_inode_fork.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+
+#include <xfs/libxfs.h>                /* for now */
+
 char *progname = "libxfs";     /* default, changed by each tool */
 
 struct cache *libxfs_bcache;   /* global buffer cache */
@@ -387,7 +400,7 @@ manage_zones(int release)
        }
        /* otherwise initialise zone allocation */
        xfs_buf_zone = kmem_zone_init(sizeof(xfs_buf_t), "xfs_buffer");
-       xfs_inode_zone = kmem_zone_init(sizeof(xfs_inode_t), "xfs_inode");
+       xfs_inode_zone = kmem_zone_init(sizeof(struct xfs_inode), "xfs_inode");
        xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork");
        xfs_ili_zone = kmem_zone_init(
                        sizeof(xfs_inode_log_item_t), "xfs_inode_log_item");
index 5d3b9b64dc1c9a40cbfa98b850a5d86350043d75..c2b91fd9c05d2e037db09f274b54008da6b05cb1 100644 (file)
@@ -1,6 +1,6 @@
 
 
-#include <xfs/libxfs.h>
+#include "xfs.h"
 
 /*
  * Simple memory interface
diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
new file mode 100644 (file)
index 0000000..0e6ed31
--- /dev/null
@@ -0,0 +1,236 @@
+/*
+ * 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_IO_H_
+#define __LIBXFS_IO_H_
+
+/*
+ * Kernel equivalent buffer based I/O interface
+ */
+
+struct xfs_buf;
+struct xfs_mount;
+struct xfs_perag;
+
+/*
+ * IO verifier callbacks need the xfs_mount pointer, so we have to behave
+ * somewhat like the kernel now for userspace IO in terms of having buftarg
+ * based devices...
+ */
+struct xfs_buftarg {
+       struct xfs_mount        *bt_mount;
+       dev_t                   dev;
+};
+
+extern void    libxfs_buftarg_init(struct xfs_mount *mp, dev_t ddev,
+                                   dev_t logdev, dev_t rtdev);
+
+#define LIBXFS_BBTOOFF64(bbs)  (((xfs_off_t)(bbs)) << BBSHIFT)
+
+#define XB_PAGES        2
+struct xfs_buf_map {
+       xfs_daddr_t             bm_bn;  /* block number for I/O */
+       int                     bm_len; /* size of I/O */
+};
+
+#define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \
+       struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) };
+
+struct xfs_buf_ops {
+       void (*verify_read)(struct xfs_buf *);
+       void (*verify_write)(struct xfs_buf *);
+};
+
+typedef struct xfs_buf {
+       struct cache_node       b_node;
+       unsigned int            b_flags;
+       xfs_daddr_t             b_bn;
+       unsigned                b_bcount;
+       unsigned int            b_length;
+       struct xfs_buftarg      *b_target;
+#define b_dev          b_target->dev
+       pthread_mutex_t         b_lock;
+       pthread_t               b_holder;
+       unsigned int            b_recur;
+       void                    *b_fspriv;
+       void                    *b_fsprivate2;
+       void                    *b_fsprivate3;
+       void                    *b_addr;
+       int                     b_error;
+       const struct xfs_buf_ops *b_ops;
+       struct xfs_perag        *b_pag;
+       struct xfs_buf_map      *b_map;
+       int                     b_nmaps;
+#ifdef XFS_BUF_TRACING
+       struct list_head        b_lock_list;
+       const char              *b_func;
+       const char              *b_file;
+       int                     b_line;
+#endif
+} xfs_buf_t;
+
+enum xfs_buf_flags_t { /* b_flags bits */
+       LIBXFS_B_EXIT           = 0x0001,       /* ==LIBXFS_EXIT_ON_FAILURE */
+       LIBXFS_B_DIRTY          = 0x0002,       /* buffer has been modified */
+       LIBXFS_B_STALE          = 0x0004,       /* buffer marked as invalid */
+       LIBXFS_B_UPTODATE       = 0x0008,       /* buffer is sync'd to disk */
+       LIBXFS_B_DISCONTIG      = 0x0010,       /* discontiguous buffer */
+       LIBXFS_B_UNCHECKED      = 0x0020,       /* needs verification */
+};
+
+#define XFS_BUF_DADDR_NULL             ((xfs_daddr_t) (-1LL))
+
+#define XFS_BUF_PTR(bp)                        ((char *)(bp)->b_addr)
+#define xfs_buf_offset(bp, offset)     (XFS_BUF_PTR(bp) + (offset))
+#define XFS_BUF_ADDR(bp)               ((bp)->b_bn)
+#define XFS_BUF_SIZE(bp)               ((bp)->b_bcount)
+#define XFS_BUF_COUNT(bp)              ((bp)->b_bcount)
+#define XFS_BUF_TARGET(bp)             ((bp)->b_dev)
+#define XFS_BUF_SET_PTR(bp,p,cnt)      ({      \
+       (bp)->b_addr = (char *)(p);             \
+       XFS_BUF_SET_COUNT(bp,cnt);              \
+})
+
+#define XFS_BUF_SET_ADDR(bp,blk)       ((bp)->b_bn = (blk))
+#define XFS_BUF_SET_COUNT(bp,cnt)      ((bp)->b_bcount = (cnt))
+
+#define XFS_BUF_FSPRIVATE(bp,type)     ((type)(bp)->b_fspriv)
+#define XFS_BUF_SET_FSPRIVATE(bp,val)  (bp)->b_fspriv = (void *)(val)
+#define XFS_BUF_FSPRIVATE2(bp,type)    ((type)(bp)->b_fsprivate2)
+#define XFS_BUF_SET_FSPRIVATE2(bp,val) (bp)->b_fsprivate2 = (void *)(val)
+#define XFS_BUF_FSPRIVATE3(bp,type)    ((type)(bp)->b_fsprivate3)
+#define XFS_BUF_SET_FSPRIVATE3(bp,val) (bp)->b_fsprivate3 = (void *)(val)
+
+#define XFS_BUF_SET_PRIORITY(bp,pri)   cache_node_set_priority( \
+                                               libxfs_bcache, \
+                                               (struct cache_node *)(bp), \
+                                               (pri))
+#define XFS_BUF_PRIORITY(bp)           (cache_node_get_priority( \
+                                               (struct cache_node *)(bp)))
+#define xfs_buf_set_ref(bp,ref)                ((void) 0)
+#define xfs_buf_ioerror(bp,err)                ((bp)->b_error = (err))
+
+#define xfs_daddr_to_agno(mp,d) \
+       ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
+#define xfs_daddr_to_agbno(mp,d) \
+       ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
+
+/* Buffer Cache Interfaces */
+
+extern struct cache    *libxfs_bcache;
+extern struct cache_operations libxfs_bcache_operations;
+
+#define LIBXFS_GETBUF_TRYLOCK  (1 << 0)
+
+#ifdef XFS_BUF_TRACING
+
+#define libxfs_readbuf(dev, daddr, len, flags, ops) \
+       libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \
+                           (dev), (daddr), (len), (flags), (ops))
+#define libxfs_readbuf_map(dev, map, nmaps, flags, ops) \
+       libxfs_trace_readbuf_map(__FUNCTION__, __FILE__, __LINE__, \
+                           (dev), (map), (nmaps), (flags), (ops))
+#define libxfs_writebuf(buf, flags) \
+       libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \
+                             (buf), (flags))
+#define libxfs_getbuf(dev, daddr, len) \
+       libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \
+                           (dev), (daddr), (len))
+#define libxfs_getbuf_map(dev, map, nmaps, flags) \
+       libxfs_trace_getbuf_map(__FUNCTION__, __FILE__, __LINE__, \
+                           (dev), (map), (nmaps), (flags))
+#define libxfs_getbuf_flags(dev, daddr, len, flags) \
+       libxfs_trace_getbuf_flags(__FUNCTION__, __FILE__, __LINE__, \
+                           (dev), (daddr), (len), (flags))
+#define libxfs_putbuf(buf) \
+       libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf))
+
+extern xfs_buf_t *libxfs_trace_readbuf(const char *, const char *, int,
+                       struct xfs_buftarg *, xfs_daddr_t, int, int,
+                       const struct xfs_buf_ops *);
+extern xfs_buf_t *libxfs_trace_readbuf_map(const char *, const char *, int,
+                       struct xfs_buftarg *, struct xfs_buf_map *, int, int,
+                       const struct xfs_buf_ops *);
+extern int     libxfs_trace_writebuf(const char *, const char *, int,
+                       xfs_buf_t *, int);
+extern xfs_buf_t *libxfs_trace_getbuf(const char *, const char *, int,
+                       struct xfs_buftarg *, xfs_daddr_t, int);
+extern xfs_buf_t *libxfs_trace_getbuf_map(const char *, const char *, int,
+                       struct xfs_buftarg *, struct xfs_buf_map *, int, int);
+extern xfs_buf_t *libxfs_trace_getbuf_flags(const char *, const char *, int,
+                       struct xfs_buftarg *, xfs_daddr_t, int, unsigned int);
+extern void    libxfs_trace_putbuf (const char *, const char *, int,
+                       xfs_buf_t *);
+
+#else
+
+extern xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, int,
+                       const struct xfs_buf_ops *);
+extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *,
+                       int, int, const struct xfs_buf_ops *);
+extern int     libxfs_writebuf(xfs_buf_t *, int);
+extern xfs_buf_t *libxfs_getbuf(struct xfs_buftarg *, xfs_daddr_t, int);
+extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *,
+                       struct xfs_buf_map *, int, int);
+extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t,
+                       int, unsigned int);
+extern void    libxfs_putbuf (xfs_buf_t *);
+
+#endif
+
+extern void    libxfs_readbuf_verify(struct xfs_buf *bp,
+                       const struct xfs_buf_ops *ops);
+extern xfs_buf_t *libxfs_getsb(struct xfs_mount *, int);
+extern void    libxfs_bcache_purge(void);
+extern void    libxfs_bcache_flush(void);
+extern void    libxfs_purgebuf(xfs_buf_t *);
+extern int     libxfs_bcache_overflowed(void);
+extern int     libxfs_bcache_usage(void);
+
+/* Buffer (Raw) Interfaces */
+extern xfs_buf_t *libxfs_getbufr(struct xfs_buftarg *, xfs_daddr_t, int);
+extern void    libxfs_putbufr(xfs_buf_t *);
+
+extern int     libxfs_writebuf_int(xfs_buf_t *, int);
+extern int     libxfs_writebufr(struct xfs_buf *);
+extern int     libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t *, int, int);
+extern int     libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *, int);
+
+extern int libxfs_bhash_size;
+
+#define LIBXFS_BREAD   0x1
+#define LIBXFS_BWRITE  0x2
+#define LIBXFS_BZERO   0x4
+
+extern void    libxfs_iomove (xfs_buf_t *, uint, int, void *, int);
+
+static inline int
+xfs_buf_verify_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
+{
+       return xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length),
+                               cksum_offset);
+}
+
+static inline void
+xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
+{
+       xfs_update_cksum(bp->b_addr, BBTOB(bp->b_length),
+                        cksum_offset);
+}
+
+#endif /* __LIBXFS_IO_H__ */
index 8d1a117688d9e2abbc7ddb31198909adbe26cad0..f16a51c71325e633a9bca1e5b8579e0d55bc2646 100644 (file)
@@ -17,7 +17,6 @@
  */
 
 #define ustat __kernel_ustat
-#include <xfs/libxfs.h>
 #include <mntent.h>
 #include <sys/stat.h>
 #undef ustat
@@ -26,6 +25,9 @@
 #include <sys/ioctl.h>
 #include <sys/sysinfo.h>
 
+#include "xfs.h"
+#include "xfs_fs.h"
+
 int platform_has_uuid = 1;
 extern char *progname;
 static int max_block_alignment;
index 73d5a9e0df07c6b0d967512fb1db6bf1495c7717..31d8005937264ef52849676c8b76ff7a41b6b799 100644 (file)
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_inode_buf.h"
+#include "xfs_inode_fork.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
 
 kmem_zone_t    *xfs_buf_item_zone;
 kmem_zone_t    *xfs_ili_zone;          /* inode log item zone */
index dbb3e7623d4c416e7ca7ddf2d02c7ae8d77a39d2..c4b69711bc1dcba5f1e8333f0bf4689a3da1040a 100644 (file)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <libxfs.h>
+#include <xfs/platform_defs.h>
 #include "radix-tree.h"
 
 #ifndef ARRAY_SIZE
index b19c29cb8f18f37ce4c46f7c1dbb8dcad29889e2..aeaae45bec570ef09b397c7373918e0618e1022c 100644 (file)
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+
 #include "xfs.h"
 #include "init.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_inode_buf.h"
+#include "xfs_inode_fork.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+
+#include <xfs/libxfs.h>                /* for now */
 
 /*
  * Important design/architecture note:
index 422a005c0e302752de69682e593eb384bfd5fd6f..8d0eed7340fb85cc4dcfad4ab55306dc14d63318 100644 (file)
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_inode_buf.h"
+#include "xfs_inode_fork.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
 
 /*
  * Simple transaction interface
index 3d8db1c17a2fd5b2189c2094030d43a91b813b10..41cc155f4b5b5ce968bfd0d1aeee2d50f79cda6e 100644 (file)
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs.h>
-#include <time.h>
-#include <stdio.h>
-#include <stdarg.h>
+#include "xfs.h"
+#include "init.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_inode_buf.h"
+#include "xfs_inode_fork.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_bmap.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_trans_space.h"
+#include "xfs_ialloc.h"
+#include "xfs_alloc.h"
 
 /*
  * Calculate the worst case log unit reservation for a given superblock
@@ -724,3 +737,12 @@ xfs_verifier_error(
                  bp->b_error == -EFSBADCRC ? "CRC error" : "corruption",
                  bp->b_bn, BBTOB(bp->b_length));
 }
+
+void
+xfs_reinit_percpu_counters(
+       struct xfs_mount        *mp)
+{
+       mp->m_icount = mp->m_sb.sb_icount;
+       mp->m_ifree = mp->m_sb.sb_ifree;
+       mp->m_fdblocks = mp->m_sb.sb_fdblocks;
+}
index 97551448c28ffa6fa9b741fb7a12a615b0685581..26db719ee839c119cb69627c74a956ee4f5664cc 100644 (file)
@@ -46,8 +46,8 @@
  * define a guard and something we can check to determine what include context
  * we are running from.
  */
-#ifndef __LIBXFS_INTERNAL_XFS_H
-#define __LIBXFS_INTERNAL_XFS_H
+#ifndef __LIBXFS_INTERNAL_XFS_H__
+#define __LIBXFS_INTERNAL_XFS_H__
 
 /*
  * repair doesn't have a inode when it calls libxfs_dir2_data_freescan,
  * Now we've renamed and mapped everything, include the rest of the external
  * libxfs headers.
  */
-#include <xfs/libxfs.h>
-#include "xfs_dir2_priv.h"
+#include <xfs/platform_defs.h>
+
+#include <xfs/list.h>
+#include <xfs/hlist.h>
+#include <xfs/cache.h>
+#include <xfs/bitops.h>
+#include <xfs/kmem.h>
+#include <xfs/radix-tree.h>
+#include <xfs/swab.h>
+#include <xfs/atomic.h>
+
+#include <xfs/xfs_types.h>
+#include <xfs/xfs_arch.h>
+
+#include <xfs/xfs_fs.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/xfs_cksum.h>
+
+/*
+ * This mirrors the kernel include for xfs_buf.h - it's implicitly included in
+ * every files via a similar include in the kernel xfs_linux.h.
+ */
+#include <xfs/libxfs_io.h>
+
+/* for all the support code that uses progname in error messages */
+extern char    *progname;
 
 #undef ASSERT
 #define ASSERT(ex) assert(ex)
@@ -184,10 +215,11 @@ typedef __uint32_t                inst_t;         /* an instruction */
 
 #define STATIC                         static
 
-#define ATTR_ROOT                      LIBXFS_ATTR_ROOT
-#define ATTR_SECURE                    LIBXFS_ATTR_SECURE
-#define ATTR_CREATE                    LIBXFS_ATTR_CREATE
-#define ATTR_REPLACE                   LIBXFS_ATTR_REPLACE
+/* XXX: need to push these out to make LIBXFS_ATTR defines */
+#define ATTR_ROOT                      0x0002
+#define ATTR_SECURE                    0x0008
+#define ATTR_CREATE                    0x0010
+#define ATTR_REPLACE                   0x0020
 #define ATTR_KERNOTIME                 0
 #define ATTR_KERNOVAL                  0
 
@@ -196,6 +228,14 @@ typedef __uint32_t         inst_t;         /* an instruction */
 #define XFS_IGET_CREATE                        0x1
 #define XFS_IGET_UNTRUSTED             0x2
 
+extern void cmn_err(int, char *, ...);
+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_hex_dump(d,n)              ((void) 0)
+
+
 /* stop unused var warnings by assigning mp to itself */
 #define XFS_CORRUPTION_ERROR(e,l,mp,m) do { \
        (mp) = (mp); \
@@ -310,6 +350,10 @@ roundup_64(__uint64_t x, __uint32_t y)
        return x * y;
 }
 
+#define __round_mask(x, y) ((__typeof__(x))((y)-1))
+#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
+#define round_down(x, y) ((x) & ~__round_mask(x, y))
+
 /* buffer management */
 #define XFS_BUF_LOCK                   0
 #define XFS_BUF_TRYLOCK                        0
@@ -447,32 +491,31 @@ do { \
 
 /*
  * Prototypes for kernel static functions that are aren't in their
- * associated header files
+ * associated header files.
  */
+struct xfs_da_args;
+struct xfs_bmap_free;
+struct xfs_bmap_free_item;
+struct xfs_mount;
+struct xfs_sb;
+struct xfs_trans;
+struct xfs_inode;
+struct xfs_log_item;
+struct xfs_buf;
+struct xfs_buf_map;
+struct xfs_buf_log_item;
+struct xfs_buftarg;
 
 /* xfs_attr.c */
 int xfs_attr_rmtval_get(struct xfs_da_args *);
 
 /* xfs_bmap.c */
-void xfs_bmap_del_free(xfs_bmap_free_t *, xfs_bmap_free_item_t *,
-                       xfs_bmap_free_item_t *);
-
-/*
- * For regular files we only update the on-disk filesize when actually
- * writing data back to disk.  Until then only the copy in the VFS inode
- * is uptodate.
- */
-static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
-{
-       if (S_ISREG(ip->i_d.di_mode))
-               return ip->i_size;
-       return ip->i_d.di_size;
-}
-#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
+void xfs_bmap_del_free(struct xfs_bmap_free *, struct xfs_bmap_free_item *,
+                       struct xfs_bmap_free_item *);
 
 /* xfs_mount.c */
-int xfs_initialize_perag_data(xfs_mount_t *, xfs_agnumber_t);
-void xfs_mount_common(xfs_mount_t *, xfs_sb_t *);
+int xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t);
+void xfs_mount_common(struct xfs_mount *, struct xfs_sb *);
 
 /*
  * logitem.c and trans.c prototypes
@@ -486,15 +529,15 @@ void xfs_trans_del_item(struct xfs_log_item *);
 void xfs_trans_free_items(struct xfs_trans *, int);
 
 /* xfs_inode_item.c */
-void xfs_inode_item_init (xfs_inode_t *, xfs_mount_t *);
+void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
 
 /* xfs_buf_item.c */
-void xfs_buf_item_init (xfs_buf_t *, xfs_mount_t *);
-void xfs_buf_item_log (xfs_buf_log_item_t *, uint, uint);
+void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
+void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
 
 /* xfs_trans_buf.c */
-xfs_buf_t *xfs_trans_buf_item_match(xfs_trans_t *, struct xfs_buftarg *,
-                       struct xfs_buf_map *, int);
+struct xfs_buf *xfs_trans_buf_item_match(struct xfs_trans *,
+                       struct xfs_buftarg *, struct xfs_buf_map *, int);
 
 /* local source files */
 #define xfs_mod_fdblocks(mp, delta, rsvd) \
@@ -502,18 +545,15 @@ xfs_buf_t *xfs_trans_buf_item_match(xfs_trans_t *, struct xfs_buftarg *,
 #define xfs_mod_frextents(mp, delta) \
        libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FREXTENTS, delta, 0)
 int  libxfs_mod_incore_sb(struct xfs_mount *, int, int64_t, int);
+void xfs_reinit_percpu_counters(struct xfs_mount *mp);
 
-static inline void
-xfs_reinit_percpu_counters(struct xfs_mount *mp)
-{
-       mp->m_icount = mp->m_sb.sb_icount;
-       mp->m_ifree = mp->m_sb.sb_ifree;
-       mp->m_fdblocks = mp->m_sb.sb_fdblocks;
-}
-
-void xfs_trans_mod_sb(xfs_trans_t *, uint, long);
+void xfs_trans_mod_sb(struct xfs_trans *, uint, long);
 void xfs_trans_init(struct xfs_mount *);
 int  xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
 void xfs_verifier_error(struct xfs_buf *bp);
 
-#endif /* __LIBXFS_INTERNAL_XFS_H */
+/* 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);
+
+#endif /* __LIBXFS_INTERNAL_XFS_H__ */
index 25e840268024ecee38c40ff3d802088248994b4d..15b4e1715dc54688fbecb164de83b076a6196934 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_shared.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_sb.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_btree.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_alloc.h"
+#include "xfs_cksum.h"
+#include "xfs_trace.h"
+#include "xfs_trans.h"
 
 struct workqueue_struct *xfs_alloc_wq;
 
index 2d755898bc79f81f20449721fe9be1cc8ba3fda4..20a072dd9c55de4e296741a7fd36af0ee025b931 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_sb.h"
+#include "xfs_mount.h"
+#include "xfs_btree.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_alloc.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
+#include "xfs_trans.h"
+
 
 STATIC struct xfs_btree_cur *
 xfs_allocbt_dup_cursor(
index 5aa8c4ff346ac59f197260cc75c58b769d4f940a..00a319bd60a9917740189c04d582e0d3753cce23 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_attr_sf.h"
+#include "xfs_inode.h"
+#include "xfs_alloc.h"
+#include "xfs_trans.h"
+#include "xfs_bmap.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_attr_leaf.h"
+#include "xfs_attr_remote.h"
+#include "xfs_trans_space.h"
+#include "xfs_trace.h"
 
 /*
  * xfs_attr.c
index 326357aa3afa245402530c4d37bc98ee33e0a819..01173a743e855661e524437ce88fb468691b7c7a 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_sb.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_bmap.h"
+#include "xfs_attr_sf.h"
+#include "xfs_attr_remote.h"
+#include "xfs_attr_leaf.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
+#include "xfs_dir2.h"
 
-#include <xfs.h>
 
 /*
  * xfs_attr_leaf.c
index 025c4b820c03a1c642c18d9c53d46e08a0ab2d94..f0b617a4908b6e50f2a2d65fcf720def87441f11 100644 (file)
@@ -52,7 +52,7 @@ int   xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
 int    xfs_attr_shortform_remove(struct xfs_da_args *args);
 int    xfs_attr_shortform_list(struct xfs_attr_list_context *context);
 int    xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
-int    xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
+int    xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
 
 
 /*
index 23d1871c274d5bb39274c3d1141f6f59d85578d2..356b2e00e09e38a283944ad7c486ef0ea0ca73c6 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_alloc.h"
+#include "xfs_trans.h"
+#include "xfs_bmap.h"
+#include "xfs_attr_leaf.h"
+#include "xfs_attr_remote.h"
+#include "xfs_trans_space.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
 
 #define ATTR_RMTVALUE_MAPSIZE  1       /* # of map entries at once */
 
index 7569c104439fc487886648e796808c8c2dbea5ed..55a2a25e44d77c887c565698b2d847db6961d93e 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_sb.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_dir2.h"
+#include "xfs_inode.h"
+#include "xfs_btree.h"
+#include "xfs_trans.h"
+#include "xfs_alloc.h"
+#include "xfs_bmap.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_trans_space.h"
+#include "xfs_trace.h"
+#include "xfs_attr_leaf.h"
+#include "xfs_quota_defs.h"
+
 
 kmem_zone_t            *xfs_bmap_free_item_zone;
 
index 7b8b307f79b776bdd9d6f625811ceb474ad0797d..f1ad2f97976cfc2fb0c9cfff5fa69c9a221e894a 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_alloc.h"
+#include "xfs_btree.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_bmap.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
 
 /*
  * Determine the extent state.
index 84f36ce563a78ef5e7a6c88bc2e466895c355488..6c460611d9147c43b468577112575007afcc1c51 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_btree.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
+#include "xfs_alloc.h"
 
 /*
  * Cursor allocation zone.
index 3c92a8085d07c993bed897d3bdcf49bb3d942671..a7502aecb6fe3c68b2c65c6b55441e29702e417f 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_dir2.h"
+#include "xfs_dir2_priv.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_alloc.h"
+#include "xfs_bmap.h"
+#include "xfs_attr_leaf.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
 
 /*
  * xfs_da_btree.c
index fe20fff6644521b31df8096b1ac68689b9c3bf2f..9d624a6229468f721beaba38826008492f325aa0 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_dir2.h"
+#include "xfs_dir2_priv.h"
 
 /*
  * Shortform directory ops
index 0be516f27498b6ac0a8ec13de4f61f1935f4e736..9ad9540d4635ffe86a0b2f4fda6a26e0927cc2eb 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_bmap.h"
+#include "xfs_dir2.h"
+#include "xfs_dir2_priv.h"
+#include "xfs_trace.h"
 
 struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR };
 
index 97850bb0dd33061b2149265164e3c4fa1e58c004..d949c6363cd92b0f5b277b5562eb1f79e3c13bed 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_bmap.h"
+#include "xfs_dir2.h"
+#include "xfs_dir2_priv.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
 
 /*
  * Local function prototypes.
index 8e138dbbc86a43a33629502eb84d119ebbba0bac..3d13011ea771897fe24f6b38f9c8c3600414d654 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_dir2.h"
+#include "xfs_dir2_priv.h"
+#include "xfs_trans.h"
+#include "xfs_cksum.h"
 
 /*
  * Check the consistency of the data block.
index d652bead7a2321c1d1ededb2c87b51b59e9655a6..4c813864e86905ce7f52ecfad73880c8f30d52ad 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_bmap.h"
+#include "xfs_dir2.h"
+#include "xfs_dir2_priv.h"
+#include "xfs_trace.h"
+#include "xfs_trans.h"
+#include "xfs_cksum.h"
 
 /*
  * Local function declarations.
index 53afb38cb7a2b899b7cd7841c8532888c55c6567..ecda1ddb2d3413627a8d71d1b2427ee02620b28e 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_bmap.h"
+#include "xfs_dir2.h"
+#include "xfs_dir2_priv.h"
+#include "xfs_trace.h"
+#include "xfs_trans.h"
+#include "xfs_cksum.h"
 
 /*
  * Function declarations.
index 020856b9e181a92c584c79f7a818bfabc015d712..f549afef034efc96d496b177ac04c98907fa6086 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_dir2.h"
+#include "xfs_dir2_priv.h"
+#include "xfs_trace.h"
 
 /*
  * Prototypes for internal functions.
index 97ac60c941dae25c4c443a2266e06641e5d35607..85827985fab99eb88d0b2fd4d2177a3af496dc9e 100644 (file)
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_cksum.h"
+#include "xfs_trace.h"
+#include "xfs_quota_defs.h"
 
 /*
  * XXX: kernel implementation causes ndquots calc to go real
index 2aefcdd27710a732c0dac443effffffe3fbbb62d..841bde5e41a5ffac4eae057587885f503d3e33ef 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_sb.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_btree.h"
+#include "xfs_ialloc.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_alloc.h"
+#include "xfs_bmap.h"
+#include "xfs_cksum.h"
+#include "xfs_trans.h"
+#include "xfs_trace.h"
 
 
 /*
index 55799b4ce46b00874f8f8b2249a580a8e1e91d2f..fd62c7f90959ffdc78e4deb5f05e0912f4d1b931 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_btree.h"
+#include "xfs_ialloc.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_alloc.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
+#include "xfs_trans.h"
+
 
 STATIC int
 xfs_inobt_get_minrecs(
index 097bfb3a63dac24cd7c5bc5f83375b4f94e1a732..561fdd2f01b349b7bfd32911349adf5068f687c4 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_cksum.h"
+#include "xfs_trans.h"
+#include "xfs_ialloc.h"
 
 /*
  * Check that none of the inode's in the buffer have a next
index 1b211549b75c220b4975848496c6531c72f80a01..334ff86b4c651cf6d7c97704db139c27a54f58e1 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_trans.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_bmap.h"
+#include "xfs_trace.h"
+#include "xfs_attr_sf.h"
 
 kmem_zone_t *xfs_ifork_zone;
 
index 8818c634dbf3211211c13de32a76b4b84deb09a9..c10597973333ce44487c4c1c6723dac4ed2d38a3 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_trans_space.h"
+#include "xfs_inode.h"
+#include "xfs_da_btree.h"
+#include "xfs_attr_leaf.h"
+#include "xfs_bmap_btree.h"
 
 /*
  * Calculate the maximum length in bytes that would be required for a local
index 088f104de39797b71eef3fde22679363676a9ad2..a4201566d6d568f9a9442d344f2161b3388b3b22 100644 (file)
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_bmap.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_alloc.h"
+#include "xfs_trans.h"
+#include "xfs_trans_space.h"
+#include "xfs_trace.h"
+
 
 /*
  * Realtime allocator bitmap functions shared with userspace.
index 39282a9daafacf2d982c9ec987fc48c723b973ae..e5cba591bce35955e6161d24909790c102f87bcf 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_bit.h"
+#include "xfs_sb.h"
+#include "xfs_mount.h"
+#include "xfs_inode.h"
+#include "xfs_ialloc.h"
+#include "xfs_alloc.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
+#include "xfs_trans.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_ialloc_btree.h"
 
 /*
  * Physical superblock buffer manipulations. Shared with libxfs in userspace.
index 39a86c8ebea2a14c705012e478b0e078adbfb00a..aad3df8a1325b63569fbe64b871cc99d42ea0c07 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_shared.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_inode.h"
+#include "xfs_trace.h"
+#include "xfs_cksum.h"
+#include "xfs_trans.h"
+
 
 /*
  * Each contiguous block has a header, so it is not just a simple pathlen
index 95c53a80328ac53e38916f601d6796fbe61cfe1e..2bb622da78e32c74b4ce7933727030b7dedc85ca 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs.h>
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_log_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
+#include "xfs_inode.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_ialloc.h"
+#include "xfs_trans.h"
+#include "xfs_trans_space.h"
+#include "xfs_trace.h"
+#include "xfs_quota_defs.h"
 
 /*
  * A buffer has a format structure overhead in the log in addition
index 949b79d6cebc7c436e3a4bb418043ec0e9760b8b..053cf042e71d7c3bf33b3bc3737a18c49985417f 100644 (file)
@@ -16,6 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <xfs/libxfs.h>
 #include <xfs/libxlog.h>
 
 int print_exit;
index d1fa53534d0f80544940182da6a41e00b40d16d2..cc8aff8d15ce3fcfda788a653066957ae53faca2 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 <xfs/libxfs.h>
 #include <xfs/libxlog.h>
 
 #define xfs_readonly_buftarg(buftarg)                  (0)
index f6ef0e91b7ff7406f9e06ba72897ceb62ce821a0..1517846fafbbec1d892964c5832510ba1548a744 100644 (file)
@@ -15,6 +15,8 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+#include <xfs/libxfs.h>
+#include <xfs/libxlog.h>
 
 #include "logprint.h"
 
index a333077cc70d00b85884ae8afabb3a8fa3bd5e29..dcecb44b129be6f6fbf418083e43a9d0fe977806 100644 (file)
@@ -15,6 +15,8 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+#include <xfs/libxfs.h>
+#include <xfs/libxlog.h>
 
 #include "logprint.h"
 
index c61bd0e07297cd9d0b0ae129179e45059f0dd6e2..521ab66a69ffaa4ad5eda4c12c2f2c9ea81e2e3b 100644 (file)
@@ -15,6 +15,8 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+#include <xfs/libxfs.h>
+#include <xfs/libxlog.h>
 
 #include "logprint.h"
 
index 2b5c4beb9f3ab26b0a72095f4f0e6d28aa75d260..a02c71a0f45dfa98dfd057239f6f19c30853b347 100644 (file)
@@ -15,6 +15,8 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+#include <xfs/libxfs.h>
+#include <xfs/libxlog.h>
 
 #include "logprint.h"
 
index 2dd3a1013e215f4b182ee4c089d4da6db3e9f3b6..0911b6fad5c2ed3d93b3b3ac283d58bbcafcc841 100644 (file)
@@ -15,6 +15,8 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+#include <xfs/libxfs.h>
+#include <xfs/libxlog.h>
 
 #include "logprint.h"
 
index 7a56462f011e3585795397bb31c9201dcd3b01b5..960a26776f71249893053ed19131fc9acf39662e 100644 (file)
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include "logprint.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <xfs/libxfs.h>
+#include <xfs/libxlog.h>
+
+#include "logprint.h"
+
 #define OP_PRINT       0
 #define OP_PRINT_TRANS 1
 #define OP_DUMP                2
index 228b04280587842aac0437ed2ae8ffcf87ee3955..018af815293b187a1b4ec7dd2bad34445ff2514b 100644 (file)
@@ -18,8 +18,6 @@
 #ifndef LOGPRINT_H
 #define LOGPRINT_H
 
-#include <xfs/libxlog.h>
-
 /* command line flags */
 extern int     print_data;
 extern int     print_only_data;
index 2817fed253101210527a80acef204567d23fec3c..0192346d8d58cc1a75914217a025711cb9230740 100644 (file)
@@ -16,6 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <xfs/libxfs.h>
 #include <xfs/libxlog.h>
 #include "avl.h"
 #include "globals.h"
index 5024e8092d2d190a6f08f9f933df79c1fd22371b..11a6069aca71af5f7a006023c7f26a35a1994152 100644 (file)
@@ -16,6 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <xfs/libxfs.h>
 #include <xfs/libxlog.h>
 #include <sys/resource.h>
 #include "avl.h"