.. | .. |
---|
1 | | -// SPDX-License-Identifier: GPL-2.0 |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 2 | /* |
---|
3 | 3 | * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. |
---|
4 | 4 | * All Rights Reserved. |
---|
.. | .. |
---|
13 | 13 | * to fit into the literal area of the inode. |
---|
14 | 14 | */ |
---|
15 | 15 | typedef struct xfs_attr_sf_hdr xfs_attr_sf_hdr_t; |
---|
16 | | -typedef struct xfs_attr_sf_entry xfs_attr_sf_entry_t; |
---|
17 | 16 | |
---|
18 | 17 | /* |
---|
19 | 18 | * We generate this then sort it, attr_list() must return things in hash-order. |
---|
.. | .. |
---|
27 | 26 | unsigned char *name; /* name value, pointer into buffer */ |
---|
28 | 27 | } xfs_attr_sf_sort_t; |
---|
29 | 28 | |
---|
30 | | -#define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) /* space name/value uses */ \ |
---|
31 | | - (((int)sizeof(xfs_attr_sf_entry_t)-1 + (nlen)+(vlen))) |
---|
32 | 29 | #define XFS_ATTR_SF_ENTSIZE_MAX /* max space for name&value */ \ |
---|
33 | 30 | ((1 << (NBBY*(int)sizeof(uint8_t))) - 1) |
---|
34 | | -#define XFS_ATTR_SF_ENTSIZE(sfep) /* space an entry uses */ \ |
---|
35 | | - ((int)sizeof(xfs_attr_sf_entry_t)-1 + (sfep)->namelen+(sfep)->valuelen) |
---|
36 | | -#define XFS_ATTR_SF_NEXTENTRY(sfep) /* next entry in struct */ \ |
---|
37 | | - ((xfs_attr_sf_entry_t *)((char *)(sfep) + XFS_ATTR_SF_ENTSIZE(sfep))) |
---|
38 | | -#define XFS_ATTR_SF_TOTSIZE(dp) /* total space in use */ \ |
---|
39 | | - (be16_to_cpu(((xfs_attr_shortform_t *) \ |
---|
40 | | - ((dp)->i_afp->if_u1.if_data))->hdr.totsize)) |
---|
| 31 | + |
---|
| 32 | +/* space name/value uses */ |
---|
| 33 | +static inline int xfs_attr_sf_entsize_byname(uint8_t nlen, uint8_t vlen) |
---|
| 34 | +{ |
---|
| 35 | + return sizeof(struct xfs_attr_sf_entry) + nlen + vlen; |
---|
| 36 | +} |
---|
| 37 | + |
---|
| 38 | +/* space an entry uses */ |
---|
| 39 | +static inline int xfs_attr_sf_entsize(struct xfs_attr_sf_entry *sfep) |
---|
| 40 | +{ |
---|
| 41 | + return struct_size(sfep, nameval, sfep->namelen + sfep->valuelen); |
---|
| 42 | +} |
---|
| 43 | + |
---|
| 44 | +/* next entry in struct */ |
---|
| 45 | +static inline struct xfs_attr_sf_entry * |
---|
| 46 | +xfs_attr_sf_nextentry(struct xfs_attr_sf_entry *sfep) |
---|
| 47 | +{ |
---|
| 48 | + return (void *)sfep + xfs_attr_sf_entsize(sfep); |
---|
| 49 | +} |
---|
41 | 50 | |
---|
42 | 51 | #endif /* __XFS_ATTR_SF_H__ */ |
---|