From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3e1162e60603301115n238a39abka1e01d3dd2fd6de0@mail.gmail.com> Date: Thu, 30 Mar 2006 11:15:31 -0800 From: "David Leimbach" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] new compilers In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <5D1F520A-5BA0-4789-8D35-61B80544285D@telus.net> <4937e6f0e033b77a2679b5853e19b96d@vitanuova.com> <20060330195101.4d9270a7.20h@r-36.net> Topicbox-Message-UUID: 27f41f72-ead1-11e9-9d60-3106f5b1d025 On 3/30/06, Burton Samograd wrote: > > ioctl(fd, SETVOLUME, &vol); is more comfortable. > > I read somewhere (but haven't actually seen it implimented yet) about > using xattrs (file system property lists) instead of ioctls and > thought that it was a pretty interesting idea. No needing to sort > through headers to find some badly acronimized value with no docs on > how to use it, etc... > > Anybody have any comments on the xattr -> ioctl type interfaces? Doesn't seem so bad. It opens up new questions about things like if all xattr APIs and implementations are created equal, and they're not. FreeBSD has one way. Mac OS X adopted the Linux API (believe it or not). Mac OS X's version differs in behavior from Linux's in some fundamental way= s. I found this out working with some friends on an archiver that gathers things like Resource Fork data between mac os x revisions, at some point you can access the data via xattrs if you wish, which changes the amount of data that is normally storable in an xattr interface. The other thing I didn't like about xattrs on linux is you have to write weird looping mechanisms to make sure you have a buffer that's big enough to hold the xattr data when reading. example: ---- TRYAGAIN: buf =3D malloc(bufsz); if (!buf) abort(); //pretty much screwed here. ret =3D listxattr(path, buf, bufsz, xattr_flags); if (ret < 0) { switch (errno) { case ERANGE: // bufsz is too small. bufsz *=3D 2; free(buf); goto TRYAGAIN; ---- And this is just to get a list of the key'd extended attributes existing on the file. Not a nice interface if you ask me. You basically fail upwards without being told how far off you were from having the correct buffer size. FreeBSD has namespaced xattrs for the SYSTEM and USERSPACE. I'll take control files any day of the week over this mess. Dave > > -- > burton samograd kruhft@gma= il.com > kruhft.blogspot.com www.myspace.com/kruhft metashell.blogspot.com >