Maximum EA size
Maximum EA size
- Subject: Maximum EA size
- From: Frank Lahm <email@hidden>
- Date: Fri, 4 Sep 2009 08:15:56 +0200
Hi list,
I'm one of the Netatalk developers. We're in the process of
implementing EA support.
Earlier this year I implemented EA support using native ZFS EAs as a
backend, still in the 10.5 timeframe. I tested for the greatest
possible EA size (for non ressource forks obviously) with a small
programm that drove setxattr with files on a local HFS+ like this:
---8<---
#include <unistd.h>
#include <sys/xattr.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int main(int argc, char **argv)
{
int ret;
size_t size;
char *buf;
if (argc != 4) {
printf("Usage: nattr <filename> <EAname> <size>\n");
exit(EXIT_FAILURE);
}
size = strtoul(argv[3], NULL, 10);
if ( ! (buf = malloc(size)) ) {
perror("malloc");
exit(EXIT_FAILURE);
}
ret = setxattr(argv[1], argv[2], buf, size, 0, XATTR_CREATE);
if (ret && errno == EEXIST)
ret = setxattr(argv[1], argv[2], buf, size, 0, XATTR_REPLACE);
if (ret)
printf("setxattr error: %s.errno: %u\n", strerror(errno), errno );
return ret;
}
---8<---
This gave me 3802. In 10.6 I still get the same result. 3803 results in E2BIG.
But: a fellow developer turned up sth. in xnu which seem to suggest
that some layers in xnu regard the maximum size as:
> http://opensource.apple.com/source/xnu/xnu-1228.15.4/bsd/hfs/hfs_xattr.c
>
> #define HFS_MAXATTRIBUTESIZE (128 * 1024)
>
>
> http://opensource.apple.com/source/xnu/xnu-1228.15.4/bsd/vfs/vfs_xattr.c
>
> #define ATTR_MAX_SIZE (128*1024) /* 128K maximum attribute data size */
Better safe then sorry, so can anybody tell us what is a reliable maximum size ?
Thanks!
-Frank
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden