2013-04-03 13:11:18 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012 Red Hat, Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it would be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
#ifndef __XFS_SYMLINK_H
|
|
|
|
#define __XFS_SYMLINK_H 1
|
|
|
|
|
2013-04-03 13:11:19 +08:00
|
|
|
struct xfs_mount;
|
|
|
|
struct xfs_trans;
|
|
|
|
struct xfs_inode;
|
|
|
|
struct xfs_buf;
|
|
|
|
struct xfs_ifork;
|
|
|
|
struct xfs_name;
|
|
|
|
|
|
|
|
#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;
|
|
|
|
};
|
|
|
|
|
2013-04-03 13:11:18 +08:00
|
|
|
/*
|
|
|
|
* The maximum pathlen is 1024 bytes. Since the minimum file system
|
2013-04-03 13:11:19 +08:00
|
|
|
* blocksize is 512 bytes, we can get a max of 3 extents back from
|
|
|
|
* bmapi when crc headers are taken into account.
|
2013-04-03 13:11:18 +08:00
|
|
|
*/
|
2013-04-03 13:11:19 +08:00
|
|
|
#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);
|
2013-08-12 18:49:31 +08:00
|
|
|
bool xfs_symlink_hdr_ok(struct xfs_mount *mp, xfs_ino_t ino, uint32_t offset,
|
|
|
|
uint32_t size, struct xfs_buf *bp);
|
2013-04-03 13:11:18 +08:00
|
|
|
void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
|
|
|
|
struct xfs_inode *ip, struct xfs_ifork *ifp);
|
|
|
|
|
2013-04-03 13:11:19 +08:00
|
|
|
extern const struct xfs_buf_ops xfs_symlink_buf_ops;
|
|
|
|
|
2013-04-03 13:11:18 +08:00
|
|
|
#ifdef __KERNEL__
|
|
|
|
|
|
|
|
int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
|
|
|
|
const char *target_path, umode_t mode, struct xfs_inode **ipp);
|
|
|
|
int xfs_readlink(struct xfs_inode *ip, char *link);
|
2013-06-18 04:35:57 +08:00
|
|
|
int xfs_inactive_symlink(struct xfs_inode *ip, struct xfs_trans **tpp);
|
2013-04-03 13:11:18 +08:00
|
|
|
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif /* __XFS_SYMLINK_H */
|