Lines Matching +full:tp +full:- +full:link

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
4 * Copyright (c) 2012-2013 Red Hat, Inc.
33 int buflen = XFS_SYMLINK_BUF_SPACE(mp, mp->m_sb.sb_blocksize); in xfs_symlink_blocks()
35 return (pathlen + buflen - 1) / buflen; in xfs_symlink_blocks()
46 struct xfs_dsymlink_hdr *dsl = bp->b_addr; in xfs_symlink_hdr_set()
52 dsl->sl_magic = cpu_to_be32(XFS_SYMLINK_MAGIC); in xfs_symlink_hdr_set()
53 dsl->sl_offset = cpu_to_be32(offset); in xfs_symlink_hdr_set()
54 dsl->sl_bytes = cpu_to_be32(size); in xfs_symlink_hdr_set()
55 uuid_copy(&dsl->sl_uuid, &mp->m_sb.sb_meta_uuid); in xfs_symlink_hdr_set()
56 dsl->sl_owner = cpu_to_be64(ino); in xfs_symlink_hdr_set()
57 dsl->sl_blkno = cpu_to_be64(xfs_buf_daddr(bp)); in xfs_symlink_hdr_set()
58 bp->b_ops = &xfs_symlink_buf_ops; in xfs_symlink_hdr_set()
75 struct xfs_dsymlink_hdr *dsl = bp->b_addr; in xfs_symlink_hdr_ok()
77 if (offset != be32_to_cpu(dsl->sl_offset)) in xfs_symlink_hdr_ok()
79 if (size != be32_to_cpu(dsl->sl_bytes)) in xfs_symlink_hdr_ok()
81 if (ino != be64_to_cpu(dsl->sl_owner)) in xfs_symlink_hdr_ok()
92 struct xfs_mount *mp = bp->b_mount; in xfs_symlink_verify()
93 struct xfs_dsymlink_hdr *dsl = bp->b_addr; in xfs_symlink_verify()
97 if (!xfs_verify_magic(bp, dsl->sl_magic)) in xfs_symlink_verify()
99 if (!uuid_equal(&dsl->sl_uuid, &mp->m_sb.sb_meta_uuid)) in xfs_symlink_verify()
101 if (xfs_buf_daddr(bp) != be64_to_cpu(dsl->sl_blkno)) in xfs_symlink_verify()
103 if (be32_to_cpu(dsl->sl_offset) + in xfs_symlink_verify()
104 be32_to_cpu(dsl->sl_bytes) >= XFS_SYMLINK_MAXLEN) in xfs_symlink_verify()
106 if (dsl->sl_owner == 0) in xfs_symlink_verify()
108 if (!xfs_log_check_lsn(mp, be64_to_cpu(dsl->sl_lsn))) in xfs_symlink_verify()
118 struct xfs_mount *mp = bp->b_mount; in xfs_symlink_read_verify()
121 /* no verification of non-crc buffers */ in xfs_symlink_read_verify()
126 xfs_verifier_error(bp, -EFSBADCRC, __this_address); in xfs_symlink_read_verify()
130 xfs_verifier_error(bp, -EFSCORRUPTED, fa); in xfs_symlink_read_verify()
138 struct xfs_mount *mp = bp->b_mount; in xfs_symlink_write_verify()
139 struct xfs_buf_log_item *bip = bp->b_log_item; in xfs_symlink_write_verify()
142 /* no verification of non-crc buffers */ in xfs_symlink_write_verify()
148 xfs_verifier_error(bp, -EFSCORRUPTED, fa); in xfs_symlink_write_verify()
153 struct xfs_dsymlink_hdr *dsl = bp->b_addr; in xfs_symlink_write_verify()
154 dsl->sl_lsn = cpu_to_be64(bip->bli_item.li_lsn); in xfs_symlink_write_verify()
169 struct xfs_trans *tp, in xfs_symlink_local_to_remote() argument
175 struct xfs_mount *mp = ip->i_mount; in xfs_symlink_local_to_remote()
178 xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF); in xfs_symlink_local_to_remote()
181 bp->b_ops = NULL; in xfs_symlink_local_to_remote()
182 memcpy(bp->b_addr, ifp->if_data, ifp->if_bytes); in xfs_symlink_local_to_remote()
183 xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); in xfs_symlink_local_to_remote()
191 ASSERT(BBTOB(bp->b_length) >= in xfs_symlink_local_to_remote()
192 ifp->if_bytes + sizeof(struct xfs_dsymlink_hdr)); in xfs_symlink_local_to_remote()
194 bp->b_ops = &xfs_symlink_buf_ops; in xfs_symlink_local_to_remote()
196 buf = bp->b_addr; in xfs_symlink_local_to_remote()
197 buf += xfs_symlink_hdr_set(mp, ip->i_ino, 0, ifp->if_bytes, bp); in xfs_symlink_local_to_remote()
198 memcpy(buf, ifp->if_data, ifp->if_bytes); in xfs_symlink_local_to_remote()
199 xfs_trans_log_buf(tp, bp, 0, sizeof(struct xfs_dsymlink_hdr) + in xfs_symlink_local_to_remote()
200 ifp->if_bytes - 1); in xfs_symlink_local_to_remote()
204 * Verify the in-memory consistency of an inline symlink data fork. This
205 * does not do on-disk format checks.
226 if (memchr(sfp, 0, size - 1)) in xfs_symlink_shortform_verify()
229 /* We /did/ null-terminate the buffer, right? */ in xfs_symlink_shortform_verify()
239 char *link) in xfs_symlink_remote_read() argument
241 struct xfs_mount *mp = ip->i_mount; in xfs_symlink_remote_read()
246 int pathlen = ip->i_disk_size; in xfs_symlink_remote_read()
266 error = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0, in xfs_symlink_remote_read()
276 cur_chunk = bp->b_addr; in xfs_symlink_remote_read()
278 if (!xfs_symlink_hdr_ok(ip->i_ino, offset, in xfs_symlink_remote_read()
281 error = -EFSCORRUPTED; in xfs_symlink_remote_read()
284 offset, byte_cnt, ip->i_ino); in xfs_symlink_remote_read()
293 memcpy(link + offset, cur_chunk, byte_cnt); in xfs_symlink_remote_read()
295 pathlen -= byte_cnt; in xfs_symlink_remote_read()
302 link[ip->i_disk_size] = '\0'; in xfs_symlink_remote_read()
312 struct xfs_trans *tp, in xfs_symlink_write_target() argument
321 struct xfs_mount *mp = tp->t_mountp; in xfs_symlink_write_target()
337 ip->i_disk_size = pathlen; in xfs_symlink_write_target()
338 ip->i_df.if_format = XFS_DINODE_FMT_LOCAL; in xfs_symlink_write_target()
339 xfs_trans_log_inode(tp, ip, XFS_ILOG_DDATA | XFS_ILOG_CORE); in xfs_symlink_write_target()
344 error = xfs_bmapi_write(tp, ip, 0, fs_blocks, XFS_BMAPI_METADATA, in xfs_symlink_write_target()
349 ip->i_disk_size = pathlen; in xfs_symlink_write_target()
350 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_symlink_write_target()
359 error = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, in xfs_symlink_write_target()
363 bp->b_ops = &xfs_symlink_buf_ops; in xfs_symlink_write_target()
368 buf = bp->b_addr; in xfs_symlink_write_target()
374 pathlen -= byte_cnt; in xfs_symlink_write_target()
377 xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF); in xfs_symlink_write_target()
378 xfs_trans_log_buf(tp, bp, 0, (buf + byte_cnt - 1) - in xfs_symlink_write_target()
379 (char *)bp->b_addr); in xfs_symlink_write_target()
388 struct xfs_trans *tp, in xfs_symlink_remote_truncate() argument
392 struct xfs_mount *mp = tp->t_mountp; in xfs_symlink_remote_truncate()
408 error = xfs_trans_get_buf(tp, mp->m_ddev_targp, in xfs_symlink_remote_truncate()
415 xfs_trans_binval(tp, bp); in xfs_symlink_remote_truncate()
419 error = xfs_bunmapi(tp, ip, 0, XFS_MAX_FILEOFF, 0, nmaps, &done); in xfs_symlink_remote_truncate()
425 return -EFSCORRUPTED; in xfs_symlink_remote_truncate()
428 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_symlink_remote_truncate()