.ig Copyright (C) 1993,1994 by the author(s). This software is published in the hope that it will be useful, but WITHOUT ANY WARRANTY for any part of this software to work correctly or as described in the manuals. See the ShapeTools Public License for details. Permission is granted to use, copy, modify, or distribute any part of this software but only under the conditions described in the ShapeTools Public License. A copy of this license is supposed to have been given to you along with ShapeTools in a file named LICENSE. Among other things, this copyright notice and the Public License must be preserved on all copies. Author: Andreas Lampen (Andreas.Lampen@cs.tu-berlin.de) $Header: af_files.3[7.0] Fri Jun 25 14:33:07 1993 andy@cs.tu-berlin.de frozen $ .. .TH af_files 3 "Fri Jun 25 14:33:07 1993" "AtFS-1.71" "Attribute Filesystem (AtFS)" .SH NAME af_crkey, af_open, af_close, af_rm, af_establish, af_restore \- AtFS file system operations .SH SYNOPSIS #include .br #include .sp int af_crkey (char *syspath, char *name, char *type, Af_key *aso) .sp FILE *af_open (Af_key *aso, char *mode) .sp int af_close (FILE *stream) .sp int af_rm (Af_key *aso) .sp int af_establish (Af_key *aso, char *filename) .sp int af_restore (Af_key *aso, Af_key *restoredAso) .sp .SH DESCRIPTION \fIaf_crkey\fP creates an object key for a regular \s-1UNIX\s+1 file identified by name, type and system path. \fIsyspath\fP is an either absolute or relative directory name. An empty syspath refers to the current directory. By convention, AtFS interprets the filename suffix of a \s-1UNIX\s+1 file as \fItype\fP and the filename without suffix as \fIname\fP attribute. To give an example, the path name .LP .RS .nf \fB/usr/andy/foo.c\fP is split up in \fB/usr/andy\fP (syspath) \fBfoo\fP (name) \fBc\fP (type) .fi .RE .LP A period as first character in the filename is always considered as part of the name. Hence \fB.cshrc\fP has a name but no type. "." and ".." are recognized as names too. If the named \s-1UNIX\s+1 file does not exist, af_crkey creates an empty file. The created key remains accessible until it is explicitly given up by af_dropkey (manual page af_retrieve(3)). .LP \fIaf_open\fP opens the contents of the ASO pointed to by \fIaso\fP and associates a stream with it. A pointer to the FILE structure associated with the stream is returned. \fIMode\fP is a character string that is either "r[+]", "w[+]" or "a[+]". See fopen(3) for further details. Upon error, af_open returns a NULL pointer. Non-busy ASOs can only be opened with mode "r". If a non-busy ASO is opened, it's contents will be placed in a temporary \s-1UNIX\s+1 file due to storage of versions as deltas. .LP \fIaf_close\fP closes a stream previously opened by af_open (see fclose(3)). Temporary files created by af_open, holding the contents of a saved versions are unlinked right after being opened so that they will automatically disappear on closing. .LP \fIaf_rm\fP removes the specified ASO. The application has to have a lock (see af_lock(3)) set on the ASO that shall be deleted by af_rm. ASOs with the state attribute set to \fBaccessed\fP or \fBfrozen\fP cannot be removed. If you keep multiple keys of one object (perhaps in different sets) af_rm invalidates all keys of the removed object. As AtFS does not support multiple links to saved ASOs, af_rm on a saved version always does a physical removal. .LP \fIaf_establish\fP establishes the contents of the saved version, pointed to by \fIaso\fP in a file named \fIfilename\fP. The resulting file gets the version's modification and access date. .LP \fIaf_restore\fP is used to restore formerly saved derived ASOs into their old file location. It also restores the file modification and access date. This function cannot be applied to source objects. af_restore returns the key of the restored version in the buffer \fIrestoredAso\fP. .SH SEE ALSO fopen(3), fclose(3), af_retrieve(3), af_lock(3) .SH DIAGNOSTICS Upon error, \-1 or a nil pointer (depending on the return type) is returned and \fIaf_errno\fP is set to the corresponding error number.