]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/xfs_attr_remote.h
xfs: rework remote attr CRCs
[thirdparty/xfsprogs-dev.git] / include / xfs_attr_remote.h
CommitLineData
9d6fabc0
DC
1/*
2 * Copyright (c) 2013 Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2.1 of the GNU Lesser General Public License
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this program; if not, write the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
22 * USA.
23 */
24#ifndef __XFS_ATTR_REMOTE_H__
25#define __XFS_ATTR_REMOTE_H__
26
59915981
DC
27#define XFS_ATTR3_RMT_MAGIC 0x5841524d /* XARM */
28
f08bc2a9
DC
29/*
30 * There is one of these headers per filesystem block in a remote attribute.
31 * This is done to ensure there is a 1:1 mapping between the attribute value
32 * length and the number of blocks needed to store the attribute. This makes the
33 * verification of a buffer a little more complex, but greatly simplifies the
34 * allocation, reading and writing of these attributes as we don't have to guess
35 * the number of blocks needed to store the attribute data.
36 */
59915981
DC
37struct xfs_attr3_rmt_hdr {
38 __be32 rm_magic;
39 __be32 rm_offset;
40 __be32 rm_bytes;
41 __be32 rm_crc;
42 uuid_t rm_uuid;
43 __be64 rm_owner;
44 __be64 rm_blkno;
45 __be64 rm_lsn;
46};
47
48#define XFS_ATTR3_RMT_CRC_OFF offsetof(struct xfs_attr3_rmt_hdr, rm_crc)
49
50#define XFS_ATTR3_RMT_BUF_SPACE(mp, bufsize) \
51 ((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
52 sizeof(struct xfs_attr3_rmt_hdr) : 0))
53
8b4dc4a9
DC
54extern const struct xfs_buf_ops xfs_attr3_rmt_buf_ops;
55
f08bc2a9
DC
56int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen);
57
9d6fabc0
DC
58int xfs_attr_rmtval_get(struct xfs_da_args *args);
59int xfs_attr_rmtval_set(struct xfs_da_args *args);
60int xfs_attr_rmtval_remove(struct xfs_da_args *args);
61
62#endif /* __XFS_ATTR_REMOTE_H__ */