Merge branch 'v3.10/topic/mm-timer' into linux-linaro-lsk-v3.10
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_symlink.h
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
20 struct xfs_mount;
21 struct xfs_trans;
22 struct xfs_inode;
23 struct xfs_buf;
24 struct xfs_ifork;
25 struct xfs_name;
26
27 #define XFS_SYMLINK_MAGIC       0x58534c4d      /* XSLM */
28
29 struct 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
40 /*
41  * The maximum pathlen is 1024 bytes. Since the minimum file system
42  * blocksize is 512 bytes, we can get a max of 3 extents back from
43  * bmapi when crc headers are taken into account.
44  */
45 #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
51 int xfs_symlink_blocks(struct xfs_mount *mp, int pathlen);
52
53 void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
54                                  struct xfs_inode *ip, struct xfs_ifork *ifp);
55
56 extern const struct xfs_buf_ops xfs_symlink_buf_ops;
57
58 #ifdef __KERNEL__
59
60 int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
61                 const char *target_path, umode_t mode, struct xfs_inode **ipp);
62 int xfs_readlink(struct xfs_inode *ip, char *link);
63 int xfs_inactive_symlink_rmt(struct xfs_inode *ip, struct xfs_trans **tpp);
64
65 #endif /* __KERNEL__ */
66 #endif /* __XFS_SYMLINK_H */