summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_format.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-08-12 10:49:40 (GMT)
committerBen Myers <bpm@sgi.com>2013-08-12 21:43:38 (GMT)
commit1fb7e48db6810093012873a652062648ace6b5bb (patch)
tree7ca9cf8073d2768fbbb44299299dd222efaf3b48 /fs/xfs/xfs_format.h
parentfde2227ce12b6d3e1945bd512da2a4a333331a2c (diff)
downloadlinux-1fb7e48db6810093012873a652062648ace6b5bb.tar.xz
xfs: split out the remote symlink handling
The remote symlink format definition and manipulation needs to be shared with userspace, but the in-kernel interfaces do not. Split the remote symlink format handling out into xfs_symlink_remote.[ch] fo it can easily be shared with userspace. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_format.h')
-rw-r--r--fs/xfs/xfs_format.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/fs/xfs/xfs_format.h b/fs/xfs/xfs_format.h
index 6205374..35c08ff 100644
--- a/fs/xfs/xfs_format.h
+++ b/fs/xfs/xfs_format.h
@@ -27,6 +27,12 @@
* xfs_log_format.h. Everything else goes here.
*/
+struct xfs_mount;
+struct xfs_trans;
+struct xfs_inode;
+struct xfs_buf;
+struct xfs_ifork;
+
/*
* RealTime Device format definitions
*/
@@ -123,5 +129,41 @@ typedef struct xfs_dqblk {
#define XFS_DQUOT_CRC_OFF offsetof(struct xfs_dqblk, dd_crc)
+/*
+ * Remote symlink format and access functions.
+ */
+#define XFS_SYMLINK_MAGIC 0x58534c4d /* XSLM */
+
+struct xfs_dsymlink_hdr {
+ __be32 sl_magic;
+ __be32 sl_offset;
+ __be32 sl_bytes;
+ __be32 sl_crc;
+ uuid_t sl_uuid;
+ __be64 sl_owner;
+ __be64 sl_blkno;
+ __be64 sl_lsn;
+};
+
+/*
+ * The maximum pathlen is 1024 bytes. Since the minimum file system
+ * blocksize is 512 bytes, we can get a max of 3 extents back from
+ * bmapi when crc headers are taken into account.
+ */
+#define XFS_SYMLINK_MAPS 3
+
+#define XFS_SYMLINK_BUF_SPACE(mp, bufsize) \
+ ((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
+ sizeof(struct xfs_dsymlink_hdr) : 0))
+
+int xfs_symlink_blocks(struct xfs_mount *mp, int pathlen);
+int xfs_symlink_hdr_set(struct xfs_mount *mp, xfs_ino_t ino, uint32_t offset,
+ uint32_t size, struct xfs_buf *bp);
+bool xfs_symlink_hdr_ok(struct xfs_mount *mp, xfs_ino_t ino, uint32_t offset,
+ uint32_t size, struct xfs_buf *bp);
+void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
+ struct xfs_inode *ip, struct xfs_ifork *ifp);
+
+extern const struct xfs_buf_ops xfs_symlink_buf_ops;
#endif /* __XFS_FORMAT_H__ */