xfs_attr_remote.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2013 Red Hat, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __XFS_ATTR_REMOTE_H__
  19. #define __XFS_ATTR_REMOTE_H__
  20. #define XFS_ATTR3_RMT_MAGIC 0x5841524d /* XARM */
  21. /*
  22. * There is one of these headers per filesystem block in a remote attribute.
  23. * This is done to ensure there is a 1:1 mapping between the attribute value
  24. * length and the number of blocks needed to store the attribute. This makes the
  25. * verification of a buffer a little more complex, but greatly simplifies the
  26. * allocation, reading and writing of these attributes as we don't have to guess
  27. * the number of blocks needed to store the attribute data.
  28. */
  29. struct xfs_attr3_rmt_hdr {
  30. __be32 rm_magic;
  31. __be32 rm_offset;
  32. __be32 rm_bytes;
  33. __be32 rm_crc;
  34. uuid_t rm_uuid;
  35. __be64 rm_owner;
  36. __be64 rm_blkno;
  37. __be64 rm_lsn;
  38. };
  39. #define XFS_ATTR3_RMT_CRC_OFF offsetof(struct xfs_attr3_rmt_hdr, rm_crc)
  40. #define XFS_ATTR3_RMT_BUF_SPACE(mp, bufsize) \
  41. ((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
  42. sizeof(struct xfs_attr3_rmt_hdr) : 0))
  43. extern const struct xfs_buf_ops xfs_attr3_rmt_buf_ops;
  44. int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen);
  45. int xfs_attr_rmtval_get(struct xfs_da_args *args);
  46. int xfs_attr_rmtval_set(struct xfs_da_args *args);
  47. int xfs_attr_rmtval_remove(struct xfs_da_args *args);
  48. #endif /* __XFS_ATTR_REMOTE_H__ */