Lines Matching refs:header
1213 attribute header, attribute entries, and attribute data.
1260 * Note: ATTR_MAX_HDR_SIZE is the largest attribute header
1265 * separately from the attribute header I/O.
1313 u_int32_t total_size; /* file offset of end of attribute header + entries + data */
1425 * Sanity check and swap the header of an AppleDouble file. Assumes the buffer
1432 * If the header is invalid, ENOATTR is returned.
1434 * NOTE: Does not attempt to validate the extended attributes header that
1443 apple_double_header_t *header;
1446 header = (apple_double_header_t *) ainfop->rawdata;
1448 /* Is the file big enough to contain an AppleDouble header? */
1452 /* Swap the AppleDouble header fields to native order */
1453 header->magic = SWAP32(header->magic);
1454 header->version = SWAP32(header->version);
1455 header->numEntries = SWAP16(header->numEntries);
1457 /* Sanity check the AppleDouble header fields */
1458 if (header->magic != ADH_MAGIC ||
1459 header->version != ADH_VERSION ||
1460 header->numEntries < 1 ||
1461 header->numEntries > 15) {
1467 header->numEntries * sizeof(apple_double_entry_t);
1475 for (i=0; i<header->numEntries; i++) {
1477 header->entries[i].type = SWAP32(header->entries[i].type);
1478 header->entries[i].offset = SWAP32(header->entries[i].offset);
1479 header->entries[i].length = SWAP32(header->entries[i].length);
1481 entry_end = header->entries[i].offset + header->entries[i].length;
1484 * Does the entry's content start within the header itself,
1488 if (header->entries[i].offset < header_end ||
1489 entry_end < header->entries[i].offset ||
1505 if (entry_end > header->entries[j].offset &&
1506 header->entries[j].offset + header->entries[j].length > header->entries[i].offset) {
1526 attr_header_t *header;
1603 header = ainfo.attrhdr;
1606 * Search for attribute name in the header.
1608 for (i = 0; i < header->num_attrs && ATTR_VALID(entry, ainfo); i++) {
1621 attrdata = ((u_int8_t *)header + entry->offset);
1647 attr_header_t *header;
1805 header = ainfo.attrhdr;
1808 /* Check if data area crosses the maximum header size. */
1809 if ((header->data_start + header->data_length + entrylen + datalen) > ATTR_MAX_HDR_SIZE)
1817 for (i = 0; i < header->num_attrs && ATTR_VALID(entry, ainfo); i++) {
1839 attrdata = (u_int8_t *)header + entry->offset;
1872 /* Check if header size limit has been reached. */
1873 if ((header->data_start + entrylen) > ATTR_MAX_HDR_SIZE) {
1878 datafreespace = header->total_size - (header->data_start + header->data_length);
1887 if (!splitdata && (header->total_size + growsize) > ATTR_MAX_HDR_SIZE) {
1888 growsize = ATTR_MAX_HDR_SIZE - header->total_size;
1912 header->total_size += growsize;
1918 header->data_start,
1919 header->data_length,
1922 bcopy((u_int8_t *)header + header->data_start,
1923 (u_int8_t *)header + header->data_start + entrylen,
1924 header->data_length);
1926 header->data_start += entrylen;
1936 * the header buffer, then just update the buffer,
1943 offset = header->data_start + header->data_length;
1952 attrdata = (u_int8_t *)header + header->data_start + header->data_length;
1963 lastentry->offset = header->data_start + header->data_length;
1968 /* Update the attributes header. */
1969 header->num_attrs++;
1970 header->data_length += datalen;
1976 /* The entry and data are both in the header; write them together. */
2016 attr_header_t *header;
2111 header = ainfo.attrhdr;
2117 for (i = 0; i < header->num_attrs && ATTR_VALID(entry, ainfo); i++) {
2120 if ((i+1) == header->num_attrs)
2137 if ((header->data_start + header->data_length) > ATTR_MAX_HDR_SIZE)
2145 ((size_t)header + header->data_start) - ((size_t)entry + entrylen));
2151 header->data_start,
2152 dataoff - header->data_start,
2158 (header->data_start + header->data_length) - (dataoff + datalen),
2167 bcopy((u_int8_t *)header + header->data_start,
2168 (u_int8_t *)header + header->data_start - entrylen,
2169 dataoff - header->data_start);
2171 bcopy((u_int8_t *)header + dataoff + datalen,
2172 (u_int8_t *)header + dataoff - entrylen,
2173 (header->data_start + header->data_length) - (dataoff + datalen));
2175 bzero (((u_int8_t *)header + header->data_start + header->data_length) - (datalen + entrylen), (datalen + entrylen));
2179 /* Adjust the header values and entry offsets. */
2180 header->num_attrs--;
2181 header->data_start -= entrylen;
2182 header->data_length -= datalen;
2186 for (i = 0; i < header->num_attrs && ATTR_VALID(entry, ainfo); i++) {
2330 * Check the header of a ._ file to verify that it is in fact an Apple Double
2331 * file. Returns 0 if the header is valid, non-zero if invalid.
2367 /* Read the header */
2380 /* If we made it here, then the header is ok */
2555 /* If create was requested, make sure file header exists. */
2566 /* If the file is empty then add a default header. */
2668 * Read in and parse the AppleDouble header and entries, and the extended
2669 * attribute header and entries if any. Populates the fields of ainfop
2674 * AppleDouble entries, the extended attribute header, and extended
2678 * - Swap and sanity check the AppleDouble header (including the AppleDouble
2682 * room to store the extended attribute header, plus some space for extended
2684 * - Swap and sanity check the extended attribute header and entries (if any).
2708 /* When setting attributes, allow room for the header to grow. */
2728 /* Read the file header. */
2742 ainfop->filehdr = filehdr; /* valid AppleDouble header */
2744 /* rel_xattrinfo is responsible for freeing the header buffer */
2817 * entry has room to store the extended attribute header, plus some
2820 * - Swap and sanity check the extended attribute header and entries
2831 * Info entry has room to store the extended attribute header,
2852 /* Steal some space for an empty RF header. */
2879 /* Push out new header */
2887 /* The attribute header gets swapped below. */
2891 * Swap and sanity check the extended attribute header and
2893 * to include the extended attribute header; if not, we just
2902 * header was found.
2910 ainfop->attrhdr = attrhdr; /* valid attribute header */
2911 /* First attr_entry starts immediately following attribute header */
3025 * Endian swap apple double header
3047 * Endian swap extended attributes header
3076 * Validate and swap the attributes header contents, and each attribute's
3081 * swap the header fields before sanity checking them.
3098 /* Swap the basic header fields */
3149 * TODO: Make sure the contents of attributes don't overlap the header
3151 * what the actual header size is until we have looped over all of the