[SOLVED] Maximum EA size
[SOLVED] Maximum EA size
- Subject: [SOLVED] Maximum EA size
- From: Frank Lahm <email@hidden>
- Date: Fri, 4 Sep 2009 16:22:24 +0200
The mentioned fellow solved this:
http://opensource.apple.com/source/xnu/xnu-1228.15.4/bsd/hfs/hfs_xattr.c
/*
* getmaxinlineattrsize - calculate maximum inline attribute size.
*
* This yields 3,802 bytes for an 8K node size.
*/
static size_t
getmaxinlineattrsize(struct vnode * attrvp)
{
struct BTreeInfoRec btinfo;
size_t nodesize = ATTRIBUTE_FILE_NODE_SIZE;
size_t maxsize;
if (attrvp != NULL) {
(void) hfs_lock(VTOC(attrvp), HFS_SHARED_LOCK);
if (BTGetInformation(VTOF(attrvp), 0, &btinfo) == 0)
nodesize = btinfo.nodeSize;
hfs_unlock(VTOC(attrvp));
}
maxsize = nodesize;
maxsize -= sizeof(BTNodeDescriptor); /* minus node descriptor */
maxsize -= 3 * sizeof(u_int16_t); /* minus 3 index slots */
maxsize /= 2; /* 2 key/rec pairs minumum */
maxsize -= sizeof(HFSPlusAttrKey); /* minus maximum key size */
maxsize -= sizeof(HFSPlusAttrData) - 2; /* minus data header */
maxsize &= 0xFFFFFFFE; /* multiple of 2 bytes */
return (maxsize);
}
------------------------------------------------------------
http://en.wikipedia.org/wiki/Extended_file_attributes#Mac_OS_X
Mac OS X 10.4 and later support extended attributes by making use of the
HFS+ filesystem Attributes file B*-tree feature which allows for named
forks. Although the named forks in HFS+ support arbitrarily large amounts
of data through extents, the OS support for extended attributes only
supports inline attributes, limiting their size to that which can fit
within a single B*-tree node.
Cheers!
_______________________________________________
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