Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!yorkohm!minster!martin From: martin@minster.york.ac.uk Newsgroups: comp.unix.wizards Subject: File attributes Message-ID: <677858503.15004@minster.york.ac.uk> Date: 25 Jun 91 14:01:43 GMT Organization: Department of Computer Science, University of York, England Lines: 52 Andrew Hume said: > ... Why not add one more system call (if you really hate this, > then standardise a way in via fcntl), say getattr, that is analogous to > stat and returns the value of an ascii attribute name? Then the files ... I implemented a filing system (for storing sampled, CD-quality sounds) which implements something like this - we call them `properties' not attributes - a null-terminated textual key, is mapped to an arbitrary binary value (with a stored length). In practice many values turn out to be textual, but the flexibility of binary values has been useful. A single `getattr'-like call is not enough - one also needs to be able to remove properties (we allow `binary properties' that have no value, and whose significance is their presence or absence in the file, so a zero value length cannot be used to remove a property. I suppose a negative length could be used, but this sounds like a hack to me :-). More interestingly one needs to be able to find out the keys of all the properties defined for a file, so the copy program can perserve them, and other more interesting manipulations can be carried out. In my system this also returns the size of the key's value, so that the application knows how much space to allocate if it has to read the property. Having done all this, properties/attributes are something of a mixed blessing. Managing the namespace, and standardizing the properties that are stored with files is a nightmare! Centralized administration is out of the question (no resources to support this, it is too awkward for developers and totally unenforceable) while locally defined property names quickly lead to chaos! At other times properties can be quite useful :-)! In a new version of the system that I am currently designing/thinking about I would prefer to use a perfectly good data agregation mechanism that is already in Unix, MSDOS, TOS, etc. I am of course refering to directories! Changes to allow directories to be moved and copied more freely seem to be enough to make this a better solution than attaching properties directly to the files. This would also allow `properties' that were hard or symbolic links, and other obvious generalizations. It also makes it much easier to avoid horrible restrictions/implementation problems on the size (and the changes in size) of properties. Martin usenet: ...!mcsun!ukc!minster!martin JANET: martin@uk.ac.york.minster INTERNET: martin%minster.york.ac.uk@nsfnet-relay.ac.uk surface: Dr. Martin C. Atkins Dept. of Computer Science University of York Heslington York YO1 5DD ENGLAND