Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
7b718769 NS |
2 | * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
1da177e4 | 4 | * |
7b718769 NS |
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 | |
1da177e4 LT |
7 | * published by the Free Software Foundation. |
8 | * | |
7b718769 NS |
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. | |
1da177e4 | 13 | * |
7b718769 NS |
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 | |
1da177e4 LT |
17 | */ |
18 | #ifndef __XFS_ATTR_SF_H__ | |
19 | #define __XFS_ATTR_SF_H__ | |
20 | ||
21 | /* | |
22 | * Attribute storage when stored inside the inode. | |
23 | * | |
24 | * Small attribute lists are packed as tightly as possible so as | |
25 | * to fit into the literal area of the inode. | |
26 | */ | |
1da177e4 LT |
27 | typedef struct xfs_attr_sf_hdr xfs_attr_sf_hdr_t; |
28 | typedef struct xfs_attr_sf_entry xfs_attr_sf_entry_t; | |
29 | ||
30 | /* | |
31 | * We generate this then sort it, attr_list() must return things in hash-order. | |
32 | */ | |
33 | typedef struct xfs_attr_sf_sort { | |
34 | __uint8_t entno; /* entry number in original list */ | |
35 | __uint8_t namelen; /* length of name value (no null) */ | |
36 | __uint8_t valuelen; /* length of value */ | |
37 | __uint8_t flags; /* flags bits (see xfs_attr_leaf.h) */ | |
38 | xfs_dahash_t hash; /* this entry's hash value */ | |
a9273ca5 | 39 | unsigned char *name; /* name value, pointer into buffer */ |
1da177e4 LT |
40 | } xfs_attr_sf_sort_t; |
41 | ||
1da177e4 | 42 | #define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) /* space name/value uses */ \ |
a844f451 | 43 | (((int)sizeof(xfs_attr_sf_entry_t)-1 + (nlen)+(vlen))) |
1da177e4 LT |
44 | #define XFS_ATTR_SF_ENTSIZE_MAX /* max space for name&value */ \ |
45 | ((1 << (NBBY*(int)sizeof(__uint8_t))) - 1) | |
1da177e4 LT |
46 | #define XFS_ATTR_SF_ENTSIZE(sfep) /* space an entry uses */ \ |
47 | ((int)sizeof(xfs_attr_sf_entry_t)-1 + (sfep)->namelen+(sfep)->valuelen) | |
1da177e4 | 48 | #define XFS_ATTR_SF_NEXTENTRY(sfep) /* next entry in struct */ \ |
a844f451 | 49 | ((xfs_attr_sf_entry_t *)((char *)(sfep) + XFS_ATTR_SF_ENTSIZE(sfep))) |
1da177e4 | 50 | #define XFS_ATTR_SF_TOTSIZE(dp) /* total space in use */ \ |
3b244aa8 NS |
51 | (be16_to_cpu(((xfs_attr_shortform_t *) \ |
52 | ((dp)->i_afp->if_u1.if_data))->hdr.totsize)) | |
1da177e4 | 53 | |
1da177e4 | 54 | #endif /* __XFS_ATTR_SF_H__ */ |