• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/src/router/squashfs-4.2/

Lines Matching refs:xattr

22  * xattr.c
37 #include <sys/xattr.h>
42 #include "xattr.h"
58 /* compressed xattr table */
62 /* cached uncompressed xattr data */
66 /* cached uncompressed xattr id table */
70 /* saved compressed xattr table */
73 /* saved cached uncompressed xattr data */
77 /* saved cached uncompressed xattr id table */
80 /* xattr hash table for value duplicate detection */
83 /* xattr hash table for id duplicate detection */
104 static int get_prefix(struct xattr_list *xattr, char *name)
108 xattr->full_name = strdup(name);
112 if(strncmp(xattr->full_name, p->prefix, strlen(p->prefix)) == 0)
117 xattr->name = xattr->full_name + strlen(prefix_table[i].prefix);
118 xattr->size = strlen(xattr->name);
152 /* xattr list grew? Try again */
177 ERROR("Unrecognised xattr prefix %s\n",
207 /* xattr grew? Try again */
222 TRACE("read_xattrs_from_system: filename %s, xattr name %s,"
241 static int get_xattr_size(struct xattr_list *xattr)
244 sizeof(struct squashfs_xattr_val) + xattr->size;
246 if(xattr->type & XATTR_VALUE_OOL)
249 size += xattr->vsize;
261 * Move and compress cached uncompressed data into xattr table.
318 struct xattr_list *xattr = &xattr_list[i];
320 checksum = get_checksum(xattr->full_name,
321 strlen(xattr->full_name), checksum);
322 checksum = get_checksum(xattr->value,
323 xattr->vsize, checksum);
331 struct xattr_list *xattr = &xattr_list[i];
334 if(strcmp(xattr->full_name, dup_xattr->full_name))
337 if(memcmp(xattr->value, dup_xattr->value, xattr->vsize))
363 static void check_value_dupl(struct xattr_list *xattr)
367 if(xattr->vsize < XATTR_VALUE_OOL_SIZE)
371 xattr->vchecksum = get_checksum(xattr->value, xattr->vsize, 0);
372 for(entry = dupl[xattr->vchecksum]; entry; entry = entry->vnext) {
373 if(entry->vsize != xattr->vsize)
376 if(memcmp(entry->value, xattr->value, xattr->vsize) == 0)
385 xattr->vnext = dupl[xattr->vchecksum];
386 dupl[xattr->vchecksum] = xattr;
387 xattr->ool_value = SQUASHFS_INVALID_BLK;
393 xattr->type |= XATTR_VALUE_OOL;
394 xattr->ool_value = entry->ool_value;
397 if(xattr->value != entry->value) {
398 free(xattr->value);
399 xattr->value = entry->value;
418 /* get total uncompressed size of xattr data, needed for stat */
424 xattr_id->xattr = xattr_disk;
429 * keep track of total uncompressed xattr data, needed for mksquashfs
451 * Move and compress cached uncompressed data into xattr table.
476 * Write compressed xattr table to file system
482 * Swap if necessary the xattr id table
520 * xattr. The choice is fairly straightforward, and depends on the
521 * size of each xattr name/value and the overall size of the
522 * resultant xattr list stored in the xattr metadata table.
526 * The overall goal is to optimise xattr scanning and lookup, and
528 * small xattr name/values to a large number of large xattr
530 * enabling the common case of a couple of small xattr name/values
534 * move xattr data out of line if it exceeds
537 * xattr list is larger than XATTR_TARGET_MAX then more
538 * aggressively move xattr data out of line by repeatedly
546 struct xattr_list *xattr = &xattr_list[i];
547 xattr->type &= XATTR_PREFIX_MASK; /* all inline */
548 if (xattr->vsize > xattr_value_max)
549 xattr->type |= XATTR_VALUE_OOL;
551 total_size += get_xattr_size(xattr);
555 * If the total size of the uncompressed xattr list is <=
574 * Check xattr values for duplicates
581 * Add each out of line value to the file system xattr table
585 struct xattr_list *xattr = &xattr_list[i];
587 if((xattr->type & XATTR_VALUE_OOL) &&
588 (xattr->ool_value == SQUASHFS_INVALID_BLK)) {
590 int size = sizeof(val) + xattr->vsize;
591 xp = get_xattr_space(size, &xattr->ool_value);
592 val.vsize = xattr->vsize;
594 memcpy(xp + sizeof(val), xattr->value, xattr->vsize);
599 * Create xattr list and add to file system xattr table
603 struct xattr_list *xattr = &xattr_list[i];
607 xp = get_xattr_space(sizeof(entry) + xattr->size, NULL);
608 entry.type = xattr->type;
609 entry.size = xattr->size;
611 memcpy(xp + sizeof(entry), xattr->name, xattr->size);
613 if(xattr->type & XATTR_VALUE_OOL) {
618 SQUASHFS_SWAP_LONG_LONGS(&xattr->ool_value, xp +
621 int size = sizeof(val) + xattr->vsize;
622 xp = get_xattr_space(size, &xattr->ool_value);
623 val.vsize = xattr->vsize;
625 memcpy(xp + sizeof(val), xattr->value, xattr->vsize);
630 * Add to xattr id lookup table
656 * Add the existing xattr ids and xattr metadata in the file system being
657 * appended to, to the in-memory xattr cache. This allows duplicate checking to
674 * for each xattr id read and construct its list of xattr
675 * name:value pairs, and add them to the in-memory xattr cache
686 * Sanity check, the new xattr id should be the same as the
687 * xattr id in the original file system
707 /* save the current state of the compressed xattr data */
712 * save the current state of the cached uncompressed xattr data.
723 /* save the current state of the xattr id table */
739 /* restore the state of the compressed xattr data */
743 /* restore the state of the uncomoressed xattr data */
747 /* restore the state of the xattr id table */