blob: 374394880c01e4d8db8dc36d6468e748295c6f29 [file] [log] [blame]
Dave Chinner19de7352013-04-03 16:11:18 +11001/*
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
Dave Chinnerf948dd72013-04-03 16:11:19 +110020struct xfs_mount;
21struct xfs_trans;
22struct xfs_inode;
23struct xfs_buf;
24struct xfs_ifork;
25struct xfs_name;
26
27#define XFS_SYMLINK_MAGIC 0x58534c4d /* XSLM */
28
29struct xfs_dsymlink_hdr {
30 __be32 sl_magic;
31 __be32 sl_offset;
32 __be32 sl_bytes;
33 __be32 sl_crc;
34 uuid_t sl_uuid;
35 __be64 sl_owner;
36 __be64 sl_blkno;
37 __be64 sl_lsn;
38};
39
Dave Chinner19de7352013-04-03 16:11:18 +110040/*
41 * The maximum pathlen is 1024 bytes. Since the minimum file system
Dave Chinnerf948dd72013-04-03 16:11:19 +110042 * blocksize is 512 bytes, we can get a max of 3 extents back from
43 * bmapi when crc headers are taken into account.
Dave Chinner19de7352013-04-03 16:11:18 +110044 */
Dave Chinnerf948dd72013-04-03 16:11:19 +110045#define XFS_SYMLINK_MAPS 3
46
47#define XFS_SYMLINK_BUF_SPACE(mp, bufsize) \
48 ((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
49 sizeof(struct xfs_dsymlink_hdr) : 0))
50
51int xfs_symlink_blocks(struct xfs_mount *mp, int pathlen);
Dave Chinner19de7352013-04-03 16:11:18 +110052
53void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
54 struct xfs_inode *ip, struct xfs_ifork *ifp);
55
Dave Chinnerf948dd72013-04-03 16:11:19 +110056extern const struct xfs_buf_ops xfs_symlink_buf_ops;
57
Dave Chinner19de7352013-04-03 16:11:18 +110058#ifdef __KERNEL__
59
60int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
61 const char *target_path, umode_t mode, struct xfs_inode **ipp);
62int xfs_readlink(struct xfs_inode *ip, char *link);
Mark Tinguely725eb1e2013-06-17 15:35:57 -050063int xfs_inactive_symlink(struct xfs_inode *ip, struct xfs_trans **tpp);
Dave Chinner19de7352013-04-03 16:11:18 +110064
65#endif /* __KERNEL__ */
66#endif /* __XFS_SYMLINK_H */