af_files(3)
β¨ af_files β the AtFS file system ops, bestie edition β¨
okay so this is af_files(3) from the Attribute Filesystem (AtFS) manual, and it's literally the whole "how do I make, open, close, yeet and resurrect files" starter pack π
π NAME π
af_crkey, af_open, af_close, af_rm, af_establish, af_restore β AtFS file system operations π
πΈ SYNOPSIS πΈ
#include <stdio.h>
#include <atfs.h>
int af_crkey (char *syspath, char *name, char *type, Af_key *aso)
FILE *af_open (Af_key *aso, char *mode)
int af_close (FILE *stream)
int af_rm (Af_key *aso)
int af_establish (Af_key *aso, char *filename)
int af_restore (Af_key *aso, Af_key *restoredAso)
π DESCRIPTION π
π¦ af_crkey
af_crkey makes an object key for a regular UNIX file, and that file is identified by name, type and syspath. syspath is either an absolute or a relative directory name β and if syspath is empty, it's giving current directory energy, no cap.
By convention, AtFS interprets the filename suffix of a UNIX file as the type and the filename without the suffix as the name attribute. Example time, bestie β this path name:
/usr/andy/foo.c is split up in /usr/andy (syspath) foo (name) c (type)
A period as the first character in the filename is always considered part of the name. So .cshrc has a name but no type. And yes, . and .. are recognized as names too π«Ά.
If the named UNIX file doesn't exist, af_crkey creates an empty file. The created key stays accessible until it's explicitly given up by af_dropkey (manual page af_retrieve(3)).
π af_open
af_open opens the contents of the ASO pointed to by aso and associates a stream with it. A pointer to the FILE structure associated with the stream is returned. mode 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" β that's the rule, periodt π
If a non-busy ASO is opened, its contents will be placed in a temporary UNIX file, due to storage of versions as deltas. iykyk.
π af_close
af_close 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. iconic behaviour honestly β¨
π af_rm
af_rm 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 accessed or frozen cannot be removed. not me warning you twice.
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. she's thorough π
π§ af_establish
af_establish establishes the contents of the saved version, pointed to by aso, in a file named filename. The resulting file gets the version's modification and access date. cute, right? π
π af_restore
af_restore 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 β so don't try it, bestie π.
af_restore returns the key of the restored version in the buffer restoredAso.
π₯ SEE ALSO π₯
π DIAGNOSTICS π
Upon error, -1 or a nil pointer (depending on the return type) is returned and af_errno is set to the corresponding error number. so like, always check af_errno, fr fr.
and that's the whole page!! source/version vibes: AtFS-1.71, dated Fri Jun 25 14:33:07 1993 β yes she's a vintage icon and she still ate πβ¨π¦
π¦ where this page comes from
- debian bookworm: atfs-dev 1.4pl6-15+b1
- ubuntu jammy: atfs-dev 1.4pl6-15
- ubuntu noble: atfs-dev 1.4pl6-16.1build1
- ubuntu resolute: atfs-dev 1.4pl6-17
- ubuntu stonking: atfs-dev 1.4pl6-17
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms