]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/symlink.c
2 * Copyright (c) 2013 Red Hat, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 * XXX: no idea how to handle multiple contiguous block symlinks here.
36 struct xfs_dsymlink_hdr
*hdr
= obj
;
38 ASSERT(startoff
== 0);
40 if (hdr
->sl_magic
!= cpu_to_be32(XFS_SYMLINK_MAGIC
))
42 if (be32_to_cpu(hdr
->sl_bytes
) + sizeof(*hdr
) > mp
->m_sb
.sb_blocksize
)
43 return mp
->m_sb
.sb_blocksize
- sizeof(*hdr
);
44 return be32_to_cpu(hdr
->sl_bytes
);
53 struct xfs_dsymlink_hdr
*hdr
= obj
;
55 ASSERT(startoff
== 0);
56 if (hdr
->sl_magic
!= cpu_to_be32(XFS_SYMLINK_MAGIC
))
58 return be32_to_cpu(hdr
->sl_bytes
) + sizeof(*hdr
);
61 const struct field symlink_crc_hfld
[] = {
62 { "", FLDT_SYMLINK_CRC
, OI(0), C1
, 0, TYP_NONE
},
66 #define OFF(f) bitize(offsetof(struct xfs_dsymlink_hdr, sl_ ## f))
67 #define SZOF(f) bitize(sizeof(struct xfs_dsymlink_hdr))
68 const struct field symlink_crc_flds
[] = {
69 { "magic", FLDT_UINT32X
, OI(OFF(magic
)), C1
, 0, TYP_NONE
},
70 { "offset", FLDT_UINT32D
, OI(OFF(offset
)), C1
, 0, TYP_NONE
},
71 { "bytes", FLDT_UINT32D
, OI(OFF(bytes
)), C1
, 0, TYP_NONE
},
72 { "crc", FLDT_CRC
, OI(OFF(crc
)), C1
, 0, TYP_NONE
},
73 { "uuid", FLDT_UUID
, OI(OFF(uuid
)), C1
, 0, TYP_NONE
},
74 { "owner", FLDT_INO
, OI(OFF(owner
)), C1
, 0, TYP_NONE
},
75 { "bno", FLDT_DFSBNO
, OI(OFF(blkno
)), C1
, 0, TYP_BMAPBTD
},
76 { "lsn", FLDT_UINT64X
, OI(OFF(lsn
)), C1
, 0, TYP_NONE
},
77 { "data", FLDT_CHARNS
, OI(bitize(sizeof(struct xfs_dsymlink_hdr
))),
78 symlink_count
, FLD_COUNT
, TYP_NONE
},