From: Dave Chinner Date: Sun, 10 May 2015 23:30:14 +0000 (+1000) Subject: libxfs: disambiguate xfs.h X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a016903ab3870eafcd8561681e1366d1163e0185;p=xfsprogs-dev.git libxfs: disambiguate xfs.h There are two "xfs.h" header files in xfsprogs. include/xfs.h contains the userspace API definitions for the platform and ioctl interfaces. libxfs/xfs.h contains support infrastructure to allow kernel code to compile in userspace. They have different purposes, and so we need to disambiguate them so it is clear what header files are being included in which files. We can't change include/xfs.h as it is exported and installed into /usr/include/xfs, and that means we have to rename the libxfs internal header file. Rename this to "libxfs_priv.h" so it is clear that it is private to libxfs, and update all the libxfs code to include it. Signed-off-by: Dave Chinner --- diff --git a/libxfs/Makefile b/libxfs/Makefile index 51b98ec6..df4e3691 100644 --- a/libxfs/Makefile +++ b/libxfs/Makefile @@ -15,10 +15,10 @@ PKGHFILES = xfs_fs.h \ xfs_types.h # headers with build dependencies -HFILES = xfs.h \ - init.h \ +HFILES = init.h \ crc32defs.h \ crc32table.h \ + libxfs_priv.h \ xfs_dir2_priv.h \ # headers installed in QA targets diff --git a/libxfs/cache.c b/libxfs/cache.c index 105d2f97..4753a1d7 100644 --- a/libxfs/cache.c +++ b/libxfs/cache.c @@ -22,7 +22,7 @@ #include #include -#include "xfs.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/init.c b/libxfs/init.c index 42fa7af6..6f404aaa 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -19,7 +19,7 @@ #include #include "init.h" -#include "xfs.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/kmem.c b/libxfs/kmem.c index c2b91fd9..6421304b 100644 --- a/libxfs/kmem.c +++ b/libxfs/kmem.c @@ -1,6 +1,6 @@ -#include "xfs.h" +#include "libxfs_priv.h" /* * Simple memory interface diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h new file mode 100644 index 00000000..26db719e --- /dev/null +++ b/libxfs/libxfs_priv.h @@ -0,0 +1,559 @@ +/* + * 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 + */ + +/* + * This header is effectively a "namespace multiplexor" for the + * user level XFS code. It provides all of the necessary stuff + * such that we can build some parts of the XFS kernel code in + * user space in a controlled fashion, and translates the names + * used in the kernel into the names which libxfs is going to + * make available to user tools. + * + * It should only ever be #include'd by XFS "kernel" code being + * compiled in user space. + * + * Our goals here are to... + * o "share" large amounts of complex code between user and + * kernel space; + * o shield the user tools from changes in the bleeding + * edge kernel code, merging source changes when + * convenient and not immediately (no symlinks); + * o i.e. be able to merge changes to the kernel source back + * into the affected user tools in a controlled fashion; + * o provide a _minimalist_ life-support system for kernel + * code in user land, not the "everything + the kitchen + * sink" model which libsim had mutated into; + * o allow the kernel code to be completely free of code + * specifically there to support the user level build. + */ + +/* + * 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__ + +/* + * repair doesn't have a inode when it calls libxfs_dir2_data_freescan, + * so we map this internally for now. + */ +#define xfs_dir2_data_freescan(ip, hdr, loghead) \ + __xfs_dir2_data_freescan((ip)->i_mount->m_dir_geo, \ + (ip)->d_ops, hdr, loghead) + +/* + * start by remapping all the symbols we expect external users to call + * to the libxfs_ namespace. This ensures that all internal symbols are + * remapped correctly throughout all the included header files + * as well as in the C code. + */ +#define xfs_alloc_fix_freelist libxfs_alloc_fix_freelist +#define xfs_attr_get libxfs_attr_get +#define xfs_attr_set libxfs_attr_set +#define xfs_attr_remove libxfs_attr_remove +#define xfs_rtfree_extent libxfs_rtfree_extent + +#define xfs_fs_repair_cmn_err libxfs_fs_repair_cmn_err +#define xfs_fs_cmn_err libxfs_fs_cmn_err + +#define xfs_bmap_finish libxfs_bmap_finish +#define xfs_trans_ichgtime libxfs_trans_ichgtime + +#define xfs_trans_alloc libxfs_trans_alloc +#define xfs_trans_add_item libxfs_trans_add_item +#define xfs_trans_bhold libxfs_trans_bhold +#define xfs_trans_binval libxfs_trans_binval +#define xfs_trans_bjoin libxfs_trans_bjoin +#define xfs_trans_brelse libxfs_trans_brelse +#define xfs_trans_commit libxfs_trans_commit +#define xfs_trans_cancel libxfs_trans_cancel +#define xfs_trans_del_item libxfs_trans_del_item +#define xfs_trans_dup libxfs_trans_dup +#define xfs_trans_get_buf libxfs_trans_get_buf +#define xfs_trans_getsb libxfs_trans_getsb +#define xfs_trans_iget libxfs_trans_iget +#define xfs_trans_ijoin libxfs_trans_ijoin +#define xfs_trans_ijoin_ref libxfs_trans_ijoin_ref +#define xfs_trans_init libxfs_trans_init +#define xfs_trans_inode_alloc_buf libxfs_trans_inode_alloc_buf +#define xfs_trans_log_buf libxfs_trans_log_buf +#define xfs_trans_log_inode libxfs_trans_log_inode +#define xfs_trans_mod_sb libxfs_trans_mod_sb +#define xfs_trans_read_buf libxfs_trans_read_buf +#define xfs_trans_read_buf_map libxfs_trans_read_buf_map +#define xfs_trans_roll libxfs_trans_roll +#define xfs_trans_get_buf_map libxfs_trans_get_buf_map +#define xfs_trans_reserve libxfs_trans_reserve + +/* xfs_attr_leaf.h */ +#define xfs_attr_leaf_newentsize libxfs_attr_leaf_newentsize + +/* xfs_bit.h */ +#define xfs_highbit32 libxfs_highbit32 +#define xfs_highbit64 libxfs_highbit64 + +/* xfs_bmap.h */ +#define xfs_bmap_cancel libxfs_bmap_cancel +#define xfs_bmap_last_offset libxfs_bmap_last_offset +#define xfs_bmapi_write libxfs_bmapi_write +#define xfs_bmapi_read libxfs_bmapi_read +#define xfs_bunmapi libxfs_bunmapi + +/* xfs_bmap_btree.h */ +#define xfs_bmbt_get_all libxfs_bmbt_get_all + +/* xfs_da_btree.h */ +#define xfs_da_brelse libxfs_da_brelse +#define xfs_da_hashname libxfs_da_hashname +#define xfs_da_shrink_inode libxfs_da_shrink_inode +#define xfs_da_read_buf libxfs_da_read_buf + +/* xfs_dir2.h */ +#define xfs_dir_createname libxfs_dir_createname +#define xfs_dir_init libxfs_dir_init +#define xfs_dir_lookup libxfs_dir_lookup +#define xfs_dir_replace libxfs_dir_replace +#define xfs_dir2_isblock libxfs_dir2_isblock +#define xfs_dir2_isleaf libxfs_dir2_isleaf + +/* xfs_dir2_data.h */ +#define __xfs_dir2_data_freescan libxfs_dir2_data_freescan +#define xfs_dir2_data_log_entry libxfs_dir2_data_log_entry +#define xfs_dir2_data_log_header libxfs_dir2_data_log_header +#define xfs_dir2_data_make_free libxfs_dir2_data_make_free +#define xfs_dir2_data_use_free libxfs_dir2_data_use_free +#define xfs_dir2_shrink_inode libxfs_dir2_shrink_inode + +/* xfs_inode.h */ +#define xfs_dinode_from_disk libxfs_dinode_from_disk +#define xfs_dinode_to_disk libxfs_dinode_to_disk +#define xfs_dinode_calc_crc libxfs_dinode_calc_crc +#define xfs_idata_realloc libxfs_idata_realloc +#define xfs_idestroy_fork libxfs_idestroy_fork + +#define xfs_dinode_verify libxfs_dinode_verify + +/* xfs_sb.h */ +#define xfs_log_sb libxfs_log_sb +#define xfs_sb_from_disk libxfs_sb_from_disk +#define xfs_sb_quota_from_disk libxfs_sb_quota_from_disk +#define xfs_sb_to_disk libxfs_sb_to_disk + +/* xfs_symlink.h */ +#define xfs_symlink_blocks libxfs_symlink_blocks +#define xfs_symlink_hdr_ok libxfs_symlink_hdr_ok + +/* xfs_trans_resv.h */ +#define xfs_trans_resv_calc libxfs_trans_resv_calc + + +/* + * Now we've renamed and mapped everything, include the rest of the external + * libxfs headers. + */ +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +/* 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 + +/* + * 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 + +/* for all the support code that uses progname in error messages */ +extern char *progname; + +#undef ASSERT +#define ASSERT(ex) assert(ex) + +typedef __uint32_t uint_t; +typedef __uint32_t inst_t; /* an instruction */ + +#ifndef EWRONGFS +#define EWRONGFS EINVAL +#endif + +#define xfs_error_level 0 + +#define STATIC static + +/* 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 + +#define IHOLD(ip) ((void) 0) + +#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); \ + cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \ +} while (0) + +#define XFS_ERROR_REPORT(e,l,mp) do { \ + (mp) = (mp); \ + cmn_err(CE_ALERT, "%s: XFS_ERROR_REPORT", (e)); \ +} while (0) + +#define XFS_QM_DQATTACH(mp,ip,flags) 0 +#define XFS_ERRLEVEL_LOW 1 +#define XFS_FORCED_SHUTDOWN(mp) 0 +#define XFS_ILOCK_EXCL 0 +#define XFS_STATS_INC(count) do { } while (0) +#define XFS_STATS_DEC(count, x) do { } while (0) +#define XFS_STATS_ADD(count, x) do { } while (0) +#define XFS_TRANS_MOD_DQUOT_BYINO(mp,tp,ip,field,delta) do { } while (0) +#define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl) 0 +#define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl) 0 +#define XFS_TEST_ERROR(expr,a,b,c) ( expr ) +#define XFS_WANT_CORRUPTED_GOTO(mp, expr, l) \ + { if (!(expr)) { error = EFSCORRUPTED; goto l; } } +#define XFS_WANT_CORRUPTED_RETURN(mp, expr) \ + { if (!(expr)) { return EFSCORRUPTED; } } + +#ifdef __GNUC__ +#define __return_address __builtin_return_address(0) +#endif + +#define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 + +/* miscellaneous kernel routines not in user space */ +#define down_read(a) ((void) 0) +#define up_read(a) ((void) 0) +#define spin_lock_init(a) ((void) 0) +#define spin_lock(a) ((void) 0) +#define spin_unlock(a) ((void) 0) +#define likely(x) (x) +#define unlikely(x) (x) +#define rcu_read_lock() ((void) 0) +#define rcu_read_unlock() ((void) 0) +#define WARN_ON_ONCE(expr) ((void) 0) + +#define percpu_counter_read(x) (*x) +#define percpu_counter_sum(x) (*x) + +/* + * prandom_u32 is used for di_gen inode allocation, it must be zero for libxfs + * or all sorts of badness can occur! + */ +#define prandom_u32() 0 + +#define PAGE_CACHE_SIZE getpagesize() + +static inline int __do_div(unsigned long long *n, unsigned base) +{ + int __res; + __res = (int)(((unsigned long) *n) % (unsigned) base); + *n = ((unsigned long) *n) / (unsigned) base; + return __res; +} + +#define do_div(n,base) (__do_div((unsigned long long *)&(n), (base))) +#define do_mod(a, b) ((a) % (b)) +#define rol32(x,y) (((x) << (y)) | ((x) >> (32 - (y)))) + +#define min_t(type,x,y) \ + ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) +#define max_t(type,x,y) \ + ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) + + + +static inline __attribute__((const)) +int is_power_of_2(unsigned long n) +{ + return (n != 0 && ((n & (n - 1)) == 0)); +} + +/* + * xfs_iroundup: round up argument to next power of two + */ +static inline uint +roundup_pow_of_two(uint v) +{ + int i; + uint m; + + if ((v & (v - 1)) == 0) + return v; + ASSERT((v & 0x80000000) == 0); + if ((v & (v + 1)) == 0) + return v + 1; + for (i = 0, m = 1; i < 31; i++, m <<= 1) { + if (v & m) + continue; + v |= m; + if ((v & (v + 1)) == 0) + return v + 1; + } + ASSERT(0); + return 0; +} + +static inline __uint64_t +roundup_64(__uint64_t x, __uint32_t y) +{ + x += y - 1; + do_div(x, 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 +#define XBF_LOCK XFS_BUF_LOCK +#define XBF_TRYLOCK XFS_BUF_TRYLOCK +#define XBF_DONT_BLOCK 0 +#define XBF_UNMAPPED 0 +#define XBF_DONE 0 +#define XFS_BUF_GETERROR(bp) 0 +#define XFS_BUF_DONE(bp) ((bp)->b_flags |= LIBXFS_B_UPTODATE) +#define XFS_BUF_ISDONE(bp) ((bp)->b_flags & LIBXFS_B_UPTODATE) +#define xfs_buf_stale(bp) ((bp)->b_flags |= LIBXFS_B_STALE) +#define XFS_BUF_UNDELAYWRITE(bp) ((bp)->b_flags &= ~LIBXFS_B_DIRTY) +#define XFS_BUF_SET_VTYPE(a,b) ((void) 0) +#define XFS_BUF_SET_VTYPE_REF(a,b,c) ((void) 0) +#define XFS_BUF_SET_BDSTRAT_FUNC(a,b) ((void) 0) + +/* avoid gcc warning */ +#define xfs_incore(bt,blkno,len,lockit) ({ \ + typeof(blkno) __foo = (blkno); \ + typeof(len) __bar = (len); \ + (blkno) = __foo; \ + (len) = __bar; /* no set-but-unused warning */ \ + NULL; \ +}) +#define xfs_buf_relse(bp) libxfs_putbuf(bp) +#define xfs_buf_get(devp,blkno,len,f) (libxfs_getbuf((devp), (blkno), (len))) +#define xfs_bwrite(bp) libxfs_writebuf((bp), 0) +#define xfs_buf_delwri_queue(bp, bl) libxfs_writebuf((bp), 0) + +#define XBRW_READ LIBXFS_BREAD +#define XBRW_WRITE LIBXFS_BWRITE +#define xfs_buf_iomove(bp,off,len,data,f) libxfs_iomove(bp,off,len,data,f) +#define xfs_buf_zero(bp,off,len) libxfs_iomove(bp,off,len,0,LIBXFS_BZERO) + +/* mount stuff */ +#define XFS_MOUNT_32BITINODES LIBXFS_MOUNT_32BITINODES +#define XFS_MOUNT_ATTR2 LIBXFS_MOUNT_ATTR2 +#define XFS_MOUNT_SMALL_INUMS 0 /* ignored in userspace */ +#define XFS_MOUNT_WSYNC 0 /* ignored in userspace */ +#define XFS_MOUNT_NOALIGN 0 /* ignored in userspace */ +#define XFS_MOUNT_IKEEP 0 /* ignored in userspace */ +#define XFS_MOUNT_SWALLOC 0 /* ignored in userspace */ +#define XFS_MOUNT_RDONLY 0 /* ignored in userspace */ + + +#define _xfs_trans_alloc(mp, type, f) libxfs_trans_alloc(mp, type) +#define xfs_trans_get_block_res(tp) 1 +#define xfs_trans_set_sync(tp) ((void) 0) +#define xfs_trans_ordered_buf(tp, bp) ((void) 0) +#define xfs_trans_agblocks_delta(tp, d) +#define xfs_trans_agflist_delta(tp, d) +#define xfs_trans_agbtree_delta(tp, d) +#define xfs_trans_buf_set_type(tp, bp, t) ({ \ + int __t = (t); \ + __t = __t; /* no set-but-unused warning */ \ +}) + +#define xfs_trans_buf_copy_type(dbp, sbp) + +/* no readahead, need to avoid set-but-unused var warnings. */ +#define xfs_buf_readahead(a,d,c,ops) ({ \ + xfs_daddr_t __d = d; \ + __d = __d; /* no set-but-unused warning */ \ +}) +#define xfs_buf_readahead_map(a,b,c,ops) ((void) 0) /* no readahead */ +#define xfs_buftrace(x,y) ((void) 0) /* debug only */ + +#define xfs_cmn_err(tag,level,mp,fmt,args...) cmn_err(level,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_alert_tag(mp,tag,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) + +#define xfs_dir2_trace_args(where, args) ((void) 0) +#define xfs_dir2_trace_args_b(where, args, bp) ((void) 0) +#define xfs_dir2_trace_args_bb(where, args, lbp, dbp) ((void) 0) +#define xfs_dir2_trace_args_bibii(where, args, bs, ss, bd, sd, c) ((void) 0) +#define xfs_dir2_trace_args_db(where, args, db, bp) ((void) 0) +#define xfs_dir2_trace_args_i(where, args, i) ((void) 0) +#define xfs_dir2_trace_args_s(where, args, s) ((void) 0) +#define xfs_dir2_trace_args_sb(where, args, s, bp) ((void) 0) +#define xfs_sort qsort + +#define xfs_icsb_reinit_counters(mp) do { } while (0) +#define xfs_initialize_perag_icache(pag) ((void) 0) + +#define xfs_ilock(ip,mode) ((void) 0) +#define xfs_ilock_nowait(ip,mode) ((void) 0) +#define xfs_ilock_demote(ip,mode) ((void) 0) +#define xfs_ilock_data_map_shared(ip) (0) +#define xfs_ilock_attr_map_shared(ip) (0) +#define xfs_iunlock(ip,mode) ({ \ + typeof(mode) __mode = mode; \ + __mode = __mode; /* no set-but-unused warning */ \ +}) +#define __xfs_flock(ip) ((void) 0) + +/* space allocation */ +#define xfs_extent_busy_reuse(mp,ag,bno,len,user) ((void) 0) +#define xfs_extent_busy_insert(tp,ag,bno,len,flags) ((void) 0) +#define xfs_extent_busy_trim(args,fbno,flen,bno,len) \ +do { \ + *(bno) = (fbno); \ + *(len) = (flen); \ +} while (0) + +/* avoid unused variable warning */ +#define xfs_alloc_busy_insert(tp,ag,b,len) ({ \ + xfs_agnumber_t __foo = ag; \ + __foo = 0; \ +}) + +#define xfs_rotorstep 1 +#define xfs_bmap_rtalloc(a) (ENOSYS) +#define xfs_rtpick_extent(mp,tp,len,p) (ENOSYS) +#define xfs_get_extsz_hint(ip) (0) +#define xfs_inode_is_filestream(ip) (0) +#define xfs_filestream_lookup_ag(ip) (0) +#define xfs_filestream_new_ag(ip,ag) (0) + +#define xfs_log_force(mp,flags) ((void) 0) +#define XFS_LOG_SYNC 1 + +/* quota bits */ +#define xfs_trans_mod_dquot_byino(t,i,f,d) ((void) 0) +#define xfs_trans_reserve_quota_nblks(t,i,b,n,f) (0) +#define xfs_trans_unreserve_quota_nblks(t,i,b,n,f) ((void) 0) +#define xfs_qm_dqattach(i,f) (0) + +#define uuid_copy(s,d) platform_uuid_copy((s),(d)) +#define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0) + +#define xfs_icreate_log(tp, agno, agbno, cnt, isize, len, gen) ((void) 0) +#define xfs_sb_validate_fsb_count(sbp, nblks) (0) + +/* + * Prototypes for kernel static functions that are aren't in their + * 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(struct xfs_bmap_free *, struct xfs_bmap_free_item *, + struct xfs_bmap_free_item *); + +/* xfs_mount.c */ +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 + */ +void xfs_trans_init(struct xfs_mount *); +int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); + +/* xfs_trans_item.c */ +void xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *); +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(struct xfs_inode *, struct xfs_mount *); + +/* xfs_buf_item.c */ +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 */ +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) \ + libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FDBLOCKS, delta, rsvd) +#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); + +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); + +/* 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__ */ diff --git a/libxfs/linux.c b/libxfs/linux.c index f16a51c7..885016a0 100644 --- a/libxfs/linux.c +++ b/libxfs/linux.c @@ -25,7 +25,7 @@ #include #include -#include "xfs.h" +#include "libxfs_priv.h" #include "xfs_fs.h" int platform_has_uuid = 1; diff --git a/libxfs/logitem.c b/libxfs/logitem.c index 31d80059..ea85e729 100644 --- a/libxfs/logitem.c +++ b/libxfs/logitem.c @@ -16,7 +16,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "xfs.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index aeaae45b..cb172064 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -17,7 +17,7 @@ */ -#include "xfs.h" +#include "libxfs_priv.h" #include "init.h" #include "xfs_fs.h" #include "xfs_shared.h" @@ -30,7 +30,7 @@ #include "xfs_inode.h" #include "xfs_trans.h" -#include /* for now */ +#include /* for LIBXFS_EXIT_ON_FAILURE */ /* * Important design/architecture note: diff --git a/libxfs/trans.c b/libxfs/trans.c index 8d0eed73..885c5f4d 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "xfs.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/util.c b/libxfs/util.c index 41cc155f..a6b1fd1f 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -16,7 +16,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "xfs.h" +#include "libxfs_priv.h" #include "init.h" #include "xfs_fs.h" #include "xfs_shared.h" diff --git a/libxfs/xfs.h b/libxfs/xfs.h deleted file mode 100644 index 26db719e..00000000 --- a/libxfs/xfs.h +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * This header is effectively a "namespace multiplexor" for the - * user level XFS code. It provides all of the necessary stuff - * such that we can build some parts of the XFS kernel code in - * user space in a controlled fashion, and translates the names - * used in the kernel into the names which libxfs is going to - * make available to user tools. - * - * It should only ever be #include'd by XFS "kernel" code being - * compiled in user space. - * - * Our goals here are to... - * o "share" large amounts of complex code between user and - * kernel space; - * o shield the user tools from changes in the bleeding - * edge kernel code, merging source changes when - * convenient and not immediately (no symlinks); - * o i.e. be able to merge changes to the kernel source back - * into the affected user tools in a controlled fashion; - * o provide a _minimalist_ life-support system for kernel - * code in user land, not the "everything + the kitchen - * sink" model which libsim had mutated into; - * o allow the kernel code to be completely free of code - * specifically there to support the user level build. - */ - -/* - * 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__ - -/* - * repair doesn't have a inode when it calls libxfs_dir2_data_freescan, - * so we map this internally for now. - */ -#define xfs_dir2_data_freescan(ip, hdr, loghead) \ - __xfs_dir2_data_freescan((ip)->i_mount->m_dir_geo, \ - (ip)->d_ops, hdr, loghead) - -/* - * start by remapping all the symbols we expect external users to call - * to the libxfs_ namespace. This ensures that all internal symbols are - * remapped correctly throughout all the included header files - * as well as in the C code. - */ -#define xfs_alloc_fix_freelist libxfs_alloc_fix_freelist -#define xfs_attr_get libxfs_attr_get -#define xfs_attr_set libxfs_attr_set -#define xfs_attr_remove libxfs_attr_remove -#define xfs_rtfree_extent libxfs_rtfree_extent - -#define xfs_fs_repair_cmn_err libxfs_fs_repair_cmn_err -#define xfs_fs_cmn_err libxfs_fs_cmn_err - -#define xfs_bmap_finish libxfs_bmap_finish -#define xfs_trans_ichgtime libxfs_trans_ichgtime - -#define xfs_trans_alloc libxfs_trans_alloc -#define xfs_trans_add_item libxfs_trans_add_item -#define xfs_trans_bhold libxfs_trans_bhold -#define xfs_trans_binval libxfs_trans_binval -#define xfs_trans_bjoin libxfs_trans_bjoin -#define xfs_trans_brelse libxfs_trans_brelse -#define xfs_trans_commit libxfs_trans_commit -#define xfs_trans_cancel libxfs_trans_cancel -#define xfs_trans_del_item libxfs_trans_del_item -#define xfs_trans_dup libxfs_trans_dup -#define xfs_trans_get_buf libxfs_trans_get_buf -#define xfs_trans_getsb libxfs_trans_getsb -#define xfs_trans_iget libxfs_trans_iget -#define xfs_trans_ijoin libxfs_trans_ijoin -#define xfs_trans_ijoin_ref libxfs_trans_ijoin_ref -#define xfs_trans_init libxfs_trans_init -#define xfs_trans_inode_alloc_buf libxfs_trans_inode_alloc_buf -#define xfs_trans_log_buf libxfs_trans_log_buf -#define xfs_trans_log_inode libxfs_trans_log_inode -#define xfs_trans_mod_sb libxfs_trans_mod_sb -#define xfs_trans_read_buf libxfs_trans_read_buf -#define xfs_trans_read_buf_map libxfs_trans_read_buf_map -#define xfs_trans_roll libxfs_trans_roll -#define xfs_trans_get_buf_map libxfs_trans_get_buf_map -#define xfs_trans_reserve libxfs_trans_reserve - -/* xfs_attr_leaf.h */ -#define xfs_attr_leaf_newentsize libxfs_attr_leaf_newentsize - -/* xfs_bit.h */ -#define xfs_highbit32 libxfs_highbit32 -#define xfs_highbit64 libxfs_highbit64 - -/* xfs_bmap.h */ -#define xfs_bmap_cancel libxfs_bmap_cancel -#define xfs_bmap_last_offset libxfs_bmap_last_offset -#define xfs_bmapi_write libxfs_bmapi_write -#define xfs_bmapi_read libxfs_bmapi_read -#define xfs_bunmapi libxfs_bunmapi - -/* xfs_bmap_btree.h */ -#define xfs_bmbt_get_all libxfs_bmbt_get_all - -/* xfs_da_btree.h */ -#define xfs_da_brelse libxfs_da_brelse -#define xfs_da_hashname libxfs_da_hashname -#define xfs_da_shrink_inode libxfs_da_shrink_inode -#define xfs_da_read_buf libxfs_da_read_buf - -/* xfs_dir2.h */ -#define xfs_dir_createname libxfs_dir_createname -#define xfs_dir_init libxfs_dir_init -#define xfs_dir_lookup libxfs_dir_lookup -#define xfs_dir_replace libxfs_dir_replace -#define xfs_dir2_isblock libxfs_dir2_isblock -#define xfs_dir2_isleaf libxfs_dir2_isleaf - -/* xfs_dir2_data.h */ -#define __xfs_dir2_data_freescan libxfs_dir2_data_freescan -#define xfs_dir2_data_log_entry libxfs_dir2_data_log_entry -#define xfs_dir2_data_log_header libxfs_dir2_data_log_header -#define xfs_dir2_data_make_free libxfs_dir2_data_make_free -#define xfs_dir2_data_use_free libxfs_dir2_data_use_free -#define xfs_dir2_shrink_inode libxfs_dir2_shrink_inode - -/* xfs_inode.h */ -#define xfs_dinode_from_disk libxfs_dinode_from_disk -#define xfs_dinode_to_disk libxfs_dinode_to_disk -#define xfs_dinode_calc_crc libxfs_dinode_calc_crc -#define xfs_idata_realloc libxfs_idata_realloc -#define xfs_idestroy_fork libxfs_idestroy_fork - -#define xfs_dinode_verify libxfs_dinode_verify - -/* xfs_sb.h */ -#define xfs_log_sb libxfs_log_sb -#define xfs_sb_from_disk libxfs_sb_from_disk -#define xfs_sb_quota_from_disk libxfs_sb_quota_from_disk -#define xfs_sb_to_disk libxfs_sb_to_disk - -/* xfs_symlink.h */ -#define xfs_symlink_blocks libxfs_symlink_blocks -#define xfs_symlink_hdr_ok libxfs_symlink_hdr_ok - -/* xfs_trans_resv.h */ -#define xfs_trans_resv_calc libxfs_trans_resv_calc - - -/* - * Now we've renamed and mapped everything, include the rest of the external - * libxfs headers. - */ -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -/* 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 - -/* - * 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 - -/* for all the support code that uses progname in error messages */ -extern char *progname; - -#undef ASSERT -#define ASSERT(ex) assert(ex) - -typedef __uint32_t uint_t; -typedef __uint32_t inst_t; /* an instruction */ - -#ifndef EWRONGFS -#define EWRONGFS EINVAL -#endif - -#define xfs_error_level 0 - -#define STATIC static - -/* 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 - -#define IHOLD(ip) ((void) 0) - -#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); \ - cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \ -} while (0) - -#define XFS_ERROR_REPORT(e,l,mp) do { \ - (mp) = (mp); \ - cmn_err(CE_ALERT, "%s: XFS_ERROR_REPORT", (e)); \ -} while (0) - -#define XFS_QM_DQATTACH(mp,ip,flags) 0 -#define XFS_ERRLEVEL_LOW 1 -#define XFS_FORCED_SHUTDOWN(mp) 0 -#define XFS_ILOCK_EXCL 0 -#define XFS_STATS_INC(count) do { } while (0) -#define XFS_STATS_DEC(count, x) do { } while (0) -#define XFS_STATS_ADD(count, x) do { } while (0) -#define XFS_TRANS_MOD_DQUOT_BYINO(mp,tp,ip,field,delta) do { } while (0) -#define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl) 0 -#define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl) 0 -#define XFS_TEST_ERROR(expr,a,b,c) ( expr ) -#define XFS_WANT_CORRUPTED_GOTO(mp, expr, l) \ - { if (!(expr)) { error = EFSCORRUPTED; goto l; } } -#define XFS_WANT_CORRUPTED_RETURN(mp, expr) \ - { if (!(expr)) { return EFSCORRUPTED; } } - -#ifdef __GNUC__ -#define __return_address __builtin_return_address(0) -#endif - -#define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 - -/* miscellaneous kernel routines not in user space */ -#define down_read(a) ((void) 0) -#define up_read(a) ((void) 0) -#define spin_lock_init(a) ((void) 0) -#define spin_lock(a) ((void) 0) -#define spin_unlock(a) ((void) 0) -#define likely(x) (x) -#define unlikely(x) (x) -#define rcu_read_lock() ((void) 0) -#define rcu_read_unlock() ((void) 0) -#define WARN_ON_ONCE(expr) ((void) 0) - -#define percpu_counter_read(x) (*x) -#define percpu_counter_sum(x) (*x) - -/* - * prandom_u32 is used for di_gen inode allocation, it must be zero for libxfs - * or all sorts of badness can occur! - */ -#define prandom_u32() 0 - -#define PAGE_CACHE_SIZE getpagesize() - -static inline int __do_div(unsigned long long *n, unsigned base) -{ - int __res; - __res = (int)(((unsigned long) *n) % (unsigned) base); - *n = ((unsigned long) *n) / (unsigned) base; - return __res; -} - -#define do_div(n,base) (__do_div((unsigned long long *)&(n), (base))) -#define do_mod(a, b) ((a) % (b)) -#define rol32(x,y) (((x) << (y)) | ((x) >> (32 - (y)))) - -#define min_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) -#define max_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) - - - -static inline __attribute__((const)) -int is_power_of_2(unsigned long n) -{ - return (n != 0 && ((n & (n - 1)) == 0)); -} - -/* - * xfs_iroundup: round up argument to next power of two - */ -static inline uint -roundup_pow_of_two(uint v) -{ - int i; - uint m; - - if ((v & (v - 1)) == 0) - return v; - ASSERT((v & 0x80000000) == 0); - if ((v & (v + 1)) == 0) - return v + 1; - for (i = 0, m = 1; i < 31; i++, m <<= 1) { - if (v & m) - continue; - v |= m; - if ((v & (v + 1)) == 0) - return v + 1; - } - ASSERT(0); - return 0; -} - -static inline __uint64_t -roundup_64(__uint64_t x, __uint32_t y) -{ - x += y - 1; - do_div(x, 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 -#define XBF_LOCK XFS_BUF_LOCK -#define XBF_TRYLOCK XFS_BUF_TRYLOCK -#define XBF_DONT_BLOCK 0 -#define XBF_UNMAPPED 0 -#define XBF_DONE 0 -#define XFS_BUF_GETERROR(bp) 0 -#define XFS_BUF_DONE(bp) ((bp)->b_flags |= LIBXFS_B_UPTODATE) -#define XFS_BUF_ISDONE(bp) ((bp)->b_flags & LIBXFS_B_UPTODATE) -#define xfs_buf_stale(bp) ((bp)->b_flags |= LIBXFS_B_STALE) -#define XFS_BUF_UNDELAYWRITE(bp) ((bp)->b_flags &= ~LIBXFS_B_DIRTY) -#define XFS_BUF_SET_VTYPE(a,b) ((void) 0) -#define XFS_BUF_SET_VTYPE_REF(a,b,c) ((void) 0) -#define XFS_BUF_SET_BDSTRAT_FUNC(a,b) ((void) 0) - -/* avoid gcc warning */ -#define xfs_incore(bt,blkno,len,lockit) ({ \ - typeof(blkno) __foo = (blkno); \ - typeof(len) __bar = (len); \ - (blkno) = __foo; \ - (len) = __bar; /* no set-but-unused warning */ \ - NULL; \ -}) -#define xfs_buf_relse(bp) libxfs_putbuf(bp) -#define xfs_buf_get(devp,blkno,len,f) (libxfs_getbuf((devp), (blkno), (len))) -#define xfs_bwrite(bp) libxfs_writebuf((bp), 0) -#define xfs_buf_delwri_queue(bp, bl) libxfs_writebuf((bp), 0) - -#define XBRW_READ LIBXFS_BREAD -#define XBRW_WRITE LIBXFS_BWRITE -#define xfs_buf_iomove(bp,off,len,data,f) libxfs_iomove(bp,off,len,data,f) -#define xfs_buf_zero(bp,off,len) libxfs_iomove(bp,off,len,0,LIBXFS_BZERO) - -/* mount stuff */ -#define XFS_MOUNT_32BITINODES LIBXFS_MOUNT_32BITINODES -#define XFS_MOUNT_ATTR2 LIBXFS_MOUNT_ATTR2 -#define XFS_MOUNT_SMALL_INUMS 0 /* ignored in userspace */ -#define XFS_MOUNT_WSYNC 0 /* ignored in userspace */ -#define XFS_MOUNT_NOALIGN 0 /* ignored in userspace */ -#define XFS_MOUNT_IKEEP 0 /* ignored in userspace */ -#define XFS_MOUNT_SWALLOC 0 /* ignored in userspace */ -#define XFS_MOUNT_RDONLY 0 /* ignored in userspace */ - - -#define _xfs_trans_alloc(mp, type, f) libxfs_trans_alloc(mp, type) -#define xfs_trans_get_block_res(tp) 1 -#define xfs_trans_set_sync(tp) ((void) 0) -#define xfs_trans_ordered_buf(tp, bp) ((void) 0) -#define xfs_trans_agblocks_delta(tp, d) -#define xfs_trans_agflist_delta(tp, d) -#define xfs_trans_agbtree_delta(tp, d) -#define xfs_trans_buf_set_type(tp, bp, t) ({ \ - int __t = (t); \ - __t = __t; /* no set-but-unused warning */ \ -}) - -#define xfs_trans_buf_copy_type(dbp, sbp) - -/* no readahead, need to avoid set-but-unused var warnings. */ -#define xfs_buf_readahead(a,d,c,ops) ({ \ - xfs_daddr_t __d = d; \ - __d = __d; /* no set-but-unused warning */ \ -}) -#define xfs_buf_readahead_map(a,b,c,ops) ((void) 0) /* no readahead */ -#define xfs_buftrace(x,y) ((void) 0) /* debug only */ - -#define xfs_cmn_err(tag,level,mp,fmt,args...) cmn_err(level,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_alert_tag(mp,tag,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) - -#define xfs_dir2_trace_args(where, args) ((void) 0) -#define xfs_dir2_trace_args_b(where, args, bp) ((void) 0) -#define xfs_dir2_trace_args_bb(where, args, lbp, dbp) ((void) 0) -#define xfs_dir2_trace_args_bibii(where, args, bs, ss, bd, sd, c) ((void) 0) -#define xfs_dir2_trace_args_db(where, args, db, bp) ((void) 0) -#define xfs_dir2_trace_args_i(where, args, i) ((void) 0) -#define xfs_dir2_trace_args_s(where, args, s) ((void) 0) -#define xfs_dir2_trace_args_sb(where, args, s, bp) ((void) 0) -#define xfs_sort qsort - -#define xfs_icsb_reinit_counters(mp) do { } while (0) -#define xfs_initialize_perag_icache(pag) ((void) 0) - -#define xfs_ilock(ip,mode) ((void) 0) -#define xfs_ilock_nowait(ip,mode) ((void) 0) -#define xfs_ilock_demote(ip,mode) ((void) 0) -#define xfs_ilock_data_map_shared(ip) (0) -#define xfs_ilock_attr_map_shared(ip) (0) -#define xfs_iunlock(ip,mode) ({ \ - typeof(mode) __mode = mode; \ - __mode = __mode; /* no set-but-unused warning */ \ -}) -#define __xfs_flock(ip) ((void) 0) - -/* space allocation */ -#define xfs_extent_busy_reuse(mp,ag,bno,len,user) ((void) 0) -#define xfs_extent_busy_insert(tp,ag,bno,len,flags) ((void) 0) -#define xfs_extent_busy_trim(args,fbno,flen,bno,len) \ -do { \ - *(bno) = (fbno); \ - *(len) = (flen); \ -} while (0) - -/* avoid unused variable warning */ -#define xfs_alloc_busy_insert(tp,ag,b,len) ({ \ - xfs_agnumber_t __foo = ag; \ - __foo = 0; \ -}) - -#define xfs_rotorstep 1 -#define xfs_bmap_rtalloc(a) (ENOSYS) -#define xfs_rtpick_extent(mp,tp,len,p) (ENOSYS) -#define xfs_get_extsz_hint(ip) (0) -#define xfs_inode_is_filestream(ip) (0) -#define xfs_filestream_lookup_ag(ip) (0) -#define xfs_filestream_new_ag(ip,ag) (0) - -#define xfs_log_force(mp,flags) ((void) 0) -#define XFS_LOG_SYNC 1 - -/* quota bits */ -#define xfs_trans_mod_dquot_byino(t,i,f,d) ((void) 0) -#define xfs_trans_reserve_quota_nblks(t,i,b,n,f) (0) -#define xfs_trans_unreserve_quota_nblks(t,i,b,n,f) ((void) 0) -#define xfs_qm_dqattach(i,f) (0) - -#define uuid_copy(s,d) platform_uuid_copy((s),(d)) -#define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0) - -#define xfs_icreate_log(tp, agno, agbno, cnt, isize, len, gen) ((void) 0) -#define xfs_sb_validate_fsb_count(sbp, nblks) (0) - -/* - * Prototypes for kernel static functions that are aren't in their - * 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(struct xfs_bmap_free *, struct xfs_bmap_free_item *, - struct xfs_bmap_free_item *); - -/* xfs_mount.c */ -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 - */ -void xfs_trans_init(struct xfs_mount *); -int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); - -/* xfs_trans_item.c */ -void xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *); -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(struct xfs_inode *, struct xfs_mount *); - -/* xfs_buf_item.c */ -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 */ -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) \ - libxfs_mod_incore_sb(mp, XFS_TRANS_SB_FDBLOCKS, delta, rsvd) -#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); - -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); - -/* 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__ */ diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 15b4e171..23e3c538 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c index 20a072dd..7fd72af9 100644 --- a/libxfs/xfs_alloc_btree.c +++ b/libxfs/xfs_alloc_btree.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 00a319bd..f8c24f6d 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 01173a74..200bd30c 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index 356b2e00..4f492c18 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 55a2a25e..e6d1e6c0 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c index f1ad2f97..2fd04e0c 100644 --- a/libxfs/xfs_bmap_btree.c +++ b/libxfs/xfs_bmap_btree.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c index 6c460611..203e7d20 100644 --- a/libxfs/xfs_btree.c +++ b/libxfs/xfs_btree.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index a7502aec..441bef4e 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_da_format.c b/libxfs/xfs_da_format.c index 9d624a62..e4c37f94 100644 --- a/libxfs/xfs_da_format.c +++ b/libxfs/xfs_da_format.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_dir2.c b/libxfs/xfs_dir2.c index 9ad9540d..2a42317a 100644 --- a/libxfs/xfs_dir2.c +++ b/libxfs/xfs_dir2.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c index d949c636..f061a99a 100644 --- a/libxfs/xfs_dir2_block.c +++ b/libxfs/xfs_dir2_block.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c index 3d13011e..609c097b 100644 --- a/libxfs/xfs_dir2_data.c +++ b/libxfs/xfs_dir2_data.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" diff --git a/libxfs/xfs_dir2_leaf.c b/libxfs/xfs_dir2_leaf.c index 4c813864..c2dba8a4 100644 --- a/libxfs/xfs_dir2_leaf.c +++ b/libxfs/xfs_dir2_leaf.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index ecda1ddb..3b71e9e5 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" diff --git a/libxfs/xfs_dir2_sf.c b/libxfs/xfs_dir2_sf.c index f549afef..e4b505b8 100644 --- a/libxfs/xfs_dir2_sf.c +++ b/libxfs/xfs_dir2_sf.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c index 85827985..2e0484a6 100644 --- a/libxfs/xfs_dquot_buf.c +++ b/libxfs/xfs_dquot_buf.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index 841bde5e..2b4e4e07 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_ialloc_btree.c b/libxfs/xfs_ialloc_btree.c index fd62c7f9..9ac143a5 100644 --- a/libxfs/xfs_ialloc_btree.c +++ b/libxfs/xfs_ialloc_btree.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index 561fdd2f..28085b32 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c index 334ff86b..e1968b43 100644 --- a/libxfs/xfs_inode_fork.c +++ b/libxfs/xfs_inode_fork.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" diff --git a/libxfs/xfs_log_rlimit.c b/libxfs/xfs_log_rlimit.c index c1059797..9264afa9 100644 --- a/libxfs/xfs_log_rlimit.c +++ b/libxfs/xfs_log_rlimit.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_rtbitmap.c b/libxfs/xfs_rtbitmap.c index a4201566..0054432c 100644 --- a/libxfs/xfs_rtbitmap.c +++ b/libxfs/xfs_rtbitmap.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c index e5cba591..6844cd8c 100644 --- a/libxfs/xfs_sb.c +++ b/libxfs/xfs_sb.c @@ -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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h" diff --git a/libxfs/xfs_symlink_remote.c b/libxfs/xfs_symlink_remote.c index aad3df8a..6bc5af53 100644 --- a/libxfs/xfs_symlink_remote.c +++ b/libxfs/xfs_symlink_remote.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" diff --git a/libxfs/xfs_trans_resv.c b/libxfs/xfs_trans_resv.c index 2bb622da..0c40b528 100644 --- a/libxfs/xfs_trans_resv.c +++ b/libxfs/xfs_trans_resv.c @@ -16,7 +16,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.h" +#include "libxfs_priv.h" #include "xfs_fs.h" #include "xfs_shared.h" #include "xfs_format.h"