1 @c Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
2 @c (Royal Institute of Technology, Stockholm, Sweden).
3 @c All rights reserved.
7 @node Parts of Arla, Debugging, AFS and the real world, Top
8 @comment node-name, next, previous, up
12 @strong{Caution:} This text just tries to give a general picture.
13 For real info read the code. If you have any questions, mail
14 @email{arla-drinkers@@stacken.kth.se}.
20 * The relation between Arlad and NNPFS::
21 * The life of a file::
23 * The files in arlad/::
27 @comment -----------------------------------------------------
28 @node How arla works, The relation between Arlad and NNPFS, Parts of Arla, Parts of Arla
29 @heading How does arla work
31 Arla consists of two parts, a userland process (arlad) and the
32 kernel-module (nnpfs).
34 Arlad is written in user-space for simpler debugging (and less rebooting).
35 As a uset space program arlad does not have the same limitations as if it
36 would be written in the kernel. To avoid performance loss as much as possible,
37 nnpfs is caching data.
39 @c XXX ptr to coda and arla-usenix paper
41 nnpfs and arlad communicate with each other via a char-device-driver.
42 There is a rpc-protocol currenly used specially written for this
43 (@file{arlad/message.c})
45 nnpfs is written to be as simple as possible. Theoretically, nnpfs could
46 be used by other user-space daemons to implement a file system. Some
47 parts, such as syscalls, are arla-specific. These parts are designed
48 to be as general as possible.
50 For example, nnpfs does not recognize which pioctl the user-level
51 program calls, it just passes this information on to arlad.
53 @comment -----------------------------------------------------
54 @node The relation between Arlad and NNPFS, The life of a file, How arla works, Parts of Arla
55 @heading The relation between Arlad and NNPFS
61 Edit file | Arlad | ------> Network
63 ----|-----------------|[1]----
65 Kernel | VFS | <--[2]--> | NNPFS |
71 @item [1] A char device (/dev/nnpfs0)
72 @item [2] NNPFS provides a filesystem for the vfs-layer in
76 @comment -----------------------------------------------------
77 @node The life of a file, Tools and libs, The relation between Arlad and NNPFS, Parts of Arla
78 @section The life of a file
80 @comment This a rough description of the life of a file.
82 Step by step description of what happens during the creation of a file.
83 The names are inspired of BSD-style VFS-layer but the idea is the same
84 in most operating systems.
88 @item The user decides to open a file.
90 @item open(2) syscall is issued.
92 @item The vfslayer sends a VOP_LOOKUP to nnpfs that is forwarded
93 to arlad with a getnode() (seq-num 1).
95 @item arlad tries to find the requested file and then, if found, sends an
96 install_node to nnpfs by writing to the nnpfs character device.
98 @item nnpfs inserts the node into the cache and returns from the device write.
100 @item arlad sends a wakeup rpc message (seq-num 1) to nnpfs.
101 If the return value is zero nnpfs tries to find the node in the cache, if
102 not found it might have been flushed out of the cache and the whole
105 @item If a none-zero return value is returned, this value is sent
106 as reply to the user. This way arla can decide what error message
107 is returned, without nnpfs having support for each error.
109 @item nnpfs now checks if it has the valid attributes. If the attributes
110 are invalid, nnpfs will send a rpc message to arlad to refresh it.
112 @item Since the user wanted to open the file, a getdata rpc message is
113 sent from nnpfs to arlad. Now arlad fetches the files from the
116 @item Arlad stores the file in the file cache. All vnode operations will
117 be done on this file. Now arlad sends a installdata to nnpfs.
119 @item When nnpfs recives the installdata it looks up the node in the cache,
120 and then it does a VOP_LOOKUP to find a vnode to the cachefile (and store
121 it to keep it for future use).
123 @item The same thing is done when the file is a directory, except that
124 the directory is converted from the afs directory format to an operating
125 system dependent format and stored in a file. nnpfs reads this file
128 @item If the directory is modified locally, write operations are
129 done on the file obtained from the afs-server, and when done the newly
130 changed file is converted and reinstalled.
132 @item Now the user wants to read a file.
134 @item read(2) system call is issued.
136 @item A VOP_READ is sent to the from the vfs-layer to nnpfs.
138 @item nnpfs checks if it has valid attributes/and data (and updates if needed).
139 Now VOP_READ is simply performed on the stored vnode of the cachefile.
143 @comment -----------------------------------------------------
144 @node Tools and libs, The files in arlad/, The life of a file, Parts of Arla
145 @heading Tools and libs
147 What other tools does the arla suite consists of
151 @item libutil: @code{util/libutil.a} - A library for the most often used
152 modules like hashtable, double-linked list, logging functions,
155 @item rx: @code{rx/librx.a} - The library for the rx protocol
156 (@pxref{Rx protocol}).
158 @item lwp: @code{lwp/liblwp.a} - The library for the lwp thread-package
161 @item ydr: @code{ydr/ydr} - A stub generator that replaces rxgen.
163 @item rxkad: @code{rxkad/librxkad.a} - The rx Kerberos authentication package.
165 @item roken: @code{lib/roken/libroken.a} - The library that will unbreak
166 things that are missing or broken.
168 @item ko: @code{lib/ko/libko.a} - A library of functions that are arlad-core
169 related but also are useful for programs like vos, pts, fs, etc.
171 @item arlalib: @code{appl/lib/libarlalib.a} - A broken library that does all
172 the hard work with connections etc.
174 @item fs: @code{appl/fs/fs} - The fs util, extra feature
175 (amongst others): getfid.
177 @item vos: @code{appl/vos/vos} - The vos util.
179 @item pts: @code{appl/pts/pts} - The pts util, extra feature: dump.
181 @item udebug: @code{appl/udebug/udebug} - Debug your ubik server.
187 @comment -----------------------------------------------------
188 @node The files in arlad/, pioctl and kafs, Tools and libs, Parts of Arla
189 @section The files in arlad/
191 This is a short describtion of the files to bring new deveplopers
194 @subsection The core of arlad
198 @item @file{adir.c} - contains all functions needed to to operations
199 on afs-directory files.
201 @item @file{afsdir_check.c} - check if an AFS-directory looks sane.
203 @item @file{arla.c} - The startup and the standalone (-t) code.
205 @item @file{arladeb.c} - The logging code specific to arla, like aliases
208 @item @file{cmcb.c} - The callback-server that is contacted by the
209 server when a callback expires or a server wants to send an InitCallBackState.
211 @item @file{conn.c} - The connection cache, responsible for caching connection
212 based on pag and security index. It will also create new connection when
215 @item @file{cred.c} - Keep track of all credentials that all users have
216 inserted. Indexed on pag.
218 @item @file{fbuf.c} - An interface between rx and filedescriptors. It is also
219 used to mmap files. Used by @file{adir.c}.
221 @item @file{fcache.c} - Responsible for keeping track of files in the cache.
222 Also fetches files from the afs-server.
224 @item @file{fprio.c} - Tries to give files priority. These files are
225 therefore not garbarge-collected as fast as they would be otherwise.
226 If you wonder what this is for, think of the disconnected mode.
228 @item @file{inter.c} - An interface to hide all junk in fcache, just give
229 the items a VenusFid and you can access them this way.
231 @item @file{kernel.c} - The interface between arlad and the char-device.
233 @item @file{messages.c} - The rpc interface between arlad and nnpfs.
235 @item @file{volcache.c} - Cache for all volumes.
239 @subsection Operating system specific files
241 These are the files that contain operating specific functions.
242 Today it's just conv_dir().
246 @item @file{aix-subr.c} - AIX
247 @item @file{bsd-subr.c} - FreeBSD 2.2.6, OpenBSD 2.2, 2.3, NetBSD 1.3.x
248 @item @file{hpux-subr.c} - HPUX
249 @item @file{irix-subr.c} - Irix
250 @item @file{linux-subr.c} - Linux 2.0.x, 2.1.x, 2.2
251 @item @file{solaris-subr.c} - Solaris 2.5.x, 2.6, 7
252 @item @file{sunos-subr.c} - SunOS
253 @item @file{unknown-subr.c} - Stub used when compiled on a unknown OS.
256 @comment -----------------------------------------------------
258 @node pioctl and kafs, ,The files in arlad/, Parts of Arla
259 @heading pioctl and kafs
261 The pioctl interface is the only part of nnpfs that is afs related.
263 pioctl is a ioctl but called with a path instead of a filedescriptor.
264 When you probe if there is a live afsclient you first run
265 @code{k_hasafs()} that probes if there is an afsclient around.
266 It also sets up some static variables in the library. So if you
267 start to do @code{pioctl()} w/o running @code{k_hasafs()}, you're
268 up to funny errors, and/or get a corefile.
270 @code{k_hasafs()} does an @code{AFSCALL_PIOCTL} with opcode
271 @code{ARLA_VIOCSETTOK} and insize == 0, ie you try to set a token
272 (ticket) that is 0 bytes long. This is cleary invalid and kafs
273 expects to find an @code{EINVAL} returned from @code{syscall(2)}.
275 The pioctl is used more then just for @code{AFSCALL_PIOCTL}, an other
276 use is @code{AFSCALL_SETPAG} (setting pag). It has also been in use for
277 setting nnpfs debugging levels.
279 When nnpfs discovers that a path is given in the @code{pioctl()} it does a
280 @code{VOP_LOOKUP} on the path and if the returned value is a vnode that
281 resides in afs then it extracts the nnpfs-handle for that node (that just
282 happens to be the VenusFid) and passes that on to arlad.
284 The only ugly thing about the current implentation is that
285 the syscall code assumes that the arlad on "nnpfs-fd" is the
286 arlad that should get this syscall.
288 An example of using @code{pioctl()}:
292 fs_getfilecellname(char *path, char *cell, size_t len)
294 struct ViceIoctl a_params;
297 a_params.out_size=len;
301 if (k_pioctl(path,ARLA_VIOC_FILE_CELL_NAME,&a_params,1) == -1)
308 main (int argc, char **argv)
313 errx (1, "there is no afs");
315 if (fs_getfilecellname (".", cell, sizeof(cell)))
316 errx (1, "fs_getfilecellname failed");
318 printf ("cell for `.' is %s", cell);
324 @comment -----------------------------------------------------
326 @c -----------------------------------------------------------
328 @c -----------------------------------------------------------
330 @c Assar Westerlund tells a story to the rest of the world:
332 @c John Hawkinson <jhawk@MIT.EDU> writes:
333 @c > What does sl stand for?
335 @c The short answer is that you should ask Mark.
337 @c The long answer is that it used to be this old library part of MIT
338 @c krb4 that was called `ss' (that I believe is short for subsystem, and
339 @c that was part of some unknown operating system a long time ago.
340 @c (Again, ask Mark.)), for reading and handling command line loops and
341 @c parsing. That wasn't IMHO optimal so we wrote a new library which we
342 @c called `sl'. The reason for SL is that the local transport authority
343 @c in Stockholm used to be called SS (Stockholms Sparvagar) but due to
344 @c the bad PR this abbreviation got under the second world war and that
345 @c they almost have abandoned trolleys (Sparvagnar) today, they renamed
346 @c themselves to SL (Storstockholms Lokaltrafik).
349 @c [ lha: Mark is only known to assar ]
350 @c [ assar: Mark == Mark Eichin ]
351 @c -----------------------------------------------------------
353 @c From: Craig_Everhart@transarc.com
354 @c Subject: Re: [OpenAFS] Silly question, Just interested
355 @c To: <openafs-info@openafs.org>
356 @c Date: Fri, 19 Jul 2002 10:00:19 -0400 (EDT)
359 @c The other way around: Vice was the Vast Integrated Computing Environment
360 @c on the server, and Venus was the client-side component but I don't know
361 @c if it was an acronym.