xfs_symlink.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2012 Red Hat, Inc. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it would be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write the Free Software Foundation,
  15. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. */
  17. #ifndef __XFS_SYMLINK_H
  18. #define __XFS_SYMLINK_H 1
  19. struct xfs_mount;
  20. struct xfs_trans;
  21. struct xfs_inode;
  22. struct xfs_buf;
  23. struct xfs_ifork;
  24. struct xfs_name;
  25. #define XFS_SYMLINK_MAGIC 0x58534c4d /* XSLM */
  26. struct xfs_dsymlink_hdr {
  27. __be32 sl_magic;
  28. __be32 sl_offset;
  29. __be32 sl_bytes;
  30. __be32 sl_crc;
  31. uuid_t sl_uuid;
  32. __be64 sl_owner;
  33. __be64 sl_blkno;
  34. __be64 sl_lsn;
  35. };
  36. /*
  37. * The maximum pathlen is 1024 bytes. Since the minimum file system
  38. * blocksize is 512 bytes, we can get a max of 3 extents back from
  39. * bmapi when crc headers are taken into account.
  40. */
  41. #define XFS_SYMLINK_MAPS 3
  42. #define XFS_SYMLINK_BUF_SPACE(mp, bufsize) \
  43. ((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
  44. sizeof(struct xfs_dsymlink_hdr) : 0))
  45. int xfs_symlink_blocks(struct xfs_mount *mp, int pathlen);
  46. void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
  47. struct xfs_inode *ip, struct xfs_ifork *ifp);
  48. extern const struct xfs_buf_ops xfs_symlink_buf_ops;
  49. #ifdef __KERNEL__
  50. int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
  51. const char *target_path, umode_t mode, struct xfs_inode **ipp);
  52. int xfs_readlink(struct xfs_inode *ip, char *link);
  53. int xfs_inactive_symlink(struct xfs_inode *ip, struct xfs_trans **tpp);
  54. #endif /* __KERNEL__ */
  55. #endif /* __XFS_SYMLINK_H */