summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile.am11
-rw-r--r--doc/authentication.txt112
-rw-r--r--doc/booster.txt54
-rw-r--r--doc/coding-standard.pdfbin0 -> 68627 bytes
-rw-r--r--doc/coding-standard.tex361
-rw-r--r--doc/errno.list.bsd.txt376
-rw-r--r--doc/errno.list.linux.txt1586
-rw-r--r--doc/errno.list.macosx.txt1513
-rw-r--r--doc/errno.list.solaris.txt206
-rw-r--r--doc/examples/Makefile.am8
-rw-r--r--doc/examples/README13
-rw-r--r--doc/examples/filter.vol23
-rw-r--r--doc/examples/io-cache.vol25
-rw-r--r--doc/examples/io-threads.vol21
-rw-r--r--doc/examples/posix-locks.vol20
-rw-r--r--doc/examples/protocol-client.vol17
-rw-r--r--doc/examples/protocol-server.vol25
-rw-r--r--doc/examples/read-ahead.vol22
-rw-r--r--doc/examples/replicate.vol119
-rw-r--r--doc/examples/stripe.vol121
-rw-r--r--doc/examples/trace.vol16
-rw-r--r--doc/examples/trash.vol20
-rw-r--r--doc/examples/unify.vol178
-rw-r--r--doc/examples/write-behind.vol26
-rw-r--r--doc/get_put_api_using_xattr.txt22
-rw-r--r--doc/glusterfs.8139
-rw-r--r--doc/glusterfs.vol.sample61
-rw-r--r--doc/glusterfsd.vol.sample47
-rw-r--r--doc/hacker-guide/Makefile.am8
-rw-r--r--doc/hacker-guide/adding-fops.txt33
-rw-r--r--doc/hacker-guide/bdb.txt70
-rw-r--r--doc/hacker-guide/call-stub.txt1033
-rw-r--r--doc/hacker-guide/hacker-guide.tex312
-rw-r--r--doc/hacker-guide/posix.txt59
-rw-r--r--doc/hacker-guide/replicate.txt206
-rw-r--r--doc/hacker-guide/write-behind.txt45
-rw-r--r--doc/handling-options.txt13
-rw-r--r--doc/mac-related-xattrs.txt21
-rw-r--r--doc/porting_guide.txt45
-rw-r--r--doc/qa/qa-client.vol170
-rw-r--r--doc/qa/qa-high-avail-client.vol17
-rw-r--r--doc/qa/qa-high-avail-server.vol346
-rw-r--r--doc/qa/qa-server.vol284
-rw-r--r--doc/replicate.lyx797
-rw-r--r--doc/replicate.pdfbin0 -> 109057 bytes
-rw-r--r--doc/solaris-related-xattrs.txt44
-rw-r--r--doc/translator-options.txt221
-rw-r--r--doc/user-guide/Makefile.am1
-rw-r--r--doc/user-guide/advanced-stripe.odgbin0 -> 12648 bytes
-rw-r--r--doc/user-guide/advanced-stripe.pdfbin0 -> 13382 bytes
-rw-r--r--doc/user-guide/colonO-icon.jpgbin0 -> 779 bytes
-rw-r--r--doc/user-guide/fdl.texi454
-rw-r--r--doc/user-guide/fuse.odgbin0 -> 13190 bytes
-rw-r--r--doc/user-guide/fuse.pdfbin0 -> 14948 bytes
-rw-r--r--doc/user-guide/ha.odgbin0 -> 37290 bytes
-rw-r--r--doc/user-guide/ha.pdfbin0 -> 19403 bytes
-rw-r--r--doc/user-guide/stripe.odgbin0 -> 10188 bytes
-rw-r--r--doc/user-guide/stripe.pdfbin0 -> 11941 bytes
-rw-r--r--doc/user-guide/unify.odgbin0 -> 12955 bytes
-rw-r--r--doc/user-guide/unify.pdfbin0 -> 18969 bytes
-rw-r--r--doc/user-guide/user-guide.info2698
-rw-r--r--doc/user-guide/user-guide.pdfbin0 -> 353986 bytes
-rw-r--r--doc/user-guide/user-guide.texi2226
-rw-r--r--doc/user-guide/xlator.odgbin0 -> 12169 bytes
-rw-r--r--doc/user-guide/xlator.pdfbin0 -> 14358 bytes
65 files changed, 14245 insertions, 0 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 00000000000..83f88320c94
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,11 @@
+EXTRA_DIST = glusterfs.vol.sample glusterfsd.vol.sample glusterfs.8 \
+ porting_guide.txt authentication.txt coding-standard.pdf get_put_api_using_xattr.txt \
+ translator-options.txt mac-related-xattrs.txt replicate.pdf
+SUBDIRS = examples hacker-guide user-guide
+
+voldir = $(sysconfdir)/glusterfs
+vol_DATA = glusterfs.vol.sample glusterfsd.vol.sample
+
+man8_MANS = glusterfs.8
+
+CLEANFILES =
diff --git a/doc/authentication.txt b/doc/authentication.txt
new file mode 100644
index 00000000000..70aafd93334
--- /dev/null
+++ b/doc/authentication.txt
@@ -0,0 +1,112 @@
+
+* Authentication is provided by two modules addr and login. Login based authentication uses username/password from client for authentication. Each module returns either ACCEPT, REJCET or DONT_CARE. DONT_CARE is returned if the input authentication information to the module is not concerned to its working. The theory behind authentication is that "none of the auth modules should return REJECT and atleast one of them should return ACCEPT"
+
+* Currently all the authentication related information is passed un-encrypted over the network from client to server.
+
+----------------------------------------------------------------------------------------------------
+* options provided in protocol/client:
+ * for username/password based authentication:
+ option username <username>
+ option password <password>
+ * client can have only one set of username/password
+ * for addr based authentication:
+ * no options required in protocol/client. Client has to bind to privileged port (port < 1024 ) which means the process in which protocol/client is loaded has to be run as root.
+
+----------------------------------------------------------------------------------------------------
+* options provided in protocol/server:
+ * for username/password based authentication:
+ option auth.login.<brick>.allow [comma seperated list of usernames using which clients can connect to volume <brick>]
+ option auth.login.<username>.password <password> #specify password <password> for username <username>
+ * for addr based authentication:
+ option auth.addr.<brick>.allow [comma seperated list of ip-addresses/unix-paths from which clients are allowed to connect to volume <brick>]
+ option auth.addr.<brick>.reject [comma seperated list of ip-addresses/unix-paths from which clients are not allowed to connect to volume <brick>]
+ * negation operator '!' is used to invert the sense of matching.
+ Eg., option auth.addr.brick.allow !a.b.c.d #do not allow client from a.b.c.d to connect to volume brick
+ option auth.addr.brick.reject !w.x.y.z #allow client from w.x.y.z to connect to volume brick
+ * wildcard '*' can be used to match any ip-address/unix-path
+
+----------------------------------------------------------------------------------------------------
+
+* Usecases:
+
+* username/password based authentication only
+ protocol/client:
+ option username foo
+ option password foo-password
+ option remote-subvolume foo-brick
+
+ protocol/server:
+ option auth.login.foo-brick.allow foo,who #,other users allowed to connect to foo-brick
+ option auth.login.foo.password foo-password
+ option auth.login.who.password who-password
+
+ * in protocol/server, dont specify ip from which client is connecting in auth.addr.foo-brick.reject list
+
+****************************************************************************************************
+
+* ip based authentication only
+ protocol/client:
+ option remote-subvolume foo-brick
+ * Client is connecting from a.b.c.d
+
+ protocol/server:
+ option auth.addr.foo-brick.allow a.b.c.d,e.f.g.h,i.j.k.l #, other ip addresses from which clients are allowed to connect to foo-brick
+
+****************************************************************************************************
+* ip and username/password based authentication
+ * allow only "user foo from a.b.c.d"
+ protocol/client:
+ option username foo
+ option password foo-password
+ option remote-subvolume foo-brick
+
+ protocol/server:
+ option auth.login.foo-brick.allow foo
+ option auth.login.foo.password foo-password
+ option auth.addr.foo-brick.reject !a.b.c.d
+
+ * allow only "user foo" from a.b.c.d i.e., only user foo is allowed from a.b.c.d, but anyone is allowed from ip addresses other than a.b.c.d
+ protocol/client:
+ option username foo
+ option password foo-password
+ option remote-subvolume foo-brick
+
+ protocol/server:
+ option auth.login.foo-brick.allow foo
+ option auth.login.foo.password foo-password
+ option auth.addr.foo-brick.allow !a.b.c.d
+
+ * reject only "user shoo from a.b.c.d"
+ protcol/client:
+ option remote-subvolume shoo-brick
+
+ protocol/server:
+ # observe that no "option auth.login.shoo-brick.allow shoo" given
+ # Also other users from a.b.c.d have to be explicitly allowed using auth.login.shoo-brick.allow ...
+ option auth.addr.shoo-brick.allow !a.b.c.d
+
+ * reject only "user shoo" from a.b.c.d i.e., user shoo from a.b.c.d has to be rejected.
+ * same as reject only "user shoo from a.b.c.d" above, but rules have to be added whether to allow ip addresses (and users from those ips) other than a.b.c.d
+
+****************************************************************************************************
+
+* ip or username/password based authentication
+
+ * allow user foo or clients from a.b.c.d
+ protocol/client:
+ option remote-subvolume foo-brick
+
+ protocol/server:
+ option auth.login.foo-brick.allow foo
+ option auth.login.foo.password foo-password
+ option auth.addr.foo-brick.allow a.b.c.d
+
+ * reject user shoo or clients from a.b.c.d
+ protocol/client:
+ option remote-subvolume shoo-brick
+
+ protocol/server:
+ option auth.login.shoo-brick.allow <usernames other than shoo>
+ #for each username mentioned in the above <usernames other than shoo> list, specify password as below
+ option auth.login.<username other than shoo>.password password
+ option auth.addr.shoo-brick.reject a.b.c.d
diff --git a/doc/booster.txt b/doc/booster.txt
new file mode 100644
index 00000000000..684ac8965c4
--- /dev/null
+++ b/doc/booster.txt
@@ -0,0 +1,54 @@
+Introduction
+============
+* booster is a LD_PRELOADable library which boosts read/write performance by bypassing fuse for
+ read() and write() calls.
+
+Requirements
+============
+* fetch volfile from glusterfs.
+* identify whether multiple files are from the same mount point. If so, use only one context.
+
+Design
+======
+* for a getxattr, along with other attributes, fuse returns following attributes.
+ * contents of client volume-file.
+ * mount point.
+
+* LD_PRELOADed booster.so maintains an hash table storing mount-points and libglusterfsclient handles
+ so that handles are reused for files from same mount point.
+
+* it also maintains a fdtable. fdtable maps the fd (integer) returned to application to fd (pointer to fd struct)
+ used by libglusterfsclient. application is returned the same fd as the one returned from libc apis.
+
+* During fork, these tables are overwritten to enable creation of fresh glusterfs context in child.
+
+Working
+=======
+* application willing to use booster LD_PRELOADs booster.so which is a wrapper library implementing
+ open, read and write.
+
+* application should specify the path to logfile through the environment variable GLFS_BOOSTER_LOGFILE. If
+ not specified, logging is done to /dev/stderr.
+
+* open call does,
+ * real_open on the file.
+ * fgetxattr(fd).
+ * store the volume-file content got in the dictionary to a temparory file.
+ * look in the hashtable for the mount-point, if already present get the libglusterfsclient handle from the
+ hashtable. Otherwise get a new handle from libglusterfsclient (be careful about mount point not present in
+ the hashtable and multiple glusterfs_inits running simultaneously for the same mount-point there by using
+ multiple handles for the same mount point).
+ * real_close (fd).
+ * delete temporary volume-volfile.
+ * glusterfs_open (handle, path, mode).
+ * store the fd returned by glusterfs_open in the fdtable at the same index as the fd returned by real_open.
+ * return the index as fd.
+
+* read/write calls do,
+ * get the libglusterfsclient fd from fdtable.
+ * if found use glusterfs_read/glusterfs_write, else use real_read/real_write.
+
+* close call does,
+ * remove the fd from the fdtable.
+
+* other calls use real_calls.
diff --git a/doc/coding-standard.pdf b/doc/coding-standard.pdf
new file mode 100644
index 00000000000..bc9cb56202c
--- /dev/null
+++ b/doc/coding-standard.pdf
Binary files differ
diff --git a/doc/coding-standard.tex b/doc/coding-standard.tex
new file mode 100644
index 00000000000..ed9d920eccf
--- /dev/null
+++ b/doc/coding-standard.tex
@@ -0,0 +1,361 @@
+\documentclass{article}[12pt]
+\usepackage{color}
+
+\begin{document}
+
+
+\hrule
+\begin{center}\textbf{\Large{GlusterFS Coding Standards}}\end{center}
+\begin{center}\textbf{\large{\textcolor{red}{Z} Research}}\end{center}
+\begin{center}{July 14, 2008}\end{center}
+\hrule
+
+\vspace{8ex}
+
+\section*{$\bullet$ Structure definitions should have a comment per member}
+
+Every member in a structure definition must have a comment about its
+purpose. The comment should be descriptive without being overly verbose.
+
+\vspace{2ex}
+\textsl{Bad}:
+
+\begin{verbatim}
+ gf_lock_t lock; /* lock */
+\end{verbatim}
+
+\textsl{Good}:
+
+\begin{verbatim}
+ DBTYPE access_mode; /* access mode for accessing
+ * the databases, can be
+ * DB_HASH, DB_BTREE
+ * (option access-mode <mode>)
+ */
+\end{verbatim}
+
+\section*{$\bullet$ Declare all variables at the beginning of the function}
+All local variables in a function must be declared immediately after the
+opening brace. This makes it easy to keep track of memory that needs to be freed
+during exit. It also helps debugging, since gdb cannot handle variables
+declared inside loops or other such blocks.
+
+\section*{$\bullet$ Always initialize local variables}
+Every local variable should be initialized to a sensible default value
+at the point of its declaration. All pointers should be initialized to NULL,
+and all integers should be zero or (if it makes sense) an error value.
+
+\vspace{2ex}
+
+\textsl{Good}:
+
+\begin{verbatim}
+ int ret = 0;
+ char *databuf = NULL;
+ int _fd = -1;
+\end{verbatim}
+
+\section*{$\bullet$ Initialization should always be done with a constant value}
+Never use a non-constant expression as the initialization value for a variable.
+
+\vspace{2ex}
+
+\textsl{Bad}:
+
+\begin{verbatim}
+ pid_t pid = frame->root->pid;
+ char *databuf = malloc (1024);
+\end{verbatim}
+
+\section*{$\bullet$ Validate all arguments to a function}
+All pointer arguments to a function must be checked for \texttt{NULL}.
+A macro named \texttt{VALIDATE} (in \texttt{common-utils.h})
+takes one argument, and if it is \texttt{NULL}, writes a log message and
+jumps to a label called \texttt{err} after setting op\_ret and op\_errno
+appropriately. It is recommended to use this template.
+
+\vspace{2ex}
+
+\textsl{Good}:
+
+\begin{verbatim}
+ VALIDATE(frame);
+ VALIDATE(this);
+ VALIDATE(inode);
+\end{verbatim}
+
+\section*{$\bullet$ Never rely on precedence of operators}
+Never write code that relies on the precedence of operators to execute
+correctly. Such code can be hard to read and someone else might not
+know the precedence of operators as accurately as you do.
+\vspace{2ex}
+
+\textsl{Bad}:
+
+\begin{verbatim}
+ if (op_ret == -1 && errno != ENOENT)
+\end{verbatim}
+
+\textsl{Good}:
+
+\begin{verbatim}
+ if ((op_ret == -1) && (errno != ENOENT))
+\end{verbatim}
+
+\section*{$\bullet$ Use exactly matching types}
+Use a variable of the exact type declared in the manual to hold the
+return value of a function. Do not use an ``equivalent'' type.
+
+\vspace{2ex}
+
+\textsl{Bad}:
+
+\begin{verbatim}
+ int len = strlen (path);
+\end{verbatim}
+
+\textsl{Good}:
+
+\begin{verbatim}
+ size_t len = strlen (path);
+\end{verbatim}
+
+\section*{$\bullet$ Never write code such as \texttt{foo->bar->baz}; check every pointer}
+Do not write code that blindly follows a chain of pointer
+references. Any pointer in the chain may be \texttt{NULL} and thus
+cause a crash. Verify that each pointer is non-null before following
+it.
+
+\section*{$\bullet$ Check return value of all functions and system calls}
+The return value of all system calls and API functions must be checked
+for success or failure.
+
+\vspace{2ex}
+\textsl{Bad}:
+
+\begin{verbatim}
+ close (fd);
+\end{verbatim}
+
+\textsl{Good}:
+
+\begin{verbatim}
+ op_ret = close (_fd);
+ if (op_ret == -1) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "close on file %s failed (%s)", real_path,
+ strerror (errno));
+ op_errno = errno;
+ goto out;
+ }
+\end{verbatim}
+
+
+\section*{$\bullet$ Gracefully handle failure of malloc}
+GlusterFS should never crash or exit due to lack of memory. If a
+memory allocation fails, the call should be unwound and an error
+returned to the user.
+
+\section*{$\bullet$ Use result args and reserve the return value to indicate success or failure}
+The return value of every functions must indicate success or failure (unless
+it is impossible for the function to fail --- e.g., boolean functions). If
+the function needs to return additional data, it must be returned using a
+result (pointer) argument.
+
+\vspace{2ex}
+\textsl{Bad}:
+
+\begin{verbatim}
+ int32_t dict_get_int32 (dict_t *this, char *key);
+\end{verbatim}
+
+\textsl{Good}:
+
+\begin{verbatim}
+ int dict_get_int32 (dict_t *this, char *key, int32_t *val);
+\end{verbatim}
+
+\section*{$\bullet$ Always use the `n' versions of string functions}
+Unless impossible, use the length-limited versions of the string functions.
+
+\vspace{2ex}
+\textsl{Bad}:
+
+\begin{verbatim}
+ strcpy (entry_path, real_path);
+\end{verbatim}
+
+\textsl{Good}:
+
+\begin{verbatim}
+ strncpy (entry_path, real_path, entry_path_len);
+\end{verbatim}
+
+\section*{$\bullet$ No dead or commented code}
+There must be no dead code (code to which control can never be passed) or
+commented out code in the codebase.
+
+\section*{$\bullet$ Only one unwind and return per function}
+There must be only one exit out of a function. \texttt{UNWIND} and return
+should happen at only point in the function.
+
+\section*{$\bullet$ Keep functions small}
+Try to keep functions small. Two to three screenfulls (80 lines per screen) is
+considered a reasonable limit. If a function is very long, try splitting it
+into many little helper functions.
+
+\vspace{2ex}
+\textsl{Example for a helper function}:
+\begin{verbatim}
+ static int
+ same_owner (posix_lock_t *l1, posix_lock_t *l2)
+ {
+ return ((l1->client_pid == l2->client_pid) &&
+ (l1->transport == l2->transport));
+ }
+\end{verbatim}
+
+\section*{Style issues}
+
+\subsection*{Brace placement}
+Use K\&R/Linux style of brace placement for blocks.
+
+\textsl{Example}:
+\begin{verbatim}
+ int some_function (...)
+ {
+ if (...) {
+ /* ... */
+ } else if (...) {
+ /* ... */
+ } else {
+ /* ... */
+ }
+
+ do {
+ /* ... */
+ } while (cond);
+ }
+\end{verbatim}
+
+\subsection*{Indentation}
+Use \textbf{eight} spaces for indenting blocks. Ensure that your
+file contains only spaces and not tab characters. You can do this
+in Emacs by selecting the entire file (\texttt{C-x h}) and
+running \texttt{M-x untabify}.
+
+To make Emacs indent lines automatically by eight spaces, add this
+line to your \texttt{.emacs}:
+
+\begin{verbatim}
+ (add-hook 'c-mode-hook (lambda () (c-set-style "linux")))
+\end{verbatim}
+
+\subsection*{Comments}
+Write a comment before every function describing its purpose (one-line),
+its arguments, and its return value. Mention whether it is an internal
+function or an exported function.
+
+Write a comment before every structure describing its purpose, and
+write comments about each of its members.
+
+Follow the style shown below for comments, since such comments
+can then be automatically extracted by doxygen to generate
+documentation.
+
+\textsl{Example}:
+\begin{verbatim}
+/**
+ * hash_name -hash function for filenames
+ * @par: parent inode number
+ * @name: basename of inode
+ * @mod: number of buckets in the hashtable
+ *
+ * @return: success: bucket number
+ * failure: -1
+ *
+ * Not for external use.
+ */
+\end{verbatim}
+
+\subsection*{Indicating critical sections}
+To clearly show regions of code which execute with locks held, use
+the following format:
+
+\begin{verbatim}
+ pthread_mutex_lock (&mutex);
+ {
+ /* code */
+ }
+ pthread_mutex_unlock (&mutex);
+\end{verbatim}
+
+\section*{A skeleton fop function}
+This is the recommended template for any fop. In the beginning come
+the initializations. After that, the `success' control flow should be
+linear. Any error conditions should cause a \texttt{goto} to a single
+point, \texttt{out}. At that point, the code should detect the error
+that has occured and do appropriate cleanup.
+
+\begin{verbatim}
+int32_t
+sample_fop (call_frame_t *frame,
+ xlator_t *this,
+ ...)
+{
+ char * var1 = NULL;
+ int32_t op_ret = -1;
+ int32_t op_errno = 0;
+ DIR * dir = NULL;
+ struct posix_fd * pfd = NULL;
+
+ VALIDATE_OR_GOTO (frame, out);
+ VALIDATE_OR_GOTO (this, out);
+
+ /* other validations */
+
+ dir = opendir (...);
+
+ if (dir == NULL) {
+ op_errno = errno;
+ gf_log (this->name, GF_LOG_ERROR,
+ "opendir failed on %s (%s)", loc->path,
+ strerror (op_errno));
+ goto out;
+ }
+
+ /* another system call */
+ if (...) {
+ op_errno = ENOMEM;
+ gf_log (this->name, GF_LOG_ERROR,
+ "out of memory :(");
+ goto out;
+ }
+
+ /* ... */
+
+ out:
+ if (op_ret == -1) {
+
+ /* check for all the cleanup that needs to be
+ done */
+
+ if (dir) {
+ closedir (dir);
+ dir = NULL;
+ }
+
+ if (pfd) {
+ if (pfd->path)
+ FREE (pfd->path);
+ FREE (pfd);
+ pfd = NULL;
+ }
+ }
+
+ STACK_UNWIND (frame, op_ret, op_errno, fd);
+ return 0;
+}
+\end{verbatim}
+
+\end{document}
diff --git a/doc/errno.list.bsd.txt b/doc/errno.list.bsd.txt
new file mode 100644
index 00000000000..350af25e4ab
--- /dev/null
+++ b/doc/errno.list.bsd.txt
@@ -0,0 +1,376 @@
+/*-
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)errno.h 8.5 (Berkeley) 1/21/94
+ * $FreeBSD: src/sys/sys/errno.h,v 1.28 2005/04/02 12:33:28 das Exp $
+ */
+
+#ifndef _SYS_ERRNO_H_
+#define _SYS_ERRNO_H_
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+int * __error(void);
+__END_DECLS
+#define errno (* __error())
+#endif
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* Input/output error */
+#define ENXIO 6 /* Device not configured */
+#define E2BIG 7 /* Argument list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file descriptor */
+#define ECHILD 10 /* No child processes */
+#define EDEADLK 11 /* Resource deadlock avoided */
+ /* 11 was EAGAIN */
+#define ENOMEM 12 /* Cannot allocate memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#ifndef _POSIX_SOURCE
+#define ENOTBLK 15 /* Block device required */
+#endif
+#define EBUSY 16 /* Device busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* Operation not supported by device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* Too many open files in system */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Inappropriate ioctl for device */
+#ifndef _POSIX_SOURCE
+#define ETXTBSY 26 /* Text file busy */
+#endif
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only filesystem */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+
+/* math software */
+#define EDOM 33 /* Numerical argument out of domain */
+#define ERANGE 34 /* Result too large */
+
+/* non-blocking and interrupt i/o */
+#define EAGAIN 35 /* Resource temporarily unavailable */
+#ifndef _POSIX_SOURCE
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define EINPROGRESS 36 /* Operation now in progress */
+#define EALREADY 37 /* Operation already in progress */
+
+/* ipc/network software -- argument errors */
+#define ENOTSOCK 38 /* Socket operation on non-socket */
+#define EDESTADDRREQ 39 /* Destination address required */
+#define EMSGSIZE 40 /* Message too long */
+#define EPROTOTYPE 41 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 42 /* Protocol not available */
+#define EPROTONOSUPPORT 43 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
+#define EOPNOTSUPP 45 /* Operation not supported */
+#define ENOTSUP EOPNOTSUPP /* Operation not supported */
+#define EPFNOSUPPORT 46 /* Protocol family not supported */
+#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
+#define EADDRINUSE 48 /* Address already in use */
+#define EADDRNOTAVAIL 49 /* Can't assign requested address */
+
+/* ipc/network software -- operational errors */
+#define ENETDOWN 50 /* Network is down */
+#define ENETUNREACH 51 /* Network is unreachable */
+#define ENETRESET 52 /* Network dropped connection on reset */
+#define ECONNABORTED 53 /* Software caused connection abort */
+#define ECONNRESET 54 /* Connection reset by peer */
+#define ENOBUFS 55 /* No buffer space available */
+#define EISCONN 56 /* Socket is already connected */
+#define ENOTCONN 57 /* Socket is not connected */
+#define ESHUTDOWN 58 /* Can't send after socket shutdown */
+#define ETOOMANYREFS 59 /* Too many references: can't splice */
+#define ETIMEDOUT 60 /* Operation timed out */
+#define ECONNREFUSED 61 /* Connection refused */
+
+#define ELOOP 62 /* Too many levels of symbolic links */
+#endif /* _POSIX_SOURCE */
+#define ENAMETOOLONG 63 /* File name too long */
+
+/* should be rearranged */
+#ifndef _POSIX_SOURCE
+#define EHOSTDOWN 64 /* Host is down */
+#define EHOSTUNREACH 65 /* No route to host */
+#endif /* _POSIX_SOURCE */
+#define ENOTEMPTY 66 /* Directory not empty */
+
+/* quotas & mush */
+#ifndef _POSIX_SOURCE
+#define EPROCLIM 67 /* Too many processes */
+#define EUSERS 68 /* Too many users */
+#define EDQUOT 69 /* Disc quota exceeded */
+
+/* Network File System */
+#define ESTALE 70 /* Stale NFS file handle */
+#define EREMOTE 71 /* Too many levels of remote in path */
+#define EBADRPC 72 /* RPC struct is bad */
+#define ERPCMISMATCH 73 /* RPC version wrong */
+#define EPROGUNAVAIL 74 /* RPC prog. not avail */
+#define EPROGMISMATCH 75 /* Program version wrong */
+#define EPROCUNAVAIL 76 /* Bad procedure for program */
+#endif /* _POSIX_SOURCE */
+
+#define ENOLCK 77 /* No locks available */
+#define ENOSYS 78 /* Function not implemented */
+
+#ifndef _POSIX_SOURCE
+#define EFTYPE 79 /* Inappropriate file type or format */
+#define EAUTH 80 /* Authentication error */
+#define ENEEDAUTH 81 /* Need authenticator */
+#define EIDRM 82 /* Identifier removed */
+#define ENOMSG 83 /* No message of desired type */
+#define EOVERFLOW 84 /* Value too large to be stored in data type */
+#define ECANCELED 85 /* Operation canceled */
+#define EILSEQ 86 /* Illegal byte sequence */
+#define ENOATTR 87 /* Attribute not found */
+
+#define EDOOFUS 88 /* Programming error */
+#endif /* _POSIX_SOURCE */
+
+#define EBADMSG 89 /* Bad message */
+#define EMULTIHOP 90 /* Multihop attempted */
+#define ENOLINK 91 /* Link has been severed */
+#define EPROTO 92 /* Protocol error */
+
+#ifndef _POSIX_SOURCE
+#define ELAST 92 /* Must be equal largest errno */
+#endif /* _POSIX_SOURCE */
+
+#ifdef _KERNEL
+/* pseudo-errors returned inside kernel to modify return to process */
+#define ERESTART (-1) /* restart syscall */
+#define EJUSTRETURN (-2) /* don't modify regs, just return */
+#define ENOIOCTL (-3) /* ioctl not handled by this layer */
+#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */
+#endif
+
+#endif
+/*-
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)errno.h 8.5 (Berkeley) 1/21/94
+ * $FreeBSD: src/sys/sys/errno.h,v 1.28 2005/04/02 12:33:28 das Exp $
+ */
+
+#ifndef _SYS_ERRNO_H_
+#define _SYS_ERRNO_H_
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+int * __error(void);
+__END_DECLS
+#define errno (* __error())
+#endif
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* Input/output error */
+#define ENXIO 6 /* Device not configured */
+#define E2BIG 7 /* Argument list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file descriptor */
+#define ECHILD 10 /* No child processes */
+#define EDEADLK 11 /* Resource deadlock avoided */
+ /* 11 was EAGAIN */
+#define ENOMEM 12 /* Cannot allocate memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#ifndef _POSIX_SOURCE
+#define ENOTBLK 15 /* Block device required */
+#endif
+#define EBUSY 16 /* Device busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* Operation not supported by device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* Too many open files in system */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Inappropriate ioctl for device */
+#ifndef _POSIX_SOURCE
+#define ETXTBSY 26 /* Text file busy */
+#endif
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only filesystem */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+
+/* math software */
+#define EDOM 33 /* Numerical argument out of domain */
+#define ERANGE 34 /* Result too large */
+
+/* non-blocking and interrupt i/o */
+#define EAGAIN 35 /* Resource temporarily unavailable */
+#ifndef _POSIX_SOURCE
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define EINPROGRESS 36 /* Operation now in progress */
+#define EALREADY 37 /* Operation already in progress */
+
+/* ipc/network software -- argument errors */
+#define ENOTSOCK 38 /* Socket operation on non-socket */
+#define EDESTADDRREQ 39 /* Destination address required */
+#define EMSGSIZE 40 /* Message too long */
+#define EPROTOTYPE 41 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 42 /* Protocol not available */
+#define EPROTONOSUPPORT 43 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
+#define EOPNOTSUPP 45 /* Operation not supported */
+#define ENOTSUP EOPNOTSUPP /* Operation not supported */
+#define EPFNOSUPPORT 46 /* Protocol family not supported */
+#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
+#define EADDRINUSE 48 /* Address already in use */
+#define EADDRNOTAVAIL 49 /* Can't assign requested address */
+
+/* ipc/network software -- operational errors */
+#define ENETDOWN 50 /* Network is down */
+#define ENETUNREACH 51 /* Network is unreachable */
+#define ENETRESET 52 /* Network dropped connection on reset */
+#define ECONNABORTED 53 /* Software caused connection abort */
+#define ECONNRESET 54 /* Connection reset by peer */
+#define ENOBUFS 55 /* No buffer space available */
+#define EISCONN 56 /* Socket is already connected */
+#define ENOTCONN 57 /* Socket is not connected */
+#define ESHUTDOWN 58 /* Can't send after socket shutdown */
+#define ETOOMANYREFS 59 /* Too many references: can't splice */
+#define ETIMEDOUT 60 /* Operation timed out */
+#define ECONNREFUSED 61 /* Connection refused */
+
+#define ELOOP 62 /* Too many levels of symbolic links */
+#endif /* _POSIX_SOURCE */
+#define ENAMETOOLONG 63 /* File name too long */
+
+/* should be rearranged */
+#ifndef _POSIX_SOURCE
+#define EHOSTDOWN 64 /* Host is down */
+#define EHOSTUNREACH 65 /* No route to host */
+#endif /* _POSIX_SOURCE */
+#define ENOTEMPTY 66 /* Directory not empty */
+
+/* quotas & mush */
+#ifndef _POSIX_SOURCE
+#define EPROCLIM 67 /* Too many processes */
+#define EUSERS 68 /* Too many users */
+#define EDQUOT 69 /* Disc quota exceeded */
+
+/* Network File System */
+#define ESTALE 70 /* Stale NFS file handle */
+#define EREMOTE 71 /* Too many levels of remote in path */
+#define EBADRPC 72 /* RPC struct is bad */
+#define ERPCMISMATCH 73 /* RPC version wrong */
+#define EPROGUNAVAIL 74 /* RPC prog. not avail */
+#define EPROGMISMATCH 75 /* Program version wrong */
+#define EPROCUNAVAIL 76 /* Bad procedure for program */
+#endif /* _POSIX_SOURCE */
+
+#define ENOLCK 77 /* No locks available */
+#define ENOSYS 78 /* Function not implemented */
+
+#ifndef _POSIX_SOURCE
+#define EFTYPE 79 /* Inappropriate file type or format */
+#define EAUTH 80 /* Authentication error */
+#define ENEEDAUTH 81 /* Need authenticator */
+#define EIDRM 82 /* Identifier removed */
+#define ENOMSG 83 /* No message of desired type */
+#define EOVERFLOW 84 /* Value too large to be stored in data type */
+#define ECANCELED 85 /* Operation canceled */
+#define EILSEQ 86 /* Illegal byte sequence */
+#define ENOATTR 87 /* Attribute not found */
+
+#define EDOOFUS 88 /* Programming error */
+#endif /* _POSIX_SOURCE */
+
+#define EBADMSG 89 /* Bad message */
+#define EMULTIHOP 90 /* Multihop attempted */
+#define ENOLINK 91 /* Link has been severed */
+#define EPROTO 92 /* Protocol error */
+
+#ifndef _POSIX_SOURCE
+#define ELAST 92 /* Must be equal largest errno */
+#endif /* _POSIX_SOURCE */
+
+#ifdef _KERNEL
+/* pseudo-errors returned inside kernel to modify return to process */
+#define ERESTART (-1) /* restart syscall */
+#define EJUSTRETURN (-2) /* don't modify regs, just return */
+#define ENOIOCTL (-3) /* ioctl not handled by this layer */
+#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */
+#endif
+
+#endif
diff --git a/doc/errno.list.linux.txt b/doc/errno.list.linux.txt
new file mode 100644
index 00000000000..baa50792d4d
--- /dev/null
+++ b/doc/errno.list.linux.txt
@@ -0,0 +1,1586 @@
+#define ICONV_SUPPORTS_ERRNO 1
+#include <errno.h>
+/* Error constants. Linux specific version.
+ Copyright (C) 1996, 1997, 1998, 1999, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef _ERRNO_H
+
+# undef EDOM
+# undef EILSEQ
+# undef ERANGE
+# include <linux/errno.h>
+
+/* Linux has no ENOTSUP error code. */
+# define ENOTSUP EOPNOTSUPP
+
+/* Older Linux versions also had no ECANCELED error code. */
+# ifndef ECANCELED
+# define ECANCELED 125
+# endif
+
+/* Support for error codes to support robust mutexes was added later, too. */
+# ifndef EOWNERDEAD
+# define EOWNERDEAD 130
+# define ENOTRECOVERABLE 131
+# endif
+
+# ifndef __ASSEMBLER__
+/* Function to get address of global `errno' variable. */
+extern int *__errno_location (void) __THROW __attribute__ ((__const__));
+
+# if !defined _LIBC || defined _LIBC_REENTRANT
+/* When using threads, errno is a per-thread value. */
+# define errno (*__errno_location ())
+# endif
+# endif /* !__ASSEMBLER__ */
+#endif /* _ERRNO_H */
+
+#if !defined _ERRNO_H && defined __need_Emath
+/* This is ugly but the kernel header is not clean enough. We must
+ define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is
+ defined. */
+# define EDOM 33 /* Math argument out of domain of function. */
+# define EILSEQ 84 /* Illegal byte sequence. */
+# define ERANGE 34 /* Math result not representable. */
+#endif /* !_ERRNO_H && __need_Emath */
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APR_ERRNO_H
+#define APR_ERRNO_H
+
+/**
+ * @file apr_errno.h
+ * @brief APR Error Codes
+ */
+
+#include "apr.h"
+
+#if APR_HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @defgroup apr_errno Error Codes
+ * @ingroup APR
+ * @{
+ */
+
+/**
+ * Type for specifying an error or status code.
+ */
+typedef int apr_status_t;
+
+/**
+ * Return a human readable string describing the specified error.
+ * @param statcode The error code the get a string for.
+ * @param buf A buffer to hold the error string.
+ * @param bufsize Size of the buffer to hold the string.
+ */
+APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf,
+ apr_size_t bufsize);
+
+#if defined(DOXYGEN)
+/**
+ * @def APR_FROM_OS_ERROR(os_err_type syserr)
+ * Fold a platform specific error into an apr_status_t code.
+ * @return apr_status_t
+ * @param e The platform os error code.
+ * @warning macro implementation; the syserr argument may be evaluated
+ * multiple times.
+ */
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+
+/**
+ * @def APR_TO_OS_ERROR(apr_status_t statcode)
+ * @return os_err_type
+ * Fold an apr_status_t code back to the native platform defined error.
+ * @param e The apr_status_t folded platform os error code.
+ * @warning macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or APR_FROM_OS_ERROR, the results are undefined.
+ */
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+/** @def apr_get_os_error()
+ * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms
+ * @remark This retrieves errno, or calls a GetLastError() style function, and
+ * folds it with APR_FROM_OS_ERROR. Some platforms (such as OS2) have no
+ * such mechanism, so this call may be unsupported. Do NOT use this
+ * call for socket errors from socket, send, recv etc!
+ */
+
+/** @def apr_set_os_error(e)
+ * Reset the last platform error, unfolded from an apr_status_t, on some platforms
+ * @param e The OS error folded in a prior call to APR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or APR_FROM_OS_ERROR, the results are undefined. This macro sets
+ * errno, or calls a SetLastError() style function, unfolding statcode
+ * with APR_TO_OS_ERROR. Some platforms (such as OS2) have no such
+ * mechanism, so this call may be unsupported.
+ */
+
+/** @def apr_get_netos_error()
+ * Return the last socket error, folded into apr_status_t, on all platforms
+ * @remark This retrieves errno or calls a GetLastSocketError() style function,
+ * and folds it with APR_FROM_OS_ERROR.
+ */
+
+/** @def apr_set_netos_error(e)
+ * Reset the last socket error, unfolded from an apr_status_t
+ * @param e The socket error folded in a prior call to APR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or APR_FROM_OS_ERROR, the results are undefined. This macro sets
+ * errno, or calls a WSASetLastError() style function, unfolding
+ * socketcode with APR_TO_OS_ERROR.
+ */
+
+#endif /* defined(DOXYGEN) */
+
+/**
+ * APR_OS_START_ERROR is where the APR specific error values start.
+ */
+#define APR_OS_START_ERROR 20000
+/**
+ * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit
+ * into one of the error/status ranges below -- except for
+ * APR_OS_START_USERERR, which see.
+ */
+#define APR_OS_ERRSPACE_SIZE 50000
+/**
+ * APR_OS_START_STATUS is where the APR specific status codes start.
+ */
+#define APR_OS_START_STATUS (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
+/**
+ * APR_OS_START_USERERR are reserved for applications that use APR that
+ * layer their own error codes along with APR's. Note that the
+ * error immediately following this one is set ten times farther
+ * away than usual, so that users of apr have a lot of room in
+ * which to declare custom error codes.
+ */
+#define APR_OS_START_USERERR (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE)
+/**
+ * APR_OS_START_USEERR is obsolete, defined for compatibility only.
+ * Use APR_OS_START_USERERR instead.
+ */
+#define APR_OS_START_USEERR APR_OS_START_USERERR
+/**
+ * APR_OS_START_CANONERR is where APR versions of errno values are defined
+ * on systems which don't have the corresponding errno.
+ */
+#define APR_OS_START_CANONERR (APR_OS_START_USERERR \
+ + (APR_OS_ERRSPACE_SIZE * 10))
+/**
+ * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
+ * apr_status_t values.
+ */
+#define APR_OS_START_EAIERR (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE)
+/**
+ * APR_OS_START_SYSERR folds platform-specific system error values into
+ * apr_status_t values.
+ */
+#define APR_OS_START_SYSERR (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE)
+
+/** no error. */
+#define APR_SUCCESS 0
+
+/**
+ * @defgroup APR_Error APR Error Values
+ * <PRE>
+ * <b>APR ERROR VALUES</b>
+ * APR_ENOSTAT APR was unable to perform a stat on the file
+ * APR_ENOPOOL APR was not provided a pool with which to allocate memory
+ * APR_EBADDATE APR was given an invalid date
+ * APR_EINVALSOCK APR was given an invalid socket
+ * APR_ENOPROC APR was not given a process structure
+ * APR_ENOTIME APR was not given a time structure
+ * APR_ENODIR APR was not given a directory structure
+ * APR_ENOLOCK APR was not given a lock structure
+ * APR_ENOPOLL APR was not given a poll structure
+ * APR_ENOSOCKET APR was not given a socket
+ * APR_ENOTHREAD APR was not given a thread structure
+ * APR_ENOTHDKEY APR was not given a thread key structure
+ * APR_ENOSHMAVAIL There is no more shared memory available
+ * APR_EDSOOPEN APR was unable to open the dso object. For more
+ * information call apr_dso_error().
+ * APR_EGENERAL General failure (specific information not available)
+ * APR_EBADIP The specified IP address is invalid
+ * APR_EBADMASK The specified netmask is invalid
+ * APR_ESYMNOTFOUND Could not find the requested symbol
+ * </PRE>
+ *
+ * <PRE>
+ * <b>APR STATUS VALUES</b>
+ * APR_INCHILD Program is currently executing in the child
+ * APR_INPARENT Program is currently executing in the parent
+ * APR_DETACH The thread is detached
+ * APR_NOTDETACH The thread is not detached
+ * APR_CHILD_DONE The child has finished executing
+ * APR_CHILD_NOTDONE The child has not finished executing
+ * APR_TIMEUP The operation did not finish before the timeout
+ * APR_INCOMPLETE The operation was incomplete although some processing
+ * was performed and the results are partially valid
+ * APR_BADCH Getopt found an option not in the option string
+ * APR_BADARG Getopt found an option that is missing an argument
+ * and an argument was specified in the option string
+ * APR_EOF APR has encountered the end of the file
+ * APR_NOTFOUND APR was unable to find the socket in the poll structure
+ * APR_ANONYMOUS APR is using anonymous shared memory
+ * APR_FILEBASED APR is using a file name as the key to the shared memory
+ * APR_KEYBASED APR is using a shared key as the key to the shared memory
+ * APR_EINIT Ininitalizer value. If no option has been found, but
+ * the status variable requires a value, this should be used
+ * APR_ENOTIMPL The APR function has not been implemented on this
+ * platform, either because nobody has gotten to it yet,
+ * or the function is impossible on this platform.
+ * APR_EMISMATCH Two passwords do not match.
+ * APR_EABSOLUTE The given path was absolute.
+ * APR_ERELATIVE The given path was relative.
+ * APR_EINCOMPLETE The given path was neither relative nor absolute.
+ * APR_EABOVEROOT The given path was above the root path.
+ * APR_EBUSY The given lock was busy.
+ * APR_EPROC_UNKNOWN The given process wasn't recognized by APR
+ * </PRE>
+ * @{
+ */
+/** @see APR_STATUS_IS_ENOSTAT */
+#define APR_ENOSTAT (APR_OS_START_ERROR + 1)
+/** @see APR_STATUS_IS_ENOPOOL */
+#define APR_ENOPOOL (APR_OS_START_ERROR + 2)
+/* empty slot: +3 */
+/** @see APR_STATUS_IS_EBADDATE */
+#define APR_EBADDATE (APR_OS_START_ERROR + 4)
+/** @see APR_STATUS_IS_EINVALSOCK */
+#define APR_EINVALSOCK (APR_OS_START_ERROR + 5)
+/** @see APR_STATUS_IS_ENOPROC */
+#define APR_ENOPROC (APR_OS_START_ERROR + 6)
+/** @see APR_STATUS_IS_ENOTIME */
+#define APR_ENOTIME (APR_OS_START_ERROR + 7)
+/** @see APR_STATUS_IS_ENODIR */
+#define APR_ENODIR (APR_OS_START_ERROR + 8)
+/** @see APR_STATUS_IS_ENOLOCK */
+#define APR_ENOLOCK (APR_OS_START_ERROR + 9)
+/** @see APR_STATUS_IS_ENOPOLL */
+#define APR_ENOPOLL (APR_OS_START_ERROR + 10)
+/** @see APR_STATUS_IS_ENOSOCKET */
+#define APR_ENOSOCKET (APR_OS_START_ERROR + 11)
+/** @see APR_STATUS_IS_ENOTHREAD */
+#define APR_ENOTHREAD (APR_OS_START_ERROR + 12)
+/** @see APR_STATUS_IS_ENOTHDKEY */
+#define APR_ENOTHDKEY (APR_OS_START_ERROR + 13)
+/** @see APR_STATUS_IS_EGENERAL */
+#define APR_EGENERAL (APR_OS_START_ERROR + 14)
+/** @see APR_STATUS_IS_ENOSHMAVAIL */
+#define APR_ENOSHMAVAIL (APR_OS_START_ERROR + 15)
+/** @see APR_STATUS_IS_EBADIP */
+#define APR_EBADIP (APR_OS_START_ERROR + 16)
+/** @see APR_STATUS_IS_EBADMASK */
+#define APR_EBADMASK (APR_OS_START_ERROR + 17)
+/* empty slot: +18 */
+/** @see APR_STATUS_IS_EDSOPEN */
+#define APR_EDSOOPEN (APR_OS_START_ERROR + 19)
+/** @see APR_STATUS_IS_EABSOLUTE */
+#define APR_EABSOLUTE (APR_OS_START_ERROR + 20)
+/** @see APR_STATUS_IS_ERELATIVE */
+#define APR_ERELATIVE (APR_OS_START_ERROR + 21)
+/** @see APR_STATUS_IS_EINCOMPLETE */
+#define APR_EINCOMPLETE (APR_OS_START_ERROR + 22)
+/** @see APR_STATUS_IS_EABOVEROOT */
+#define APR_EABOVEROOT (APR_OS_START_ERROR + 23)
+/** @see APR_STATUS_IS_EBADPATH */
+#define APR_EBADPATH (APR_OS_START_ERROR + 24)
+/** @see APR_STATUS_IS_EPATHWILD */
+#define APR_EPATHWILD (APR_OS_START_ERROR + 25)
+/** @see APR_STATUS_IS_ESYMNOTFOUND */
+#define APR_ESYMNOTFOUND (APR_OS_START_ERROR + 26)
+/** @see APR_STATUS_IS_EPROC_UNKNOWN */
+#define APR_EPROC_UNKNOWN (APR_OS_START_ERROR + 27)
+/** @see APR_STATUS_IS_ENOTENOUGHENTROPY */
+#define APR_ENOTENOUGHENTROPY (APR_OS_START_ERROR + 28)
+/** @} */
+
+/**
+ * @defgroup APR_STATUS_IS Status Value Tests
+ * @warning For any particular error condition, more than one of these tests
+ * may match. This is because platform-specific error codes may not
+ * always match the semantics of the POSIX codes these tests (and the
+ * corresponding APR error codes) are named after. A notable example
+ * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
+ * Win32 platforms. The programmer should always be aware of this and
+ * adjust the order of the tests accordingly.
+ * @{
+ */
+/**
+ * APR was unable to perform a stat on the file
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_ENOSTAT(s) ((s) == APR_ENOSTAT)
+/**
+ * APR was not provided a pool with which to allocate memory
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_ENOPOOL(s) ((s) == APR_ENOPOOL)
+/** APR was given an invalid date */
+#define APR_STATUS_IS_EBADDATE(s) ((s) == APR_EBADDATE)
+/** APR was given an invalid socket */
+#define APR_STATUS_IS_EINVALSOCK(s) ((s) == APR_EINVALSOCK)
+/** APR was not given a process structure */
+#define APR_STATUS_IS_ENOPROC(s) ((s) == APR_ENOPROC)
+/** APR was not given a time structure */
+#define APR_STATUS_IS_ENOTIME(s) ((s) == APR_ENOTIME)
+/** APR was not given a directory structure */
+#define APR_STATUS_IS_ENODIR(s) ((s) == APR_ENODIR)
+/** APR was not given a lock structure */
+#define APR_STATUS_IS_ENOLOCK(s) ((s) == APR_ENOLOCK)
+/** APR was not given a poll structure */
+#define APR_STATUS_IS_ENOPOLL(s) ((s) == APR_ENOPOLL)
+/** APR was not given a socket */
+#define APR_STATUS_IS_ENOSOCKET(s) ((s) == APR_ENOSOCKET)
+/** APR was not given a thread structure */
+#define APR_STATUS_IS_ENOTHREAD(s) ((s) == APR_ENOTHREAD)
+/** APR was not given a thread key structure */
+#define APR_STATUS_IS_ENOTHDKEY(s) ((s) == APR_ENOTHDKEY)
+/** Generic Error which can not be put into another spot */
+#define APR_STATUS_IS_EGENERAL(s) ((s) == APR_EGENERAL)
+/** There is no more shared memory available */
+#define APR_STATUS_IS_ENOSHMAVAIL(s) ((s) == APR_ENOSHMAVAIL)
+/** The specified IP address is invalid */
+#define APR_STATUS_IS_EBADIP(s) ((s) == APR_EBADIP)
+/** The specified netmask is invalid */
+#define APR_STATUS_IS_EBADMASK(s) ((s) == APR_EBADMASK)
+/* empty slot: +18 */
+/**
+ * APR was unable to open the dso object.
+ * For more information call apr_dso_error().
+ */
+#if defined(WIN32)
+#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN \
+ || APR_TO_OS_ERROR(s) == ERROR_MOD_NOT_FOUND)
+#else
+#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN)
+#endif
+/** The given path was absolute. */
+#define APR_STATUS_IS_EABSOLUTE(s) ((s) == APR_EABSOLUTE)
+/** The given path was relative. */
+#define APR_STATUS_IS_ERELATIVE(s) ((s) == APR_ERELATIVE)
+/** The given path was neither relative nor absolute. */
+#define APR_STATUS_IS_EINCOMPLETE(s) ((s) == APR_EINCOMPLETE)
+/** The given path was above the root path. */
+#define APR_STATUS_IS_EABOVEROOT(s) ((s) == APR_EABOVEROOT)
+/** The given path was bad. */
+#define APR_STATUS_IS_EBADPATH(s) ((s) == APR_EBADPATH)
+/** The given path contained wildcards. */
+#define APR_STATUS_IS_EPATHWILD(s) ((s) == APR_EPATHWILD)
+/** Could not find the requested symbol.
+ * For more information call apr_dso_error().
+ */
+#if defined(WIN32)
+#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND \
+ || APR_TO_OS_ERROR(s) == ERROR_PROC_NOT_FOUND)
+#else
+#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND)
+#endif
+/** The given process was not recognized by APR. */
+#define APR_STATUS_IS_EPROC_UNKNOWN(s) ((s) == APR_EPROC_UNKNOWN)
+
+/** APR could not gather enough entropy to continue. */
+#define APR_STATUS_IS_ENOTENOUGHENTROPY(s) ((s) == APR_ENOTENOUGHENTROPY)
+
+/** @} */
+
+/**
+ * @addtogroup APR_Error
+ * @{
+ */
+/** @see APR_STATUS_IS_INCHILD */
+#define APR_INCHILD (APR_OS_START_STATUS + 1)
+/** @see APR_STATUS_IS_INPARENT */
+#define APR_INPARENT (APR_OS_START_STATUS + 2)
+/** @see APR_STATUS_IS_DETACH */
+#define APR_DETACH (APR_OS_START_STATUS + 3)
+/** @see APR_STATUS_IS_NOTDETACH */
+#define APR_NOTDETACH (APR_OS_START_STATUS + 4)
+/** @see APR_STATUS_IS_CHILD_DONE */
+#define APR_CHILD_DONE (APR_OS_START_STATUS + 5)
+/** @see APR_STATUS_IS_CHILD_NOTDONE */
+#define APR_CHILD_NOTDONE (APR_OS_START_STATUS + 6)
+/** @see APR_STATUS_IS_TIMEUP */
+#define APR_TIMEUP (APR_OS_START_STATUS + 7)
+/** @see APR_STATUS_IS_INCOMPLETE */
+#define APR_INCOMPLETE (APR_OS_START_STATUS + 8)
+/* empty slot: +9 */
+/* empty slot: +10 */
+/* empty slot: +11 */
+/** @see APR_STATUS_IS_BADCH */
+#define APR_BADCH (APR_OS_START_STATUS + 12)
+/** @see APR_STATUS_IS_BADARG */
+#define APR_BADARG (APR_OS_START_STATUS + 13)
+/** @see APR_STATUS_IS_EOF */
+#define APR_EOF (APR_OS_START_STATUS + 14)
+/** @see APR_STATUS_IS_NOTFOUND */
+#define APR_NOTFOUND (APR_OS_START_STATUS + 15)
+/* empty slot: +16 */
+/* empty slot: +17 */
+/* empty slot: +18 */
+/** @see APR_STATUS_IS_ANONYMOUS */
+#define APR_ANONYMOUS (APR_OS_START_STATUS + 19)
+/** @see APR_STATUS_IS_FILEBASED */
+#define APR_FILEBASED (APR_OS_START_STATUS + 20)
+/** @see APR_STATUS_IS_KEYBASED */
+#define APR_KEYBASED (APR_OS_START_STATUS + 21)
+/** @see APR_STATUS_IS_EINIT */
+#define APR_EINIT (APR_OS_START_STATUS + 22)
+/** @see APR_STATUS_IS_ENOTIMPL */
+#define APR_ENOTIMPL (APR_OS_START_STATUS + 23)
+/** @see APR_STATUS_IS_EMISMATCH */
+#define APR_EMISMATCH (APR_OS_START_STATUS + 24)
+/** @see APR_STATUS_IS_EBUSY */
+#define APR_EBUSY (APR_OS_START_STATUS + 25)
+/** @} */
+
+/**
+ * @addtogroup APR_STATUS_IS
+ * @{
+ */
+/**
+ * Program is currently executing in the child
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code */
+#define APR_STATUS_IS_INCHILD(s) ((s) == APR_INCHILD)
+/**
+ * Program is currently executing in the parent
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_INPARENT(s) ((s) == APR_INPARENT)
+/**
+ * The thread is detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_DETACH(s) ((s) == APR_DETACH)
+/**
+ * The thread is not detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_NOTDETACH(s) ((s) == APR_NOTDETACH)
+/**
+ * The child has finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_CHILD_DONE(s) ((s) == APR_CHILD_DONE)
+/**
+ * The child has not finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_CHILD_NOTDONE(s) ((s) == APR_CHILD_NOTDONE)
+/**
+ * The operation did not finish before the timeout
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP)
+/**
+ * The operation was incomplete although some processing was performed
+ * and the results are partially valid.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_INCOMPLETE(s) ((s) == APR_INCOMPLETE)
+/* empty slot: +9 */
+/* empty slot: +10 */
+/* empty slot: +11 */
+/**
+ * Getopt found an option not in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_BADCH(s) ((s) == APR_BADCH)
+/**
+ * Getopt found an option not in the option string and an argument was
+ * specified in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_BADARG(s) ((s) == APR_BADARG)
+/**
+ * APR has encountered the end of the file
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_EOF(s) ((s) == APR_EOF)
+/**
+ * APR was unable to find the socket in the poll structure
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_NOTFOUND(s) ((s) == APR_NOTFOUND)
+/* empty slot: +16 */
+/* empty slot: +17 */
+/* empty slot: +18 */
+/**
+ * APR is using anonymous shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_ANONYMOUS(s) ((s) == APR_ANONYMOUS)
+/**
+ * APR is using a file name as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_FILEBASED(s) ((s) == APR_FILEBASED)
+/**
+ * APR is using a shared key as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_KEYBASED(s) ((s) == APR_KEYBASED)
+/**
+ * Ininitalizer value. If no option has been found, but
+ * the status variable requires a value, this should be used
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_EINIT(s) ((s) == APR_EINIT)
+/**
+ * The APR function has not been implemented on this
+ * platform, either because nobody has gotten to it yet,
+ * or the function is impossible on this platform.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_ENOTIMPL(s) ((s) == APR_ENOTIMPL)
+/**
+ * Two passwords do not match.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_EMISMATCH(s) ((s) == APR_EMISMATCH)
+/**
+ * The given lock was busy
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_EBUSY(s) ((s) == APR_EBUSY)
+
+/** @} */
+
+/**
+ * @addtogroup APR_Error APR Error Values
+ * @{
+ */
+/* APR CANONICAL ERROR VALUES */
+/** @see APR_STATUS_IS_EACCES */
+#ifdef EACCES
+#define APR_EACCES EACCES
+#else
+#define APR_EACCES (APR_OS_START_CANONERR + 1)
+#endif
+
+/** @see APR_STATUS_IS_EXIST */
+#ifdef EEXIST
+#define APR_EEXIST EEXIST
+#else
+#define APR_EEXIST (APR_OS_START_CANONERR + 2)
+#endif
+
+/** @see APR_STATUS_IS_ENAMETOOLONG */
+#ifdef ENAMETOOLONG
+#define APR_ENAMETOOLONG ENAMETOOLONG
+#else
+#define APR_ENAMETOOLONG (APR_OS_START_CANONERR + 3)
+#endif
+
+/** @see APR_STATUS_IS_ENOENT */
+#ifdef ENOENT
+#define APR_ENOENT ENOENT
+#else
+#define APR_ENOENT (APR_OS_START_CANONERR + 4)
+#endif
+
+/** @see APR_STATUS_IS_ENOTDIR */
+#ifdef ENOTDIR
+#define APR_ENOTDIR ENOTDIR
+#else
+#define APR_ENOTDIR (APR_OS_START_CANONERR + 5)
+#endif
+
+/** @see APR_STATUS_IS_ENOSPC */
+#ifdef ENOSPC
+#define APR_ENOSPC ENOSPC
+#else
+#define APR_ENOSPC (APR_OS_START_CANONERR + 6)
+#endif
+
+/** @see APR_STATUS_IS_ENOMEM */
+#ifdef ENOMEM
+#define APR_ENOMEM ENOMEM
+#else
+#define APR_ENOMEM (APR_OS_START_CANONERR + 7)
+#endif
+
+/** @see APR_STATUS_IS_EMFILE */
+#ifdef EMFILE
+#define APR_EMFILE EMFILE
+#else
+#define APR_EMFILE (APR_OS_START_CANONERR + 8)
+#endif
+
+/** @see APR_STATUS_IS_ENFILE */
+#ifdef ENFILE
+#define APR_ENFILE ENFILE
+#else
+#define APR_ENFILE (APR_OS_START_CANONERR + 9)
+#endif
+
+/** @see APR_STATUS_IS_EBADF */
+#ifdef EBADF
+#define APR_EBADF EBADF
+#else
+#define APR_EBADF (APR_OS_START_CANONERR + 10)
+#endif
+
+/** @see APR_STATUS_IS_EINVAL */
+#ifdef EINVAL
+#define APR_EINVAL EINVAL
+#else
+#define APR_EINVAL (APR_OS_START_CANONERR + 11)
+#endif
+
+/** @see APR_STATUS_IS_ESPIPE */
+#ifdef ESPIPE
+#define APR_ESPIPE ESPIPE
+#else
+#define APR_ESPIPE (APR_OS_START_CANONERR + 12)
+#endif
+
+/**
+ * @see APR_STATUS_IS_EAGAIN
+ * @warning use APR_STATUS_IS_EAGAIN instead of just testing this value
+ */
+#ifdef EAGAIN
+#define APR_EAGAIN EAGAIN
+#elif defined(EWOULDBLOCK)
+#define APR_EAGAIN EWOULDBLOCK
+#else
+#define APR_EAGAIN (APR_OS_START_CANONERR + 13)
+#endif
+
+/** @see APR_STATUS_IS_EINTR */
+#ifdef EINTR
+#define APR_EINTR EINTR
+#else
+#define APR_EINTR (APR_OS_START_CANONERR + 14)
+#endif
+
+/** @see APR_STATUS_IS_ENOTSOCK */
+#ifdef ENOTSOCK
+#define APR_ENOTSOCK ENOTSOCK
+#else
+#define APR_ENOTSOCK (APR_OS_START_CANONERR + 15)
+#endif
+
+/** @see APR_STATUS_IS_ECONNREFUSED */
+#ifdef ECONNREFUSED
+#define APR_ECONNREFUSED ECONNREFUSED
+#else
+#define APR_ECONNREFUSED (APR_OS_START_CANONERR + 16)
+#endif
+
+/** @see APR_STATUS_IS_EINPROGRESS */
+#ifdef EINPROGRESS
+#define APR_EINPROGRESS EINPROGRESS
+#else
+#define APR_EINPROGRESS (APR_OS_START_CANONERR + 17)
+#endif
+
+/**
+ * @see APR_STATUS_IS_ECONNABORTED
+ * @warning use APR_STATUS_IS_ECONNABORTED instead of just testing this value
+ */
+
+#ifdef ECONNABORTED
+#define APR_ECONNABORTED ECONNABORTED
+#else
+#define APR_ECONNABORTED (APR_OS_START_CANONERR + 18)
+#endif
+
+/** @see APR_STATUS_IS_ECONNRESET */
+#ifdef ECONNRESET
+#define APR_ECONNRESET ECONNRESET
+#else
+#define APR_ECONNRESET (APR_OS_START_CANONERR + 19)
+#endif
+
+/** @see APR_STATUS_IS_ETIMEDOUT
+ * @deprecated */
+#ifdef ETIMEDOUT
+#define APR_ETIMEDOUT ETIMEDOUT
+#else
+#define APR_ETIMEDOUT (APR_OS_START_CANONERR + 20)
+#endif
+
+/** @see APR_STATUS_IS_EHOSTUNREACH */
+#ifdef EHOSTUNREACH
+#define APR_EHOSTUNREACH EHOSTUNREACH
+#else
+#define APR_EHOSTUNREACH (APR_OS_START_CANONERR + 21)
+#endif
+
+/** @see APR_STATUS_IS_ENETUNREACH */
+#ifdef ENETUNREACH
+#define APR_ENETUNREACH ENETUNREACH
+#else
+#define APR_ENETUNREACH (APR_OS_START_CANONERR + 22)
+#endif
+
+/** @see APR_STATUS_IS_EFTYPE */
+#ifdef EFTYPE
+#define APR_EFTYPE EFTYPE
+#else
+#define APR_EFTYPE (APR_OS_START_CANONERR + 23)
+#endif
+
+/** @see APR_STATUS_IS_EPIPE */
+#ifdef EPIPE
+#define APR_EPIPE EPIPE
+#else
+#define APR_EPIPE (APR_OS_START_CANONERR + 24)
+#endif
+
+/** @see APR_STATUS_IS_EXDEV */
+#ifdef EXDEV
+#define APR_EXDEV EXDEV
+#else
+#define APR_EXDEV (APR_OS_START_CANONERR + 25)
+#endif
+
+/** @see APR_STATUS_IS_ENOTEMPTY */
+#ifdef ENOTEMPTY
+#define APR_ENOTEMPTY ENOTEMPTY
+#else
+#define APR_ENOTEMPTY (APR_OS_START_CANONERR + 26)
+#endif
+
+/** @} */
+
+#if defined(OS2) && !defined(DOXYGEN)
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define INCL_DOSERRORS
+#define INCL_DOS
+
+/* Leave these undefined.
+ * OS2 doesn't rely on the errno concept.
+ * The API calls always return a result codes which
+ * should be filtered through APR_FROM_OS_ERROR().
+ *
+ * #define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError()))
+ * #define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))
+ */
+
+/* A special case, only socket calls require this;
+ */
+#define apr_get_netos_error() (APR_FROM_OS_ERROR(errno))
+#define apr_set_netos_error(e) (errno = APR_TO_OS_ERROR(e))
+
+/* And this needs to be greped away for good:
+ */
+#define APR_OS2_STATUS(e) (APR_FROM_OS_ERROR(e))
+
+/* These can't sit in a private header, so in spite of the extra size,
+ * they need to be made available here.
+ */
+#define SOCBASEERR 10000
+#define SOCEPERM (SOCBASEERR+1) /* Not owner */
+#define SOCESRCH (SOCBASEERR+3) /* No such process */
+#define SOCEINTR (SOCBASEERR+4) /* Interrupted system call */
+#define SOCENXIO (SOCBASEERR+6) /* No such device or address */
+#define SOCEBADF (SOCBASEERR+9) /* Bad file number */
+#define SOCEACCES (SOCBASEERR+13) /* Permission denied */
+#define SOCEFAULT (SOCBASEERR+14) /* Bad address */
+#define SOCEINVAL (SOCBASEERR+22) /* Invalid argument */
+#define SOCEMFILE (SOCBASEERR+24) /* Too many open files */
+#define SOCEPIPE (SOCBASEERR+32) /* Broken pipe */
+#define SOCEOS2ERR (SOCBASEERR+100) /* OS/2 Error */
+#define SOCEWOULDBLOCK (SOCBASEERR+35) /* Operation would block */
+#define SOCEINPROGRESS (SOCBASEERR+36) /* Operation now in progress */
+#define SOCEALREADY (SOCBASEERR+37) /* Operation already in progress */
+#define SOCENOTSOCK (SOCBASEERR+38) /* Socket operation on non-socket */
+#define SOCEDESTADDRREQ (SOCBASEERR+39) /* Destination address required */
+#define SOCEMSGSIZE (SOCBASEERR+40) /* Message too long */
+#define SOCEPROTOTYPE (SOCBASEERR+41) /* Protocol wrong type for socket */
+#define SOCENOPROTOOPT (SOCBASEERR+42) /* Protocol not available */
+#define SOCEPROTONOSUPPORT (SOCBASEERR+43) /* Protocol not supported */
+#define SOCESOCKTNOSUPPORT (SOCBASEERR+44) /* Socket type not supported */
+#define SOCEOPNOTSUPP (SOCBASEERR+45) /* Operation not supported on socket */
+#define SOCEPFNOSUPPORT (SOCBASEERR+46) /* Protocol family not supported */
+#define SOCEAFNOSUPPORT (SOCBASEERR+47) /* Address family not supported by protocol family */
+#define SOCEADDRINUSE (SOCBASEERR+48) /* Address already in use */
+#define SOCEADDRNOTAVAIL (SOCBASEERR+49) /* Can't assign requested address */
+#define SOCENETDOWN (SOCBASEERR+50) /* Network is down */
+#define SOCENETUNREACH (SOCBASEERR+51) /* Network is unreachable */
+#define SOCENETRESET (SOCBASEERR+52) /* Network dropped connection on reset */
+#define SOCECONNABORTED (SOCBASEERR+53) /* Software caused connection abort */
+#define SOCECONNRESET (SOCBASEERR+54) /* Connection reset by peer */
+#define SOCENOBUFS (SOCBASEERR+55) /* No buffer space available */
+#define SOCEISCONN (SOCBASEERR+56) /* Socket is already connected */
+#define SOCENOTCONN (SOCBASEERR+57) /* Socket is not connected */
+#define SOCESHUTDOWN (SOCBASEERR+58) /* Can't send after socket shutdown */
+#define SOCETOOMANYREFS (SOCBASEERR+59) /* Too many references: can't splice */
+#define SOCETIMEDOUT (SOCBASEERR+60) /* Connection timed out */
+#define SOCECONNREFUSED (SOCBASEERR+61) /* Connection refused */
+#define SOCELOOP (SOCBASEERR+62) /* Too many levels of symbolic links */
+#define SOCENAMETOOLONG (SOCBASEERR+63) /* File name too long */
+#define SOCEHOSTDOWN (SOCBASEERR+64) /* Host is down */
+#define SOCEHOSTUNREACH (SOCBASEERR+65) /* No route to host */
+#define SOCENOTEMPTY (SOCBASEERR+66) /* Directory not empty */
+
+/* APR CANONICAL ERROR TESTS */
+#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
+ || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \
+ || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
+ || (s) == APR_OS_START_SYSERR + SOCENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES \
+ || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED)
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
+ || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \
+ || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE)
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION)
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
+ || (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION)
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
+ || (s) == APR_OS_START_SYSERR + SOCEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
+ || (s) == APR_OS_START_SYSERR + SOCENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
+ || (s) == APR_OS_START_SYSERR + SOCECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
+ || (s) == APR_OS_START_SYSERR + SOCEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == APR_OS_START_SYSERR + SOCECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
+ || (s) == APR_OS_START_SYSERR + SOCECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
+ || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
+ || (s) == APR_OS_START_SYSERR + SOCEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
+ || (s) == APR_OS_START_SYSERR + SOCENETUNREACH)
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE \
+ || (s) == APR_OS_START_SYSERR + SOCEPIPE)
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \
+ || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
+
+/*
+ Sorry, too tired to wrap this up for OS2... feel free to
+ fit the following into their best matches.
+
+ { ERROR_NO_SIGNAL_SENT, ESRCH },
+ { SOCEALREADY, EALREADY },
+ { SOCEDESTADDRREQ, EDESTADDRREQ },
+ { SOCEMSGSIZE, EMSGSIZE },
+ { SOCEPROTOTYPE, EPROTOTYPE },
+ { SOCENOPROTOOPT, ENOPROTOOPT },
+ { SOCEPROTONOSUPPORT, EPROTONOSUPPORT },
+ { SOCESOCKTNOSUPPORT, ESOCKTNOSUPPORT },
+ { SOCEOPNOTSUPP, EOPNOTSUPP },
+ { SOCEPFNOSUPPORT, EPFNOSUPPORT },
+ { SOCEAFNOSUPPORT, EAFNOSUPPORT },
+ { SOCEADDRINUSE, EADDRINUSE },
+ { SOCEADDRNOTAVAIL, EADDRNOTAVAIL },
+ { SOCENETDOWN, ENETDOWN },
+ { SOCENETRESET, ENETRESET },
+ { SOCENOBUFS, ENOBUFS },
+ { SOCEISCONN, EISCONN },
+ { SOCENOTCONN, ENOTCONN },
+ { SOCESHUTDOWN, ESHUTDOWN },
+ { SOCETOOMANYREFS, ETOOMANYREFS },
+ { SOCELOOP, ELOOP },
+ { SOCEHOSTDOWN, EHOSTDOWN },
+ { SOCENOTEMPTY, ENOTEMPTY },
+ { SOCEPIPE, EPIPE }
+*/
+
+#elif defined(WIN32) && !defined(DOXYGEN) /* !defined(OS2) */
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError()))
+#define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))
+
+/* A special case, only socket calls require this:
+ */
+#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError()))
+#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e)))
+
+/* APR CANONICAL ERROR TESTS */
+#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
+ || (s) == APR_OS_START_SYSERR + ERROR_CANNOT_MAKE \
+ || (s) == APR_OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \
+ || (s) == APR_OS_START_SYSERR + ERROR_DRIVE_LOCKED \
+ || (s) == APR_OS_START_SYSERR + ERROR_FAIL_I24 \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_FAILED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_LOCKED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \
+ || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS)
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
+ || (s) == APR_OS_START_SYSERR + WSAENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES)
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR \
+ || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_NETPATH \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_NET_NAME \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_PATHNAME \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DRIVE)
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
+ || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM \
+ || (s) == APR_OS_START_SYSERR + ERROR_ARENA_TRASHED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_MEMORY \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_BLOCK \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_QUOTA \
+ || (s) == APR_OS_START_SYSERR + ERROR_OUTOFMEMORY)
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \
+ || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_TARGET_HANDLE)
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_ACCESS \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DATA \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
+ || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_SEEK_ON_DEVICE \
+ || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_PROC_SLOTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_NESTING_NOT_ALLOWED \
+ || (s) == APR_OS_START_SYSERR + ERROR_MAX_THRDS_REACHED \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+ || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
+ || (s) == APR_OS_START_SYSERR + WSAEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
+ || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
+ || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
+ || (s) == APR_OS_START_SYSERR + ERROR_NETNAME_DELETED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_EXE_MACHINE_TYPE_MISMATCH \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DLL \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_MODULETYPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_EXE_FORMAT \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_EXE_SIGNATURE \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_CORRUPT \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_FORMAT)
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE)
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \
+ || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY)
+
+#elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define apr_get_os_error() (errno)
+#define apr_set_os_error(e) (errno = (e))
+
+/* A special case, only socket calls require this: */
+#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError()))
+#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e)))
+
+/* APR CANONICAL ERROR TESTS */
+#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES)
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST)
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT)
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC)
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE)
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF)
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL)
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE)
+
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == EWOULDBLOCK \
+ || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
+ || (s) == APR_OS_START_SYSERR + WSAEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
+ || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
+ || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
+ || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
+#define APR_STATUS_IS_ENETDOWN(s) ((s) == APR_OS_START_SYSERR + WSAENETDOWN)
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE)
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV)
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY)
+
+#else /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
+
+/*
+ * os error codes are clib error codes
+ */
+#define APR_FROM_OS_ERROR(e) (e)
+#define APR_TO_OS_ERROR(e) (e)
+
+#define apr_get_os_error() (errno)
+#define apr_set_os_error(e) (errno = (e))
+
+/* A special case, only socket calls require this:
+ */
+#define apr_get_netos_error() (errno)
+#define apr_set_netos_error(e) (errno = (e))
+
+/**
+ * @addtogroup APR_STATUS_IS
+ * @{
+ */
+
+/** permission denied */
+#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES)
+/** file exists */
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST)
+/** path name is too long */
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG)
+/**
+ * no such file or directory
+ * @remark
+ * EMVSCATLG can be returned by the automounter on z/OS for
+ * paths which do not exist.
+ */
+#ifdef EMVSCATLG
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
+ || (s) == EMVSCATLG)
+#else
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT)
+#endif
+/** not a directory */
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
+/** no space left on device */
+#ifdef EDQUOT
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
+ || (s) == EDQUOT)
+#else
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC)
+#endif
+/** not enough memory */
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
+/** too many open files */
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE)
+/** file table overflow */
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+/** bad file # */
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF)
+/** invalid argument */
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL)
+/** illegal seek */
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE)
+
+/** operation would block */
+#if !defined(EWOULDBLOCK) || !defined(EAGAIN)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN)
+#elif (EWOULDBLOCK == EAGAIN)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN)
+#else
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == EWOULDBLOCK)
+#endif
+
+/** interrupted system call */
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR)
+/** socket operation on a non-socket */
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK)
+/** Connection Refused */
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED)
+/** operation now in progress */
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS)
+
+/**
+ * Software caused connection abort
+ * @remark
+ * EPROTO on certain older kernels really means ECONNABORTED, so we need to
+ * ignore it for them. See discussion in new-httpd archives nh.9701 & nh.9603
+ *
+ * There is potentially a bug in Solaris 2.x x<6, and other boxes that
+ * implement tcp sockets in userland (i.e. on top of STREAMS). On these
+ * systems, EPROTO can actually result in a fatal loop. See PR#981 for
+ * example. It's hard to handle both uses of EPROTO.
+ */
+#ifdef EPROTO
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == EPROTO)
+#else
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED)
+#endif
+
+/** Connection Reset by peer */
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET)
+/** Operation timed out
+ * @deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT)
+/** no route to host */
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH)
+/** network is unreachable */
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH)
+/** inappropiate file type or format */
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
+/** broken pipe */
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE)
+/** cross device link */
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV)
+/** Directory Not Empty */
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY || \
+ (s) == APR_EEXIST)
+/** @} */
+
+#endif /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! APR_ERRNO_H */
+#ifndef _LINUX_ERRNO_H
+#define _LINUX_ERRNO_H
+
+#include <asm/errno.h>
+
+#ifdef __KERNEL__
+
+/* Should never be seen by user programs */
+#define ERESTARTSYS 512
+#define ERESTARTNOINTR 513
+#define ERESTARTNOHAND 514 /* restart if no handler.. */
+#define ENOIOCTLCMD 515 /* No ioctl command */
+#define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */
+
+/* Defined for the NFSv3 protocol */
+#define EBADHANDLE 521 /* Illegal NFS file handle */
+#define ENOTSYNC 522 /* Update synchronization mismatch */
+#define EBADCOOKIE 523 /* Cookie is stale */
+#define ENOTSUPP 524 /* Operation is not supported */
+#define ETOOSMALL 525 /* Buffer or request is too small */
+#define ESERVERFAULT 526 /* An untranslatable error occurred */
+#define EBADTYPE 527 /* Type not supported by server */
+#define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */
+#define EIOCBQUEUED 529 /* iocb queued, will get completion event */
+#define EIOCBRETRY 530 /* iocb queued, will trigger a retry */
+
+#endif
+
+#endif
+// Copyright (c) 1994 James Clark
+// See the file COPYING for copying permission.
+
+#ifndef ErrnoMessageArg_INCLUDED
+#define ErrnoMessageArg_INCLUDED 1
+
+#include "MessageArg.h"
+#include "rtti.h"
+
+#ifdef SP_NAMESPACE
+namespace SP_NAMESPACE {
+#endif
+
+class SP_API ErrnoMessageArg : public OtherMessageArg {
+ RTTI_CLASS
+public:
+ ErrnoMessageArg(int errnum) : errno_(errnum) { }
+ MessageArg *copy() const;
+ // errno might be a macro so we must use a different name
+ int errnum() const;
+private:
+ int errno_;
+};
+
+inline
+int ErrnoMessageArg::errnum() const
+{
+ return errno_;
+}
+
+#ifdef SP_NAMESPACE
+}
+#endif
+
+#endif /* not ErrnoMessageArg_INCLUDED */
+/* Copyright (C) 1991,92,93,94,95,96,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * ISO C99 Standard: 7.5 Errors <errno.h>
+ */
+
+#ifndef _ERRNO_H
+
+/* The includer defined __need_Emath if he wants only the definitions
+ of EDOM and ERANGE, and not everything else. */
+#ifndef __need_Emath
+# define _ERRNO_H 1
+# include <features.h>
+#endif
+
+__BEGIN_DECLS
+
+/* Get the error number constants from the system-specific file.
+ This file will test __need_Emath and _ERRNO_H. */
+#include <bits/errno.h>
+#undef __need_Emath
+
+#ifdef _ERRNO_H
+
+/* Declare the `errno' variable, unless it's defined as a macro by
+ bits/errno.h. This is the case in GNU, where it is a per-thread
+ variable. This redeclaration using the macro still works, but it
+ will be a function declaration without a prototype and may trigger
+ a -Wstrict-prototypes warning. */
+#ifndef errno
+extern int errno;
+#endif
+
+#ifdef __USE_GNU
+
+/* The full and simple forms of the name with which the program was
+ invoked. These variables are set up automatically at startup based on
+ the value of ARGV[0] (this works only if you use GNU ld). */
+extern char *program_invocation_name, *program_invocation_short_name;
+#endif /* __USE_GNU */
+#endif /* _ERRNO_H */
+
+__END_DECLS
+
+#endif /* _ERRNO_H */
+
+/* The Hurd <bits/errno.h> defines `error_t' as an enumerated type so
+ that printing `error_t' values in the debugger shows the names. We
+ might need this definition sometimes even if this file was included
+ before. */
+#if defined __USE_GNU || defined __need_error_t
+# ifndef __error_t_defined
+typedef int error_t;
+# define __error_t_defined 1
+# endif
+# undef __need_error_t
+#endif
+#ifndef _I386_ERRNO_H
+#define _I386_ERRNO_H
+
+#include <asm-generic/errno.h>
+
+#endif
+#ifndef _ASM_GENERIC_ERRNO_BASE_H
+#define _ASM_GENERIC_ERRNO_BASE_H
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Argument list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+
+#endif
+#ifndef _ASM_GENERIC_ERRNO_H
+#define _ASM_GENERIC_ERRNO_H
+
+#include <asm-generic/errno-base.h>
+
+#define EDEADLK 35 /* Resource deadlock would occur */
+#define ENAMETOOLONG 36 /* File name too long */
+#define ENOLCK 37 /* No record locks available */
+#define ENOSYS 38 /* Function not implemented */
+#define ENOTEMPTY 39 /* Directory not empty */
+#define ELOOP 40 /* Too many symbolic links encountered */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define ENOMSG 42 /* No message of desired type */
+#define EIDRM 43 /* Identifier removed */
+#define ECHRNG 44 /* Channel number out of range */
+#define EL2NSYNC 45 /* Level 2 not synchronized */
+#define EL3HLT 46 /* Level 3 halted */
+#define EL3RST 47 /* Level 3 reset */
+#define ELNRNG 48 /* Link number out of range */
+#define EUNATCH 49 /* Protocol driver not attached */
+#define ENOCSI 50 /* No CSI structure available */
+#define EL2HLT 51 /* Level 2 halted */
+#define EBADE 52 /* Invalid exchange */
+#define EBADR 53 /* Invalid request descriptor */
+#define EXFULL 54 /* Exchange full */
+#define ENOANO 55 /* No anode */
+#define EBADRQC 56 /* Invalid request code */
+#define EBADSLT 57 /* Invalid slot */
+
+#define EDEADLOCK EDEADLK
+
+#define EBFONT 59 /* Bad font file format */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data available */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* Object is remote */
+#define ENOLINK 67 /* Link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EMULTIHOP 72 /* Multihop attempted */
+#define EDOTDOT 73 /* RFS specific error */
+#define EBADMSG 74 /* Not a data message */
+#define EOVERFLOW 75 /* Value too large for defined data type */
+#define ENOTUNIQ 76 /* Name not unique on network */
+#define EBADFD 77 /* File descriptor in bad state */
+#define EREMCHG 78 /* Remote address changed */
+#define ELIBACC 79 /* Can not access a needed shared library */
+#define ELIBBAD 80 /* Accessing a corrupted shared library */
+#define ELIBSCN 81 /* .lib section in a.out corrupted */
+#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 83 /* Cannot exec a shared library directly */
+#define EILSEQ 84 /* Illegal byte sequence */
+#define ERESTART 85 /* Interrupted system call should be restarted */
+#define ESTRPIPE 86 /* Streams pipe error */
+#define EUSERS 87 /* Too many users */
+#define ENOTSOCK 88 /* Socket operation on non-socket */
+#define EDESTADDRREQ 89 /* Destination address required */
+#define EMSGSIZE 90 /* Message too long */
+#define EPROTOTYPE 91 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 92 /* Protocol not available */
+#define EPROTONOSUPPORT 93 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
+#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
+#define EADDRINUSE 98 /* Address already in use */
+#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
+#define ENETDOWN 100 /* Network is down */
+#define ENETUNREACH 101 /* Network is unreachable */
+#define ENETRESET 102 /* Network dropped connection because of reset */
+#define ECONNABORTED 103 /* Software caused connection abort */
+#define ECONNRESET 104 /* Connection reset by peer */
+#define ENOBUFS 105 /* No buffer space available */
+#define EISCONN 106 /* Transport endpoint is already connected */
+#define ENOTCONN 107 /* Transport endpoint is not connected */
+#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 109 /* Too many references: cannot splice */
+#define ETIMEDOUT 110 /* Connection timed out */
+#define ECONNREFUSED 111 /* Connection refused */
+#define EHOSTDOWN 112 /* Host is down */
+#define EHOSTUNREACH 113 /* No route to host */
+#define EALREADY 114 /* Operation already in progress */
+#define EINPROGRESS 115 /* Operation now in progress */
+#define ESTALE 116 /* Stale NFS file handle */
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+#define EDQUOT 122 /* Quota exceeded */
+
+#define ENOMEDIUM 123 /* No medium found */
+#define EMEDIUMTYPE 124 /* Wrong medium type */
+#define ECANCELED 125 /* Operation Canceled */
+#define ENOKEY 126 /* Required key not available */
+#define EKEYEXPIRED 127 /* Key has expired */
+#define EKEYREVOKED 128 /* Key has been revoked */
+#define EKEYREJECTED 129 /* Key was rejected by service */
+
+/* for robust mutexes */
+#define EOWNERDEAD 130 /* Owner died */
+#define ENOTRECOVERABLE 131 /* State not recoverable */
+
+#endif
diff --git a/doc/errno.list.macosx.txt b/doc/errno.list.macosx.txt
new file mode 100644
index 00000000000..728753ac793
--- /dev/null
+++ b/doc/errno.list.macosx.txt
@@ -0,0 +1,1513 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APR_ERRNO_H
+#define APR_ERRNO_H
+
+/**
+ * @file apr_errno.h
+ * @brief APR Error Codes
+ */
+
+#include "apr.h"
+
+#if APR_HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @defgroup apr_errno Error Codes
+ * @ingroup APR
+ * @{
+ */
+
+/**
+ * Type for specifying an error or status code.
+ */
+typedef int apr_status_t;
+
+/**
+ * Return a human readable string describing the specified error.
+ * @param statcode The error code the get a string for.
+ * @param buf A buffer to hold the error string.
+ * @param bufsize Size of the buffer to hold the string.
+ */
+APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf,
+ apr_size_t bufsize);
+
+#if defined(DOXYGEN)
+/**
+ * @def APR_FROM_OS_ERROR(os_err_type syserr)
+ * Fold a platform specific error into an apr_status_t code.
+ * @return apr_status_t
+ * @param e The platform os error code.
+ * @warning macro implementation; the syserr argument may be evaluated
+ * multiple times.
+ */
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+
+/**
+ * @def APR_TO_OS_ERROR(apr_status_t statcode)
+ * @return os_err_type
+ * Fold an apr_status_t code back to the native platform defined error.
+ * @param e The apr_status_t folded platform os error code.
+ * @warning macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or APR_FROM_OS_ERROR, the results are undefined.
+ */
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+/** @def apr_get_os_error()
+ * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms
+ * @remark This retrieves errno, or calls a GetLastError() style function, and
+ * folds it with APR_FROM_OS_ERROR. Some platforms (such as OS2) have no
+ * such mechanism, so this call may be unsupported. Do NOT use this
+ * call for socket errors from socket, send, recv etc!
+ */
+
+/** @def apr_set_os_error(e)
+ * Reset the last platform error, unfolded from an apr_status_t, on some platforms
+ * @param e The OS error folded in a prior call to APR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or APR_FROM_OS_ERROR, the results are undefined. This macro sets
+ * errno, or calls a SetLastError() style function, unfolding statcode
+ * with APR_TO_OS_ERROR. Some platforms (such as OS2) have no such
+ * mechanism, so this call may be unsupported.
+ */
+
+/** @def apr_get_netos_error()
+ * Return the last socket error, folded into apr_status_t, on all platforms
+ * @remark This retrieves errno or calls a GetLastSocketError() style function,
+ * and folds it with APR_FROM_OS_ERROR.
+ */
+
+/** @def apr_set_netos_error(e)
+ * Reset the last socket error, unfolded from an apr_status_t
+ * @param e The socket error folded in a prior call to APR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or APR_FROM_OS_ERROR, the results are undefined. This macro sets
+ * errno, or calls a WSASetLastError() style function, unfolding
+ * socketcode with APR_TO_OS_ERROR.
+ */
+
+#endif /* defined(DOXYGEN) */
+
+/**
+ * APR_OS_START_ERROR is where the APR specific error values start.
+ */
+#define APR_OS_START_ERROR 20000
+/**
+ * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit
+ * into one of the error/status ranges below -- except for
+ * APR_OS_START_USERERR, which see.
+ */
+#define APR_OS_ERRSPACE_SIZE 50000
+/**
+ * APR_OS_START_STATUS is where the APR specific status codes start.
+ */
+#define APR_OS_START_STATUS (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
+/**
+ * APR_OS_START_USERERR are reserved for applications that use APR that
+ * layer their own error codes along with APR's. Note that the
+ * error immediately following this one is set ten times farther
+ * away than usual, so that users of apr have a lot of room in
+ * which to declare custom error codes.
+ */
+#define APR_OS_START_USERERR (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE)
+/**
+ * APR_OS_START_USEERR is obsolete, defined for compatibility only.
+ * Use APR_OS_START_USERERR instead.
+ */
+#define APR_OS_START_USEERR APR_OS_START_USERERR
+/**
+ * APR_OS_START_CANONERR is where APR versions of errno values are defined
+ * on systems which don't have the corresponding errno.
+ */
+#define APR_OS_START_CANONERR (APR_OS_START_USERERR \
+ + (APR_OS_ERRSPACE_SIZE * 10))
+/**
+ * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
+ * apr_status_t values.
+ */
+#define APR_OS_START_EAIERR (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE)
+/**
+ * APR_OS_START_SYSERR folds platform-specific system error values into
+ * apr_status_t values.
+ */
+#define APR_OS_START_SYSERR (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE)
+
+/** no error. */
+#define APR_SUCCESS 0
+
+/**
+ * @defgroup APR_Error APR Error Values
+ * <PRE>
+ * <b>APR ERROR VALUES</b>
+ * APR_ENOSTAT APR was unable to perform a stat on the file
+ * APR_ENOPOOL APR was not provided a pool with which to allocate memory
+ * APR_EBADDATE APR was given an invalid date
+ * APR_EINVALSOCK APR was given an invalid socket
+ * APR_ENOPROC APR was not given a process structure
+ * APR_ENOTIME APR was not given a time structure
+ * APR_ENODIR APR was not given a directory structure
+ * APR_ENOLOCK APR was not given a lock structure
+ * APR_ENOPOLL APR was not given a poll structure
+ * APR_ENOSOCKET APR was not given a socket
+ * APR_ENOTHREAD APR was not given a thread structure
+ * APR_ENOTHDKEY APR was not given a thread key structure
+ * APR_ENOSHMAVAIL There is no more shared memory available
+ * APR_EDSOOPEN APR was unable to open the dso object. For more
+ * information call apr_dso_error().
+ * APR_EGENERAL General failure (specific information not available)
+ * APR_EBADIP The specified IP address is invalid
+ * APR_EBADMASK The specified netmask is invalid
+ * APR_ESYMNOTFOUND Could not find the requested symbol
+ * </PRE>
+ *
+ * <PRE>
+ * <b>APR STATUS VALUES</b>
+ * APR_INCHILD Program is currently executing in the child
+ * APR_INPARENT Program is currently executing in the parent
+ * APR_DETACH The thread is detached
+ * APR_NOTDETACH The thread is not detached
+ * APR_CHILD_DONE The child has finished executing
+ * APR_CHILD_NOTDONE The child has not finished executing
+ * APR_TIMEUP The operation did not finish before the timeout
+ * APR_INCOMPLETE The operation was incomplete although some processing
+ * was performed and the results are partially valid
+ * APR_BADCH Getopt found an option not in the option string
+ * APR_BADARG Getopt found an option that is missing an argument
+ * and an argument was specified in the option string
+ * APR_EOF APR has encountered the end of the file
+ * APR_NOTFOUND APR was unable to find the socket in the poll structure
+ * APR_ANONYMOUS APR is using anonymous shared memory
+ * APR_FILEBASED APR is using a file name as the key to the shared memory
+ * APR_KEYBASED APR is using a shared key as the key to the shared memory
+ * APR_EINIT Ininitalizer value. If no option has been found, but
+ * the status variable requires a value, this should be used
+ * APR_ENOTIMPL The APR function has not been implemented on this
+ * platform, either because nobody has gotten to it yet,
+ * or the function is impossible on this platform.
+ * APR_EMISMATCH Two passwords do not match.
+ * APR_EABSOLUTE The given path was absolute.
+ * APR_ERELATIVE The given path was relative.
+ * APR_EINCOMPLETE The given path was neither relative nor absolute.
+ * APR_EABOVEROOT The given path was above the root path.
+ * APR_EBUSY The given lock was busy.
+ * APR_EPROC_UNKNOWN The given process wasn't recognized by APR
+ * </PRE>
+ * @{
+ */
+/** @see APR_STATUS_IS_ENOSTAT */
+#define APR_ENOSTAT (APR_OS_START_ERROR + 1)
+/** @see APR_STATUS_IS_ENOPOOL */
+#define APR_ENOPOOL (APR_OS_START_ERROR + 2)
+/* empty slot: +3 */
+/** @see APR_STATUS_IS_EBADDATE */
+#define APR_EBADDATE (APR_OS_START_ERROR + 4)
+/** @see APR_STATUS_IS_EINVALSOCK */
+#define APR_EINVALSOCK (APR_OS_START_ERROR + 5)
+/** @see APR_STATUS_IS_ENOPROC */
+#define APR_ENOPROC (APR_OS_START_ERROR + 6)
+/** @see APR_STATUS_IS_ENOTIME */
+#define APR_ENOTIME (APR_OS_START_ERROR + 7)
+/** @see APR_STATUS_IS_ENODIR */
+#define APR_ENODIR (APR_OS_START_ERROR + 8)
+/** @see APR_STATUS_IS_ENOLOCK */
+#define APR_ENOLOCK (APR_OS_START_ERROR + 9)
+/** @see APR_STATUS_IS_ENOPOLL */
+#define APR_ENOPOLL (APR_OS_START_ERROR + 10)
+/** @see APR_STATUS_IS_ENOSOCKET */
+#define APR_ENOSOCKET (APR_OS_START_ERROR + 11)
+/** @see APR_STATUS_IS_ENOTHREAD */
+#define APR_ENOTHREAD (APR_OS_START_ERROR + 12)
+/** @see APR_STATUS_IS_ENOTHDKEY */
+#define APR_ENOTHDKEY (APR_OS_START_ERROR + 13)
+/** @see APR_STATUS_IS_EGENERAL */
+#define APR_EGENERAL (APR_OS_START_ERROR + 14)
+/** @see APR_STATUS_IS_ENOSHMAVAIL */
+#define APR_ENOSHMAVAIL (APR_OS_START_ERROR + 15)
+/** @see APR_STATUS_IS_EBADIP */
+#define APR_EBADIP (APR_OS_START_ERROR + 16)
+/** @see APR_STATUS_IS_EBADMASK */
+#define APR_EBADMASK (APR_OS_START_ERROR + 17)
+/* empty slot: +18 */
+/** @see APR_STATUS_IS_EDSOPEN */
+#define APR_EDSOOPEN (APR_OS_START_ERROR + 19)
+/** @see APR_STATUS_IS_EABSOLUTE */
+#define APR_EABSOLUTE (APR_OS_START_ERROR + 20)
+/** @see APR_STATUS_IS_ERELATIVE */
+#define APR_ERELATIVE (APR_OS_START_ERROR + 21)
+/** @see APR_STATUS_IS_EINCOMPLETE */
+#define APR_EINCOMPLETE (APR_OS_START_ERROR + 22)
+/** @see APR_STATUS_IS_EABOVEROOT */
+#define APR_EABOVEROOT (APR_OS_START_ERROR + 23)
+/** @see APR_STATUS_IS_EBADPATH */
+#define APR_EBADPATH (APR_OS_START_ERROR + 24)
+/** @see APR_STATUS_IS_EPATHWILD */
+#define APR_EPATHWILD (APR_OS_START_ERROR + 25)
+/** @see APR_STATUS_IS_ESYMNOTFOUND */
+#define APR_ESYMNOTFOUND (APR_OS_START_ERROR + 26)
+/** @see APR_STATUS_IS_EPROC_UNKNOWN */
+#define APR_EPROC_UNKNOWN (APR_OS_START_ERROR + 27)
+/** @see APR_STATUS_IS_ENOTENOUGHENTROPY */
+#define APR_ENOTENOUGHENTROPY (APR_OS_START_ERROR + 28)
+/** @} */
+
+/**
+ * @defgroup APR_STATUS_IS Status Value Tests
+ * @warning For any particular error condition, more than one of these tests
+ * may match. This is because platform-specific error codes may not
+ * always match the semantics of the POSIX codes these tests (and the
+ * corresponding APR error codes) are named after. A notable example
+ * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
+ * Win32 platforms. The programmer should always be aware of this and
+ * adjust the order of the tests accordingly.
+ * @{
+ */
+/**
+ * APR was unable to perform a stat on the file
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_ENOSTAT(s) ((s) == APR_ENOSTAT)
+/**
+ * APR was not provided a pool with which to allocate memory
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_ENOPOOL(s) ((s) == APR_ENOPOOL)
+/** APR was given an invalid date */
+#define APR_STATUS_IS_EBADDATE(s) ((s) == APR_EBADDATE)
+/** APR was given an invalid socket */
+#define APR_STATUS_IS_EINVALSOCK(s) ((s) == APR_EINVALSOCK)
+/** APR was not given a process structure */
+#define APR_STATUS_IS_ENOPROC(s) ((s) == APR_ENOPROC)
+/** APR was not given a time structure */
+#define APR_STATUS_IS_ENOTIME(s) ((s) == APR_ENOTIME)
+/** APR was not given a directory structure */
+#define APR_STATUS_IS_ENODIR(s) ((s) == APR_ENODIR)
+/** APR was not given a lock structure */
+#define APR_STATUS_IS_ENOLOCK(s) ((s) == APR_ENOLOCK)
+/** APR was not given a poll structure */
+#define APR_STATUS_IS_ENOPOLL(s) ((s) == APR_ENOPOLL)
+/** APR was not given a socket */
+#define APR_STATUS_IS_ENOSOCKET(s) ((s) == APR_ENOSOCKET)
+/** APR was not given a thread structure */
+#define APR_STATUS_IS_ENOTHREAD(s) ((s) == APR_ENOTHREAD)
+/** APR was not given a thread key structure */
+#define APR_STATUS_IS_ENOTHDKEY(s) ((s) == APR_ENOTHDKEY)
+/** Generic Error which can not be put into another spot */
+#define APR_STATUS_IS_EGENERAL(s) ((s) == APR_EGENERAL)
+/** There is no more shared memory available */
+#define APR_STATUS_IS_ENOSHMAVAIL(s) ((s) == APR_ENOSHMAVAIL)
+/** The specified IP address is invalid */
+#define APR_STATUS_IS_EBADIP(s) ((s) == APR_EBADIP)
+/** The specified netmask is invalid */
+#define APR_STATUS_IS_EBADMASK(s) ((s) == APR_EBADMASK)
+/* empty slot: +18 */
+/**
+ * APR was unable to open the dso object.
+ * For more information call apr_dso_error().
+ */
+#if defined(WIN32)
+#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN \
+ || APR_TO_OS_ERROR(s) == ERROR_MOD_NOT_FOUND)
+#else
+#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN)
+#endif
+/** The given path was absolute. */
+#define APR_STATUS_IS_EABSOLUTE(s) ((s) == APR_EABSOLUTE)
+/** The given path was relative. */
+#define APR_STATUS_IS_ERELATIVE(s) ((s) == APR_ERELATIVE)
+/** The given path was neither relative nor absolute. */
+#define APR_STATUS_IS_EINCOMPLETE(s) ((s) == APR_EINCOMPLETE)
+/** The given path was above the root path. */
+#define APR_STATUS_IS_EABOVEROOT(s) ((s) == APR_EABOVEROOT)
+/** The given path was bad. */
+#define APR_STATUS_IS_EBADPATH(s) ((s) == APR_EBADPATH)
+/** The given path contained wildcards. */
+#define APR_STATUS_IS_EPATHWILD(s) ((s) == APR_EPATHWILD)
+/** Could not find the requested symbol.
+ * For more information call apr_dso_error().
+ */
+#if defined(WIN32)
+#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND \
+ || APR_TO_OS_ERROR(s) == ERROR_PROC_NOT_FOUND)
+#else
+#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND)
+#endif
+/** The given process was not recognized by APR. */
+#define APR_STATUS_IS_EPROC_UNKNOWN(s) ((s) == APR_EPROC_UNKNOWN)
+
+/** APR could not gather enough entropy to continue. */
+#define APR_STATUS_IS_ENOTENOUGHENTROPY(s) ((s) == APR_ENOTENOUGHENTROPY)
+
+/** @} */
+
+/**
+ * @addtogroup APR_Error
+ * @{
+ */
+/** @see APR_STATUS_IS_INCHILD */
+#define APR_INCHILD (APR_OS_START_STATUS + 1)
+/** @see APR_STATUS_IS_INPARENT */
+#define APR_INPARENT (APR_OS_START_STATUS + 2)
+/** @see APR_STATUS_IS_DETACH */
+#define APR_DETACH (APR_OS_START_STATUS + 3)
+/** @see APR_STATUS_IS_NOTDETACH */
+#define APR_NOTDETACH (APR_OS_START_STATUS + 4)
+/** @see APR_STATUS_IS_CHILD_DONE */
+#define APR_CHILD_DONE (APR_OS_START_STATUS + 5)
+/** @see APR_STATUS_IS_CHILD_NOTDONE */
+#define APR_CHILD_NOTDONE (APR_OS_START_STATUS + 6)
+/** @see APR_STATUS_IS_TIMEUP */
+#define APR_TIMEUP (APR_OS_START_STATUS + 7)
+/** @see APR_STATUS_IS_INCOMPLETE */
+#define APR_INCOMPLETE (APR_OS_START_STATUS + 8)
+/* empty slot: +9 */
+/* empty slot: +10 */
+/* empty slot: +11 */
+/** @see APR_STATUS_IS_BADCH */
+#define APR_BADCH (APR_OS_START_STATUS + 12)
+/** @see APR_STATUS_IS_BADARG */
+#define APR_BADARG (APR_OS_START_STATUS + 13)
+/** @see APR_STATUS_IS_EOF */
+#define APR_EOF (APR_OS_START_STATUS + 14)
+/** @see APR_STATUS_IS_NOTFOUND */
+#define APR_NOTFOUND (APR_OS_START_STATUS + 15)
+/* empty slot: +16 */
+/* empty slot: +17 */
+/* empty slot: +18 */
+/** @see APR_STATUS_IS_ANONYMOUS */
+#define APR_ANONYMOUS (APR_OS_START_STATUS + 19)
+/** @see APR_STATUS_IS_FILEBASED */
+#define APR_FILEBASED (APR_OS_START_STATUS + 20)
+/** @see APR_STATUS_IS_KEYBASED */
+#define APR_KEYBASED (APR_OS_START_STATUS + 21)
+/** @see APR_STATUS_IS_EINIT */
+#define APR_EINIT (APR_OS_START_STATUS + 22)
+/** @see APR_STATUS_IS_ENOTIMPL */
+#define APR_ENOTIMPL (APR_OS_START_STATUS + 23)
+/** @see APR_STATUS_IS_EMISMATCH */
+#define APR_EMISMATCH (APR_OS_START_STATUS + 24)
+/** @see APR_STATUS_IS_EBUSY */
+#define APR_EBUSY (APR_OS_START_STATUS + 25)
+/** @} */
+
+/**
+ * @addtogroup APR_STATUS_IS
+ * @{
+ */
+/**
+ * Program is currently executing in the child
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code */
+#define APR_STATUS_IS_INCHILD(s) ((s) == APR_INCHILD)
+/**
+ * Program is currently executing in the parent
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_INPARENT(s) ((s) == APR_INPARENT)
+/**
+ * The thread is detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_DETACH(s) ((s) == APR_DETACH)
+/**
+ * The thread is not detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_NOTDETACH(s) ((s) == APR_NOTDETACH)
+/**
+ * The child has finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_CHILD_DONE(s) ((s) == APR_CHILD_DONE)
+/**
+ * The child has not finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_CHILD_NOTDONE(s) ((s) == APR_CHILD_NOTDONE)
+/**
+ * The operation did not finish before the timeout
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP)
+/**
+ * The operation was incomplete although some processing was performed
+ * and the results are partially valid.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_INCOMPLETE(s) ((s) == APR_INCOMPLETE)
+/* empty slot: +9 */
+/* empty slot: +10 */
+/* empty slot: +11 */
+/**
+ * Getopt found an option not in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_BADCH(s) ((s) == APR_BADCH)
+/**
+ * Getopt found an option not in the option string and an argument was
+ * specified in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_BADARG(s) ((s) == APR_BADARG)
+/**
+ * APR has encountered the end of the file
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_EOF(s) ((s) == APR_EOF)
+/**
+ * APR was unable to find the socket in the poll structure
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_NOTFOUND(s) ((s) == APR_NOTFOUND)
+/* empty slot: +16 */
+/* empty slot: +17 */
+/* empty slot: +18 */
+/**
+ * APR is using anonymous shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_ANONYMOUS(s) ((s) == APR_ANONYMOUS)
+/**
+ * APR is using a file name as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_FILEBASED(s) ((s) == APR_FILEBASED)
+/**
+ * APR is using a shared key as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_KEYBASED(s) ((s) == APR_KEYBASED)
+/**
+ * Ininitalizer value. If no option has been found, but
+ * the status variable requires a value, this should be used
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_EINIT(s) ((s) == APR_EINIT)
+/**
+ * The APR function has not been implemented on this
+ * platform, either because nobody has gotten to it yet,
+ * or the function is impossible on this platform.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_ENOTIMPL(s) ((s) == APR_ENOTIMPL)
+/**
+ * Two passwords do not match.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_EMISMATCH(s) ((s) == APR_EMISMATCH)
+/**
+ * The given lock was busy
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define APR_STATUS_IS_EBUSY(s) ((s) == APR_EBUSY)
+
+/** @} */
+
+/**
+ * @addtogroup APR_Error APR Error Values
+ * @{
+ */
+/* APR CANONICAL ERROR VALUES */
+/** @see APR_STATUS_IS_EACCES */
+#ifdef EACCES
+#define APR_EACCES EACCES
+#else
+#define APR_EACCES (APR_OS_START_CANONERR + 1)
+#endif
+
+/** @see APR_STATUS_IS_EXIST */
+#ifdef EEXIST
+#define APR_EEXIST EEXIST
+#else
+#define APR_EEXIST (APR_OS_START_CANONERR + 2)
+#endif
+
+/** @see APR_STATUS_IS_ENAMETOOLONG */
+#ifdef ENAMETOOLONG
+#define APR_ENAMETOOLONG ENAMETOOLONG
+#else
+#define APR_ENAMETOOLONG (APR_OS_START_CANONERR + 3)
+#endif
+
+/** @see APR_STATUS_IS_ENOENT */
+#ifdef ENOENT
+#define APR_ENOENT ENOENT
+#else
+#define APR_ENOENT (APR_OS_START_CANONERR + 4)
+#endif
+
+/** @see APR_STATUS_IS_ENOTDIR */
+#ifdef ENOTDIR
+#define APR_ENOTDIR ENOTDIR
+#else
+#define APR_ENOTDIR (APR_OS_START_CANONERR + 5)
+#endif
+
+/** @see APR_STATUS_IS_ENOSPC */
+#ifdef ENOSPC
+#define APR_ENOSPC ENOSPC
+#else
+#define APR_ENOSPC (APR_OS_START_CANONERR + 6)
+#endif
+
+/** @see APR_STATUS_IS_ENOMEM */
+#ifdef ENOMEM
+#define APR_ENOMEM ENOMEM
+#else
+#define APR_ENOMEM (APR_OS_START_CANONERR + 7)
+#endif
+
+/** @see APR_STATUS_IS_EMFILE */
+#ifdef EMFILE
+#define APR_EMFILE EMFILE
+#else
+#define APR_EMFILE (APR_OS_START_CANONERR + 8)
+#endif
+
+/** @see APR_STATUS_IS_ENFILE */
+#ifdef ENFILE
+#define APR_ENFILE ENFILE
+#else
+#define APR_ENFILE (APR_OS_START_CANONERR + 9)
+#endif
+
+/** @see APR_STATUS_IS_EBADF */
+#ifdef EBADF
+#define APR_EBADF EBADF
+#else
+#define APR_EBADF (APR_OS_START_CANONERR + 10)
+#endif
+
+/** @see APR_STATUS_IS_EINVAL */
+#ifdef EINVAL
+#define APR_EINVAL EINVAL
+#else
+#define APR_EINVAL (APR_OS_START_CANONERR + 11)
+#endif
+
+/** @see APR_STATUS_IS_ESPIPE */
+#ifdef ESPIPE
+#define APR_ESPIPE ESPIPE
+#else
+#define APR_ESPIPE (APR_OS_START_CANONERR + 12)
+#endif
+
+/**
+ * @see APR_STATUS_IS_EAGAIN
+ * @warning use APR_STATUS_IS_EAGAIN instead of just testing this value
+ */
+#ifdef EAGAIN
+#define APR_EAGAIN EAGAIN
+#elif defined(EWOULDBLOCK)
+#define APR_EAGAIN EWOULDBLOCK
+#else
+#define APR_EAGAIN (APR_OS_START_CANONERR + 13)
+#endif
+
+/** @see APR_STATUS_IS_EINTR */
+#ifdef EINTR
+#define APR_EINTR EINTR
+#else
+#define APR_EINTR (APR_OS_START_CANONERR + 14)
+#endif
+
+/** @see APR_STATUS_IS_ENOTSOCK */
+#ifdef ENOTSOCK
+#define APR_ENOTSOCK ENOTSOCK
+#else
+#define APR_ENOTSOCK (APR_OS_START_CANONERR + 15)
+#endif
+
+/** @see APR_STATUS_IS_ECONNREFUSED */
+#ifdef ECONNREFUSED
+#define APR_ECONNREFUSED ECONNREFUSED
+#else
+#define APR_ECONNREFUSED (APR_OS_START_CANONERR + 16)
+#endif
+
+/** @see APR_STATUS_IS_EINPROGRESS */
+#ifdef EINPROGRESS
+#define APR_EINPROGRESS EINPROGRESS
+#else
+#define APR_EINPROGRESS (APR_OS_START_CANONERR + 17)
+#endif
+
+/**
+ * @see APR_STATUS_IS_ECONNABORTED
+ * @warning use APR_STATUS_IS_ECONNABORTED instead of just testing this value
+ */
+
+#ifdef ECONNABORTED
+#define APR_ECONNABORTED ECONNABORTED
+#else
+#define APR_ECONNABORTED (APR_OS_START_CANONERR + 18)
+#endif
+
+/** @see APR_STATUS_IS_ECONNRESET */
+#ifdef ECONNRESET
+#define APR_ECONNRESET ECONNRESET
+#else
+#define APR_ECONNRESET (APR_OS_START_CANONERR + 19)
+#endif
+
+/** @see APR_STATUS_IS_ETIMEDOUT
+ * @deprecated */
+#ifdef ETIMEDOUT
+#define APR_ETIMEDOUT ETIMEDOUT
+#else
+#define APR_ETIMEDOUT (APR_OS_START_CANONERR + 20)
+#endif
+
+/** @see APR_STATUS_IS_EHOSTUNREACH */
+#ifdef EHOSTUNREACH
+#define APR_EHOSTUNREACH EHOSTUNREACH
+#else
+#define APR_EHOSTUNREACH (APR_OS_START_CANONERR + 21)
+#endif
+
+/** @see APR_STATUS_IS_ENETUNREACH */
+#ifdef ENETUNREACH
+#define APR_ENETUNREACH ENETUNREACH
+#else
+#define APR_ENETUNREACH (APR_OS_START_CANONERR + 22)
+#endif
+
+/** @see APR_STATUS_IS_EFTYPE */
+#ifdef EFTYPE
+#define APR_EFTYPE EFTYPE
+#else
+#define APR_EFTYPE (APR_OS_START_CANONERR + 23)
+#endif
+
+/** @see APR_STATUS_IS_EPIPE */
+#ifdef EPIPE
+#define APR_EPIPE EPIPE
+#else
+#define APR_EPIPE (APR_OS_START_CANONERR + 24)
+#endif
+
+/** @see APR_STATUS_IS_EXDEV */
+#ifdef EXDEV
+#define APR_EXDEV EXDEV
+#else
+#define APR_EXDEV (APR_OS_START_CANONERR + 25)
+#endif
+
+/** @see APR_STATUS_IS_ENOTEMPTY */
+#ifdef ENOTEMPTY
+#define APR_ENOTEMPTY ENOTEMPTY
+#else
+#define APR_ENOTEMPTY (APR_OS_START_CANONERR + 26)
+#endif
+
+/** @} */
+
+#if defined(OS2) && !defined(DOXYGEN)
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define INCL_DOSERRORS
+#define INCL_DOS
+
+/* Leave these undefined.
+ * OS2 doesn't rely on the errno concept.
+ * The API calls always return a result codes which
+ * should be filtered through APR_FROM_OS_ERROR().
+ *
+ * #define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError()))
+ * #define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))
+ */
+
+/* A special case, only socket calls require this;
+ */
+#define apr_get_netos_error() (APR_FROM_OS_ERROR(errno))
+#define apr_set_netos_error(e) (errno = APR_TO_OS_ERROR(e))
+
+/* And this needs to be greped away for good:
+ */
+#define APR_OS2_STATUS(e) (APR_FROM_OS_ERROR(e))
+
+/* These can't sit in a private header, so in spite of the extra size,
+ * they need to be made available here.
+ */
+#define SOCBASEERR 10000
+#define SOCEPERM (SOCBASEERR+1) /* Not owner */
+#define SOCESRCH (SOCBASEERR+3) /* No such process */
+#define SOCEINTR (SOCBASEERR+4) /* Interrupted system call */
+#define SOCENXIO (SOCBASEERR+6) /* No such device or address */
+#define SOCEBADF (SOCBASEERR+9) /* Bad file number */
+#define SOCEACCES (SOCBASEERR+13) /* Permission denied */
+#define SOCEFAULT (SOCBASEERR+14) /* Bad address */
+#define SOCEINVAL (SOCBASEERR+22) /* Invalid argument */
+#define SOCEMFILE (SOCBASEERR+24) /* Too many open files */
+#define SOCEPIPE (SOCBASEERR+32) /* Broken pipe */
+#define SOCEOS2ERR (SOCBASEERR+100) /* OS/2 Error */
+#define SOCEWOULDBLOCK (SOCBASEERR+35) /* Operation would block */
+#define SOCEINPROGRESS (SOCBASEERR+36) /* Operation now in progress */
+#define SOCEALREADY (SOCBASEERR+37) /* Operation already in progress */
+#define SOCENOTSOCK (SOCBASEERR+38) /* Socket operation on non-socket */
+#define SOCEDESTADDRREQ (SOCBASEERR+39) /* Destination address required */
+#define SOCEMSGSIZE (SOCBASEERR+40) /* Message too long */
+#define SOCEPROTOTYPE (SOCBASEERR+41) /* Protocol wrong type for socket */
+#define SOCENOPROTOOPT (SOCBASEERR+42) /* Protocol not available */
+#define SOCEPROTONOSUPPORT (SOCBASEERR+43) /* Protocol not supported */
+#define SOCESOCKTNOSUPPORT (SOCBASEERR+44) /* Socket type not supported */
+#define SOCEOPNOTSUPP (SOCBASEERR+45) /* Operation not supported on socket */
+#define SOCEPFNOSUPPORT (SOCBASEERR+46) /* Protocol family not supported */
+#define SOCEAFNOSUPPORT (SOCBASEERR+47) /* Address family not supported by protocol family */
+#define SOCEADDRINUSE (SOCBASEERR+48) /* Address already in use */
+#define SOCEADDRNOTAVAIL (SOCBASEERR+49) /* Can't assign requested address */
+#define SOCENETDOWN (SOCBASEERR+50) /* Network is down */
+#define SOCENETUNREACH (SOCBASEERR+51) /* Network is unreachable */
+#define SOCENETRESET (SOCBASEERR+52) /* Network dropped connection on reset */
+#define SOCECONNABORTED (SOCBASEERR+53) /* Software caused connection abort */
+#define SOCECONNRESET (SOCBASEERR+54) /* Connection reset by peer */
+#define SOCENOBUFS (SOCBASEERR+55) /* No buffer space available */
+#define SOCEISCONN (SOCBASEERR+56) /* Socket is already connected */
+#define SOCENOTCONN (SOCBASEERR+57) /* Socket is not connected */
+#define SOCESHUTDOWN (SOCBASEERR+58) /* Can't send after socket shutdown */
+#define SOCETOOMANYREFS (SOCBASEERR+59) /* Too many references: can't splice */
+#define SOCETIMEDOUT (SOCBASEERR+60) /* Connection timed out */
+#define SOCECONNREFUSED (SOCBASEERR+61) /* Connection refused */
+#define SOCELOOP (SOCBASEERR+62) /* Too many levels of symbolic links */
+#define SOCENAMETOOLONG (SOCBASEERR+63) /* File name too long */
+#define SOCEHOSTDOWN (SOCBASEERR+64) /* Host is down */
+#define SOCEHOSTUNREACH (SOCBASEERR+65) /* No route to host */
+#define SOCENOTEMPTY (SOCBASEERR+66) /* Directory not empty */
+
+/* APR CANONICAL ERROR TESTS */
+#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
+ || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \
+ || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
+ || (s) == APR_OS_START_SYSERR + SOCENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES \
+ || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED)
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
+ || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \
+ || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE)
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION)
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
+ || (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION)
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
+ || (s) == APR_OS_START_SYSERR + SOCEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
+ || (s) == APR_OS_START_SYSERR + SOCENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
+ || (s) == APR_OS_START_SYSERR + SOCECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
+ || (s) == APR_OS_START_SYSERR + SOCEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == APR_OS_START_SYSERR + SOCECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
+ || (s) == APR_OS_START_SYSERR + SOCECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
+ || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
+ || (s) == APR_OS_START_SYSERR + SOCEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
+ || (s) == APR_OS_START_SYSERR + SOCENETUNREACH)
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE \
+ || (s) == APR_OS_START_SYSERR + SOCEPIPE)
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \
+ || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
+
+/*
+ Sorry, too tired to wrap this up for OS2... feel free to
+ fit the following into their best matches.
+
+ { ERROR_NO_SIGNAL_SENT, ESRCH },
+ { SOCEALREADY, EALREADY },
+ { SOCEDESTADDRREQ, EDESTADDRREQ },
+ { SOCEMSGSIZE, EMSGSIZE },
+ { SOCEPROTOTYPE, EPROTOTYPE },
+ { SOCENOPROTOOPT, ENOPROTOOPT },
+ { SOCEPROTONOSUPPORT, EPROTONOSUPPORT },
+ { SOCESOCKTNOSUPPORT, ESOCKTNOSUPPORT },
+ { SOCEOPNOTSUPP, EOPNOTSUPP },
+ { SOCEPFNOSUPPORT, EPFNOSUPPORT },
+ { SOCEAFNOSUPPORT, EAFNOSUPPORT },
+ { SOCEADDRINUSE, EADDRINUSE },
+ { SOCEADDRNOTAVAIL, EADDRNOTAVAIL },
+ { SOCENETDOWN, ENETDOWN },
+ { SOCENETRESET, ENETRESET },
+ { SOCENOBUFS, ENOBUFS },
+ { SOCEISCONN, EISCONN },
+ { SOCENOTCONN, ENOTCONN },
+ { SOCESHUTDOWN, ESHUTDOWN },
+ { SOCETOOMANYREFS, ETOOMANYREFS },
+ { SOCELOOP, ELOOP },
+ { SOCEHOSTDOWN, EHOSTDOWN },
+ { SOCENOTEMPTY, ENOTEMPTY },
+ { SOCEPIPE, EPIPE }
+*/
+
+#elif defined(WIN32) && !defined(DOXYGEN) /* !defined(OS2) */
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError()))
+#define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))
+
+/* A special case, only socket calls require this:
+ */
+#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError()))
+#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e)))
+
+/* APR CANONICAL ERROR TESTS */
+#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
+ || (s) == APR_OS_START_SYSERR + ERROR_CANNOT_MAKE \
+ || (s) == APR_OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \
+ || (s) == APR_OS_START_SYSERR + ERROR_DRIVE_LOCKED \
+ || (s) == APR_OS_START_SYSERR + ERROR_FAIL_I24 \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_FAILED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_LOCKED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \
+ || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS)
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
+ || (s) == APR_OS_START_SYSERR + WSAENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES)
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR \
+ || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_NETPATH \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_NET_NAME \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_PATHNAME \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DRIVE)
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
+ || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM \
+ || (s) == APR_OS_START_SYSERR + ERROR_ARENA_TRASHED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_MEMORY \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_BLOCK \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_QUOTA \
+ || (s) == APR_OS_START_SYSERR + ERROR_OUTOFMEMORY)
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \
+ || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_TARGET_HANDLE)
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_ACCESS \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DATA \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
+ || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_SEEK_ON_DEVICE \
+ || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_PROC_SLOTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_NESTING_NOT_ALLOWED \
+ || (s) == APR_OS_START_SYSERR + ERROR_MAX_THRDS_REACHED \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+ || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
+ || (s) == APR_OS_START_SYSERR + WSAEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
+ || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
+ || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
+ || (s) == APR_OS_START_SYSERR + ERROR_NETNAME_DELETED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_EXE_MACHINE_TYPE_MISMATCH \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DLL \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_MODULETYPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_EXE_FORMAT \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_EXE_SIGNATURE \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_CORRUPT \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_FORMAT)
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE)
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \
+ || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY)
+
+#elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define apr_get_os_error() (errno)
+#define apr_set_os_error(e) (errno = (e))
+
+/* A special case, only socket calls require this: */
+#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError()))
+#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e)))
+
+/* APR CANONICAL ERROR TESTS */
+#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES)
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST)
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT)
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC)
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE)
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF)
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL)
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE)
+
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == EWOULDBLOCK \
+ || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
+ || (s) == APR_OS_START_SYSERR + WSAEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
+ || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
+ || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
+ || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
+#define APR_STATUS_IS_ENETDOWN(s) ((s) == APR_OS_START_SYSERR + WSAENETDOWN)
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE)
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV)
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY)
+
+#else /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
+
+/*
+ * os error codes are clib error codes
+ */
+#define APR_FROM_OS_ERROR(e) (e)
+#define APR_TO_OS_ERROR(e) (e)
+
+#define apr_get_os_error() (errno)
+#define apr_set_os_error(e) (errno = (e))
+
+/* A special case, only socket calls require this:
+ */
+#define apr_get_netos_error() (errno)
+#define apr_set_netos_error(e) (errno = (e))
+
+/**
+ * @addtogroup APR_STATUS_IS
+ * @{
+ */
+
+/** permission denied */
+#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES)
+/** file exists */
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST)
+/** path name is too long */
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG)
+/**
+ * no such file or directory
+ * @remark
+ * EMVSCATLG can be returned by the automounter on z/OS for
+ * paths which do not exist.
+ */
+#ifdef EMVSCATLG
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
+ || (s) == EMVSCATLG)
+#else
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT)
+#endif
+/** not a directory */
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
+/** no space left on device */
+#ifdef EDQUOT
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
+ || (s) == EDQUOT)
+#else
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC)
+#endif
+/** not enough memory */
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
+/** too many open files */
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE)
+/** file table overflow */
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+/** bad file # */
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF)
+/** invalid argument */
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL)
+/** illegal seek */
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE)
+
+/** operation would block */
+#if !defined(EWOULDBLOCK) || !defined(EAGAIN)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN)
+#elif (EWOULDBLOCK == EAGAIN)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN)
+#else
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == EWOULDBLOCK)
+#endif
+
+/** interrupted system call */
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR)
+/** socket operation on a non-socket */
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK)
+/** Connection Refused */
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED)
+/** operation now in progress */
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS)
+
+/**
+ * Software caused connection abort
+ * @remark
+ * EPROTO on certain older kernels really means ECONNABORTED, so we need to
+ * ignore it for them. See discussion in new-httpd archives nh.9701 & nh.9603
+ *
+ * There is potentially a bug in Solaris 2.x x<6, and other boxes that
+ * implement tcp sockets in userland (i.e. on top of STREAMS). On these
+ * systems, EPROTO can actually result in a fatal loop. See PR#981 for
+ * example. It's hard to handle both uses of EPROTO.
+ */
+#ifdef EPROTO
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == EPROTO)
+#else
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED)
+#endif
+
+/** Connection Reset by peer */
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET)
+/** Operation timed out
+ * @deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT)
+/** no route to host */
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH)
+/** network is unreachable */
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH)
+/** inappropiate file type or format */
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
+/** broken pipe */
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE)
+/** cross device link */
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV)
+/** Directory Not Empty */
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY || \
+ (s) == APR_EEXIST)
+/** @} */
+
+#endif /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! APR_ERRNO_H */
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+#include <sys/errno.h>
+
+
+/*
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)errno.h 8.5 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_ERRNO_H_
+#define _SYS_ERRNO_H_
+
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+extern int * __error(void);
+#define errno (*__error())
+__END_DECLS
+
+/*
+ * Error codes
+ */
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* Input/output error */
+#define ENXIO 6 /* Device not configured */
+#define E2BIG 7 /* Argument list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file descriptor */
+#define ECHILD 10 /* No child processes */
+#define EDEADLK 11 /* Resource deadlock avoided */
+ /* 11 was EAGAIN */
+#define ENOMEM 12 /* Cannot allocate memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define ENOTBLK 15 /* Block device required */
+#endif
+#define EBUSY 16 /* Device / Resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* Operation not supported by device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* Too many open files in system */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Inappropriate ioctl for device */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+
+/* math software */
+#define EDOM 33 /* Numerical argument out of domain */
+#define ERANGE 34 /* Result too large */
+
+/* non-blocking and interrupt i/o */
+#define EAGAIN 35 /* Resource temporarily unavailable */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define EINPROGRESS 36 /* Operation now in progress */
+#define EALREADY 37 /* Operation already in progress */
+
+/* ipc/network software -- argument errors */
+#define ENOTSOCK 38 /* Socket operation on non-socket */
+#define EDESTADDRREQ 39 /* Destination address required */
+#define EMSGSIZE 40 /* Message too long */
+#define EPROTOTYPE 41 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 42 /* Protocol not available */
+#define EPROTONOSUPPORT 43 /* Protocol not supported */
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
+#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
+#define ENOTSUP 45 /* Operation not supported */
+#if !__DARWIN_UNIX03 && !defined(KERNEL)
+/*
+ * This is the same for binary and source copmpatability, unless compiling
+ * the kernel itself, or compiling __DARWIN_UNIX03; if compiling for the
+ * kernel, the correct value will be returned. If compiling non-POSIX
+ * source, the kernel return value will be converted by a stub in libc, and
+ * if compiling source with __DARWIN_UNIX03, the conversion in libc is not
+ * done, and the caller gets the expected (discrete) value.
+ */
+#define EOPNOTSUPP ENOTSUP /* Operation not supported on socket */
+#endif /* !__DARWIN_UNIX03 && !KERNEL */
+
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define EPFNOSUPPORT 46 /* Protocol family not supported */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
+#define EADDRINUSE 48 /* Address already in use */
+#define EADDRNOTAVAIL 49 /* Can't assign requested address */
+
+/* ipc/network software -- operational errors */
+#define ENETDOWN 50 /* Network is down */
+#define ENETUNREACH 51 /* Network is unreachable */
+#define ENETRESET 52 /* Network dropped connection on reset */
+#define ECONNABORTED 53 /* Software caused connection abort */
+#define ECONNRESET 54 /* Connection reset by peer */
+#define ENOBUFS 55 /* No buffer space available */
+#define EISCONN 56 /* Socket is already connected */
+#define ENOTCONN 57 /* Socket is not connected */
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define ESHUTDOWN 58 /* Can't send after socket shutdown */
+#define ETOOMANYREFS 59 /* Too many references: can't splice */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+#define ETIMEDOUT 60 /* Operation timed out */
+#define ECONNREFUSED 61 /* Connection refused */
+
+#define ELOOP 62 /* Too many levels of symbolic links */
+#define ENAMETOOLONG 63 /* File name too long */
+
+/* should be rearranged */
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define EHOSTDOWN 64 /* Host is down */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+#define EHOSTUNREACH 65 /* No route to host */
+#define ENOTEMPTY 66 /* Directory not empty */
+
+/* quotas & mush */
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define EPROCLIM 67 /* Too many processes */
+#define EUSERS 68 /* Too many users */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+#define EDQUOT 69 /* Disc quota exceeded */
+
+/* Network File System */
+#define ESTALE 70 /* Stale NFS file handle */
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define EREMOTE 71 /* Too many levels of remote in path */
+#define EBADRPC 72 /* RPC struct is bad */
+#define ERPCMISMATCH 73 /* RPC version wrong */
+#define EPROGUNAVAIL 74 /* RPC prog. not avail */
+#define EPROGMISMATCH 75 /* Program version wrong */
+#define EPROCUNAVAIL 76 /* Bad procedure for program */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+
+#define ENOLCK 77 /* No locks available */
+#define ENOSYS 78 /* Function not implemented */
+
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define EFTYPE 79 /* Inappropriate file type or format */
+#define EAUTH 80 /* Authentication error */
+#define ENEEDAUTH 81 /* Need authenticator */
+
+/* Intelligent device errors */
+#define EPWROFF 82 /* Device power is off */
+#define EDEVERR 83 /* Device error, e.g. paper out */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+
+#define EOVERFLOW 84 /* Value too large to be stored in data type */
+
+/* Program loading errors */
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define EBADEXEC 85 /* Bad executable */
+#define EBADARCH 86 /* Bad CPU type in executable */
+#define ESHLIBVERS 87 /* Shared library version mismatch */
+#define EBADMACHO 88 /* Malformed Macho file */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+
+#define ECANCELED 89 /* Operation canceled */
+
+#define EIDRM 90 /* Identifier removed */
+#define ENOMSG 91 /* No message of desired type */
+#define EILSEQ 92 /* Illegal byte sequence */
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define ENOATTR 93 /* Attribute not found */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+
+#define EBADMSG 94 /* Bad message */
+#define EMULTIHOP 95 /* Reserved */
+#define ENODATA 96 /* No message available on STREAM */
+#define ENOLINK 97 /* Reserved */
+#define ENOSR 98 /* No STREAM resources */
+#define ENOSTR 99 /* Not a STREAM */
+#define EPROTO 100 /* Protocol error */
+#define ETIME 101 /* STREAM ioctl timeout */
+
+#if __DARWIN_UNIX03 || defined(KERNEL)
+/* This value is only discrete when compiling __DARWIN_UNIX03, or KERNEL */
+#define EOPNOTSUPP 102 /* Operation not supported on socket */
+#endif /* __DARWIN_UNIX03 || KERNEL */
+
+#define ENOPOLICY 103 /* No such policy registered */
+
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define ELAST 103 /* Must be equal largest errno */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+
+#endif /* _SYS_ERRNO_H_ */
diff --git a/doc/errno.list.solaris.txt b/doc/errno.list.solaris.txt
new file mode 100644
index 00000000000..23601e9d374
--- /dev/null
+++ b/doc/errno.list.solaris.txt
@@ -0,0 +1,206 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2000 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+/*
+ * University Copyright- Copyright (c) 1982, 1986, 1988
+ * The Regents of the University of California
+ * All Rights Reserved
+ *
+ * University Acknowledgment- Portions of this document are derived from
+ * software developed by the University of California, Berkeley, and its
+ * contributors.
+ */
+
+#ifndef _SYS_ERRNO_H
+#define _SYS_ERRNO_H
+
+#pragma ident "@(#)errno.h 1.22 05/06/08 SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Error codes
+ */
+
+#define EPERM 1 /* Not super-user */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Arg list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No children */
+#define EAGAIN 11 /* Resource temporarily unavailable */
+#define ENOMEM 12 /* Not enough core */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Mount device busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Inappropriate ioctl for device */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math arg out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+#define ENOMSG 35 /* No message of desired type */
+#define EIDRM 36 /* Identifier removed */
+#define ECHRNG 37 /* Channel number out of range */
+#define EL2NSYNC 38 /* Level 2 not synchronized */
+#define EL3HLT 39 /* Level 3 halted */
+#define EL3RST 40 /* Level 3 reset */
+#define ELNRNG 41 /* Link number out of range */
+#define EUNATCH 42 /* Protocol driver not attached */
+#define ENOCSI 43 /* No CSI structure available */
+#define EL2HLT 44 /* Level 2 halted */
+#define EDEADLK 45 /* Deadlock condition. */
+#define ENOLCK 46 /* No record locks available. */
+#define ECANCELED 47 /* Operation canceled */
+#define ENOTSUP 48 /* Operation not supported */
+
+/* Filesystem Quotas */
+#define EDQUOT 49 /* Disc quota exceeded */
+
+/* Convergent Error Returns */
+#define EBADE 50 /* invalid exchange */
+#define EBADR 51 /* invalid request descriptor */
+#define EXFULL 52 /* exchange full */
+#define ENOANO 53 /* no anode */
+#define EBADRQC 54 /* invalid request code */
+#define EBADSLT 55 /* invalid slot */
+#define EDEADLOCK 56 /* file locking deadlock error */
+
+#define EBFONT 57 /* bad font file fmt */
+
+/* Interprocess Robust Locks */
+#define EOWNERDEAD 58 /* process died with the lock */
+#define ENOTRECOVERABLE 59 /* lock is not recoverable */
+
+/* stream problems */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* no data (for no delay io) */
+#define ETIME 62 /* timer expired */
+#define ENOSR 63 /* out of streams resources */
+
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* The object is remote */
+#define ENOLINK 67 /* the link has been severed */
+#define EADV 68 /* advertise error */
+#define ESRMNT 69 /* srmount error */
+
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+
+/* Interprocess Robust Locks */
+#define ELOCKUNMAPPED 72 /* locked lock was unmapped */
+
+#define ENOTACTIVE 73 /* Facility is not active */
+#define EMULTIHOP 74 /* multihop attempted */
+#define EBADMSG 77 /* trying to read unreadable message */
+#define ENAMETOOLONG 78 /* path name is too long */
+#define EOVERFLOW 79 /* value too large to be stored in data type */
+#define ENOTUNIQ 80 /* given log. name not unique */
+#define EBADFD 81 /* f.d. invalid for this operation */
+#define EREMCHG 82 /* Remote address changed */
+
+/* shared library problems */
+#define ELIBACC 83 /* Can't access a needed shared lib. */
+#define ELIBBAD 84 /* Accessing a corrupted shared lib. */
+#define ELIBSCN 85 /* .lib section in a.out corrupted. */
+#define ELIBMAX 86 /* Attempting to link in too many libs. */
+#define ELIBEXEC 87 /* Attempting to exec a shared library. */
+#define EILSEQ 88 /* Illegal byte sequence. */
+#define ENOSYS 89 /* Unsupported file system operation */
+#define ELOOP 90 /* Symbolic link loop */
+#define ERESTART 91 /* Restartable system call */
+#define ESTRPIPE 92 /* if pipe/FIFO, don't sleep in stream head */
+#define ENOTEMPTY 93 /* directory not empty */
+#define EUSERS 94 /* Too many users (for UFS) */
+
+/* BSD Networking Software */
+ /* argument errors */
+#define ENOTSOCK 95 /* Socket operation on non-socket */
+#define EDESTADDRREQ 96 /* Destination address required */
+#define EMSGSIZE 97 /* Message too long */
+#define EPROTOTYPE 98 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 99 /* Protocol not available */
+#define EPROTONOSUPPORT 120 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 121 /* Socket type not supported */
+#define EOPNOTSUPP 122 /* Operation not supported on socket */
+#define EPFNOSUPPORT 123 /* Protocol family not supported */
+#define EAFNOSUPPORT 124 /* Address family not supported by */
+ /* protocol family */
+#define EADDRINUSE 125 /* Address already in use */
+#define EADDRNOTAVAIL 126 /* Can't assign requested address */
+ /* operational errors */
+#define ENETDOWN 127 /* Network is down */
+#define ENETUNREACH 128 /* Network is unreachable */
+#define ENETRESET 129 /* Network dropped connection because */
+ /* of reset */
+#define ECONNABORTED 130 /* Software caused connection abort */
+#define ECONNRESET 131 /* Connection reset by peer */
+#define ENOBUFS 132 /* No buffer space available */
+#define EISCONN 133 /* Socket is already connected */
+#define ENOTCONN 134 /* Socket is not connected */
+/* XENIX has 135 - 142 */
+#define ESHUTDOWN 143 /* Can't send after socket shutdown */
+#define ETOOMANYREFS 144 /* Too many references: can't splice */
+#define ETIMEDOUT 145 /* Connection timed out */
+#define ECONNREFUSED 146 /* Connection refused */
+#define EHOSTDOWN 147 /* Host is down */
+#define EHOSTUNREACH 148 /* No route to host */
+#define EWOULDBLOCK EAGAIN
+#define EALREADY 149 /* operation already in progress */
+#define EINPROGRESS 150 /* operation now in progress */
+
+/* SUN Network File System */
+#define ESTALE 151 /* Stale NFS file handle */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_ERRNO_H */
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
new file mode 100644
index 00000000000..b4c93f4c90b
--- /dev/null
+++ b/doc/examples/Makefile.am
@@ -0,0 +1,8 @@
+EXTRA = README unify.vol replicate.vol stripe.vol protocol-client.vol protocol-server.vol posix-locks.vol trash.vol write-behind.vol io-threads.vol io-cache.vol read-ahead.vol filter.vol trace.vol
+EXTRA_DIST = $(EXTRA)
+
+docdir = $(datadir)/doc/$(PACKAGE_NAME)
+Examplesdir = $(docdir)/examples
+Examples_DATA = $(EXTRA)
+
+CLEANFILES =
diff --git a/doc/examples/README b/doc/examples/README
new file mode 100644
index 00000000000..4d472ac086e
--- /dev/null
+++ b/doc/examples/README
@@ -0,0 +1,13 @@
+GlusterFS's translator feature is very flexible and there are quite a lot of ways one
+can configure their filesystem to behave like.
+
+Volume Specification is a way in which GlusterFS understands how it has to work, based
+on what is written there.
+
+Going through the following URLs may give you more idea about all these.
+
+* http://www.gluster.org/docs/index.php/GlusterFS
+* http://www.gluster.org/docs/index.php/GlusterFS_Volume_Specification
+* http://www.gluster.org/docs/index.php/GlusterFS_Translators
+
+Mail us any doubts, suggestions on 'gluster-devel(at)nongnu.org'
diff --git a/doc/examples/filter.vol b/doc/examples/filter.vol
new file mode 100644
index 00000000000..ca5c5983779
--- /dev/null
+++ b/doc/examples/filter.vol
@@ -0,0 +1,23 @@
+volume client
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 192.168.1.10 # IP address of the remote brick
+ option remote-subvolume brick # name of the remote volume
+end-volume
+
+## In normal clustered storage type, any of the cluster translators can come here.
+#
+# Definition of other clients
+#
+# Definition of cluster translator (may be unify, afr, or unify over afr)
+#
+
+### 'Filter' translator is used on client side (or server side according to needs). This traslator makes all the below translators, (or say volumes) as read-only. Hence if one wants a 'read-only' filesystem, using filter as the top most volume will make it really fast as the fops are returned from this level itself.
+
+volume filter-ro
+ type features/filter
+ option root-squashing enable
+# option completely-read-only yes
+# translate-uid 1-99=0
+ subvolumes client
+end-volume \ No newline at end of file
diff --git a/doc/examples/io-cache.vol b/doc/examples/io-cache.vol
new file mode 100644
index 00000000000..5f3eca4c527
--- /dev/null
+++ b/doc/examples/io-cache.vol
@@ -0,0 +1,25 @@
+volume client
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 192.168.1.10 # IP address of the remote brick
+ option remote-subvolume brick # name of the remote volume
+end-volume
+
+## In normal clustered storage type, any of the cluster translators can come here.
+#
+# Definition of other clients
+#
+# Definition of cluster translator (may be unify, replicate, or unify over replicate)
+#
+
+### 'IO-Cache' translator is best used on client side when a filesystem has file which are not modified frequently but read several times. For example, while compiling a kernel, *.h files are read while compiling every *.c file, in these case, io-cache translator comes very handy, as it keeps the whole file content in the cache, and serves from the cache.
+# One can provide the priority of the cache too.
+
+volume ioc
+ type performance/io-cache
+ subvolumes client # In this example it is 'client' you may have to change it according to your spec file.
+ option page-size 1MB # 128KB is default
+ option cache-size 64MB # 32MB is default
+ option force-revalidate-timeout 5 # 1second is default
+ option priority *.html:2,*:1 # default is *:0
+end-volume
diff --git a/doc/examples/io-threads.vol b/doc/examples/io-threads.vol
new file mode 100644
index 00000000000..9954724e1fe
--- /dev/null
+++ b/doc/examples/io-threads.vol
@@ -0,0 +1,21 @@
+
+volume brick
+ type storage/posix # POSIX FS translator
+ option directory /home/export # Export this directory
+end-volume
+
+### 'IO-threads' translator gives a threading behaviour to File I/O calls. All other normal fops are having default behaviour. Loading this on server side helps to reduce the contension of network. (Which is assumed as a GlusterFS hang).
+# One can load it in client side to reduce the latency involved in case of a slow network, when loaded below write-behind.
+volume iot
+ type performance/io-threads
+ subvolumes brick
+ option thread-count 4 # default value is 1
+end-volume
+
+volume server
+ type protocol/server
+ subvolumes iot brick
+ option transport-type tcp # For TCP/IP transport
+ option auth.addr.brick.allow 192.168.* # Allow access to "brick" volume
+ option auth.addr.iot.allow 192.168.* # Allow access to "p-locks" volume
+end-volume
diff --git a/doc/examples/posix-locks.vol b/doc/examples/posix-locks.vol
new file mode 100644
index 00000000000..b9c9e7a6481
--- /dev/null
+++ b/doc/examples/posix-locks.vol
@@ -0,0 +1,20 @@
+
+volume brick
+ type storage/posix # POSIX FS translator
+ option directory /home/export # Export this directory
+end-volume
+
+### 'Posix-locks' feature should be added on the server side (as posix volume as subvolume) because it contains the actual file.
+volume p-locks
+ type features/posix-locks
+ subvolumes brick
+ option mandatory on
+end-volume
+
+volume server
+ type protocol/server
+ subvolumes p-locks brick
+ option transport-type tcp
+ option auth.addr.brick.allow 192.168.* # Allow access to "brick" volume
+ option auth.addr.p-locks.allow 192.168.* # Allow access to "p-locks" volume
+end-volume
diff --git a/doc/examples/protocol-client.vol b/doc/examples/protocol-client.vol
new file mode 100644
index 00000000000..43108f2c2c1
--- /dev/null
+++ b/doc/examples/protocol-client.vol
@@ -0,0 +1,17 @@
+volume client
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+ option remote-host 192.168.1.10 # IP address of the remote brick
+# option transport.socket.remote-port 6996 # default server port is 6996
+
+# option transport-type ib-verbs # for Infiniband verbs transport
+# option transport.ib-verbs.work-request-send-size 1048576
+# option transport.ib-verbs.work-request-send-count 16
+# option transport.ib-verbs.work-request-recv-size 1048576
+# option transport.ib-verbs.work-request-recv-count 16
+# option transport.ib-verbs.remote-port 6996 # default server port is 6996
+
+ option remote-subvolume brick # name of the remote volume
+# option transport-timeout 30 # default value is 120seconds
+end-volume
diff --git a/doc/examples/protocol-server.vol b/doc/examples/protocol-server.vol
new file mode 100644
index 00000000000..88477511f55
--- /dev/null
+++ b/doc/examples/protocol-server.vol
@@ -0,0 +1,25 @@
+
+### Export volume "brick" with the contents of "/home/export" directory.
+volume brick
+ type storage/posix # POSIX FS translator
+ option directory /home/export # Export this directory
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+# option transport.socket.listen-port 6996 # Default is 6996
+
+# option transport-type ib-verbs # For Infiniband Verbs transport
+# option transport.ib-verbs.work-request-send-size 131072
+# option transport.ib-verbs.work-request-send-count 64
+# option transport.ib-verbs.work-request-recv-size 131072
+# option transport.ib-verbs.work-request-recv-count 64
+# option transport.ib-verbs.listen-port 6996 # Default is 6996
+
+# option bind-address 192.168.1.10 # Default is to listen on all interfaces
+# option client-volume-filename /etc/glusterfs/glusterfs-client.vol
+ subvolumes brick
+ option auth.addr.brick.allow 192.168.* # Allow access to "brick" volume
+end-volume
diff --git a/doc/examples/read-ahead.vol b/doc/examples/read-ahead.vol
new file mode 100644
index 00000000000..3ce0d95aca7
--- /dev/null
+++ b/doc/examples/read-ahead.vol
@@ -0,0 +1,22 @@
+volume client
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 192.168.1.10 # IP address of the remote brick
+ option remote-subvolume brick # name of the remote volume
+end-volume
+
+## In normal clustered storage type, any of the cluster translators can come here.
+#
+# Definition of other clients
+#
+# Definition of cluster translator (may be unify, replicate, or unify over replicate)
+#
+
+### 'Read-Ahead' translator is best utilized on client side, as it prefetches the file contents when the first read() call is issued.
+volume ra
+ type performance/read-ahead
+ subvolumes client # In this example it is 'client' you may have to change it according to your spec file.
+ option page-size 1MB # default is 256KB
+ option page-count 4 # default is 2
+ option force-atime-update no # defalut is 'no'
+end-volume
diff --git a/doc/examples/replicate.vol b/doc/examples/replicate.vol
new file mode 100644
index 00000000000..8c9541444f8
--- /dev/null
+++ b/doc/examples/replicate.vol
@@ -0,0 +1,119 @@
+### 'NOTE'
+# This file has both server spec and client spec to get an understanding of stripe's spec file. Hence can't be used as it is, as a GlusterFS spec file.
+# One need to seperate out server spec and client spec to get it working.
+
+#=========================================================================
+
+# **** server1 spec file ****
+
+### Export volume "brick" with the contents of "/home/export" directory.
+volume posix1
+ type storage/posix # POSIX FS translator
+ option directory /home/export1 # Export this directory
+end-volume
+
+### Add POSIX record locking support to the storage brick
+volume brick1
+ type features/posix-locks
+ option mandatory on # enables mandatory locking on all files
+ subvolumes posix1
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6996 # Default is 6996
+# option client-volume-filename /etc/glusterfs/glusterfs-client.vol
+ subvolumes brick1
+ option auth.addr.brick1.allow * # access to "brick" volume
+end-volume
+
+
+#=========================================================================
+
+# **** server2 spec file ****
+volume posix2
+ type storage/posix # POSIX FS translator
+ option directory /home/export2 # Export this directory
+end-volume
+
+### Add POSIX record locking support to the storage brick
+volume brick2
+ type features/posix-locks
+ option mandatory on # enables mandatory locking on all files
+ subvolumes posix2
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6997 # Default is 6996
+ subvolumes brick2
+ option auth.addr.brick2.allow * # Allow access to "brick" volume
+end-volume
+
+
+#=========================================================================
+
+# **** server3 spec file ****
+
+volume posix3
+ type storage/posix # POSIX FS translator
+ option directory /home/export3 # Export this directory
+end-volume
+
+### Add POSIX record locking support to the storage brick
+volume brick3
+ type features/posix-locks
+ option mandatory on # enables mandatory locking on all files
+ subvolumes posix3
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6998 # Default is 6996
+ subvolumes brick3
+ option auth.addr.brick3.allow * # access to "brick" volume
+end-volume
+
+
+#=========================================================================
+
+# **** Clustered Client config file ****
+
+### Add client feature and attach to remote subvolume of server1
+volume client1
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6996 # default server port is 6996
+ option remote-subvolume brick1 # name of the remote volume
+end-volume
+
+### Add client feature and attach to remote subvolume of server2
+volume client2
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6997 # default server port is 6996
+ option remote-subvolume brick2 # name of the remote volume
+end-volume
+
+volume client3
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6998 # default server port is 6996
+ option remote-subvolume brick3 # name of the remote volume
+end-volume
+
+## Add replicate feature.
+volume replicate
+ type cluster/replicate
+ subvolumes client1 client2 client3
+end-volume
+
diff --git a/doc/examples/stripe.vol b/doc/examples/stripe.vol
new file mode 100644
index 00000000000..ea24cf86038
--- /dev/null
+++ b/doc/examples/stripe.vol
@@ -0,0 +1,121 @@
+
+### 'NOTE'
+# This file has both server spec and client spec to get an understanding of stripe's spec file. Hence can't be used as it is, as a GlusterFS spec file.
+# One need to seperate out server spec and client spec to get it working.
+
+#=========================================================================
+
+# **** server1 spec file ****
+
+### Export volume "brick" with the contents of "/home/export" directory.
+volume posix1
+ type storage/posix # POSIX FS translator
+ option directory /home/export1 # Export this directory
+end-volume
+
+### Add POSIX record locking support to the storage brick
+volume brick1
+ type features/posix-locks
+ option mandatory on # enables mandatory locking on all files
+ subvolumes posix1
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6996 # Default is 6996
+# option client-volume-filename /etc/glusterfs/glusterfs-client.vol
+ subvolumes brick1
+ option auth.addr.brick1.allow * # access to "brick" volume
+end-volume
+
+
+#=========================================================================
+
+# **** server2 spec file ****
+volume posix2
+ type storage/posix # POSIX FS translator
+ option directory /home/export2 # Export this directory
+end-volume
+
+### Add POSIX record locking support to the storage brick
+volume brick2
+ type features/posix-locks
+ option mandatory on # enables mandatory locking on all files
+ subvolumes posix2
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6997 # Default is 6996
+ subvolumes brick2
+ option auth.addr.brick2.allow * # Allow access to "brick" volume
+end-volume
+
+
+#=========================================================================
+
+# **** server3 spec file ****
+
+volume posix3
+ type storage/posix # POSIX FS translator
+ option directory /home/export3 # Export this directory
+end-volume
+
+### Add POSIX record locking support to the storage brick
+volume brick3
+ type features/posix-locks
+ option mandatory on # enables mandatory locking on all files
+ subvolumes posix3
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6998 # Default is 6996
+ subvolumes brick3
+ option auth.addr.brick3.allow * # access to "brick" volume
+end-volume
+
+
+#=========================================================================
+
+# **** Clustered Client config file ****
+
+### Add client feature and attach to remote subvolume of server1
+volume client1
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6996 # default server port is 6996
+ option remote-subvolume brick1 # name of the remote volume
+end-volume
+
+### Add client feature and attach to remote subvolume of server2
+volume client2
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6997 # default server port is 6996
+ option remote-subvolume brick2 # name of the remote volume
+end-volume
+
+volume client3
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6998 # default server port is 6996
+ option remote-subvolume brick3 # name of the remote volume
+end-volume
+
+## Add Stripe Feature.
+volume stripe
+ type cluster/stripe
+ subvolumes client1 client2 client3
+ option block-size 1MB
+end-volume
+
diff --git a/doc/examples/trace.vol b/doc/examples/trace.vol
new file mode 100644
index 00000000000..3f4864db496
--- /dev/null
+++ b/doc/examples/trace.vol
@@ -0,0 +1,16 @@
+volume client
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 192.168.1.10 # IP address of the remote brick
+ option remote-subvolume brick # name of the remote volume
+end-volume
+
+### 'Trace' translator is a very handy debug tool for GlusterFS, as it can be loaded between any of the two volumes without changing the behaviour of the filesystem.
+# On client side it can be the top most volume in spec (like now) to understand what calls are made on FUSE filesystem, when a mounted filesystem is accessed.
+
+volume trace
+ type debug/trace
+ subvolumes client
+end-volume
+
+# 'NOTE:' By loading 'debug/trace' translator, filesystem will be very slow as it logs each and every calls to the log file.
diff --git a/doc/examples/trash.vol b/doc/examples/trash.vol
new file mode 100644
index 00000000000..16e71be3232
--- /dev/null
+++ b/doc/examples/trash.vol
@@ -0,0 +1,20 @@
+
+volume brick
+ type storage/posix # POSIX FS translator
+ option directory /home/export # Export this directory
+end-volume
+
+### 'Trash' translator is best used on server side as it just renames the deleted file inside 'trash-dir', and it makes 4 seperate fops for one unlink call.
+volume trashcan
+ type features/trash
+ subvolumes brick
+ option trash-dir /.trashcan
+end-volume
+
+volume server
+ type protocol/server
+ subvolumes trashcan brick
+ option transport-type tcp # For TCP/IP transport
+ option auth.addr.brick.allow 192.168.* # Allow access to "brick" volume
+ option auth.addr.trashcan.allow 192.168.* # Allow access to "p-locks" volume
+end-volume
diff --git a/doc/examples/unify.vol b/doc/examples/unify.vol
new file mode 100644
index 00000000000..4f7415a2369
--- /dev/null
+++ b/doc/examples/unify.vol
@@ -0,0 +1,178 @@
+### 'NOTE'
+# This file has both server spec and client spec to get an understanding of stripe's spec file. Hence can't be used as it is, as a GlusterFS spec file.
+# One need to seperate out server spec and client spec to get it working.
+
+
+#=========================================================================
+
+# **** server1 spec file ****
+
+### Export volume "brick" with the contents of "/home/export" directory.
+volume posix1
+ type storage/posix # POSIX FS translator
+ option directory /home/export1 # Export this directory
+end-volume
+
+### Add POSIX record locking support to the storage brick
+volume brick1
+ type features/posix-locks
+ option mandatory on # enables mandatory locking on all files
+ subvolumes posix1
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6996 # Default is 6996
+# option client-volume-filename /etc/glusterfs/glusterfs-client.vol
+ subvolumes brick1
+ option auth.addr.brick1.allow * # access to "brick" volume
+end-volume
+
+
+#=========================================================================
+
+# **** server2 spec file ****
+volume posix2
+ type storage/posix # POSIX FS translator
+ option directory /home/export2 # Export this directory
+end-volume
+
+### Add POSIX record locking support to the storage brick
+volume brick2
+ type features/posix-locks
+ option mandatory on # enables mandatory locking on all files
+ subvolumes posix2
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6997 # Default is 6996
+ subvolumes brick2
+ option auth.addr.brick2.allow * # Allow access to "brick" volume
+end-volume
+
+
+#=========================================================================
+
+# **** server3 spec file ****
+
+volume posix3
+ type storage/posix # POSIX FS translator
+ option directory /home/export3 # Export this directory
+end-volume
+
+### Add POSIX record locking support to the storage brick
+volume brick3
+ type features/posix-locks
+ option mandatory on # enables mandatory locking on all files
+ subvolumes posix3
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6998 # Default is 6996
+ subvolumes brick3
+ option auth.addr.brick3.allow * # access to "brick" volume
+end-volume
+
+#=========================================================================
+
+# *** server for namespace ***
+### Export volume "brick" with the contents of "/home/export" directory.
+volume brick-ns
+ type storage/posix # POSIX FS translator
+ option directory /home/export-ns # Export this directory
+end-volume
+
+volume server
+ type protocol/server
+ option transport-type tcp # For TCP/IP transport
+ option transport.socket.listen-port 6999 # Default is 6996
+ subvolumes brick-ns
+ option auth.addr.brick-ns.allow * # access to "brick" volume
+end-volume
+
+
+#=========================================================================
+
+# **** Clustered Client config file ****
+
+### Add client feature and attach to remote subvolume of server1
+volume client1
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6996 # default server port is 6996
+ option remote-subvolume brick1 # name of the remote volume
+end-volume
+
+### Add client feature and attach to remote subvolume of server2
+volume client2
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6997 # default server port is 6996
+ option remote-subvolume brick2 # name of the remote volume
+end-volume
+
+volume client3
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6998 # default server port is 6996
+ option remote-subvolume brick3 # name of the remote volume
+end-volume
+
+
+volume client-ns
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+ option remote-host 127.0.0.1 # IP address of the remote brick
+ option transport.socket.remote-port 6999 # default server port is 6996
+ option remote-subvolume brick-ns # name of the remote volume
+end-volume
+
+### Add unify feature to cluster the servers. Associate an
+### appropriate scheduler that matches your I/O demand.
+volume bricks
+ type cluster/unify
+ option namespace client-ns # this will not be storage child of unify.
+ subvolumes client1 client2 client3
+### ** ALU Scheduler Option **
+ option self-heal background # foreground off # default is foreground
+ option scheduler alu
+ option alu.limits.min-free-disk 5% #%
+ option alu.limits.max-open-files 10000
+ option alu.order disk-usage:read-usage:write-usage:open-files-usage:disk-speed-usage
+ option alu.disk-usage.entry-threshold 2GB
+ option alu.disk-usage.exit-threshold 128MB
+ option alu.open-files-usage.entry-threshold 1024
+ option alu.open-files-usage.exit-threshold 32
+ option alu.read-usage.entry-threshold 20 #%
+ option alu.read-usage.exit-threshold 4 #%
+ option alu.write-usage.entry-threshold 20 #%
+ option alu.write-usage.exit-threshold 4 #%
+ option alu.disk-speed-usage.entry-threshold 0 # DO NOT SET IT. SPEED IS CONSTANT!!!.
+ option alu.disk-speed-usage.exit-threshold 0 # DO NOT SET IT. SPEED IS CONSTANT!!!.
+ option alu.stat-refresh.interval 10sec
+ option alu.stat-refresh.num-file-create 10
+### ** Random Scheduler **
+# option scheduler random
+### ** NUFA Scheduler **
+# option scheduler nufa
+# option nufa.local-volume-name posix1
+### ** Round Robin (RR) Scheduler **
+# option scheduler rr
+# option rr.limits.min-free-disk 5% #%
+end-volume
+
diff --git a/doc/examples/write-behind.vol b/doc/examples/write-behind.vol
new file mode 100644
index 00000000000..9c6bae11c53
--- /dev/null
+++ b/doc/examples/write-behind.vol
@@ -0,0 +1,26 @@
+volume client
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+ option remote-host 192.168.1.10 # IP address of the remote brick
+ option remote-subvolume brick # name of the remote volume
+end-volume
+
+## In normal clustered storage type, any of the cluster translators can come here.
+#
+# Definition of other clients
+#
+# Definition of cluster translator (may be unify, replicate, or unify over replicate)
+#
+
+
+### 'Write-behind' translator is a performance booster for write operation. Best used on client side, as its main intension is to reduce the network latency caused for each write operation.
+
+volume wb
+ type performance/write-behind
+ subvolumes client # In this example it is 'client' you may have to change it according to your spec file.
+ option flush-behind on # default value is 'off'
+ option window-size 2MB
+ option aggregate-size 1MB # default value is 0
+ option enable_O_SYNC no # default is no
+ option disable-for-first-nbytes 128KB #default is 1
+end-volume
diff --git a/doc/get_put_api_using_xattr.txt b/doc/get_put_api_using_xattr.txt
new file mode 100644
index 00000000000..58951f5bf4f
--- /dev/null
+++ b/doc/get_put_api_using_xattr.txt
@@ -0,0 +1,22 @@
+GlusterFS get/put API interface provided through extended attributes:
+
+API usage:
+ int put(dirpath/filename, data): setfattr -n glusterfs.file.<filename> -v <data> <dirpath>
+ void *get(dirpath/filename): getfattr -n glusterfs.file.<filename> <dirpath>
+
+
+internals:
+* unify handling setxattr/getxattr
+ - setxattr
+ unify's setxattr forwards setxattr call to all the child nodes with XATTR_REPLACE flag, except namespace. setxattr will succeeds only on the child node on which the file already exists. if the setxattr operation fails on all child nodes, it indicates that the file does not already exist on any of the child nodes. unify follows the same rules as it follows for create, but using setxattr call itself with XATTR_CREATE flag. unify sends a setxattr to namespace first, with zero length data. if namespace setxattr succeeds, unify schedules setxattr to one of the child nodes.
+
+ - getxattr
+ unify's getxattr forwards getxattr call to all the child nodes. wait for completion of operation on all the child nodes, and returns success if getxattr succeeded one child node.
+
+* posix handling setxattr/getxattr
+ - setxattr
+ posix setxattr does a open with O_CREAT|O_TRUNC on the <path>/<name>, writes value of the setxattr as data into the file and closes the file. when data is null, posix setxattr avoids doing write. file is closed after write.
+
+ - getxattr
+ posix getxattr does open with O_RDONLY on the <path>/<name>, reads the complete content of the file. file is closed after read.
+
diff --git a/doc/glusterfs.8 b/doc/glusterfs.8
new file mode 100644
index 00000000000..46c596a5bb3
--- /dev/null
+++ b/doc/glusterfs.8
@@ -0,0 +1,139 @@
+.\" Copyright (c) 2008 Z RESEARCH, Inc. <http://www.zresearch.com>
+.\" This file is part of GlusterFS.
+.\"
+.\" GlusterFS is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published
+.\" by the Free Software Foundation; either version 3 of the License,
+.\" or (at your option) any later version.
+.\"
+.\" GlusterFS is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+.\" General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License
+.\" long with this program. If not, see
+.\" <http://www.gnu.org/licenses/>.
+.\"
+.\" :O
+.\"
+.TH GlusterFS 8 ":O Cluster Filesystem" "07 December 2008" "Z Research Inc."
+.SH NAME
+GlusterFS \- Clustered Filesystem.
+.SH SYNOPSYS
+.B glusterfs
+.I [options] [mountpoint]
+.PP
+.SH DESCRIPTION
+GlusterFS is a clustered file-system capable of scaling to several peta-bytes. It aggregates various storage bricks over Infiniband RDMA or TCP/IP interconnect into one large parallel network file system. Storage bricks can be made of any commodity hardware such as x86-64 server with SATA-II RAID and Infiniband HBA.
+GlusterFS is fully POSIX compliant FileSystem. On client side, it has dependency on FUSE package, on server side, it works seemlessly on different OSes. (Currently supported on GNU/Linux, Mac OSX, FreeBSD, OpenSolaris).
+.SH OPTIONS
+.PP
+Mandatory or optional arguments to long options are also mandatory or optional
+for any corresponding short options.
+.SS "Basic options"
+.PP
+.TP
+
+\fB\-f, \fB\-\-volfile=VOLUME-FILE\fR
+File to use as VOLUME-FILE [default:/etc/glusterfs/glusterfs.vol]
+.TP
+\fB\-l, \fB\-\-log\-file=LOGFILE\fR
+File to use for logging [default:/var/log/glusterfs/glusterfs.log]
+.TP
+\fB\-L, \fB\-\-log\-level=LOGLEVEL\fR
+Logging severity. Valid options are DEBUG, WARNING, ERROR, CRITICAL
+and NONE [default: WARNING]
+.TP
+\fB\-s, \fB\-\-volfile\-server=SERVER\fR
+Server to get the volume from. This option overrides \fB\-\-volfile option
+
+.SS "Advanced options"
+.PP
+.TP
+
+\fB\-\-debug\fR
+Run in debug mode. This option sets \fB\-\-no\-daemon\fR, \fB\-\-log\-level\fR to DEBUG
+and \fB\-\-log\-file\fR to console
+.TP
+\fB\-N, \fB\-\-no\-daemon\fR
+Run in foreground
+.TP
+\fB\-p, \fB\-\-pid\-file=PIDFILE\fR
+File to use as pid file
+.TP
+\fB\-\-volfile\-id=KEY\fR
+KEY of the volume file to be fetched from server
+.TP
+\fB\-\-volfile\-server\-port=PORT\fR
+Port number of volfile server
+.TP
+\fB\-\-volfile\-server\-transport=TRANSPORT\fR
+Transport type to get volume file from server [default: socket]
+.TP
+\fB\-\-volume\-name=VOLUME\-NAME\fR
+Volume name to be used for MOUNT-POINT [default: top most volume in
+VOLUME-FILE]
+.TP
+\fB\-\-xlator\-option=VOLUME\-NAME.OPTION=VALUE\fR
+Add/override a translator option for a volume with the specified value
+
+
+.SS "Fuse options"
+.PP
+.TP
+
+\fB\-\-attribute\-timeout=SECONDS\fR
+Set attribute timeout to SECONDS for inodes in fuse kernel module [default: 1]
+.TP
+\fB\-\-entry\-timeout=SECONDS\fR
+Set entry timeout to SECONDS in fuse kernel module [default: 1]
+.TP
+\fB\-\-disable\-direct\-io\-mode\fR
+Disable direct I/O mode in fuse kernel module
+.TP
+
+.SS "Miscellaneous Options"
+.PP
+.TP
+
+\fB\-?, \fB\-\-help\fR
+Give this help list
+.TP
+\fB\-\-usage\fR
+Give a short usage message
+.TP
+\fB\-V, \fB\-\-version\fR
+Print program version
+
+.PP
+.SH FILES
+/etc/glusterfs/*.vol
+
+.SH SEE ALSO
+.nf
+The full documentation for \fBGlusterFS\fR is maintained as a Texinfo manual.
+If the \fBinfo\fR and \fBglusterfs\fR are properly installed on your site, the command
+ \fBinfo glusterfs\fR
+should give you access to complete documentation.
+
+.nf
+\fBbison\fR(1) \fBflex\fR(1) \fBfusermount\fR(1)
+\fBhttp://www.glusterfs.org/ <URL:http://www.glusterfs.org/>
+\fR
+.fi
+.SH SUPPORT
+.nf
+\fBhttp://support.gluster.com/ <URL:http://support.gluster.com/>
+\fR
+.fi
+.SH AUTHORS
+.nf
+\fBhttp://www.gluster.org/core-team.php <URL:http://www.gluster.org/core-team.php>
+\fR
+.fi
+.SH COPYRIGHT
+.nf
+\fBCopyright(c)2006,2007,2008,2009 Z RESEARCH, Inc. <http://www.zresearch.com>
+\fR
+.fi
diff --git a/doc/glusterfs.vol.sample b/doc/glusterfs.vol.sample
new file mode 100644
index 00000000000..e126f66b3dc
--- /dev/null
+++ b/doc/glusterfs.vol.sample
@@ -0,0 +1,61 @@
+### file: client-volume.vol.sample
+
+#####################################
+### GlusterFS Client Volume File ##
+#####################################
+
+#### CONFIG FILE RULES:
+### "#" is comment character.
+### - Config file is case sensitive
+### - Options within a volume block can be in any order.
+### - Spaces or tabs are used as delimitter within a line.
+### - Each option should end within a line.
+### - Missing or commented fields will assume default values.
+### - Blank/commented lines are allowed.
+### - Sub-volumes should already be defined above before referring.
+
+### Add client feature and attach to remote subvolume
+volume client
+ type protocol/client
+ option transport-type tcp
+# option transport-type unix
+# option transport-type ib-sdp
+ option remote-host 127.0.0.1 # IP address of the remote brick
+# option transport.socket.remote-port 6996 # default server port is 6996
+
+# option transport-type ib-verbs
+# option transport.ib-verbs.remote-port 6996 # default server port is 6996
+# option transport.ib-verbs.work-request-send-size 1048576
+# option transport.ib-verbs.work-request-send-count 16
+# option transport.ib-verbs.work-request-recv-size 1048576
+# option transport.ib-verbs.work-request-recv-count 16
+
+# option transport-timeout 30 # seconds to wait for a reply
+ # from server for each request
+ option remote-subvolume brick # name of the remote volume
+end-volume
+
+### Add readahead feature
+#volume readahead
+# type performance/read-ahead
+# option page-size 1MB # unit in bytes
+# option page-count 2 # cache per file = (page-count x page-size)
+# subvolumes client
+#end-volume
+
+### Add IO-Cache feature
+#volume iocache
+# type performance/io-cache
+# option page-size 256KB
+# option page-count 2
+# subvolumes readahead
+#end-volume
+
+### Add writeback feature
+#volume writeback
+# type performance/write-behind
+# option aggregate-size 1MB
+# option window-size 2MB
+# option flush-behind off
+# subvolumes iocache
+#end-volume
diff --git a/doc/glusterfsd.vol.sample b/doc/glusterfsd.vol.sample
new file mode 100644
index 00000000000..b6d8a158072
--- /dev/null
+++ b/doc/glusterfsd.vol.sample
@@ -0,0 +1,47 @@
+### file: server-volume.vol.sample
+
+#####################################
+### GlusterFS Server Volume File ##
+#####################################
+
+#### CONFIG FILE RULES:
+### "#" is comment character.
+### - Config file is case sensitive
+### - Options within a volume block can be in any order.
+### - Spaces or tabs are used as delimitter within a line.
+### - Multiple values to options will be : delimitted.
+### - Each option should end within a line.
+### - Missing or commented fields will assume default values.
+### - Blank/commented lines are allowed.
+### - Sub-volumes should already be defined above before referring.
+
+### Export volume "brick" with the contents of "/home/export" directory.
+volume brick
+ type storage/posix # POSIX FS translator
+ option directory /home/export # Export this directory
+end-volume
+
+### Add network serving capability to above brick.
+volume server
+ type protocol/server
+ option transport-type tcp
+# option transport-type unix
+# option transport-type ib-sdp
+# option transport.socket.bind-address 192.168.1.10 # Default is to listen on all interfaces
+# option transport.socket.listen-port 6996 # Default is 6996
+
+# option transport-type ib-verbs
+# option transport.ib-verbs.bind-address 192.168.1.10 # Default is to listen on all interfaces
+# option transport.ib-verbs.listen-port 6996 # Default is 6996
+# option transport.ib-verbs.work-request-send-size 131072
+# option transport.ib-verbs.work-request-send-count 64
+# option transport.ib-verbs.work-request-recv-size 131072
+# option transport.ib-verbs.work-request-recv-count 64
+
+# option client-volume-filename /etc/glusterfs/glusterfs-client.vol
+ subvolumes brick
+# NOTE: Access to any volume through protocol/server is denied by
+# default. You need to explicitly grant access through # "auth"
+# option.
+ option auth.addr.brick.allow * # Allow access to "brick" volume
+end-volume
diff --git a/doc/hacker-guide/Makefile.am b/doc/hacker-guide/Makefile.am
new file mode 100644
index 00000000000..65c92ac235e
--- /dev/null
+++ b/doc/hacker-guide/Makefile.am
@@ -0,0 +1,8 @@
+EXTRA_DIST = replicate.txt bdb.txt posix.txt call-stub.txt write-behind.txt
+
+#EXTRA_DIST = hacker-guide.tex afr.txt bdb.txt posix.txt call-stub.txt write-behind.txt
+#hacker_guidedir = $(docdir)
+#hacker_guide_DATA = hacker-guide.pdf
+
+#hacker-guide.pdf: $(EXTRA_DIST)
+# pdflatex $(srcdir)/hacker-guide.tex
diff --git a/doc/hacker-guide/adding-fops.txt b/doc/hacker-guide/adding-fops.txt
new file mode 100644
index 00000000000..293de2637b0
--- /dev/null
+++ b/doc/hacker-guide/adding-fops.txt
@@ -0,0 +1,33 @@
+ HOW TO ADD A NEW FOP TO GlusterFS
+ =================================
+
+Steps to be followed when adding a new FOP to GlusterFS:
+
+1. Edit glusterfs.h and add a GF_FOP_* constant.
+
+2. Edit xlator.[ch] and:
+ 2a. add the new prototype for fop and callback.
+ 2b. edit xlator_fops structure.
+
+3. Edit xlator.c and add to fill_defaults.
+
+4. Edit protocol.h and add struct necessary for the new FOP.
+
+5. Edit defaults.[ch] and provide default implementation.
+
+6. Edit call-stub.[ch] and provide stub implementation.
+
+7. Edit common-utils.c and add to gf_global_variable_init().
+
+8. Edit client-protocol and add your FOP.
+
+9. Edit server-protocol and add your FOP.
+
+10. Implement your FOP in any translator for which the default implementation
+ is not sufficient.
+
+==========================================
+Last updated: Mon Oct 27 21:35:49 IST 2008
+
+Author: Vikas Gorur <vikas@zresearch.com>
+==========================================
diff --git a/doc/hacker-guide/bdb.txt b/doc/hacker-guide/bdb.txt
new file mode 100644
index 00000000000..fd0bd365206
--- /dev/null
+++ b/doc/hacker-guide/bdb.txt
@@ -0,0 +1,70 @@
+
+* How does file translates to key/value pair?
+---------------------------------------------
+
+ in bdb a file is identified by key (obtained by taking basename() of the path of
+the file) and file contents are stored as value corresponding to the key in database
+file (defaults to glusterfs_storage.db under dirname() directory).
+
+* symlinks, directories
+-----------------------
+
+ symlinks and directories are stored as is.
+
+* db (database) files
+---------------------
+
+ every directory, including root directory, contains a database file called
+glusterfs_storage.db. all the regular files contained in the directory are stored
+as key/value pair inside the glusterfs_storage.db.
+
+* internal data cache
+---------------------
+
+ db does not provide a way to find out the size of the value corresponding to a key.
+so, bdb makes DB->get() call for key and takes the length of the value returned.
+since DB->get() also returns file contents for key, bdb maintains an internal cache and
+stores the file contents in the cache.
+ every directory maintains a seperate cache.
+
+* inode number transformation
+-----------------------------
+
+ bdb allocates a inode number to each file and directory on its own. bdb maintains a
+global counter and increments it after allocating inode number for each file
+(regular, symlink or directory). NOTE: bdb does not guarantee persistent inode numbers.
+
+* checkpoint thread
+-------------------
+
+ bdb creates a checkpoint thread at the time of init(). checkpoint thread does a
+periodic checkpoint on the DB_ENV. checkpoint is the mechanism, provided by db, to
+forcefully commit the logged transactions to the storage.
+
+NOTES ABOUT FOPS:
+-----------------
+
+lookup() -
+ 1> do lstat() on the path, if lstat fails, we assume that the file being looked up
+ is either a regular file or doesn't exist.
+ 2> lookup in the DB of parent directory for key corresponding to path. if key exists,
+ return key, with.
+ NOTE: 'struct stat' stat()ed from DB file is used as a container for 'struct stat'
+ of the regular file. st_ino, st_size, st_blocks are updated with file's values.
+
+readv() -
+ 1> do a lookup in bctx cache. if successful, return the requested data from cache.
+ 2> if cache missed, do a DB->get() the entire file content and insert to cache.
+
+writev():
+ 1> flush any cached content of this file.
+ 2> do a DB->put(), with DB_DBT_PARTIAL flag.
+ NOTE: DB_DBT_PARTIAL is used to do partial update of a value in DB.
+
+readdir():
+ 1> regular readdir() in a loop, and vomit all DB_ENV log files and DB files that
+ we encounter.
+ 2> if the readdir() buffer still has space, open a DB cursor and do a sequential
+ DBC->get() to fill the reaadir buffer.
+
+
diff --git a/doc/hacker-guide/call-stub.txt b/doc/hacker-guide/call-stub.txt
new file mode 100644
index 00000000000..bca1579b22d
--- /dev/null
+++ b/doc/hacker-guide/call-stub.txt
@@ -0,0 +1,1033 @@
+creating a call stub and pausing a call
+---------------------------------------
+libglusterfs provides seperate API to pause each of the fop. parameters to each API is
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+ NOTE: @fn should exactly take the same type and number of parameters that
+ the corresponding regular fop takes.
+rest will be the regular parameters to corresponding fop.
+
+NOTE: @frame can never be NULL. fop_<operation>_stub() fails with errno
+ set to EINVAL, if @frame is NULL. also wherever @loc is applicable,
+ @loc cannot be NULL.
+
+refer to individual stub creation API to know about call-stub creation's behaviour with
+specific parameters.
+
+here is the list of stub creation APIs for xlator fops.
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@need_xattr - flag to specify if xattr should be returned or not.
+call_stub_t *
+fop_lookup_stub (call_frame_t *frame,
+ fop_lookup_t fn,
+ loc_t *loc,
+ int32_t need_xattr);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+call_stub_t *
+fop_stat_stub (call_frame_t *frame,
+ fop_stat_t fn,
+ loc_t *loc);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to lk fop.
+ NOTE: @fd is stored with a fd_ref().
+call_stub_t *
+fop_fstat_stub (call_frame_t *frame,
+ fop_fstat_t fn,
+ fd_t *fd);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to @loc->inode and
+ @loc->parent, if not NULL. also @loc->path will be copied to a different location.
+@mode - mode parameter to chmod.
+call_stub_t *
+fop_chmod_stub (call_frame_t *frame,
+ fop_chmod_t fn,
+ loc_t *loc,
+ mode_t mode);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to lk fop.
+ NOTE: @fd is stored with a fd_ref().
+@mode - mode parameter for fchmod fop.
+call_stub_t *
+fop_fchmod_stub (call_frame_t *frame,
+ fop_fchmod_t fn,
+ fd_t *fd,
+ mode_t mode);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to @loc->inode and
+ @loc->parent, if not NULL. also @loc->path will be copied to a different location.
+@uid - uid parameter to chown.
+@gid - gid parameter to chown.
+call_stub_t *
+fop_chown_stub (call_frame_t *frame,
+ fop_chown_t fn,
+ loc_t *loc,
+ uid_t uid,
+ gid_t gid);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to lk fop.
+ NOTE: @fd is stored with a fd_ref().
+@uid - uid parameter to fchown.
+@gid - gid parameter to fchown.
+call_stub_t *
+fop_fchown_stub (call_frame_t *frame,
+ fop_fchown_t fn,
+ fd_t *fd,
+ uid_t uid,
+ gid_t gid);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location, if not NULL.
+@off - offset parameter to truncate fop.
+call_stub_t *
+fop_truncate_stub (call_frame_t *frame,
+ fop_truncate_t fn,
+ loc_t *loc,
+ off_t off);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to lk fop.
+ NOTE: @fd is stored with a fd_ref().
+@off - offset parameter to ftruncate fop.
+call_stub_t *
+fop_ftruncate_stub (call_frame_t *frame,
+ fop_ftruncate_t fn,
+ fd_t *fd,
+ off_t off);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@tv - tv parameter to utimens fop.
+call_stub_t *
+fop_utimens_stub (call_frame_t *frame,
+ fop_utimens_t fn,
+ loc_t *loc,
+ struct timespec tv[2]);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@mask - mask parameter for access fop.
+call_stub_t *
+fop_access_stub (call_frame_t *frame,
+ fop_access_t fn,
+ loc_t *loc,
+ int32_t mask);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@size - size parameter to readlink fop.
+call_stub_t *
+fop_readlink_stub (call_frame_t *frame,
+ fop_readlink_t fn,
+ loc_t *loc,
+ size_t size);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@mode - mode parameter to mknod fop.
+@rdev - rdev parameter to mknod fop.
+call_stub_t *
+fop_mknod_stub (call_frame_t *frame,
+ fop_mknod_t fn,
+ loc_t *loc,
+ mode_t mode,
+ dev_t rdev);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@mode - mode parameter to mkdir fop.
+call_stub_t *
+fop_mkdir_stub (call_frame_t *frame,
+ fop_mkdir_t fn,
+ loc_t *loc,
+ mode_t mode);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+call_stub_t *
+fop_unlink_stub (call_frame_t *frame,
+ fop_unlink_t fn,
+ loc_t *loc);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+call_stub_t *
+fop_rmdir_stub (call_frame_t *frame,
+ fop_rmdir_t fn,
+ loc_t *loc);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@linkname - linkname parameter to symlink fop.
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+call_stub_t *
+fop_symlink_stub (call_frame_t *frame,
+ fop_symlink_t fn,
+ const char *linkname,
+ loc_t *loc);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@oldloc - pointer to location structure.
+ NOTE: @oldloc will be copied to a different location, with inode_ref() to
+ @oldloc->inode and @oldloc->parent, if not NULL. also @oldloc->path will
+ be copied to a different location, if not NULL.
+@newloc - pointer to location structure.
+ NOTE: @newloc will be copied to a different location, with inode_ref() to
+ @newloc->inode and @newloc->parent, if not NULL. also @newloc->path will
+ be copied to a different location, if not NULL.
+call_stub_t *
+fop_rename_stub (call_frame_t *frame,
+ fop_rename_t fn,
+ loc_t *oldloc,
+ loc_t *newloc);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@newpath - newpath parameter to link fop.
+call_stub_t *
+fop_link_stub (call_frame_t *frame,
+ fop_link_t fn,
+ loc_t *oldloc,
+ const char *newpath);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@flags - flags parameter to create fop.
+@mode - mode parameter to create fop.
+@fd - file descriptor parameter to create fop.
+ NOTE: @fd is stored with a fd_ref().
+call_stub_t *
+fop_create_stub (call_frame_t *frame,
+ fop_create_t fn,
+ loc_t *loc,
+ int32_t flags,
+ mode_t mode, fd_t *fd);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@flags - flags parameter to open fop.
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+call_stub_t *
+fop_open_stub (call_frame_t *frame,
+ fop_open_t fn,
+ loc_t *loc,
+ int32_t flags,
+ fd_t *fd);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to lk fop.
+ NOTE: @fd is stored with a fd_ref().
+@size - size parameter to readv fop.
+@off - offset parameter to readv fop.
+call_stub_t *
+fop_readv_stub (call_frame_t *frame,
+ fop_readv_t fn,
+ fd_t *fd,
+ size_t size,
+ off_t off);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to lk fop.
+ NOTE: @fd is stored with a fd_ref().
+@vector - vector parameter to writev fop.
+ NOTE: @vector is iov_dup()ed while creating stub. and frame->root->req_refs
+ dictionary is dict_ref()ed.
+@count - count parameter to writev fop.
+@off - off parameter to writev fop.
+call_stub_t *
+fop_writev_stub (call_frame_t *frame,
+ fop_writev_t fn,
+ fd_t *fd,
+ struct iovec *vector,
+ int32_t count,
+ off_t off);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to flush fop.
+ NOTE: @fd is stored with a fd_ref().
+call_stub_t *
+fop_flush_stub (call_frame_t *frame,
+ fop_flush_t fn,
+ fd_t *fd);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to lk fop.
+ NOTE: @fd is stored with a fd_ref().
+@datasync - datasync parameter to fsync fop.
+call_stub_t *
+fop_fsync_stub (call_frame_t *frame,
+ fop_fsync_t fn,
+ fd_t *fd,
+ int32_t datasync);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to @loc->inode and
+ @loc->parent, if not NULL. also @loc->path will be copied to a different location.
+@fd - file descriptor parameter to opendir fop.
+ NOTE: @fd is stored with a fd_ref().
+call_stub_t *
+fop_opendir_stub (call_frame_t *frame,
+ fop_opendir_t fn,
+ loc_t *loc,
+ fd_t *fd);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to getdents fop.
+ NOTE: @fd is stored with a fd_ref().
+@size - size parameter to getdents fop.
+@off - off parameter to getdents fop.
+@flags - flags parameter to getdents fop.
+call_stub_t *
+fop_getdents_stub (call_frame_t *frame,
+ fop_getdents_t fn,
+ fd_t *fd,
+ size_t size,
+ off_t off,
+ int32_t flag);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to setdents fop.
+ NOTE: @fd is stored with a fd_ref().
+@flags - flags parameter to setdents fop.
+@entries - entries parameter to setdents fop.
+call_stub_t *
+fop_setdents_stub (call_frame_t *frame,
+ fop_setdents_t fn,
+ fd_t *fd,
+ int32_t flags,
+ dir_entry_t *entries,
+ int32_t count);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to setdents fop.
+ NOTE: @fd is stored with a fd_ref().
+@datasync - datasync parameter to fsyncdir fop.
+call_stub_t *
+fop_fsyncdir_stub (call_frame_t *frame,
+ fop_fsyncdir_t fn,
+ fd_t *fd,
+ int32_t datasync);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+call_stub_t *
+fop_statfs_stub (call_frame_t *frame,
+ fop_statfs_t fn,
+ loc_t *loc);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@dict - dict parameter to setxattr fop.
+ NOTE: stub creation procedure stores @dict pointer with dict_ref() to it.
+call_stub_t *
+fop_setxattr_stub (call_frame_t *frame,
+ fop_setxattr_t fn,
+ loc_t *loc,
+ dict_t *dict,
+ int32_t flags);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@name - name parameter to getxattr fop.
+call_stub_t *
+fop_getxattr_stub (call_frame_t *frame,
+ fop_getxattr_t fn,
+ loc_t *loc,
+ const char *name);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@name - name parameter to removexattr fop.
+ NOTE: name string will be copied to a different location while creating stub.
+call_stub_t *
+fop_removexattr_stub (call_frame_t *frame,
+ fop_removexattr_t fn,
+ loc_t *loc,
+ const char *name);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to lk fop.
+ NOTE: @fd is stored with a fd_ref().
+@cmd - command parameter to lk fop.
+@lock - lock parameter to lk fop.
+ NOTE: lock will be copied to a different location while creating stub.
+call_stub_t *
+fop_lk_stub (call_frame_t *frame,
+ fop_lk_t fn,
+ fd_t *fd,
+ int32_t cmd,
+ struct flock *lock);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - fd parameter to gf_lk fop.
+ NOTE: @fd is fd_ref()ed while creating stub, if not NULL.
+@cmd - cmd parameter to gf_lk fop.
+@lock - lock paramater to gf_lk fop.
+ NOTE: @lock is copied to a different memory location while creating
+ stub.
+call_stub_t *
+fop_gf_lk_stub (call_frame_t *frame,
+ fop_gf_lk_t fn,
+ fd_t *fd,
+ int32_t cmd,
+ struct flock *lock);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@fd - file descriptor parameter to readdir fop.
+ NOTE: @fd is stored with a fd_ref().
+@size - size parameter to readdir fop.
+@off - offset parameter to readdir fop.
+call_stub_t *
+fop_readdir_stub (call_frame_t *frame,
+ fop_readdir_t fn,
+ fd_t *fd,
+ size_t size,
+ off_t off);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@loc - pointer to location structure.
+ NOTE: @loc will be copied to a different location, with inode_ref() to
+ @loc->inode and @loc->parent, if not NULL. also @loc->path will be
+ copied to a different location.
+@flags - flags parameter to checksum fop.
+call_stub_t *
+fop_checksum_stub (call_frame_t *frame,
+ fop_checksum_t fn,
+ loc_t *loc,
+ int32_t flags);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@inode - inode parameter to @fn.
+ NOTE: @inode pointer is stored with a inode_ref().
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+@dict - dict parameter to @fn.
+ NOTE: @dict pointer is stored with dict_ref().
+call_stub_t *
+fop_lookup_cbk_stub (call_frame_t *frame,
+ fop_lookup_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
+ struct stat *buf,
+ dict_t *dict);
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_stat_cbk_stub (call_frame_t *frame,
+ fop_stat_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_fstat_cbk_stub (call_frame_t *frame,
+ fop_fstat_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_chmod_cbk_stub (call_frame_t *frame,
+ fop_chmod_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_fchmod_cbk_stub (call_frame_t *frame,
+ fop_fchmod_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_chown_cbk_stub (call_frame_t *frame,
+ fop_chown_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_fchown_cbk_stub (call_frame_t *frame,
+ fop_fchown_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_truncate_cbk_stub (call_frame_t *frame,
+ fop_truncate_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_ftruncate_cbk_stub (call_frame_t *frame,
+ fop_ftruncate_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_utimens_cbk_stub (call_frame_t *frame,
+ fop_utimens_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+call_stub_t *
+fop_access_cbk_stub (call_frame_t *frame,
+ fop_access_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@path - path parameter to @fn.
+ NOTE: @path is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_readlink_cbk_stub (call_frame_t *frame,
+ fop_readlink_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ const char *path);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@inode - inode parameter to @fn.
+ NOTE: @inode pointer is stored with a inode_ref().
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_mknod_cbk_stub (call_frame_t *frame,
+ fop_mknod_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@inode - inode parameter to @fn.
+ NOTE: @inode pointer is stored with a inode_ref().
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_mkdir_cbk_stub (call_frame_t *frame,
+ fop_mkdir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+call_stub_t *
+fop_unlink_cbk_stub (call_frame_t *frame,
+ fop_unlink_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+call_stub_t *
+fop_rmdir_cbk_stub (call_frame_t *frame,
+ fop_rmdir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@inode - inode parameter to @fn.
+ NOTE: @inode pointer is stored with a inode_ref().
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_symlink_cbk_stub (call_frame_t *frame,
+ fop_symlink_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_rename_cbk_stub (call_frame_t *frame,
+ fop_rename_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@inode - inode parameter to @fn.
+ NOTE: @inode pointer is stored with a inode_ref().
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_link_cbk_stub (call_frame_t *frame,
+ fop_link_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ inode_t *inode,
+ struct stat *buf);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@fd - fd parameter to @fn.
+ NOTE: @fd pointer is stored with a fd_ref().
+@inode - inode parameter to @fn.
+ NOTE: @inode pointer is stored with a inode_ref().
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_create_cbk_stub (call_frame_t *frame,
+ fop_create_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ fd_t *fd,
+ inode_t *inode,
+ struct stat *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@fd - fd parameter to @fn.
+ NOTE: @fd pointer is stored with a fd_ref().
+call_stub_t *
+fop_open_cbk_stub (call_frame_t *frame,
+ fop_open_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ fd_t *fd);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@vector - vector parameter to @fn.
+ NOTE: @vector is copied to a different memory location, if not NULL. also
+ frame->root->rsp_refs is dict_ref()ed.
+@stbuf - stbuf parameter to @fn.
+ NOTE: @stbuf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_readv_cbk_stub (call_frame_t *frame,
+ fop_readv_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct iovec *vector,
+ int32_t count,
+ struct stat *stbuf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@stbuf - stbuf parameter to @fn.
+ NOTE: @stbuf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_writev_cbk_stub (call_frame_t *frame,
+ fop_writev_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *stbuf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+call_stub_t *
+fop_flush_cbk_stub (call_frame_t *frame,
+ fop_flush_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+call_stub_t *
+fop_fsync_cbk_stub (call_frame_t *frame,
+ fop_fsync_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@fd - fd parameter to @fn.
+ NOTE: @fd pointer is stored with a fd_ref().
+call_stub_t *
+fop_opendir_cbk_stub (call_frame_t *frame,
+ fop_opendir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ fd_t *fd);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@entries - entries parameter to @fn.
+@count - count parameter to @fn.
+call_stub_t *
+fop_getdents_cbk_stub (call_frame_t *frame,
+ fop_getdents_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ dir_entry_t *entries,
+ int32_t count);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+call_stub_t *
+fop_setdents_cbk_stub (call_frame_t *frame,
+ fop_setdents_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+call_stub_t *
+fop_fsyncdir_cbk_stub (call_frame_t *frame,
+ fop_fsyncdir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@buf - buf parameter to @fn.
+ NOTE: @buf is copied to a different memory location, if not NULL.
+call_stub_t *
+fop_statfs_cbk_stub (call_frame_t *frame,
+ fop_statfs_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct statvfs *buf);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+call_stub_t *
+fop_setxattr_cbk_stub (call_frame_t *frame,
+ fop_setxattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@value - value dictionary parameter to @fn.
+ NOTE: @value pointer is stored with a dict_ref().
+call_stub_t *
+fop_getxattr_cbk_stub (call_frame_t *frame,
+ fop_getxattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ dict_t *value);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+call_stub_t *
+fop_removexattr_cbk_stub (call_frame_t *frame,
+ fop_removexattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@lock - lock parameter to @fn.
+ NOTE: @lock is copied to a different memory location while creating
+ stub.
+call_stub_t *
+fop_lk_cbk_stub (call_frame_t *frame,
+ fop_lk_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct flock *lock);
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@lock - lock parameter to @fn.
+ NOTE: @lock is copied to a different memory location while creating
+ stub.
+call_stub_t *
+fop_gf_lk_cbk_stub (call_frame_t *frame,
+ fop_gf_lk_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct flock *lock);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@entries - entries parameter to @fn.
+call_stub_t *
+fop_readdir_cbk_stub (call_frame_t *frame,
+ fop_readdir_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ gf_dirent_t *entries);
+
+
+@frame - call frame which has to be used to resume the call at call_resume().
+@fn - procedure to call during call_resume().
+@op_ret - op_ret parameter to @fn.
+@op_errno - op_errno parameter to @fn.
+@file_checksum - file_checksum parameter to @fn.
+ NOTE: file_checksum will be copied to a different memory location
+ while creating stub.
+@dir_checksum - dir_checksum parameter to @fn.
+ NOTE: file_checksum will be copied to a different memory location
+ while creating stub.
+call_stub_t *
+fop_checksum_cbk_stub (call_frame_t *frame,
+ fop_checksum_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno,
+ uint8_t *file_checksum,
+ uint8_t *dir_checksum);
+
+resuming a call:
+---------------
+ call can be resumed using call stub through call_resume API.
+
+ void call_resume (call_stub_t *stub);
+
+ stub - call stub created during pausing a call.
+
+ NOTE: call_resume() will decrease reference count of any fd_t, dict_t and inode_t that it finds
+ in stub->args.<operation>.<fd_t-or-inode_t-or-dict_t>. so, if any fd_t, dict_t or
+ inode_t pointers are assigned at stub->args.<operation>.<fd_t-or-inode_t-or-dict_t> after
+ fop_<operation>_stub() call, they must be <fd_t-or-inode_t-or-dict_t>_ref()ed.
+
+ call_resume does not STACK_DESTROY() for any fop.
+
+ if stub->fn is NULL, call_resume does STACK_WIND() or STACK_UNWIND() using the stub->frame.
+
+ return - call resume fails only if stub is NULL. call resume fails with errno set to EINVAL.
diff --git a/doc/hacker-guide/hacker-guide.tex b/doc/hacker-guide/hacker-guide.tex
new file mode 100644
index 00000000000..72c44df1a33
--- /dev/null
+++ b/doc/hacker-guide/hacker-guide.tex
@@ -0,0 +1,312 @@
+\documentclass{book}[12pt]
+\usepackage{graphicx}
+% \usepackage{fancyhdr}
+
+% \pagestyle{fancy}
+\begin{document}
+
+% \headheight 117pt
+% \rhead{\includegraphics{zr-logo.eps}}
+
+\author{Z Research}
+\title{GlusterFS 1.3 Hacker's Guide}
+\date{June 1, 2007}
+
+\maketitle
+\frontmatter
+\tableofcontents
+
+\mainmatter
+\chapter{Introduction}
+
+\section{Coding guidelines}
+GlusterFS uses GNU Arch for version control. To get the latest source do:
+\begin{verbatim}
+ $ tla register-archive http://arch.sv.gnu.org/archives/gluster
+ $ tla -A gluster@sv.gnu.org get glusterfs--mainline--2.4
+\end{verbatim}
+\noindent
+GlusterFS follows the GNU coding
+standards\footnote{http://www.gnu.org/prep/standards\_toc.html} for the
+most part.
+
+\chapter{Major components}
+\section{libglusterfs}
+\texttt{libglusterfs} contains supporting code used by all the other components.
+The important files here are:
+
+\texttt{dict.c}: This is an implementation of a serializable dictionary type. It is
+used by the protocol code to send requests and replies. It is also used to pass options
+to translators.
+
+\texttt{logging.c}: This is a thread-safe logging library. The log messages go to a
+file (default \texttt{/usr/local/var/log/glusterfs/*}).
+
+\texttt{protocol.c}: This file implements the GlusterFS on-the-wire
+protocol. The protocol itself is a simple ASCII protocol, designed to
+be easy to parse and be human readable.
+
+A sample GlusterFS protocol block looks like this:
+\begin{verbatim}
+ Block Start header
+ 0000000000000023 callid
+ 00000001 type
+ 00000016 op
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx human-readable name
+ 00000000000000000000000000000ac3 block size
+ <...> block
+ Block End
+\end{verbatim}
+
+\texttt{stack.h}: This file defines the \texttt{STACK\_WIND} and
+\texttt{STACK\_UNWIND} macros which are used to implement the parallel
+stack that is maintained for inter-xlator calls. See the \textsl{Taking control
+of the stack} section below for more details.
+
+\texttt{spec.y}: This contains the Yacc grammar for the GlusterFS
+specification file, and the parsing code.
+
+
+Draw diagrams of trees
+Two rules:
+(1) directory structure is same
+(2) file can exist only on one node
+
+\section{glusterfs-fuse}
+\section{glusterfsd}
+\section{transport}
+\section{scheduler}
+\section{xlator}
+
+\chapter{xlators}
+\section{Taking control of the stack}
+One can think of STACK\_WIND/UNWIND as a very specific RPC mechanism.
+
+% \includegraphics{stack.eps}
+
+\section{Overview of xlators}
+
+\flushleft{\LARGE\texttt{cluster/}}
+\vskip 2ex
+\flushleft{\Large\texttt{afr}}
+\vskip 2ex
+\flushleft{\Large\texttt{stripe}}
+\vskip 2ex
+\flushleft{\Large\texttt{unify}}
+
+\vskip 4ex
+\flushleft{\LARGE\texttt{debug/}}
+\vskip 2ex
+\flushleft{\Large\texttt{trace}}
+\vskip 2ex
+The trace xlator simply logs all fops and mops, and passes them through to its child.
+
+\vskip 4ex
+\flushleft{\LARGE\texttt{features/}}
+\flushleft{\Large\texttt{posix-locks}}
+\vskip 2ex
+This xlator implements \textsc{posix} record locking semantics over
+any kind of storage.
+
+\vskip 4ex
+\flushleft{\LARGE\texttt{performance/}}
+
+\flushleft{\Large\texttt{io-threads}}
+\vskip 2ex
+\flushleft{\Large\texttt{read-ahead}}
+\vskip 2ex
+\flushleft{\Large\texttt{stat-prefetch}}
+\vskip 2ex
+\flushleft{\Large\texttt{write-behind}}
+\vskip 2ex
+
+\vskip 4ex
+\flushleft{\LARGE\texttt{protocol/}}
+\vskip 2ex
+
+\flushleft{\Large\texttt{client}}
+\vskip 2ex
+
+\flushleft{\Large\texttt{server}}
+\vskip 2ex
+
+\vskip 4ex
+\flushleft{\LARGE\texttt{storage/}}
+\flushleft{\Large\texttt{posix}}
+\vskip 2ex
+The \texttt{posix} xlator is the one which actually makes calls to the
+on-disk filesystem. Currently this is the only storage xlator available. However,
+plans to develop other storage xlators, such as one for Amazon's S3 service, are
+on the roadmap.
+
+\chapter{Writing a simple xlator}
+\noindent
+In this section we're going to write a rot13 xlator. ``Rot13'' is a
+simple substitution cipher which obscures a text by replacing each
+letter with the letter thirteen places down the alphabet. So `a' (0)
+would become `n' (12), `b' would be 'm', and so on. Rot13 applied to
+a piece of ciphertext yields the plaintext again, because rot13 is its
+own inverse, since:
+
+\[
+x_c = x + 13\; (mod\; 26)
+\]
+\[
+x_c + 13\; (mod\; 26) = x + 13 + 13\; (mod\; 26) = x
+\]
+
+First we include the requisite headers.
+
+\begin{verbatim}
+#include <ctype.h>
+#include <sys/uio.h>
+
+#include "glusterfs.h"
+#include "xlator.h"
+#include "logging.h"
+
+/*
+ * This is a rot13 ``encryption'' xlator. It rot13's data when
+ * writing to disk and rot13's it back when reading it.
+ * This xlator is meant as an example, not for production
+ * use ;) (hence no error-checking)
+ */
+
+\end{verbatim}
+
+Then we write the rot13 function itself. For simplicity, we only transform lower case
+letters. Any other byte is passed through as it is.
+
+\begin{verbatim}
+/* We only handle lower case letters for simplicity */
+static void
+rot13 (char *buf, int len)
+{
+ int i;
+ for (i = 0; i < len; i++) {
+ if (isalpha (buf[i]))
+ buf[i] = (buf[i] - 'a' + 13) % 26;
+ else if (buf[i] <= 26)
+ buf[i] = (buf[i] + 13) % 26 + 'a';
+ }
+}
+\end{verbatim}
+
+Next comes a utility function whose purpose will be clear after looking at the code
+below.
+
+\begin{verbatim}
+static void
+rot13_iovec (struct iovec *vector, int count)
+{
+ int i;
+ for (i = 0; i < count; i++) {
+ rot13 (vector[i].iov_base, vector[i].iov_len);
+ }
+}
+\end{verbatim}
+
+\begin{verbatim}
+static int32_t
+rot13_readv_cbk (call_frame_t *frame,
+ call_frame_t *prev_frame,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct iovec *vector,
+ int32_t count)
+{
+ rot13_iovec (vector, count);
+
+ STACK_UNWIND (frame, op_ret, op_errno, vector, count);
+ return 0;
+}
+
+static int32_t
+rot13_readv (call_frame_t *frame,
+ xlator_t *this,
+ dict_t *ctx,
+ size_t size,
+ off_t offset)
+{
+ STACK_WIND (frame,
+ rot13_readv_cbk,
+ FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->readv,
+ ctx, size, offset);
+ return 0;
+}
+
+static int32_t
+rot13_writev_cbk (call_frame_t *frame,
+ call_frame_t *prev_frame,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno)
+{
+ STACK_UNWIND (frame, op_ret, op_errno);
+ return 0;
+}
+
+static int32_t
+rot13_writev (call_frame_t *frame,
+ xlator_t *this,
+ dict_t *ctx,
+ struct iovec *vector,
+ int32_t count,
+ off_t offset)
+{
+ rot13_iovec (vector, count);
+
+ STACK_WIND (frame,
+ rot13_writev_cbk,
+ FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->writev,
+ ctx, vector, count, offset);
+ return 0;
+}
+
+\end{verbatim}
+
+Every xlator must define two functions and two external symbols. The functions are
+\texttt{init} and \texttt{fini}, and the symbols are \texttt{fops} and \texttt{mops}.
+The \texttt{init} function is called when the xlator is loaded by GlusterFS, and
+contains code for the xlator to initialize itself. Note that if an xlator is present
+multiple times in the spec tree, the \texttt{init} function will be called each time
+the xlator is loaded.
+
+\begin{verbatim}
+int32_t
+init (xlator_t *this)
+{
+ if (!this->children) {
+ gf_log ("rot13", GF_LOG_ERROR,
+ "FATAL: rot13 should have exactly one child");
+ return -1;
+ }
+
+ gf_log ("rot13", GF_LOG_DEBUG, "rot13 xlator loaded");
+ return 0;
+}
+\end{verbatim}
+
+\begin{verbatim}
+
+void
+fini (xlator_t *this)
+{
+ return;
+}
+
+struct xlator_fops fops = {
+ .readv = rot13_readv,
+ .writev = rot13_writev
+};
+
+struct xlator_mops mops = {
+};
+
+\end{verbatim}
+
+\end{document}
+
diff --git a/doc/hacker-guide/posix.txt b/doc/hacker-guide/posix.txt
new file mode 100644
index 00000000000..d0132abfedc
--- /dev/null
+++ b/doc/hacker-guide/posix.txt
@@ -0,0 +1,59 @@
+---------------
+* storage/posix
+---------------
+
+- SET_FS_ID
+
+ This is so that all filesystem checks are done with the user's
+ uid/gid and not GlusterFS's uid/gid.
+
+- MAKE_REAL_PATH
+
+ This macro concatenates the base directory of the posix volume
+ ('option directory') with the given path.
+
+- need_xattr in lookup
+
+ If this flag is passed, lookup returns a xattr dictionary that contains
+ the file's create time, the file's contents, and the version number
+ of the file.
+
+ This is a hack to increase small file performance. If an application
+ wants to read a small file, it can finish its job with just a lookup
+ call instead of a lookup followed by read.
+
+- getdents/setdents
+
+ These are used by unify to set and get directory entries.
+
+- ALIGN_BUF
+
+ Macro to align an address to a page boundary (4K).
+
+- priv->export_statfs
+
+ In some cases, two exported volumes may reside on the same
+ partition on the server. Sending statvfs info for both
+ the volumes will lead to erroneous df output at the client,
+ since free space on the partition will be counted twice.
+
+ In such cases, user can disable exporting statvfs info
+ on one of the volumes by setting this option.
+
+- xattrop
+
+ This fop is used by replicate to set version numbers on files.
+
+- getxattr/setxattr hack to read/write files
+
+ A key, GLUSTERFS_FILE_CONTENT_STRING, is handled in a special way by
+ getxattr/setxattr. A getxattr with the key will return the entire
+ content of the file as the value. A setxattr with the key will write
+ the value as the entire content of the file.
+
+- posix_checksum
+
+ This calculates a simple XOR checksum on all entry names in a
+ directory that is used by unify to compare directory contents.
+
+
diff --git a/doc/hacker-guide/replicate.txt b/doc/hacker-guide/replicate.txt
new file mode 100644
index 00000000000..284f373fb6f
--- /dev/null
+++ b/doc/hacker-guide/replicate.txt
@@ -0,0 +1,206 @@
+---------------
+* cluster/replicate
+---------------
+
+Before understanding replicate, one must understand two internal FOPs:
+
+GF_FILE_LK:
+ This is exactly like fcntl(2) locking, except the locks are in a
+ separate domain from locks held by applications.
+
+GF_DIR_LK (loc_t *loc, char *basename):
+ This allows one to lock a name under a directory. For example,
+ to lock /mnt/glusterfs/foo, one would use the call:
+
+ GF_DIR_LK ({loc_t for "/mnt/glusterfs"}, "foo")
+
+ If one wishes to lock *all* the names under a particular directory,
+ supply the basename argument as NULL.
+
+ The locks can either be read locks or write locks; consult the
+ function prototype for more details.
+
+Both these operations are implemented by the features/locks (earlier
+known as posix-locks) translator.
+
+--------------
+* Basic design
+--------------
+
+All FOPs can be classified into four major groups:
+
+ - inode-read
+ Operations that read an inode's data (file contents) or metadata (perms, etc.).
+
+ access, getxattr, fstat, readlink, readv, stat.
+
+ - inode-write
+ Operations that modify an inode's data or metadata.
+
+ chmod, chown, truncate, writev, utimens.
+
+ - dir-read
+ Operations that read a directory's contents or metadata.
+
+ readdir, getdents, checksum.
+
+ - dir-write
+ Operations that modify a directory's contents or metadata.
+
+ create, link, mkdir, mknod, rename, rmdir, symlink, unlink.
+
+ Some of these make a subgroup in that they modify *two* different entries:
+ link, rename, symlink.
+
+ - Others
+ Other operations.
+
+ flush, lookup, open, opendir, statfs.
+
+------------
+* Algorithms
+------------
+
+Each of the four major groups has its own algorithm:
+
+ ----------------------
+ - inode-read, dir-read
+ ----------------------
+
+ = Send a request to the first child that is up:
+ - if it fails:
+ try the next available child
+ - if we have exhausted all children:
+ return failure
+
+ -------------
+ - inode-write
+ -------------
+
+ All operations are done in parallel unless specified otherwise.
+
+ (1) Send a GF_FILE_LK request on all children for a write lock on
+ the appropriate region
+ (for metadata operations: entire file (0, 0)
+ for writev: (offset, offset+size of buffer))
+
+ - If a lock request fails on a child:
+ unlock all children
+ try to acquire a blocking lock (F_SETLKW) on each child, serially.
+
+ If this fails (due to ENOTCONN or EINVAL):
+ Consider this child as dead for rest of transaction.
+
+ (2) Mark all children as "pending" on all (alive) children
+ (see below for meaning of "pending").
+
+ - If it fails on any child:
+ mark it as dead (in transaction local state).
+
+ (3) Perform operation on all (alive) children.
+
+ - If it fails on any child:
+ mark it as dead (in transaction local state).
+
+ (4) Unmark all successful children as not "pending" on all nodes.
+
+ (5) Unlock region on all (alive) children.
+
+ -----------
+ - dir-write
+ -----------
+
+ The algorithm for dir-write is same as above except instead of holding
+ GF_FILE_LK locks we hold a GF_DIR_LK lock on the name being operated upon.
+ In case of link-type calls, we hold locks on both the operand names.
+
+-----------
+* "pending"
+-----------
+
+ The "pending" number is like a journal entry. A pending entry is an
+ array of 32-bit integers stored in network byte-order as the extended
+ attribute of an inode (which can be a directory as well).
+
+ There are three keys corresponding to three types of pending operations:
+
+ - AFR_METADATA_PENDING
+ There are some metadata operations pending on this inode (perms, ctime/mtime,
+ xattr, etc.).
+
+ - AFR_DATA_PENDING
+ There is some data pending on this inode (writev).
+
+ - AFR_ENTRY_PENDING
+ There are some directory operations pending on this directory
+ (create, unlink, etc.).
+
+-----------
+* Self heal
+-----------
+
+ - On lookup, gather extended attribute data:
+ - If entry is a regular file:
+ - If an entry is present on one child and not on others:
+ - create entry on others.
+ - If entries exist but have different metadata (perms, etc.):
+ - consider the entry with the highest AFR_METADATA_PENDING number as
+ definitive and replicate its attributes on children.
+
+ - If entry is a directory:
+ - Consider the entry with the higest AFR_ENTRY_PENDING number as
+ definitive and replicate its contents on all children.
+
+ - If any two entries have non-matching types (i.e., one is file and
+ other is directory):
+ - Announce to the user via log that a split-brain situation has been
+ detected, and do nothing.
+
+ - On open, gather extended attribute data:
+ - Consider the file with the highest AFR_DATA_PENDING number as
+ the definitive one and replicate its contents on all other
+ children.
+
+ During all self heal operations, appropriate locks must be held on all
+ regions/entries being affected.
+
+---------------
+* Inode scaling
+---------------
+
+Inode scaling is necessary because if a situation arises where:
+ - An inode number is returned for a directory (by lookup) which was
+ previously the inode number of a file (as per FUSE's table), then
+ FUSE gets horribly confused (consult a FUSE expert for more details).
+
+To avoid such a situation, we distribute the 64-bit inode space equally
+among all children of replicate.
+
+To illustrate:
+
+If c1, c2, c3 are children of replicate, they each get 1/3 of the available
+inode space:
+
+Child: c1 c2 c3 c1 c2 c3 c1 c2 c3 c1 c2 ...
+Inode number: 1 2 3 4 5 6 7 8 9 10 11 ...
+
+Thus, if lookup on c1 returns an inode number "2", it is scaled to "4"
+(which is the second inode number in c1's space).
+
+This way we ensure that there is never a collision of inode numbers from
+two different children.
+
+This reduction of inode space doesn't really reduce the usability of
+replicate since even if we assume replicate has 1024 children (which would be a
+highly unusual scenario), each child still has a 54-bit inode space.
+
+2^54 ~ 1.8 * 10^16
+
+which is much larger than any real world requirement.
+
+
+==============================================
+$ Last updated: Sun Oct 12 23:17:01 IST 2008 $
+$ Author: Vikas Gorur <vikas@zresearch.com> $
+==============================================
+
diff --git a/doc/hacker-guide/write-behind.txt b/doc/hacker-guide/write-behind.txt
new file mode 100644
index 00000000000..498e95480ae
--- /dev/null
+++ b/doc/hacker-guide/write-behind.txt
@@ -0,0 +1,45 @@
+basic working
+--------------
+
+ write behind is basically a translator to lie to the application that the write-requests are finished, even before it is actually finished.
+
+ on a regular translator tree without write-behind, control flow is like this:
+
+ 1. application makes a write() system call.
+ 2. VFS ==> FUSE ==> /dev/fuse.
+ 3. fuse-bridge initiates a glusterfs writev() call.
+ 4. writev() is STACK_WIND()ed upto client-protocol or storage translator.
+ 5. client-protocol, on recieving reply from server, starts STACK_UNWIND() towards the fuse-bridge.
+
+ on a translator tree with write-behind, control flow is like this:
+
+ 1. application makes a write() system call.
+ 2. VFS ==> FUSE ==> /dev/fuse.
+ 3. fuse-bridge initiates a glusterfs writev() call.
+ 4. writev() is STACK_WIND()ed upto write-behind translator.
+ 5. write-behind adds the write buffer to its internal queue and does a STACK_UNWIND() towards the fuse-bridge.
+
+ write call is completed in application's percepective. after STACK_UNWIND()ing towards the fuse-bridge, write-behind initiates a fresh writev() call to its child translator, whose replies will be consumed by write-behind itself. write-behind _doesn't_ cache the write buffer, unless 'option flush-behind on' is specified in volume specification file.
+
+windowing
+---------
+
+ write respect to write-behind, each write-buffer has three flags: 'stack_wound', 'write_behind' and 'got_reply'.
+
+ stack_wound: if set, indicates that write-behind has initiated STACK_WIND() towards child translator.
+
+ write_behind: if set, indicates that write-behind has done STACK_UNWIND() towards fuse-bridge.
+
+ got_reply: if set, indicates that write-behind has recieved reply from child translator for a writev() STACK_WIND(). a request will be destroyed by write-behind only if this flag is set.
+
+ currently pending write requests = aggregate size of requests with write_behind = 1 and got_reply = 0.
+
+ window size limits the aggregate size of currently pending write requests. once the pending requests' size has reached the window size, write-behind blocks writev() calls from fuse-bridge.
+ blocking is only from application's perspective. write-behind does STACK_WIND() to child translator straight-away, but hold behind the STACK_UNWIND() towards fuse-bridge. STACK_UNWIND() is done only once write-behind gets enough replies to accomodate for currently blocked request.
+
+flush behind
+------------
+
+ if 'option flush-behind on' is specified in volume specification file, then write-behind sends aggregate write requests to child translator, instead of regular per request STACK_WIND()s.
+
+
diff --git a/doc/handling-options.txt b/doc/handling-options.txt
new file mode 100644
index 00000000000..cac1fe93947
--- /dev/null
+++ b/doc/handling-options.txt
@@ -0,0 +1,13 @@
+
+How to add a new option to a given volume ?
+===========================================
+
+* Add a entry in 'struct volume_options options[]' with your key, what is
+ the type of the 'key', etc.
+
+* The 'key' and corresponding 'value' given for the same by user are validated
+ before calling init() of the translator/transport/scheduler/auth-module.
+
+* Once the complete init() is successful, user will get a warning if he has
+ given a 'key' which is not defined in these modules.
+
diff --git a/doc/mac-related-xattrs.txt b/doc/mac-related-xattrs.txt
new file mode 100644
index 00000000000..805658334e6
--- /dev/null
+++ b/doc/mac-related-xattrs.txt
@@ -0,0 +1,21 @@
+
+This document is intended to briefly explain how the Extended Attributes on
+Darwin 10.5.x releases works
+----
+
+On Darwin other than all the normal filesystem operations, 'Finder' (like
+Explorer in Windows but a little more) keeps its information in two extended
+attributes named 'com.apple.FinderInfo' and 'com.apple.ResourceFork'. If these
+xattrs are not implemented the filesystem won't be shown on Finder, and if they
+are not implemented properly there may be issues when some of the file operations
+are done through GUI of Finder. But when a filesystem is used over mountpoint in a
+terminal, everything is fine and these xattrs are not required.
+
+Currently the way these xattrs are implemented is simple. All the xattr calls
+(getxattr, setxattr, listxattr, removexattr) are passed down to underlaying filesystem,
+most of the cases when exported FS is on MacOS X itself, these keys are supported, hence
+the fops succeed. But in the case of using exports of different OS on Darwin the issue is
+extended attribute prefix like 'com.apple.' may not be supported, hence the problem with
+Finder. To solve this issue, GlusterFS returns virtual default values to these keys, which
+works fine on most of the cases.
+
diff --git a/doc/porting_guide.txt b/doc/porting_guide.txt
new file mode 100644
index 00000000000..905bb422858
--- /dev/null
+++ b/doc/porting_guide.txt
@@ -0,0 +1,45 @@
+ GlusterFS Porting Guide
+ -----------------------
+
+* General setup
+
+The configure script will detect the target platform for the build.
+All platform-specific CFLAGS, macro definitions should be done
+in configure.ac
+
+Platform-specific code can be written like this:
+
+#ifdef GF_DARWIN_HOST_OS
+ /* some code specific to Darwin */
+#endif
+
+* Coding guidelines
+
+In general, avoid glibc extensions. For example, nested functions don't work
+on Mac OS X. It is best to stick to C99.
+
+When using library calls and system calls, pay attention to the
+portability notes. As far as possible stick to POSIX-specified behavior.
+Do not use anything expressly permitted by the specification. For example,
+some fields in structures may be present only on certain platforms. Avoid
+use of such things.
+
+Do not pass values of constants such as F_*, O_*, errno values, etc. across
+platforms.
+
+Please refer compat-errno.h for more details about errno handling inside
+glusterfs for cross platform.
+
+* Specific issues
+
+- The argp library is available only on Linux through glibc, but for other
+ platforms glusterfs has already included argp-standalone library which will
+ statically linked during the glusterfs build.
+
+- Extended attribute calls (setxattr, listxattr, etc.) have differing prototypes
+ on different platforms. See compat.h for macro definitions to resolve this, also
+ read out the specific extended attribute documentation for your platforms.
+
+------------------------------------------
+Last revised: Thu Feb 28 13:58:07 IST 2008
+------------------------------------------
diff --git a/doc/qa/qa-client.vol b/doc/qa/qa-client.vol
new file mode 100644
index 00000000000..176dda5892a
--- /dev/null
+++ b/doc/qa/qa-client.vol
@@ -0,0 +1,170 @@
+# This spec file should be used for testing before any release
+#
+
+# 1st client
+volume client1
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+# option transport-type ib-verbs # for ib-verbs transport
+# option transport.ib-verbs.work-request-send-size 131072
+# option transport.ib-verbs.work-request-send-count 64
+# option transport.ib-verbs.work-request-recv-size 131072
+# option transport.ib-verbs.work-request-recv-count 64
+ option remote-host 127.0.0.1
+ option remote-subvolume ra1
+end-volume
+
+# 2nd client
+volume client2
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+# option transport-type ib-verbs # for ib-verbs transport
+ option remote-host 127.0.0.1
+ option remote-subvolume ra2
+end-volume
+
+# 3rd client
+volume client3
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+# option transport-type ib-verbs # for ib-verbs transport
+ option remote-host 127.0.0.1
+ option remote-subvolume ra3
+end-volume
+
+# 4th client
+volume client4
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+# option transport-type ib-verbs # for ib-verbs transport
+ option remote-host 127.0.0.1
+ option remote-subvolume ra4
+end-volume
+
+# 5th client
+volume client5
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+# option transport-type ib-verbs # for ib-verbs transport
+ option remote-host 127.0.0.1
+ option remote-subvolume ra5
+end-volume
+
+# 6th client
+volume client6
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+# option transport-type ib-verbs # for ib-verbs transport
+ option remote-host 127.0.0.1
+ option remote-subvolume ra6
+end-volume
+
+# 7th client
+volume client7
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+# option transport-type ib-verbs # for ib-verbs transport
+ option remote-host 127.0.0.1
+ option remote-subvolume ra7
+end-volume
+
+# 8th client
+volume client8
+ type protocol/client
+ option transport-type tcp # for TCP/IP transport
+# option transport-type ib-sdp # for Infiniband transport
+# option transport-type ib-verbs # for ib-verbs transport
+ option remote-host 127.0.0.1
+ option remote-subvolume ra8
+end-volume
+
+# 1st Stripe (client1 client2)
+volume stripe1
+ type cluster/stripe
+ subvolumes client1 client2
+ option block-size 128KB # all striped in 128kB block
+end-volume
+
+# 2st Stripe (client3 client4)
+volume stripe2
+ type cluster/stripe
+ subvolumes client3 client4
+ option block-size 128KB # all striped in 128kB block
+end-volume
+
+# 3st Stripe (client5 client6)
+volume stripe3
+ type cluster/stripe
+ subvolumes client5 client6
+ option block-size 128KB # all striped in 128kB block
+end-volume
+
+# 4st Stripe (client7 client8)
+volume stripe4
+ type cluster/stripe
+ subvolumes client7 client8
+ option block-size 128KB # all striped in 128kB block
+end-volume
+
+
+# 1st replicate
+volume replicate1
+ type cluster/replicate
+ subvolumes stripe1 stripe2
+end-volume
+
+# 2nd replicate
+volume replicate2
+ type cluster/replicate
+ subvolumes stripe3 stripe4
+end-volume
+
+volume ns
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option remote-subvolume brick-ns
+end-volume
+
+# Unify
+volume unify0
+ type cluster/unify
+ subvolumes replicate1 replicate2
+# subvolumes stripe1 stripe3
+ option namespace ns
+ option scheduler rr # random # alu # nufa
+ option rr.limits.min-free-disk 1GB
+# option alu.order x
+# option alu.x.entry-threshold
+# option alu.x.exit-threshold
+end-volume
+
+
+# ==== Performance Translators ====
+# The default options for performance translators should be the best for 90+% of the cases
+volume iot
+ type performance/io-threads
+ subvolumes unify0
+end-volume
+
+volume wb
+ type performance/write-behind
+ subvolumes iot
+end-volume
+
+volume ioc
+ type performance/io-cache
+ subvolumes wb
+end-volume
+
+volume ra
+ type performance/read-ahead
+ subvolumes ioc
+end-volume
diff --git a/doc/qa/qa-high-avail-client.vol b/doc/qa/qa-high-avail-client.vol
new file mode 100644
index 00000000000..69cb8dd30f1
--- /dev/null
+++ b/doc/qa/qa-high-avail-client.vol
@@ -0,0 +1,17 @@
+volume client
+ type protocol/client
+ option transport-type tcp
+ option remote-host localhost
+ option transport.socket.remote-port 7001
+ option remote-subvolume server1-iot
+end-volume
+
+volume ra
+ type performance/read-ahead
+ subvolumes client
+end-volume
+
+volume wb
+ type performance/write-behind
+ subvolumes ra
+end-volume
diff --git a/doc/qa/qa-high-avail-server.vol b/doc/qa/qa-high-avail-server.vol
new file mode 100644
index 00000000000..09d91c4c43b
--- /dev/null
+++ b/doc/qa/qa-high-avail-server.vol
@@ -0,0 +1,346 @@
+
+# -- server 1 --
+volume server1-posix1
+ type storage/posix
+ option directory /tmp/ha-export1/
+end-volume
+
+volume server1-ns1
+ type storage/posix
+ option directory /tmp/ha-export-ns1/
+end-volume
+
+volume server1-client2
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7002
+ option remote-subvolume server2-posix2
+end-volume
+
+volume server1-ns2
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7002
+ option remote-subvolume server2-ns2
+end-volume
+
+volume server1-client3
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7003
+ option remote-subvolume server3-posix3
+end-volume
+
+volume server1-ns3
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7003
+ option remote-subvolume server3-ns3
+end-volume
+
+volume server1-io1
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server1-posix1
+end-volume
+
+
+volume server1-io2
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server1-client2
+end-volume
+
+volume server1-io3
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server1-client3
+end-volume
+
+volume server1-ns-io1
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server1-ns1
+end-volume
+
+volume server1-ns-io2
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server1-ns2
+end-volume
+
+volume server1-ns-io3
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server1-ns3
+end-volume
+
+volume server1-ns-replicate
+ type cluster/replicate
+ subvolumes server1-ns-io1 server1-ns-io2 server1-ns-io3
+end-volume
+
+volume server1-storage-replicate
+ type cluster/replicate
+ subvolumes server1-io1 server1-io2 server1-io3
+end-volume
+
+volume server1-unify
+ type cluster/unify
+ #option self-heal off
+ subvolumes server1-storage-replicate
+ option namespace server1-ns-replicate
+ option scheduler rr
+end-volume
+
+volume server1-iot
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server1-unify
+end-volume
+
+volume server1
+ type protocol/server
+ option transport-type tcp
+ subvolumes server1-iot
+ option transport.socket.listen-port 7001
+ option auth.addr.server1-posix1.allow *
+ option auth.addr.server1-ns1.allow *
+ option auth.addr.server1-iot.allow *
+end-volume
+
+
+# == Server2 ==
+volume server2-client1
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7001
+ option remote-subvolume server1-posix1
+end-volume
+
+volume server2-ns1
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7001
+ option remote-subvolume server1-ns1
+end-volume
+
+volume server2-posix2
+ type storage/posix
+ option directory /tmp/ha-export2/
+end-volume
+
+volume server2-ns2
+ type storage/posix
+ option directory /tmp/ha-export-ns2/
+end-volume
+
+volume server2-client3
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7003
+ option remote-subvolume server3-posix3
+end-volume
+
+volume server2-ns3
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7003
+ option remote-subvolume server3-ns3
+end-volume
+
+volume server2-io1
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server2-client1
+end-volume
+
+
+volume server2-io2
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server2-posix2
+end-volume
+
+volume server2-io3
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server2-client3
+end-volume
+
+volume server2-ns-io1
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server2-ns1
+end-volume
+
+volume server2-ns-io2
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server2-ns2
+end-volume
+
+volume server2-ns-io3
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server2-ns3
+end-volume
+
+volume server2-ns-replicate
+ type cluster/replicate
+ subvolumes server2-ns-io1 server2-ns-io2 server2-ns-io3
+end-volume
+
+volume server2-storage-replicate
+ type cluster/replicate
+ subvolumes server2-io2 server2-io3 server2-io1
+end-volume
+
+volume server2-unify
+ type cluster/unify
+ option self-heal off
+ subvolumes server2-storage-replicate
+ option namespace server2-ns-replicate
+ option scheduler rr
+end-volume
+
+volume server2-iot
+ type performance/io-threads
+ option thread-count 8
+ option cache-size 64MB
+ subvolumes server2-unify
+end-volume
+
+volume server2
+ type protocol/server
+ option transport-type tcp
+ subvolumes server2-iot
+ option transport.socket.listen-port 7002
+ option auth.addr.server2-posix2.allow *
+ option auth.addr.server2-ns2.allow *
+ option auth.addr.server2-iot.allow *
+end-volume
+
+# == server 3 ==
+volume server3-client1
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7001
+ option remote-subvolume server1-posix1
+end-volume
+
+volume server3-ns1
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7001
+ option remote-subvolume server1-ns1
+end-volume
+
+volume server3-client2
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7002
+ option remote-subvolume server2-posix2
+end-volume
+
+volume server3-ns2
+ type protocol/client
+ option transport-type tcp
+ option remote-host 127.0.0.1
+ option transport.socket.remote-port 7002
+ option remote-subvolume server2-ns2
+end-volume
+
+volume server3-posix3
+ type storage/posix
+ option directory /tmp/ha-export3/
+end-volume
+
+volume server3-ns3
+ type storage/posix
+ option directory /tmp/ha-export-ns3/
+end-volume
+
+volume server3-io1
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server3-client1
+end-volume
+
+
+volume server3-io2
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server3-client2
+end-volume
+
+volume server3-io3
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server3-posix3
+end-volume
+
+volume server3-ns-io1
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server3-ns1
+end-volume
+
+volume server3-ns-io2
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server3-ns2
+end-volume
+
+volume server3-ns-io3
+ type performance/io-threads
+ option thread-count 8
+ subvolumes server3-ns3
+end-volume
+
+volume server3-ns-replicate
+ type cluster/replicate
+ subvolumes server3-ns-io1 server3-ns-io2 server3-ns-io3
+end-volume
+
+volume server3-storage-replicate
+ type cluster/replicate
+ subvolumes server3-io3 server3-io2 server3-io1
+end-volume
+
+volume server3-unify
+ type cluster/unify
+ option self-heal off
+ subvolumes server3-storage-replicate
+ option namespace server3-ns-replicate
+ option scheduler rr
+end-volume
+
+volume server3-iot
+ type performance/io-threads
+ option thread-count 8
+ option cache-size 64MB
+ subvolumes server3-unify
+end-volume
+
+volume server3
+ type protocol/server
+ option transport-type tcp
+ subvolumes server3-iot
+ option transport.socket.listen-port 7003
+ option auth.addr.server3-posix3.allow *
+ option auth.addr.server3-ns3.allow *
+ option auth.addr.server3-iot.allow *
+end-volume
+
diff --git a/doc/qa/qa-server.vol b/doc/qa/qa-server.vol
new file mode 100644
index 00000000000..1c245c324ad
--- /dev/null
+++ b/doc/qa/qa-server.vol
@@ -0,0 +1,284 @@
+# This spec file should be used for testing before any release
+#
+
+# Namespace posix
+volume brick-ns
+ type storage/posix # POSIX FS translator
+ option directory /tmp/export-ns # Export this directory
+end-volume
+
+# 1st server
+
+volume brick1
+ type storage/posix # POSIX FS translator
+ option directory /tmp/export1 # Export this directory
+end-volume
+
+# == Posix-Locks ==
+ volume plocks1
+ type features/posix-locks
+# option mandatory on
+ subvolumes brick1
+ end-volume
+
+volume iot1
+ type performance/io-threads
+ subvolumes plocks1 # change properly if above commented volumes needs to be included
+# option <key> <value>
+end-volume
+
+volume wb1
+ type performance/write-behind
+ subvolumes iot1
+# option <key> <value>
+end-volume
+
+volume ra1
+ type performance/read-ahead
+ subvolumes wb1
+# option <key> <value>
+end-volume
+
+volume brick2
+ type storage/posix # POSIX FS translator
+ option directory /tmp/export2 # Export this directory
+end-volume
+
+# == TrashCan Translator ==
+# volume trash2
+# type features/trash
+# option trash-dir /.trashcan
+# subvolumes brick2
+# end-volume
+
+# == Posix-Locks ==
+volume plocks2
+ type features/posix-locks
+# option <something> <something>
+ subvolumes brick2
+end-volume
+
+volume iot2
+ type performance/io-threads
+ subvolumes plocks2 # change properly if above commented volumes needs to be included
+# option <key> <value>
+end-volume
+
+volume wb2
+ type performance/write-behind
+ subvolumes iot2
+# option <key> <value>
+end-volume
+
+volume ra2
+ type performance/read-ahead
+ subvolumes wb2
+# option <key> <value>
+end-volume
+
+volume brick3
+ type storage/posix # POSIX FS translator
+ option directory /tmp/export3 # Export this directory
+end-volume
+
+# == TrashCan Translator ==
+# volume trash3
+# type features/trash
+# option trash-dir /.trashcan
+# subvolumes brick3
+# end-volume
+
+# == Posix-Locks ==
+volume plocks3
+ type features/posix-locks
+# option <something> <something>
+ subvolumes brick3
+end-volume
+
+volume iot3
+ type performance/io-threads
+ subvolumes plocks3 # change properly if above commented volumes needs to be included
+# option <key> <value>
+end-volume
+
+volume wb3
+ type performance/write-behind
+ subvolumes iot3
+# option <key> <value>
+end-volume
+
+volume ra3
+ type performance/read-ahead
+ subvolumes wb3
+# option <key> <value>
+end-volume
+
+volume brick4
+ type storage/posix # POSIX FS translator
+ option directory /tmp/export4 # Export this directory
+end-volume
+
+# == Posix-Locks ==
+volume plocks4
+ type features/posix-locks
+# option <something> <something>
+ subvolumes brick4
+end-volume
+
+volume iot4
+ type performance/io-threads
+ subvolumes plocks4 # change properly if above commented volumes needs to be included
+# option <key> <value>
+end-volume
+
+volume wb4
+ type performance/write-behind
+ subvolumes iot4
+# option <key> <value>
+end-volume
+
+volume ra4
+ type performance/read-ahead
+ subvolumes wb4
+# option <key> <value>
+end-volume
+
+volume brick5
+ type storage/posix # POSIX FS translator
+ option directory /tmp/export5 # Export this directory
+end-volume
+
+
+# == Posix-Locks ==
+volume plocks5
+ type features/posix-locks
+# option <something> <something>
+ subvolumes brick5
+end-volume
+
+volume iot5
+ type performance/io-threads
+ subvolumes plocks5 # change properly if above commented volumes needs to be included
+# option <key> <value>
+end-volume
+
+volume wb5
+ type performance/write-behind
+ subvolumes iot5
+# option <key> <value>
+end-volume
+
+volume ra5
+ type performance/read-ahead
+ subvolumes wb5
+# option <key> <value>
+end-volume
+
+volume brick6
+ type storage/posix # POSIX FS translator
+ option directory /tmp/export6 # Export this directory
+end-volume
+
+# == Posix-Locks ==
+volume plocks6
+ type features/posix-locks
+# option <something> <something>
+ subvolumes brick6
+end-volume
+
+volume iot6
+ type performance/io-threads
+ subvolumes plocks6 # change properly if above commented volumes needs to be included
+# option <key> <value>
+end-volume
+
+volume wb6
+ type performance/write-behind
+ subvolumes iot6
+# option <key> <value>
+end-volume
+
+volume ra6
+ type performance/read-ahead
+ subvolumes wb6
+# option <key> <value>
+end-volume
+
+volume brick7
+ type storage/posix # POSIX FS translator
+ option directory /tmp/export7 # Export this directory
+end-volume
+
+# == Posix-Locks ==
+volume plocks7
+ type features/posix-locks
+# option <something> <something>
+ subvolumes brick7
+end-volume
+
+volume iot7
+ type performance/io-threads
+ subvolumes plocks7 # change properly if above commented volumes needs to be included
+# option <key> <value>
+end-volume
+
+volume wb7
+ type performance/write-behind
+ subvolumes iot7
+# option <key> <value>
+end-volume
+
+volume ra7
+ type performance/read-ahead
+ subvolumes wb7
+# option <key> <value>
+end-volume
+
+volume brick8
+ type storage/posix # POSIX FS translator
+ option directory /tmp/export8 # Export this directory
+end-volume
+
+# == Posix-Locks ==
+volume plocks8
+ type features/posix-locks
+# option <something> <something>
+ subvolumes brick8
+end-volume
+
+volume iot8
+ type performance/io-threads
+ subvolumes plocks8 # change properly if above commented volumes needs to be included
+# option <key> <value>
+end-volume
+
+volume wb8
+ type performance/write-behind
+ subvolumes iot8
+# option <key> <value>
+end-volume
+
+volume ra8
+ type performance/read-ahead
+ subvolumes wb8
+# option <key> <value>
+end-volume
+
+volume server8
+ type protocol/server
+ subvolumes ra8 ra1 ra2 ra3 ra4 ra5 ra6 ra7 brick-ns
+ option transport-type tcp # For TCP/IP transport
+# option transport-type ib-sdp # For Infiniband transport
+# option transport-type ib-verbs # For ib-verbs transport
+ option client-volume-filename /examples/qa-client.vol
+ option auth.addr.ra1.allow * # Allow access to "stat8" volume
+ option auth.addr.ra2.allow * # Allow access to "stat8" volume
+ option auth.addr.ra3.allow * # Allow access to "stat8" volume
+ option auth.addr.ra4.allow * # Allow access to "stat8" volume
+ option auth.addr.ra5.allow * # Allow access to "stat8" volume
+ option auth.addr.ra6.allow * # Allow access to "stat8" volume
+ option auth.addr.ra7.allow * # Allow access to "stat8" volume
+ option auth.addr.ra8.allow * # Allow access to "stat8" volume
+ option auth.addr.brick-ns.allow * # Allow access to "stat8" volume
+end-volume
+
diff --git a/doc/replicate.lyx b/doc/replicate.lyx
new file mode 100644
index 00000000000..2bbcb652aaa
--- /dev/null
+++ b/doc/replicate.lyx
@@ -0,0 +1,797 @@
+#LyX 1.4.2 created this file. For more info see http://www.lyx.org/
+\lyxformat 245
+\begin_document
+\begin_header
+\textclass article
+\language english
+\inputencoding auto
+\fontscheme default
+\graphics default
+\paperfontsize default
+\spacing single
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\cite_engine basic
+\use_bibtopic false
+\paperorientation portrait
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation skip
+\defskip medskip
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\end_header
+
+\begin_body
+
+\begin_layout Title
+
+\size larger
+Automatic File Replication (replicate) in GlusterFS
+\end_layout
+
+\begin_layout Author
+Vikas Gorur
+\family typewriter
+\size larger
+<vikas@zresearch.com>
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+hrule
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section*
+Overview
+\end_layout
+
+\begin_layout Standard
+This document describes the design and usage of the replicate translator in GlusterFS.
+ This document is valid for the 1.4.x releases, and not earlier ones.
+\end_layout
+
+\begin_layout Standard
+The replicate translator of GlusterFS aims to keep identical copies of a file
+ on all its subvolumes, as far as possible.
+ It tries to do this by performing all filesystem mutation operations (writing
+ data, creating files, changing ownership, etc.) on all its subvolumes in
+ such a way that if an operation succeeds on atleast one subvolume, all
+ other subvolumes can later be brought up to date.
+\end_layout
+
+\begin_layout Standard
+In the rest of the document the terms
+\begin_inset Quotes eld
+\end_inset
+
+subvolume
+\begin_inset Quotes erd
+\end_inset
+
+ and
+\begin_inset Quotes eld
+\end_inset
+
+server
+\begin_inset Quotes erd
+\end_inset
+
+ are used interchangeably, trusting that it will cause no confusion to the
+ reader.
+\end_layout
+
+\begin_layout Section*
+Usage
+\end_layout
+
+\begin_layout Standard
+A sample volume declaration for replicate looks like this:
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+begin{verbatim}
+\end_layout
+
+\begin_layout Standard
+
+volume replicate
+\end_layout
+
+\begin_layout Standard
+
+ type cluster/replicate
+\end_layout
+
+\begin_layout Standard
+
+ # options, see below for description
+\end_layout
+
+\begin_layout Standard
+
+ subvolumes brick1 brick2
+\end_layout
+
+\begin_layout Standard
+
+end-volume
+\end_layout
+
+\begin_layout Standard
+
+
+\backslash
+end{verbatim}
+\end_layout
+
+\begin_layout Standard
+
+\end_layout
+
+\begin_layout Standard
+
+\end_layout
+
+\begin_layout Standard
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This defines an replicate volume with two subvolumes, brick1, and brick2.
+ For replicate to work properly, it is essential that its subvolumes support
+\series bold
+extended attributes
+\series default
+.
+ This means that you should choose a backend filesystem that supports extended
+ attributes, like XFS, ReiserFS, or Ext3.
+\end_layout
+
+\begin_layout Standard
+The storage volumes used as backend for replicate
+\emph on
+must
+\emph default
+ have a posix-locks volume loaded above them.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+
+\backslash
+begin{verbatim}
+\end_layout
+
+\begin_layout Standard
+
+volume brick1
+\end_layout
+
+\begin_layout Standard
+
+ type features/posix-locks
+\end_layout
+
+\begin_layout Standard
+
+ subvolumes brick1-ds
+\end_layout
+
+\begin_layout Standard
+
+end-volume
+\end_layout
+
+\begin_layout Standard
+
+
+\backslash
+end{verbatim}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section*
+Design
+\end_layout
+
+\begin_layout Subsection*
+Read algorithm
+\end_layout
+
+\begin_layout Standard
+All operations that do not modify the file or directory are sent to all
+ the subvolumes and the first successful reply is returned to the application.
+\end_layout
+
+\begin_layout Standard
+The read() system call (reading data from a file) is an exception.
+ For read() calls, replicate tries to do load balancing by sending all reads from
+ a particular file to a particular server.
+\end_layout
+
+\begin_layout Standard
+The read algorithm is also affected by the option read-subvolume; see below
+ for details.
+\end_layout
+
+\begin_layout Subsection*
+Classes of file operations
+\end_layout
+
+\begin_layout Standard
+replicate divides all filesystem write operations into three classes:
+\end_layout
+
+\begin_layout Itemize
+
+\series bold
+data:
+\series default
+Operations that modify the contents of a file (write, truncate).
+\end_layout
+
+\begin_layout Itemize
+
+\series bold
+metadata:
+\series default
+Operations that modify attributes of a file or directory (permissions, ownership
+, etc.).
+\end_layout
+
+\begin_layout Itemize
+
+\series bold
+entry:
+\series default
+Operations that create or delete directory entries (mkdir, create, rename,
+ rmdir, unlink, etc.).
+\end_layout
+
+\begin_layout Subsection*
+Locking and Change Log
+\end_layout
+
+\begin_layout Standard
+To ensure consistency across subvolumes, replicate holds a lock whenever a modificatio
+n is being made to a file or directory.
+ By default, replicate considers the first subvolume as the sole lock server.
+ However, the number of lock servers can be increased upto the total number
+ of subvolumes.
+\end_layout
+
+\begin_layout Standard
+The change log is a set of extended attributes associated with files and
+ directories that replicate maintains.
+ The change log keeps track of the changes made to files and directories
+ (data, metadata, entry) so that the self-heal algorithm knows which copy
+ of a file or directory is the most recent one.
+\end_layout
+
+\begin_layout Subsection*
+Write algorithm
+\end_layout
+
+\begin_layout Standard
+The algorithm for all write operations (data, metadata, entry) is:
+\end_layout
+
+\begin_layout Enumerate
+Lock the file (or directory) on all of the lock servers (see options below).
+\end_layout
+
+\begin_layout Enumerate
+Write change log entries on all servers.
+\end_layout
+
+\begin_layout Enumerate
+Perform the operation.
+\end_layout
+
+\begin_layout Enumerate
+Erase change log entries.
+\end_layout
+
+\begin_layout Enumerate
+Unlock the file (or directory) on all of the lock servers.
+\end_layout
+
+\begin_layout Standard
+The above algorithm is a simplified version intended for general users.
+ Please refer to the source code for the full details.
+\end_layout
+
+\begin_layout Subsection*
+Self-Heal
+\end_layout
+
+\begin_layout Standard
+replicate automatically tries to fix any inconsistencies it detects among different
+ copies of a file.
+ It uses information in the change log to determine which copy is the
+\begin_inset Quotes eld
+\end_inset
+
+correct
+\begin_inset Quotes erd
+\end_inset
+
+ version.
+\end_layout
+
+\begin_layout Standard
+Self-heal is triggered when a file or directory is first
+\begin_inset Quotes eld
+\end_inset
+
+accessed
+\begin_inset Quotes erd
+\end_inset
+
+, that is, the first time any operation is attempted on it.
+ The self-heal algorithm does the following things:
+\end_layout
+
+\begin_layout Standard
+If the entry being accessed is a directory:
+\end_layout
+
+\begin_layout Itemize
+The contents of the
+\begin_inset Quotes eld
+\end_inset
+
+correct
+\begin_inset Quotes erd
+\end_inset
+
+ version is replicated on all subvolumes, by deleting entries and creating
+ entries as necessary.
+\end_layout
+
+\begin_layout Standard
+If the entry being accessed is a file:
+\end_layout
+
+\begin_layout Itemize
+If the file does not exist on some subvolumes, it is created.
+\end_layout
+
+\begin_layout Itemize
+If there is a mismatch in the size of the file, or ownership, or permission,
+ it is fixed.
+\end_layout
+
+\begin_layout Itemize
+If the change log indicates that some copies need updating, they are updated.
+\end_layout
+
+\begin_layout Subsection*
+Split-brain
+\end_layout
+
+\begin_layout Standard
+It may happen that one replicate client can access only some of the servers in
+ a cluster and another replicate client can access the remaining servers.
+ Or it may happen that in a cluster of two servers, one server goes down
+ and comes back up, but the other goes down immediately.
+ Both these scenarios result in a
+\begin_inset Quotes eld
+\end_inset
+
+split-brain
+\begin_inset Quotes erd
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+In a split-brain situation, there will be two or more copies of a file,
+ all of which are
+\begin_inset Quotes eld
+\end_inset
+
+correct
+\begin_inset Quotes erd
+\end_inset
+
+ in some sense.
+ replicate without manual intervention has no way of knowing what to do, since
+ it cannot consider any single copy as definitive, nor does it know of any
+ meaningful way to merge the copies.
+\end_layout
+
+\begin_layout Standard
+If replicate detects that a split-brain has happened on a file, it disallows opening
+ of that file.
+ You will have to manually resolve the conflict by deleting all but one
+ copy of the file.
+ Alternatively you can set an automatic split-brain resolution policy by
+ using the `favorite-child' option (see below).
+\end_layout
+
+\begin_layout Section*
+Translator Options
+\end_layout
+
+\begin_layout Standard
+replicate accepts the following options:
+\end_layout
+
+\begin_layout Subsection*
+read-subvolume (default: none)
+\end_layout
+
+\begin_layout Standard
+The value of this option must be the name of a subvolume.
+ If given, all read operations are sent to only the specified subvolume,
+ instead of being balanced across all subvolumes.
+\end_layout
+
+\begin_layout Subsection*
+favorite-child (default: none)
+\end_layout
+
+\begin_layout Standard
+The value of this option must be the name of a subvolume.
+ If given, the specified subvolume will be preferentially used in resolving
+ conflicts (
+\begin_inset Quotes eld
+\end_inset
+
+split-brain
+\begin_inset Quotes erd
+\end_inset
+
+).
+ This means if a discrepancy is noticed in the attributes or content of
+ a file, the copy on the `favorite-child' will be considered the definitive
+ version and its contents will
+\emph on
+overwrite
+\emph default
+the contents of all other copies.
+ Use this option with caution! It is possible to
+\emph on
+lose data
+\emph default
+ with this option.
+ If you are in doubt, do not specify this option.
+\end_layout
+
+\begin_layout Subsection*
+Self-heal options
+\end_layout
+
+\begin_layout Standard
+Setting any of these options to
+\begin_inset Quotes eld
+\end_inset
+
+off
+\begin_inset Quotes erd
+\end_inset
+
+ prevents that kind of self-heal from being done on a file or directory.
+ For example, if metadata self-heal is turned off, permissions and ownership
+ are no longer fixed automatically.
+\end_layout
+
+\begin_layout Subsubsection*
+data-self-heal (default: on)
+\end_layout
+
+\begin_layout Standard
+Enable/disable self-healing of file contents.
+\end_layout
+
+\begin_layout Subsubsection*
+metadata-self-heal (default: off)
+\end_layout
+
+\begin_layout Standard
+Enable/disable self-healing of metadata (permissions, ownership, modification
+ times).
+\end_layout
+
+\begin_layout Subsubsection*
+entry-self-heal (default: on)
+\end_layout
+
+\begin_layout Standard
+Enable/disable self-healing of directory entries.
+\end_layout
+
+\begin_layout Subsection*
+Change Log options
+\end_layout
+
+\begin_layout Standard
+If any of these options is turned off, it disables writing of change log
+ entries for that class of file operations.
+ That is, steps 2 and 4 of the write algorithm (see above) are not done.
+ Note that if the change log is not written, the self-heal algorithm cannot
+ determine the
+\begin_inset Quotes eld
+\end_inset
+
+correct
+\begin_inset Quotes erd
+\end_inset
+
+ version of a file and hence self-heal will only be able to fix
+\begin_inset Quotes eld
+\end_inset
+
+obviously
+\begin_inset Quotes erd
+\end_inset
+
+ wrong things (such as a file existing on only one node).
+\end_layout
+
+\begin_layout Subsubsection*
+data-change-log (default: on)
+\end_layout
+
+\begin_layout Standard
+Enable/disable writing of change log for data operations.
+\end_layout
+
+\begin_layout Subsubsection*
+metadata-change-log (default: on)
+\end_layout
+
+\begin_layout Standard
+Enable/disable writing of change log for metadata operations.
+\end_layout
+
+\begin_layout Subsubsection*
+entry-change-log (default: on)
+\end_layout
+
+\begin_layout Standard
+Enable/disable writing of change log for entry operations.
+\end_layout
+
+\begin_layout Subsection*
+Locking options
+\end_layout
+
+\begin_layout Standard
+These options let you specify the number of lock servers to use for each
+ class of file operations.
+ The default values are satisfactory in most cases.
+ If you are extra paranoid, you may want to increase the values.
+ However, be very cautious if you set the data- or entry- lock server counts
+ to zero, since this can result in
+\emph on
+lost data.
+
+\emph default
+ For example, if you set the data-lock-server-count to zero, and two application
+s write to the same region of a file, there is a possibility that none of
+ your servers will have all the data.
+ In other words, the copies will be
+\emph on
+inconsistent
+\emph default
+, and
+\emph on
+incomplete
+\emph default
+.
+ Do not set data- and entry- lock server counts to zero unless you absolutely
+ know what you are doing and agree to not hold GlusterFS responsible for
+ any lost data.
+\end_layout
+
+\begin_layout Subsubsection*
+data-lock-server-count (default: 1)
+\end_layout
+
+\begin_layout Standard
+Number of lock servers to use for data operations.
+\end_layout
+
+\begin_layout Subsubsection*
+metadata-lock-server-count (default: 0)
+\end_layout
+
+\begin_layout Standard
+Number of lock servers to use for metadata operations.
+\end_layout
+
+\begin_layout Subsubsection*
+entry-lock-server-count (default: 1)
+\end_layout
+
+\begin_layout Standard
+Number of lock servers to use for entry operations.
+\end_layout
+
+\begin_layout Section*
+Known Issues
+\end_layout
+
+\begin_layout Subsection*
+Self-heal of file with more than one link (hard links):
+\end_layout
+
+\begin_layout Standard
+Consider two servers, A and B.
+ Assume A is down, and the user creates a file `new' as a hard link to a
+ file `old'.
+ When A comes back up, replicate will see that the file `new' does not exist on
+ A, and self-heal will create the file and copy the contents from B.
+ However, now on server A the file `new' is not a link to the file `old'
+ but an entirely different file.
+\end_layout
+
+\begin_layout Standard
+We know of no easy way to fix this problem, but we will try to fix it in
+ forthcoming releases.
+\end_layout
+
+\begin_layout Subsection*
+File re-opening after a server comes back up:
+\end_layout
+
+\begin_layout Standard
+If a server A goes down and comes back up, any files which were opened while
+ A was down and are still open will not have their writes replicated on
+ A.
+ In other words, data replication only happens on those servers which were
+ alive when the file was opened.
+\end_layout
+
+\begin_layout Standard
+This is a rather tricky issue but we hope to fix it very soon.
+\end_layout
+
+\begin_layout Section*
+Frequently Asked Questions
+\end_layout
+
+\begin_layout Subsection*
+1.
+ How can I force self-heal to happen?
+\end_layout
+
+\begin_layout Standard
+You can force self-heal to happen on your cluster by running a script or
+ a command that accesses every file.
+ A simple way to do it would be:
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Standard
+
+\end_layout
+
+\begin_layout Standard
+
+
+\backslash
+begin{verbatim}
+\end_layout
+
+\begin_layout Standard
+
+$ ls -lR
+\end_layout
+
+\begin_layout Standard
+
+
+\backslash
+end{verbatim}
+\end_layout
+
+\begin_layout Standard
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Run the command in all directories which you want to forcibly self-heal.
+\end_layout
+
+\begin_layout Subsection*
+2.
+ Which backend filesystem should I use for replicate?
+\end_layout
+
+\begin_layout Standard
+You can use any backend filesystem that supports extended attributes.
+ We know of users successfully using XFR, ReiserFS, and Ext3.
+\end_layout
+
+\begin_layout Subsection*
+3.
+ What can I do to improve replicate performance?
+\end_layout
+
+\begin_layout Standard
+Try loading performance translators such as io-threads, write-behind, io-cache,
+ and read-ahead depending on your workload.
+ If you are willing to sacrifice correctness in corner cases, you can experiment
+ with the lock-server-count and the change-log options (see above).
+ As warned earlier, be very careful!
+\end_layout
+
+\begin_layout Subsection*
+4.
+ How can I selectively replicate files?
+\end_layout
+
+\begin_layout Standard
+There is no support for selective replication in replicate itself.
+ You can achieve selective replication by loading the unify translator over
+ replicate, and using the switch scheduler.
+ Configure unify with two subvolumes, one of them being replicate.
+ Using the switch scheduler, schedule all files for which you need replication
+ to the replicate subvolume.
+ Consult unify and switch documentation for more details.
+\end_layout
+
+\begin_layout Section*
+Contact
+\end_layout
+
+\begin_layout Standard
+If you need more assistance on replicate, contact us on the mailing list <gluster-user
+s@gluster.org> (visit gluster.org for details on how to subscribe).
+\end_layout
+
+\begin_layout Standard
+Send you comments and suggestions about this document to <vikas@zresearch.com>.
+\end_layout
+
+\end_body
+\end_document
diff --git a/doc/replicate.pdf b/doc/replicate.pdf
new file mode 100644
index 00000000000..b7212af2b4e
--- /dev/null
+++ b/doc/replicate.pdf
Binary files differ
diff --git a/doc/solaris-related-xattrs.txt b/doc/solaris-related-xattrs.txt
new file mode 100644
index 00000000000..e26efa5d189
--- /dev/null
+++ b/doc/solaris-related-xattrs.txt
@@ -0,0 +1,44 @@
+ Solaris Extended Attributes
+
+In solaris extended attributes are logically supported as files
+within the filesystem. The file system is therefore augmented
+with an orthogonal namespace of file attributes. Attribute values
+are accessed by file descriptors obtained through a special attribute
+interface. This type of logical view of "attributes as files" allows
+the leveraging of existing file system interface functionality to
+support the construction, deletion and manipulation of attributes.
+
+But as we have tested through this functionality provided by Solaris
+we have come accross two major issues as written below.
+
+1. Symlink XATTR_NOFOLLOW not present for creating extended attributes
+ directly on the symlinks like other platforms Linux,MAC-OSX,BSD etc.
+ An implementation is present for O_NOFOLLOW for "openat()" call sets
+ up errno ELOOP whenever encountered with a symlink and also another
+ implementation AT_SYMLINK_NOFOLLOW which is not present for calls like
+ "attropen(), openat()"
+
+ a snippet of test code which helped us understand this behaviour
+ --------------------------------------
+ attrfd = attropen (path, key,
+ flags|AT_SYMLINK_NOFOLLOW|O_CREAT|O_WRONLY|O_NOFOLLOW, 0777);
+ if (attrfd >= 0) {
+ ftruncate (attrfd, 0);
+ ret = write (attrfd, value, size);
+ close (attrfd);
+ } else {
+ fprintf (stderr, "Couldn't set extended attribute for %s (%d)\n",
+ path, errno);
+ }
+ --------------------------------------
+
+2. Extended attribute support for special files like device files, fifo files
+ is not supported under solaris.
+
+Apart from these glitches almost everything regarding porting functionality
+for extended attribute calls has been properly implemented in compat.c
+with writing wrapper around functions over
+"attropen()", "openat()", "unlinkat()"
+
+
+
diff --git a/doc/translator-options.txt b/doc/translator-options.txt
new file mode 100644
index 00000000000..3d8402be5fc
--- /dev/null
+++ b/doc/translator-options.txt
@@ -0,0 +1,221 @@
+mount/fuse:
+ * direct-io-mode GF_OPTION_TYPE_BOOL on|off|yes|no
+ * macfuse-local GF_OPTION_TYPE_BOOL on|off|yes|no
+ * mount-point (mountpoint) GF_OPTION_TYPE_PATH <any-posix-valid-path>
+ * attribute-timeout GF_OPTION_TYPE_TIME 0-3600
+ * entry-timeout GF_OPTION_TYPE_TIME 0-3600
+
+protocol/server:
+ * transport-type GF_OPTION_TYPE_STR tcp|socket|ib-verbs|unix|ib-sdp|
+ tcp/client|ib-verbs/client
+ * volume-filename.* GF_OPTION_TYPE_PATH
+ * inode-lru-limit GF_OPTION_TYPE_INT 0-(1 * GF_UNIT_MB)
+ * client-volume-filename GF_OPTION_TYPE_PATH
+
+protocol/client:
+ * username GF_OPTION_TYPE_ANY
+ * password GF_OPTION_TYPE_ANY
+ * transport-type GF_OPTION_TYPE_STR tcp|socket|ib-verbs|unix|ib-sdp|
+ tcp/client|ib-verbs/client
+ * remote-host GF_OPTION_TYPE_ANY
+ * remote-subvolume GF_OPTION_TYPE_ANY
+ * transport-timeout GF_OPTION_TYPE_TIME 5-1013
+
+cluster/replicate:
+ * read-subvolume GF_OPTION_TYPE_XLATOR
+ * favorite-child GF_OPTION_TYPE_XLATOR
+ * data-self-heal GF_OPTION_TYPE_BOOL
+ * metadata-self-heal GF_OPTION_TYPE_BOOL
+ * entry-self-heal GF_OPTION_TYPE_BOOL
+ * data-change-log GF_OPTION_TYPE_BOOL
+ * metadata-change-log GF_OPTION_TYPE_BOOL
+ * entry-change-log GF_OPTION_TYPE_BOOL
+ * data-lock-server-count GF_OPTION_TYPE_INT 0
+ * metadata-lock-server-count GF_OPTION_TYPE_INT 0
+ * entry-lock-server-count GF_OPTION_TYPE_INT 0
+
+cluster/distribute:
+ * lookup-unhashed GF_OPTION_TYPE_BOOL
+
+cluster/unify:
+ * namespace GF_OPTION_TYPE_XLATOR
+ * scheduler GF_OPTION_TYPE_STR alu|rr|random|nufa|switch
+ * self-heal GF_OPTION_TYPE_STR foreground|background|off
+ * optimist GF_OPTION_TYPE_BOOL
+
+cluster/nufa:
+ local-volume-name GF_OPTION_TYPE_XLATOR
+
+cluster/stripe:
+ * block-size GF_OPTION_TYPE_ANY
+ * use-xattr GF_OPTION_TYPE_BOOL
+
+debug/trace:
+ * include-ops (include) GF_OPTION_TYPE_STR
+ * exclude-ops (exclude) GF_OPTION_TYPE_STR
+
+encryption/rot-13:
+ * encrypt-write GF_OPTION_TYPE_BOOL
+ * decrypt-read GF_OPTION_TYPE_BOOL
+
+features/path-convertor:
+ * start-offset GF_OPTION_TYPE_INT 0-4095
+ * end-offset GF_OPTION_TYPE_INT 1-4096
+ * replace-with GF_OPTION_TYPE_ANY
+
+features/trash:
+ * trash-dir GF_OPTION_TYPE_PATH
+
+features/locks:
+ * mandatory-locks (mandatory) GF_OPTION_TYPE_BOOL
+
+features/filter:
+ * root-squashing GF_OPTION_TYPE_BOOL
+ * read-only GF_OPTION_TYPE_BOOL
+ * fixed-uid GF_OPTION_TYPE_INT
+ * fixed-gid GF_OPTION_TYPE_INT
+ * translate-uid GF_OPTION_TYPE_ANY
+ * translate-gid GF_OPTION_TYPE_ANY
+ * filter-uid GF_OPTION_TYPE_ANY
+ * filter-gid GF_OPTION_TYPE_ANY
+
+features/quota:
+ * min-free-disk-limit GF_OPTION_TYPE_PERCENT
+ * refresh-interval GF_OPTION_TYPE_TIME
+ * disk-usage-limit GF_OPTION_TYPE_SIZET
+
+storage/posix:
+ * o-direct GF_OPTION_TYPE_BOOL
+ * directory GF_OPTION_TYPE_PATH
+ * export-statfs-size GF_OPTION_TYPE_BOOL
+ * mandate-attribute GF_OPTION_TYPE_BOOL
+
+storage/bdb:
+ * directory GF_OPTION_TYPE_PATH
+ * logdir GF_OPTION_TYPE_PATH
+ * errfile GF_OPTION_TYPE_PATH
+ * dir-mode GF_OPTION_TYPE_ANY
+ * file-mode GF_OPTION_TYPE_ANY
+ * page-size GF_OPTION_TYPE_SIZET
+ * lru-limit GF_OPTION_TYPE_INT
+ * lock-timeout GF_OPTION_TYPE_TIME
+ * checkpoint-timeout GF_OPTION_TYPE_TIME
+ * transaction-timeout GF_OPTION_TYPE_TIME
+ * mode GF_OPTION_TYPE_BOOL
+ * access-mode GF_OPTION_TYPE_STR
+
+performance/read-ahead:
+ * force-atime-update GF_OPTION_TYPE_BOOL
+ * page-size GF_OPTION_TYPE_SIZET (64 * GF_UNIT_KB)-(2 * GF_UNIT_MB)
+ * page-count GF_OPTION_TYPE_INT 1-16
+
+performance/write-behind:
+ * flush-behind GF_OPTION_TYPE_BOOL
+ * aggregate-size GF_OPTION_TYPE_SIZET (128 * GF_UNIT_KB)-(4 * GF_UNIT_MB)
+ * window-size GF_OPTION_TYPE_SIZET (512 * GF_UNIT_KB)-(1 * GF_UNIT_GB)
+ * enable-O_SYNC GF_OPTION_TYPE_BOOL
+ * disable-for-first-nbytes GF_OPTION_TYPE_SIZET 1 - (1 * GF_UNIT_MB)
+
+performance/symlink-cache:
+
+performance/io-threads:
+ * thread-count GF_OPTION_TYPE_INT 1-32
+
+performance/io-cache:
+ * priority GF_OPTION_TYPE_ANY
+ * cache-timeout (force-revalidate-timeout) GF_OPTION_TYPE_INT 0-60
+ * page-size GF_OPTION_TYPE_SIZET (16 * GF_UNIT_KB)-(4 * GF_UNIT_MB)
+ * cache-size GF_OPTION_TYPE_SIZET (4 * GF_UNIT_MB)-(6 * GF_UNIT_GB)
+
+auth:
+- addr:
+ * auth.addr.*.allow GF_OPTION_TYPE_ANY
+ * auth.addr.*.reject GF_OPTION_TYPE_ANY
+
+- login:
+ * auth.login.*.allow GF_OPTION_TYPE_ANY
+ * auth.login.*.password GF_OPTION_TYPE_ANY
+
+scheduler/alu:
+ * scheduler.alu.order (alu.order)
+ GF_OPTION_TYPE_ANY
+ * scheduler.alu.disk-usage.entry-threshold (alu.disk-usage.entry-threshold)
+ GF_OPTION_TYPE_SIZET
+ * scheduler.alu.disk-usage.exit-threshold (alu.disk-usage.exit-threshold)
+ GF_OPTION_TYPE_SIZET
+ * scheduler.alu.write-usage.entry-threshold (alu.write-usage.entry-threshold)
+ GF_OPTION_TYPE_SIZET
+ * scheduler.alu.write-usage.exit-threshold (alu.write-usage.exit-threshold)
+ GF_OPTION_TYPE_SIZET
+ * scheduler.alu.read-usage.entry-threshold (alu.read-usage.entry-threshold)
+ GF_OPTION_TYPE_SIZET
+ * scheduler.alu.read-usage.exit-threshold (alu.read-usage.exit-threshold)
+ GF_OPTION_TYPE_SIZET
+ * scheduler.alu.open-files-usage.entry-threshold (alu.open-files-usage.entry-threshold)
+ GF_OPTION_TYPE_INT
+ * scheduler.alu.open-files-usage.exit-threshold (alu.open-files-usage.exit-threshold)
+ GF_OPTION_TYPE_INT
+ * scheduler.read-only-subvolumes (alu.read-only-subvolumes)
+ GF_OPTION_TYPE_ANY
+ * scheduler.refresh-interval (alu.refresh-interval)
+ GF_OPTION_TYPE_TIME
+ * scheduler.limits.min-free-disk (alu.limits.min-free-disk)
+ GF_OPTION_TYPE_PERCENT
+ * scheduler.alu.stat-refresh.num-file-create (alu.stat-refresh.num-file-create)
+ GF_OPTION_TYPE_INT
+
+scheduler/nufa:
+ * scheduler.refresh-interval (nufa.refresh-interval)
+ GF_OPTION_TYPE_TIME
+ * scheduler.limits.min-free-disk (nufa.limits.min-free-disk)
+ GF_OPTION_TYPE_PERCENT
+ * scheduler.local-volume-name (nufa.local-volume-name)
+ GF_OPTION_TYPE_XLATOR
+
+scheduler/random:
+ * scheduler.refresh-interval (random.refresh-interval) GF_OPTION_TYPE_TIME
+ * scheduler.limits.min-free-disk (random.limits.min-free-disk) GF_OPTION_TYPE_PERCENT
+
+scheduler/rr:
+ * scheduler.refresh-interval (rr.refresh-interval) GF_OPTION_TYPE_TIME
+ * scheduler.limits.min-free-disk (rr.limits.min-free-disk) GF_OPTION_TYPE_PERCENT
+ * scheduler.read-only-subvolumes (rr.read-only-subvolumes) GF_OPTION_TYPE_ANY
+
+scheduler/switch:
+ * scheduler.read-only-subvolumes (switch.read-only-subvolumes) GF_OPTION_TYPE_ANY
+ * scheduler.local-volume-name (switch.nufa.local-volume-name) GF_OPTION_TYPE_XLATOR
+ * scheduler.switch.case (switch.case) GF_OPTION_TYPE_ANY
+
+transport/ib-verbs:
+ * transport.ib-verbs.port (ib-verbs-port) GF_OPTION_TYPE_INT 1-4
+ check the option by 'ibv_devinfo'
+ * transport.ib-verbs.mtu (ib-verbs-mtu) GF_OPTION_TYPE_INT
+ * transport.ib-verbs.device-name (ib-verbs-device-name) GF_OPTION_TYPE_ANY,
+ check by 'ibv_devinfo'
+ * transport.ib-verbs.work-request-send-size (ib-verbs-work-request-send-size)
+ GF_OPTION_TYPE_INT,
+ * transport.ib-verbs.work-request-recv-size (ib-verbs-work-request-recv-size)
+ GF_OPTION_TYPE_INT
+ * transport.ib-verbs.work-request-send-count (ib-verbs-work-request-send-count)
+ GF_OPTION_TYPE_INT
+ * transport.ib-verbs.work-request-recv-count (ib-verbs-work-request-recv-count)
+ GF_OPTION_TYPE_INT
+ * remote-port (transport.remote-port,transport.ib-verbs.remote-port)
+ GF_OPTION_TYPE_INT
+ * transport.ib-verbs.listen-port GF_OPTION_TYPE_INT
+ * transport.ib-verbs.connect-path (connect-path) GF_OPTION_TYPE_ANY
+ * transport.ib-verbs.bind-path (bind-path) GF_OPTION_TYPE_ANY
+ * transport.ib-verbs.listen-path (listen-path) GF_OPTION_TYPE_ANY
+ * transport.address-family (address-family) GF_OPTION_TYPE_STR inet|inet6|inet/inet6|
+ inet6/inet|unix|inet-sdp
+
+transport/socket:
+ * transport.remote-port (remote-port,transport.socket.remote-port) GF_OPTION_TYPE_INT
+ * transport.socket.listen-port (listen-port) GF_OPTION_TYPE_INT
+ * transport.socket.bind-address (bind-address) GF_OPTION_TYPE_ANY
+ * transport.socket.connect-path (connect-path) GF_OPTION_TYPE_ANY
+ * transport.socket.bind-path (bind-path) GF_OPTION_TYPE_ANY
+ * transport.socket.listen-path (listen-path) GF_OPTION_TYPE_ANY
+ * transport.address-family (address-family) GF_OPTION_TYPE_STR inet|inet6|
+ inet/inet6|inet6/inet|
+ unix|inet-sdp
diff --git a/doc/user-guide/Makefile.am b/doc/user-guide/Makefile.am
new file mode 100644
index 00000000000..8d7068f14aa
--- /dev/null
+++ b/doc/user-guide/Makefile.am
@@ -0,0 +1 @@
+info_TEXINFOS = user-guide.texi
diff --git a/doc/user-guide/advanced-stripe.odg b/doc/user-guide/advanced-stripe.odg
new file mode 100644
index 00000000000..7686d7091b2
--- /dev/null
+++ b/doc/user-guide/advanced-stripe.odg
Binary files differ
diff --git a/doc/user-guide/advanced-stripe.pdf b/doc/user-guide/advanced-stripe.pdf
new file mode 100644
index 00000000000..ec8b03dcfbb
--- /dev/null
+++ b/doc/user-guide/advanced-stripe.pdf
Binary files differ
diff --git a/doc/user-guide/colonO-icon.jpg b/doc/user-guide/colonO-icon.jpg
new file mode 100644
index 00000000000..3e66f7a2775
--- /dev/null
+++ b/doc/user-guide/colonO-icon.jpg
Binary files differ
diff --git a/doc/user-guide/fdl.texi b/doc/user-guide/fdl.texi
new file mode 100644
index 00000000000..e33c687cdfb
--- /dev/null
+++ b/doc/user-guide/fdl.texi
@@ -0,0 +1,454 @@
+
+@c @node GNU Free Documentation License
+@c @appendixsec GNU Free Documentation License
+
+@cindex FDL, GNU Free Documentation License
+@center Version 1.2, November 2002
+
+@display
+Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+@end display
+
+@enumerate 0
+@item
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document @dfn{free} in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+@item
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The ``Document'', below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as ``you''. You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not ``Transparent'' is called ``Opaque''.
+
+Examples of suitable formats for Transparent copies include plain
+@sc{ascii} without markup, Texinfo input format, La@TeX{} input
+format, @acronym{SGML} or @acronym{XML} using a publicly available
+@acronym{DTD}, and standard-conforming simple @acronym{HTML},
+PostScript or @acronym{PDF} designed for human modification. Examples
+of transparent image formats include @acronym{PNG}, @acronym{XCF} and
+@acronym{JPG}. Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, @acronym{SGML} or
+@acronym{XML} for which the @acronym{DTD} and/or processing tools are
+not generally available, and the machine-generated @acronym{HTML},
+PostScript or @acronym{PDF} produced by some word processors for
+output purposes only.
+
+The ``Title Page'' means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, ``Title Page'' means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+A section ``Entitled XYZ'' means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as ``Acknowledgements'',
+``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
+of such a section when you modify the Document means that it remains a
+section ``Entitled XYZ'' according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+@item
+VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+@item
+COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+@item
+MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+@enumerate A
+@item
+Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document). You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
+@item
+List on the Title Page, as authors, one or more persons or entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
+@item
+State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
+@item
+Preserve all the copyright notices of the Document.
+
+@item
+Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
+@item
+Include, immediately after the copyright notices, a license notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
+@item
+Preserve in that license notice the full lists of Invariant Sections
+and required Cover Texts given in the Document's license notice.
+
+@item
+Include an unaltered copy of this License.
+
+@item
+Preserve the section Entitled ``History'', Preserve its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page. If
+there is no section Entitled ``History'' in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
+@item
+Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on. These may be placed in the ``History'' section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
+@item
+For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
+@item
+Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles. Section numbers
+or the equivalent are not considered part of the section titles.
+
+@item
+Delete any section Entitled ``Endorsements''. Such a section
+may not be included in the Modified Version.
+
+@item
+Do not retitle any existing section to be Entitled ``Endorsements'' or
+to conflict in title with any Invariant Section.
+
+@item
+Preserve any Warranty Disclaimers.
+@end enumerate
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled ``Endorsements'', provided it contains
+nothing but endorsements of your Modified Version by various
+parties---for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+@item
+COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled ``History''
+in the various original documents, forming one section Entitled
+``History''; likewise combine any sections Entitled ``Acknowledgements'',
+and any sections Entitled ``Dedications''. You must delete all
+sections Entitled ``Endorsements.''
+
+@item
+COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+@item
+AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an ``aggregate'' if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+@item
+TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled ``Acknowledgements'',
+``Dedications'', or ``History'', the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+@item
+TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License. Any other attempt to
+copy, modify, sublicense or distribute the Document is void, and will
+automatically terminate your rights under this License. However,
+parties who have received copies, or rights, from you under this
+License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+@item
+FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+@uref{http://www.gnu.org/copyleft/}.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License ``or any later version'' applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+@end enumerate
+
+@page
+@c @appendixsubsec ADDENDUM: How to use this License for your
+@c documents
+@subsection ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+@smallexample
+@group
+ Copyright (C) @var{year} @var{your name}.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+@end group
+@end smallexample
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the ``with...Texts.'' line with this:
+
+@smallexample
+@group
+ with the Invariant Sections being @var{list their titles}, with
+ the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
+ being @var{list}.
+@end group
+@end smallexample
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+
+@c Local Variables:
+@c ispell-local-pdict: "ispell-dict"
+@c End:
+
diff --git a/doc/user-guide/fuse.odg b/doc/user-guide/fuse.odg
new file mode 100644
index 00000000000..61bd103c78b
--- /dev/null
+++ b/doc/user-guide/fuse.odg
Binary files differ
diff --git a/doc/user-guide/fuse.pdf b/doc/user-guide/fuse.pdf
new file mode 100644
index 00000000000..a7d13faff56
--- /dev/null
+++ b/doc/user-guide/fuse.pdf
Binary files differ
diff --git a/doc/user-guide/ha.odg b/doc/user-guide/ha.odg
new file mode 100644
index 00000000000..e4b8b72d08b
--- /dev/null
+++ b/doc/user-guide/ha.odg
Binary files differ
diff --git a/doc/user-guide/ha.pdf b/doc/user-guide/ha.pdf
new file mode 100644
index 00000000000..e372c0ab03e
--- /dev/null
+++ b/doc/user-guide/ha.pdf
Binary files differ
diff --git a/doc/user-guide/stripe.odg b/doc/user-guide/stripe.odg
new file mode 100644
index 00000000000..79441bf1452
--- /dev/null
+++ b/doc/user-guide/stripe.odg
Binary files differ
diff --git a/doc/user-guide/stripe.pdf b/doc/user-guide/stripe.pdf
new file mode 100644
index 00000000000..b94446feb56
--- /dev/null
+++ b/doc/user-guide/stripe.pdf
Binary files differ
diff --git a/doc/user-guide/unify.odg b/doc/user-guide/unify.odg
new file mode 100644
index 00000000000..ccaa9bf16f9
--- /dev/null
+++ b/doc/user-guide/unify.odg
Binary files differ
diff --git a/doc/user-guide/unify.pdf b/doc/user-guide/unify.pdf
new file mode 100644
index 00000000000..c22027f66e7
--- /dev/null
+++ b/doc/user-guide/unify.pdf
Binary files differ
diff --git a/doc/user-guide/user-guide.info b/doc/user-guide/user-guide.info
new file mode 100644
index 00000000000..078d62adef1
--- /dev/null
+++ b/doc/user-guide/user-guide.info
@@ -0,0 +1,2698 @@
+This is ../../../doc/user-guide/user-guide.info, produced by makeinfo
+version 4.9 from ../../../doc/user-guide/user-guide.texi.
+
+START-INFO-DIR-ENTRY
+* GlusterFS: (user-guide). GlusterFS distributed filesystem user guide
+END-INFO-DIR-ENTRY
+
+ This is the user manual for GlusterFS 2.0.
+
+ Copyright (C) 2008,2007 <Z> Research, Inc. Permission is granted to
+copy, distribute and/or modify this document under the terms of the GNU
+Free Documentation License, Version 1.2 or any later version published
+by the Free Software Foundation; with no Invariant Sections, no
+Front-Cover Texts, and no Back-Cover Texts. A copy of the license is
+included in the chapter entitled "GNU Free Documentation License".
+
+
+File: user-guide.info, Node: Top, Next: Acknowledgements, Up: (dir)
+
+GlusterFS 2.0 User Guide
+************************
+
+This is the user manual for GlusterFS 2.0.
+
+ Copyright (C) 2008,2007 <Z> Research, Inc. Permission is granted to
+copy, distribute and/or modify this document under the terms of the GNU
+Free Documentation License, Version 1.2 or any later version published
+by the Free Software Foundation; with no Invariant Sections, no
+Front-Cover Texts, and no Back-Cover Texts. A copy of the license is
+included in the chapter entitled "GNU Free Documentation License".
+
+* Menu:
+
+* Acknowledgements::
+* Introduction::
+* Installation and Invocation::
+* Concepts::
+* Translators::
+* Usage Scenarios::
+* Troubleshooting::
+* GNU Free Documentation Licence::
+* Index::
+
+ --- The Detailed Node Listing ---
+
+Installation and Invocation
+
+* Pre requisites::
+* Getting GlusterFS::
+* Building::
+* Running GlusterFS::
+* A Tutorial Introduction::
+
+Running GlusterFS
+
+* Server::
+* Client::
+
+Concepts
+
+* Filesystems in Userspace::
+* Translator::
+* Volume specification file::
+
+Translators
+
+* Storage Translators::
+* Client and Server Translators::
+* Clustering Translators::
+* Performance Translators::
+* Features Translators::
+
+Storage Translators
+
+* POSIX::
+
+Client and Server Translators
+
+* Transport modules::
+* Client protocol::
+* Server protocol::
+
+Clustering Translators
+
+* Unify::
+* Replicate::
+* Stripe::
+
+Performance Translators
+
+* Read Ahead::
+* Write Behind::
+* IO Threads::
+* IO Cache::
+
+Features Translators
+
+* POSIX Locks::
+* Fixed ID::
+
+Miscellaneous Translators
+
+* ROT-13::
+* Trace::
+
+
+File: user-guide.info, Node: Acknowledgements, Next: Introduction, Prev: Top, Up: Top
+
+Acknowledgements
+****************
+
+GlusterFS continues to be a wonderful and enriching experience for all
+of us involved.
+
+ GlusterFS development would not have been possible at this pace if
+not for our enthusiastic users. People from around the world have
+helped us with bug reports, performance numbers, and feature
+suggestions. A huge thanks to them all.
+
+ Matthew Paine - for RPMs & general enthu
+
+ Leonardo Rodrigues de Mello - for DEBs
+
+ Julian Perez & Adam D'Auria - for multi-server tutorial
+
+ Paul England - for HA spec
+
+ Brent Nelson - for many bug reports
+
+ Jacques Mattheij - for Europe mirror.
+
+ Patrick Negri - for TCP non-blocking connect.
+ http://gluster.org/core-team.php (<list-hacking@zresearch.com>)
+ <Z> Research
+
+
+File: user-guide.info, Node: Introduction, Next: Installation and Invocation, Prev: Acknowledgements, Up: Top
+
+1 Introduction
+**************
+
+GlusterFS is a distributed filesystem. It works at the file level, not
+block level.
+
+ A network filesystem is one which allows us to access remote files. A
+distributed filesystem is one that stores data on multiple machines and
+makes them all appear to be a part of the same filesystem.
+
+ Need for distributed filesystems
+
+ * Scalability: A distributed filesystem allows us to store more data
+ than what can be stored on a single machine.
+
+ * Redundancy: We might want to replicate crucial data on to several
+ machines.
+
+ * Uniform access: One can mount a remote volume (for example your
+ home directory) from any machine and access the same data.
+
+1.1 Contacting us
+=================
+
+You can reach us through the mailing list *gluster-devel*
+(<gluster-devel@nongnu.org>).
+
+ You can also find many of the developers on IRC, on the `#gluster'
+channel on Freenode (<irc.freenode.net>).
+
+ The GlusterFS documentation wiki is also useful:
+<http://gluster.org/docs/index.php/GlusterFS>
+
+ For commercial support, you can contact <Z> Research at:
+
+ 3194 Winding Vista Common
+ Fremont, CA 94539
+ USA.
+
+ Phone: +1 (510) 354 6801
+ Toll free: +1 (888) 813 6309
+ Fax: +1 (510) 372 0604
+
+ You can also email us at <support@zresearch.com>.
+
+
+File: user-guide.info, Node: Installation and Invocation, Next: Concepts, Prev: Introduction, Up: Top
+
+2 Installation and Invocation
+*****************************
+
+* Menu:
+
+* Pre requisites::
+* Getting GlusterFS::
+* Building::
+* Running GlusterFS::
+* A Tutorial Introduction::
+
+
+File: user-guide.info, Node: Pre requisites, Next: Getting GlusterFS, Up: Installation and Invocation
+
+2.1 Pre requisites
+==================
+
+Before installing GlusterFS make sure you have the following components
+installed.
+
+2.1.1 FUSE
+----------
+
+You'll need FUSE version 2.6.0 or higher to use GlusterFS. You can omit
+installing FUSE if you want to build _only_ the server. Note that you
+won't be able to mount a GlusterFS filesystem on a machine that does
+not have FUSE installed.
+
+ FUSE can be downloaded from: <http://fuse.sourceforge.net/>
+
+ To get the best performance from GlusterFS, however, it is
+recommended that you use our patched version of FUSE. See Patched FUSE
+for details.
+
+2.1.2 Patched FUSE
+------------------
+
+The GlusterFS project maintains a patched version of FUSE meant to be
+used with GlusterFS. The patches increase GlusterFS performance. It is
+recommended that all users use the patched FUSE.
+
+ The patched FUSE tarball can be downloaded from:
+
+ <ftp://ftp.zresearch.com/pub/gluster/glusterfs/fuse/>
+
+ The specific changes made to FUSE are:
+
+ * The communication channel size between FUSE kernel module and
+ GlusterFS has been increased to 1MB, permitting large reads and
+ writes to be sent in bigger chunks.
+
+ * The kernel's read-ahead boundry has been extended upto 1MB.
+
+ * Block size returned in the `stat()'/`fstat()' calls tuned to 1MB,
+ to make cp and similar commands perform I/O using that block size.
+
+ * `flock()' locking support has been added (although some rework in
+ GlusterFS is needed for perfect compliance).
+
+2.1.3 libibverbs (optional)
+---------------------------
+
+This is only needed if you want GlusterFS to use InfiniBand as the
+interconnect mechanism between server and client. You can get it from:
+
+ <http://www.openfabrics.org/downloads.htm>.
+
+2.1.4 Bison and Flex
+--------------------
+
+These should be already installed on most Linux systems. If not, use
+your distribution's normal software installation procedures to install
+them. Make sure you install the relevant developer packages also.
+
+
+File: user-guide.info, Node: Getting GlusterFS, Next: Building, Prev: Pre requisites, Up: Installation and Invocation
+
+2.2 Getting GlusterFS
+=====================
+
+There are many ways to get hold of GlusterFS. For a production
+deployment, the recommended method is to download the latest release
+tarball. Release tarballs are available at:
+<http://gluster.org/download.php>.
+
+ If you want the bleeding edge development source, you can get them
+from the GNU Arch(1) repository. First you must install GNU Arch
+itself. Then register the GlusterFS archive by doing:
+
+ $ tla register-archive http://arch.sv.gnu.org/archives/gluster
+
+ Now you can check out the source itself:
+
+ $ tla get -A gluster@sv.gnu.org glusterfs--mainline--3.0
+
+ ---------- Footnotes ----------
+
+ (1) <http://www.gnu.org/software/gnu-arch/>
+
+
+File: user-guide.info, Node: Building, Next: Running GlusterFS, Prev: Getting GlusterFS, Up: Installation and Invocation
+
+2.3 Building
+============
+
+You can skip this section if you're installing from RPMs or DEBs.
+
+ GlusterFS uses the Autotools mechanism to build. As such, the
+procedure is straight-forward. First, change into the GlusterFS source
+directory.
+
+ $ cd glusterfs-<version>
+
+ If you checked out the source from the Arch repository, you'll need
+to run `./autogen.sh' first. Note that you'll need to have Autoconf and
+Automake installed for this.
+
+ Run `configure'.
+
+ $ ./configure
+
+ The configure script accepts the following options:
+
+`--disable-ibverbs'
+ Disable the InfiniBand transport mechanism.
+
+`--disable-fuse-client'
+ Disable the FUSE client.
+
+`--disable-server'
+ Disable building of the GlusterFS server.
+
+`--disable-bdb'
+ Disable building of Berkeley DB based storage translator.
+
+`--disable-mod_glusterfs'
+ Disable building of Apache/lighttpd glusterfs plugins.
+
+`--disable-epoll'
+ Use poll instead of epoll.
+
+`--disable-libglusterfsclient'
+ Disable building of libglusterfsclient
+
+
+ Build and install GlusterFS.
+
+ # make install
+
+ The binaries (`glusterfsd' and `glusterfs') will be by default
+installed in `/usr/local/sbin/'. Translator, scheduler, and transport
+shared libraries will be installed in
+`/usr/local/lib/glusterfs/<version>/'. Sample volume specification
+files will be in `/usr/local/etc/glusterfs/'. This document itself can
+be found in `/usr/local/share/doc/glusterfs/'. If you passed the
+`--prefix' argument to the configure script, then replace `/usr/local'
+in the preceding paths with the prefix.
+
+
+File: user-guide.info, Node: Running GlusterFS, Next: A Tutorial Introduction, Prev: Building, Up: Installation and Invocation
+
+2.4 Running GlusterFS
+=====================
+
+* Menu:
+
+* Server::
+* Client::
+
+
+File: user-guide.info, Node: Server, Next: Client, Up: Running GlusterFS
+
+2.4.1 Server
+------------
+
+The GlusterFS server is necessary to export storage volumes to remote
+clients (See *Note Server protocol:: for more info). This section
+documents the invocation of the GlusterFS server program and all the
+command-line options accepted by it.
+
+ Basic Options
+
+`-f, --volfile=<path>'
+ Use the volume file as the volume specification.
+
+`-s, --volfile-server=<hostname>'
+ Server to get volume file from. This option overrides -volfile
+ option.
+
+`-l, --log-file=<path>'
+ Specify the path for the log file.
+
+`-L, --log-level=<level>'
+ Set the log level for the server. Log level should be one of DEBUG,
+ WARNING, ERROR, CRITICAL, or NONE.
+
+ Advanced Options
+
+`--debug'
+ Run in debug mode. This option sets -no-daemon, -log-level to
+ DEBUG and -log-file to console.
+
+`-N, --no-daemon'
+ Run glusterfsd as a foreground process.
+
+`-p, --pid-file=<path>'
+ Path for the PID file.
+
+`--volfile-id=<key>'
+ 'key' of the volfile to be fetched from server.
+
+`--volfile-server-port=<port-number>'
+ Listening port number of volfile server.
+
+`--volfile-server-transport=[socket|ib-verbs]'
+ Transport type to get volfile from server. [default: `socket']
+
+`--xlator-options=<volume-name.option=value>'
+ Add/override a translator option for a volume with specified value.
+
+ Miscellaneous Options
+
+`-?, --help'
+ Show this help text.
+
+`--usage'
+ Display a short usage message.
+
+`-V, --version'
+ Show version information.
+
+
+File: user-guide.info, Node: Client, Prev: Server, Up: Running GlusterFS
+
+2.4.2 Client
+------------
+
+The GlusterFS client process is necessary to access remote storage
+volumes and mount them locally using FUSE. This section documents the
+invocation of the client process and all its command-line arguments.
+
+ # glusterfs [options] <mountpoint>
+
+ The `mountpoint' is the directory where you want the GlusterFS
+filesystem to appear. Example:
+
+ # glusterfs -f /usr/local/etc/glusterfs-client.vol /mnt
+
+ The command-line options are detailed below.
+
+ Basic Options
+
+`-f, --volfile=<path>'
+ Use the volume file as the volume specification.
+
+`-s, --volfile-server=<hostname>'
+ Server to get volume file from. This option overrides -volfile
+ option.
+
+`-l, --log-file=<path>'
+ Specify the path for the log file.
+
+`-L, --log-level=<level>'
+ Set the log level for the server. Log level should be one of DEBUG,
+ WARNING, ERROR, CRITICAL, or NONE.
+
+ Advanced Options
+
+`--debug'
+ Run in debug mode. This option sets -no-daemon, -log-level to
+ DEBUG and -log-file to console.
+
+`-N, --no-daemon'
+ Run `glusterfs' as a foreground process.
+
+`-p, --pid-file=<path>'
+ Path for the PID file.
+
+`--volfile-id=<key>'
+ 'key' of the volfile to be fetched from server.
+
+`--volfile-server-port=<port-number>'
+ Listening port number of volfile server.
+
+`--volfile-server-transport=[socket|ib-verbs]'
+ Transport type to get volfile from server. [default: `socket']
+
+`--xlator-options=<volume-name.option=value>'
+ Add/override a translator option for a volume with specified value.
+
+`--volume-name=<volume name>'
+ Volume name in client spec to use. Defaults to the root volume.
+
+ FUSE Options
+
+`--attribute-timeout=<n>'
+ Attribute timeout for inodes in the kernel, in seconds. Defaults
+ to 1 second.
+
+`--disable-direct-io-mode'
+ Disable direct I/O mode in FUSE kernel module.
+
+`-e, --entry-timeout=<n>'
+ Entry timeout for directory entries in the kernel, in seconds.
+ Defaults to 1 second.
+
+ Missellaneous Options
+
+`-?, --help'
+ Show this help information.
+
+`-V, --version'
+ Show version information.
+
+
+File: user-guide.info, Node: A Tutorial Introduction, Prev: Running GlusterFS, Up: Installation and Invocation
+
+2.5 A Tutorial Introduction
+===========================
+
+This section will show you how to quickly get GlusterFS up and running.
+We'll configure GlusterFS as a simple network filesystem, with one
+server and one client. In this mode of usage, GlusterFS can serve as a
+replacement for NFS.
+
+ We'll make use of two machines; call them _server_ and _client_ (If
+you don't want to setup two machines, just run everything that follows
+on the same machine). In the examples that follow, the shell prompts
+will use these names to clarify the machine on which the command is
+being run. For example, a command that should be run on the server will
+be shown with the prompt:
+
+ [root@server]#
+
+ Our goal is to make a directory on the _server_ (say, `/export')
+accessible to the _client_.
+
+ First of all, get GlusterFS installed on both the machines, as
+described in the previous sections. Make sure you have the FUSE kernel
+module loaded. You can ensure this by running:
+
+ [root@server]# modprobe fuse
+
+ Before we can run the GlusterFS client or server programs, we need
+to write two files called _volume specifications_ (equivalently refered
+to as _volfiles_). The volfile describes the _translator tree_ on a
+node. The next chapter will explain the concepts of `translator' and
+`volume specification' in detail. For now, just assume that the volfile
+is like an NFS `/etc/export' file.
+
+ On the server, create a text file somewhere (we'll assume the path
+`/tmp/glusterfsd.vol') with the following contents.
+
+ volume colon-o
+ type storage/posix
+ option directory /export
+ end-volume
+
+ volume server
+ type protocol/server
+ subvolumes colon-o
+ option transport-type tcp
+ option auth.addr.colon-o.allow *
+ end-volume
+
+ A brief explanation of the file's contents. The first section
+defines a storage volume, named "colon-o" (the volume names are
+arbitrary), which exports the `/export' directory. The second section
+defines options for the translator which will make the storage volume
+accessible remotely. It specifies `colon-o' as a subvolume. This
+defines the _translator tree_, about which more will be said in the
+next chapter. The two options specify that the TCP protocol is to be
+used (as opposed to InfiniBand, for example), and that access to the
+storage volume is to be provided to clients with any IP address at all.
+If you wanted to restrict access to this server to only your subnet for
+example, you'd specify something like `192.168.1.*' in the second
+option line.
+
+ On the client machine, create the following text file (again, we'll
+assume the path to be `/tmp/glusterfs-client.vol'). Replace
+_server-ip-address_ with the IP address of your server machine. If you
+are doing all this on a single machine, use `127.0.0.1'.
+
+ volume client
+ type protocol/client
+ option transport-type tcp
+ option remote-host _server-ip-address_
+ option remote-subvolume colon-o
+ end-volume
+
+ Now we need to start both the server and client programs. To start
+the server:
+
+ [root@server]# glusterfsd -f /tmp/glusterfs-server.vol
+
+ To start the client:
+
+ [root@client]# glusterfs -f /tmp/glusterfs-client.vol /mnt/glusterfs
+
+ You should now be able to see the files under the server's `/export'
+directory in the `/mnt/glusterfs' directory on the client. That's it;
+GlusterFS is now working as a network file system.
+
+
+File: user-guide.info, Node: Concepts, Next: Translators, Prev: Installation and Invocation, Up: Top
+
+3 Concepts
+**********
+
+* Menu:
+
+* Filesystems in Userspace::
+* Translator::
+* Volume specification file::
+
+
+File: user-guide.info, Node: Filesystems in Userspace, Next: Translator, Up: Concepts
+
+3.1 Filesystems in Userspace
+============================
+
+A filesystem is usually implemented in kernel space. Kernel space
+development is much harder than userspace development. FUSE is a kernel
+module/library that allows us to write a filesystem completely in
+userspace.
+
+ FUSE consists of a kernel module which interacts with the userspace
+implementation using a device file `/dev/fuse'. When a process makes a
+syscall on a FUSE filesystem, VFS hands the request to the FUSE module,
+which writes the request to `/dev/fuse'. The userspace implementation
+polls `/dev/fuse', and when a request arrives, processes it and writes
+the result back to `/dev/fuse'. The kernel then reads from the device
+file and returns the result to the user process.
+
+ In case of GlusterFS, the userspace program is the GlusterFS client.
+The control flow is shown in the diagram below. The GlusterFS client
+services the request by sending it to the server, which in turn hands
+it to the local POSIX filesystem.
+
+
+ Fig 1. Control flow in GlusterFS
+
+
+File: user-guide.info, Node: Translator, Next: Volume specification file, Prev: Filesystems in Userspace, Up: Concepts
+
+3.2 Translator
+==============
+
+The _translator_ is the most important concept in GlusterFS. In fact,
+GlusterFS is nothing but a collection of translators working together,
+forming a translator _tree_.
+
+ The idea of a translator is perhaps best understood using an
+analogy. Consider the VFS in the Linux kernel. The VFS abstracts the
+various filesystem implementations (such as EXT3, ReiserFS, XFS, etc.)
+supported by the kernel. When an application calls the kernel to
+perform an operation on a file, the kernel passes the request on to the
+appropriate filesystem implementation.
+
+ For example, let's say there are two partitions on a Linux machine:
+`/', which is an EXT3 partition, and `/usr', which is a ReiserFS
+partition. Now if an application wants to open a file called, say,
+`/etc/fstab', then the kernel will internally pass the request to the
+EXT3 implementation. If on the other hand, an application wants to
+read a file called `/usr/src/linux/CREDITS', then the kernel will call
+upon the ReiserFS implementation to do the job.
+
+ The "filesystem implementation" objects are analogous to GlusterFS
+translators. A GlusterFS translator implements all the filesystem
+operations. Whereas in VFS there is a two-level tree (with the kernel
+at the root and all the filesystem implementation as its children), in
+GlusterFS there exists a more elaborate tree structure.
+
+ We can now define translators more precisely. A GlusterFS translator
+is a shared object (`.so') that implements every filesystem call.
+GlusterFS translators can be arranged in an arbitrary tree structure
+(subject to constraints imposed by the translators). When GlusterFS
+receives a filesystem call, it passes it on to the translator at the
+root of the translator tree. The root translator may in turn pass it on
+to any or all of its children, and so on, until the leaf nodes are
+reached. The result of a filesystem call is communicated in the reverse
+fashion, from the leaf nodes up to the root node, and then on to the
+application.
+
+ So what might a translator tree look like?
+
+
+ Fig 2. A sample translator tree
+
+ The diagram depicts three servers and one GlusterFS client. It is
+important to note that conceptually, the translator tree spans machine
+boundaries. Thus, the client machine in the diagram, `10.0.0.1', can
+access the aggregated storage of the filesystems on the server machines
+`10.0.0.2', `10.0.0.3', and `10.0.0.4'. The translator diagram will
+make more sense once you've read the next chapter and understood the
+functions of the various translators.
+
+
+File: user-guide.info, Node: Volume specification file, Prev: Translator, Up: Concepts
+
+3.3 Volume specification file
+=============================
+
+The volume specification file describes the translator tree for both the
+server and client programs.
+
+ A volume specification file is a sequence of volume definitions.
+The syntax of a volume definition is explained below:
+
+ *volume* _volume-name_
+ *type* _translator-name_
+ *option* _option-name_ _option-value_
+ ...
+ *subvolumes* _subvolume1_ _subvolume2_ ...
+ *end-volume*
+
+ ...
+
+_volume-name_
+ An identifier for the volume. This is just a human-readable name,
+ and can contain any alphanumeric character. For instance,
+ "storage-1", "colon-o", or "forty-two".
+
+_translator-name_
+ Name of one of the available translators. Example:
+ `protocol/client', `cluster/unify'.
+
+_option-name_
+ Name of a valid option for the translator.
+
+_option-value_
+ Value for the option. Everything following the "option" keyword to
+ the end of the line is considered the value; it is up to the
+ translator to parse it.
+
+_subvolume1_, _subvolume2_, ...
+ Volume names of sub-volumes. The sub-volumes must already have
+ been defined earlier in the file.
+
+ There are a few rules you must follow when writing a volume
+specification file:
+
+ * Everything following a ``#'' is considered a comment and is
+ ignored. Blank lines are also ignored.
+
+ * All names and keywords are case-sensitive.
+
+ * The order of options inside a volume definition does not matter.
+
+ * An option value may not span multiple lines.
+
+ * If an option is not specified, it will assume its default value.
+
+ * A sub-volume must have already been defined before it can be
+ referenced. This means you have to write the specification file
+ "bottom-up", starting from the leaf nodes of the translator tree
+ and moving up to the root.
+
+ A simple example volume specification file is shown below:
+
+ # This is a comment line
+ volume client
+ type protocol/client
+ option transport-type tcp
+ option remote-host localhost # Also a comment
+ option remote-subvolume brick
+ # The subvolumes line may be absent
+ end-volume
+
+ volume iot
+ type performance/io-threads
+ option thread-count 4
+ subvolumes client
+ end-volume
+
+ volume wb
+ type performance/write-behind
+ subvolumes iot
+ end-volume
+
+
+File: user-guide.info, Node: Translators, Next: Usage Scenarios, Prev: Concepts, Up: Top
+
+4 Translators
+*************
+
+* Menu:
+
+* Storage Translators::
+* Client and Server Translators::
+* Clustering Translators::
+* Performance Translators::
+* Features Translators::
+* Miscellaneous Translators::
+
+ This chapter documents all the available GlusterFS translators in
+detail. Each translator section will show its name (for example,
+`cluster/unify'), briefly describe its purpose and workings, and list
+every option accepted by that translator and their meaning.
+
+
+File: user-guide.info, Node: Storage Translators, Next: Client and Server Translators, Up: Translators
+
+4.1 Storage Translators
+=======================
+
+The storage translators form the "backend" for GlusterFS. Currently,
+the only available storage translator is the POSIX translator, which
+stores files on a normal POSIX filesystem. A pleasant consequence of
+this is that your data will still be accessible if GlusterFS crashes or
+cannot be started.
+
+ Other storage backends are planned for the future. One of the
+possibilities is an Amazon S3 translator. Amazon S3 is an unlimited
+online storage service accessible through a web services API. The S3
+translator will allow you to access the storage as a normal POSIX
+filesystem. (1)
+
+* Menu:
+
+* POSIX::
+* BDB::
+
+ ---------- Footnotes ----------
+
+ (1) Some more discussion about this can be found at:
+
+http://developer.amazonwebservices.com/connect/message.jspa?messageID=52873
+
+
+File: user-guide.info, Node: POSIX, Next: BDB, Up: Storage Translators
+
+4.1.1 POSIX
+-----------
+
+ type storage/posix
+
+ The `posix' translator uses a normal POSIX filesystem as its
+"backend" to actually store files and directories. This can be any
+filesystem that supports extended attributes (EXT3, ReiserFS, XFS,
+...). Extended attributes are used by some translators to store
+metadata, for example, by the replicate and stripe translators. See
+*Note Replicate:: and *Note Stripe::, respectively for details.
+
+`directory <path>'
+ The directory on the local filesystem which is to be used for
+ storage.
+
+
+File: user-guide.info, Node: BDB, Prev: POSIX, Up: Storage Translators
+
+4.1.2 BDB
+---------
+
+ type storage/bdb
+
+ The `BDB' translator uses a Berkeley DB database as its "backend" to
+actually store files as key-value pair in the database and directories
+as regular POSIX directories. Note that BDB does not provide extended
+attribute support for regular files. Do not use BDB as storage
+translator while using any translator that demands extended attributes
+on "backend".
+
+`directory <path>'
+ The directory on the local filesystem which is to be used for
+ storage.
+
+`mode [cache|persistent] (cache)'
+ When BDB is run in `cache' mode, recovery of back-end is not
+ completely guaranteed. `persistent' guarantees that BDB can
+ recover back-end from Berkeley DB even if GlusterFS crashes.
+
+`errfile <path>'
+ The path of the file to be used as `errfile' for Berkeley DB to
+ report detailed error messages, if any. Note that all the contents
+ of this file will be written by Berkeley DB, not GlusterFS.
+
+`logdir <path>'
+
+
+File: user-guide.info, Node: Client and Server Translators, Next: Clustering Translators, Prev: Storage Translators, Up: Translators
+
+4.2 Client and Server Translators
+=================================
+
+The client and server translator enable GlusterFS to export a
+translator tree over the network or access a remote GlusterFS server.
+These two translators implement GlusterFS's network protocol.
+
+* Menu:
+
+* Transport modules::
+* Client protocol::
+* Server protocol::
+
+
+File: user-guide.info, Node: Transport modules, Next: Client protocol, Up: Client and Server Translators
+
+4.2.1 Transport modules
+-----------------------
+
+The client and server translators are capable of using any of the
+pluggable transport modules. Currently available transport modules are
+`tcp', which uses a TCP connection between client and server to
+communicate; `ib-sdp', which uses a TCP connection over InfiniBand, and
+`ibverbs', which uses high-speed InfiniBand connections.
+
+ Each transport module comes in two different versions, one to be
+used on the server side and the other on the client side.
+
+4.2.1.1 TCP
+...........
+
+The TCP transport module uses a TCP/IP connection between the server
+and the client.
+
+ option transport-type tcp
+
+ The TCP client module accepts the following options:
+
+`non-blocking-connect [no|off|on|yes] (on)'
+ Whether to make the connection attempt asynchronous.
+
+`remote-port <n> (6996)'
+ Server port to connect to.
+
+`remote-host <hostname> *'
+ Hostname or IP address of the server. If the host name resolves to
+ multiple IP addresses, all of them will be tried in a round-robin
+ fashion. This feature can be used to implement fail-over.
+
+ The TCP server module accepts the following options:
+
+`bind-address <address> (0.0.0.0)'
+ The local interface on which the server should listen to requests.
+ Default is to listen on all interfaces.
+
+`listen-port <n> (6996)'
+ The local port to listen on.
+
+4.2.1.2 IB-SDP
+..............
+
+ option transport-type ib-sdp
+
+ kernel implements socket interface for ib hardware. SDP is over
+ib-verbs. This module accepts the same options as `tcp'
+
+4.2.1.3 ibverbs
+...............
+
+ option transport-type tcp
+
+ InfiniBand is a scalable switched fabric interconnect mechanism
+primarily used in high-performance computing. InfiniBand can deliver
+data throughput of the order of 10 Gbit/s, with latencies of 4-5 ms.
+
+ The `ib-verbs' transport accesses the InfiniBand hardware through
+the "verbs" API, which is the lowest level of software access possible
+and which gives the highest performance. On InfiniBand hardware, it is
+always best to use `ib-verbs'. Use `ib-sdp' only if you cannot get
+`ib-verbs' working for some reason.
+
+ The `ib-verbs' client module accepts the following options:
+
+`non-blocking-connect [no|off|on|yes] (on)'
+ Whether to make the connection attempt asynchronous.
+
+`remote-port <n> (6996)'
+ Server port to connect to.
+
+`remote-host <hostname> *'
+ Hostname or IP address of the server. If the host name resolves to
+ multiple IP addresses, all of them will be tried in a round-robin
+ fashion. This feature can be used to implement fail-over.
+
+ The `ib-verbs' server module accepts the following options:
+
+`bind-address <address> (0.0.0.0)'
+ The local interface on which the server should listen to requests.
+ Default is to listen on all interfaces.
+
+`listen-port <n> (6996)'
+ The local port to listen on.
+
+ The following options are common to both the client and server
+modules:
+
+ If you are familiar with InfiniBand jargon, the mode is used by
+GlusterFS is "reliable connection-oriented channel transfer".
+
+`ib-verbs-work-request-send-count <n> (64)'
+ Length of the send queue in datagrams. [Reason to
+ increase/decrease?]
+
+`ib-verbs-work-request-recv-count <n> (64)'
+ Length of the receive queue in datagrams. [Reason to
+ increase/decrease?]
+
+`ib-verbs-work-request-send-size <size> (128KB)'
+ Size of each datagram that is sent. [Reason to increase/decrease?]
+
+`ib-verbs-work-request-recv-size <size> (128KB)'
+ Size of each datagram that is received. [Reason to
+ increase/decrease?]
+
+`ib-verbs-port <n> (1)'
+ Port number for ib-verbs.
+
+`ib-verbs-mtu [256|512|1024|2048|4096] (2048)'
+ The Maximum Transmission Unit [Reason to increase/decrease?]
+
+`ib-verbs-device-name <device-name> (first device in the list)'
+ InfiniBand device to be used.
+
+ For maximum performance, you should ensure that the send/receive
+counts on both the client and server are the same.
+
+ ib-verbs is preferred over ib-sdp.
+
+
+File: user-guide.info, Node: Client protocol, Next: Server protocol, Prev: Transport modules, Up: Client and Server Translators
+
+4.2.2 Client
+------------
+
+ type procotol/client
+
+ The client translator enables the GlusterFS client to access a
+remote server's translator tree.
+
+`transport-type [tcp,ib-sdp,ib-verbs] (tcp)'
+ The transport type to use. You should use the client versions of
+ all the transport modules (`tcp', `ib-sdp', `ib-verbs').
+
+`remote-subvolume <volume_name> *'
+ The name of the volume on the remote host to attach to. Note that
+ this is _not_ the name of the `protocol/server' volume on the
+ server. It should be any volume under the server.
+
+`transport-timeout <n> (120- seconds)'
+ Inactivity timeout. If a reply is expected and no activity takes
+ place on the connection within this time, the transport connection
+ will be broken, and a new connection will be attempted.
+
+
+File: user-guide.info, Node: Server protocol, Prev: Client protocol, Up: Client and Server Translators
+
+4.2.3 Server
+------------
+
+ type protocol/server
+
+ The server translator exports a translator tree and makes it
+accessible to remote GlusterFS clients.
+
+`client-volume-filename <path> (<CONFDIR>/glusterfs-client.vol)'
+ The volume specification file to use for the client. This is the
+ file the client will receive when it is invoked with the
+ `--server' option (*Note Client::).
+
+`transport-type [tcp,ib-verbs,ib-sdp] (tcp)'
+ The transport to use. You should use the server versions of all
+ the transport modules (`tcp', `ib-sdp', `ib-verbs').
+
+`auth.addr.<volume name>.allow <IP address wildcard pattern>'
+ IP addresses of the clients that are allowed to attach to the
+ specified volume. This can be a wildcard. For example, a wildcard
+ of the form `192.168.*.*' allows any host in the `192.168.x.x'
+ subnet to connect to the server.
+
+
+
+File: user-guide.info, Node: Clustering Translators, Next: Performance Translators, Prev: Client and Server Translators, Up: Translators
+
+4.3 Clustering Translators
+==========================
+
+The clustering translators are the most important GlusterFS
+translators, since it is these that make GlusterFS a cluster
+filesystem. These translators together enable GlusterFS to access an
+arbitrarily large amount of storage, and provide RAID-like redundancy
+and distribution over the entire cluster.
+
+ There are three clustering translators: *unify*, *replicate*, and
+*stripe*. The unify translator aggregates storage from many server
+nodes. The replicate translator provides file replication. The stripe
+translator allows a file to be spread across many server nodes. The
+following sections look at each of these translators in detail.
+
+* Menu:
+
+* Unify::
+* Replicate::
+* Stripe::
+
+
+File: user-guide.info, Node: Unify, Next: Replicate, Up: Clustering Translators
+
+4.3.1 Unify
+-----------
+
+ type cluster/unify
+
+ The unify translator presents a `unified' view of all its
+sub-volumes. That is, it makes the union of all its sub-volumes appear
+as a single volume. It is the unify translator that gives GlusterFS the
+ability to access an arbitrarily large amount of storage.
+
+ For unify to work correctly, certain invariants need to be
+maintained across the entire network. These are:
+
+ * The directory structure of all the sub-volumes must be identical.
+
+ * A particular file can exist on only one of the sub-volumes.
+ Phrasing it in another way, a pathname such as
+ `/home/calvin/homework.txt') is unique across the entire cluster.
+
+
+
+Looking at the second requirement, you might wonder how one can
+accomplish storing redundant copies of a file, if no file can exist
+multiple times. To answer, we must remember that these invariants are
+from _unify's perspective_. A translator such as replicate at a lower
+level in the translator tree than unify may subvert this picture.
+
+ The first invariant might seem quite tedious to ensure. We shall see
+later that this is not so, since unify's _self-heal_ mechanism takes
+care of maintaining it.
+
+ The second invariant implies that unify needs some way to decide
+which file goes where. Unify makes use of _scheduler_ modules for this
+purpose.
+
+ When a file needs to be created, unify's scheduler decides upon the
+sub-volume to be used to store the file. There are many schedulers
+available, each using a different algorithm and suitable for different
+purposes.
+
+ The various schedulers are described in detail in the sections that
+follow.
+
+4.3.1.1 ALU
+...........
+
+ option scheduler alu
+
+ ALU stands for "Adaptive Least Usage". It is the most advanced
+scheduler available in GlusterFS. It balances the load across volumes
+taking several factors in account. It adapts itself to changing I/O
+patterns according to its configuration. When properly configured, it
+can eliminate the need for regular tuning of the filesystem to keep
+volume load nicely balanced.
+
+ The ALU scheduler is composed of multiple least-usage
+sub-schedulers. Each sub-scheduler keeps track of a certain type of
+load, for each of the sub-volumes, getting statistics from the
+sub-volumes themselves. The sub-schedulers are these:
+
+ * disk-usage: The used and free disk space on the volume.
+
+ * read-usage: The amount of reading done from this volume.
+
+ * write-usage: The amount of writing done to this volume.
+
+ * open-files-usage: The number of files currently open from this
+ volume.
+
+ * disk-speed-usage: The speed at which the disks are spinning. This
+ is a constant value and therefore not very useful.
+
+ The ALU scheduler needs to know which of these sub-schedulers to use,
+and in which order to evaluate them. This is done through the `option
+alu.order' configuration directive.
+
+ Each sub-scheduler needs to know two things: when to kick in (the
+entry-threshold), and how long to stay in control (the exit-threshold).
+For example: when unifying three disks of 100GB, keeping an exact
+balance of disk-usage is not necesary. Instead, there could be a 1GB
+margin, which can be used to nicely balance other factors, such as
+read-usage. The disk-usage scheduler can be told to kick in only when a
+certain threshold of discrepancy is passed, such as 1GB. When it
+assumes control under this condition, it will write all subsequent data
+to the least-used volume. If it is doing so, it is unwise to stop right
+after the values are below the entry-threshold again, since that would
+make it very likely that the situation will occur again very soon. Such
+a situation would cause the ALU to spend most of its time disk-usage
+scheduling, which is unfair to the other sub-schedulers. The
+exit-threshold therefore defines the amount of data that needs to be
+written to the least-used disk, before control is relinquished again.
+
+ In addition to the sub-schedulers, the ALU scheduler also has
+"limits" options. These can stop the creation of new files on a volume
+once values drop below a certain threshold. For example, setting
+`option alu.limits.min-free-disk 5GB' will stop the scheduling of files
+to volumes that have less than 5GB of free disk space, leaving the
+files on that disk some room to grow.
+
+ The actual values you assign to the thresholds for sub-schedulers and
+limits depend on your situation. If you have fast-growing files, you'll
+want to stop file-creation on a disk much earlier than when hardly any
+of your files are growing. If you care less about disk-usage balance
+than about read-usage balance, you'll want a bigger disk-usage
+scheduler entry-threshold and a smaller read-usage scheduler
+entry-threshold.
+
+ For thresholds defining a size, values specifying "KB", "MB" and "GB"
+are allowed. For example: `option alu.limits.min-free-disk 5GB'.
+
+`alu.order <order> * ("disk-usage:write-usage:read-usage:open-files-usage:disk-speed")'
+
+`alu.disk-usage.entry-threshold <size> (1GB)'
+
+`alu.disk-usage.exit-threshold <size> (512MB)'
+
+`alu.write-usage.entry-threshold <%> (25)'
+
+`alu.write-usage.exit-threshold <%> (5)'
+
+`alu.read-usage.entry-threshold <%> (25)'
+
+`alu.read-usage.exit-threshold <%> (5)'
+
+`alu.open-files-usage.entry-threshold <n> (1000)'
+
+`alu.open-files-usage.exit-threshold <n> (100)'
+
+`alu.limits.min-free-disk <%>'
+
+`alu.limits.max-open-files <n>'
+
+4.3.1.2 Round Robin (RR)
+........................
+
+ option scheduler rr
+
+ Round-Robin (RR) scheduler creates files in a round-robin fashion.
+Each client will have its own round-robin loop. When your files are
+mostly similar in size and I/O access pattern, this scheduler is a good
+choice. RR scheduler checks for free disk space on the server before
+scheduling, so you can know when to add another server node. The
+default value of min-free-disk is 5% and is checked on file creation
+calls, with atleast 10 seconds (by default) elapsing between two checks.
+
+ Options:
+`rr.limits.min-free-disk <%> (5)'
+ Minimum free disk space a node must have for RR to schedule a file
+ to it.
+
+`rr.refresh-interval <t> (10 seconds)'
+ Time between two successive free disk space checks.
+
+4.3.1.3 Random
+..............
+
+ option scheduler random
+
+ The random scheduler schedules file creation randomly among its
+child nodes. Like the round-robin scheduler, it also checks for a
+minimum amount of free disk space before scheduling a file to a node.
+
+`random.limits.min-free-disk <%> (5)'
+ Minimum free disk space a node must have for random to schedule a
+ file to it.
+
+`random.refresh-interval <t> (10 seconds)'
+ Time between two successive free disk space checks.
+
+4.3.1.4 NUFA
+............
+
+ option scheduler nufa
+
+ It is common in many GlusterFS computing environments for all
+deployed machines to act as both servers and clients. For example, a
+research lab may have 40 workstations each with its own storage. All of
+these workstations might act as servers exporting a volume as well as
+clients accessing the entire cluster's storage. In such a situation,
+it makes sense to store locally created files on the local workstation
+itself (assuming files are accessed most by the workstation that
+created them). The Non-Uniform File Allocation (NUFA) scheduler
+accomplishes that.
+
+ NUFA gives the local system first priority for file creation over
+other nodes. If the local volume does not have more free disk space
+than a specified amount (5% by default) then NUFA schedules files among
+the other child volumes in a round-robin fashion.
+
+ NUFA is named after the similar strategy used for memory access,
+NUMA(1).
+
+`nufa.limits.min-free-disk <%> (5)'
+ Minimum disk space that must be free (local or remote) for NUFA to
+ schedule a file to it.
+
+`nufa.refresh-interval <t> (10 seconds)'
+ Time between two successive free disk space checks.
+
+`nufa.local-volume-name <volume>'
+ The name of the volume corresponding to the local system. This
+ volume must be one of the children of the unify volume. This
+ option is mandatory.
+
+4.3.1.5 Namespace
+.................
+
+Namespace volume needed because: - persistent inode numbers. - file
+exists even when node is down.
+
+ namespace files are simply touched. on every lookup it is checked.
+
+`namespace <volume> *'
+ Name of the namespace volume (which should be one of the unify
+ volume's children).
+
+`self-heal [on|off] (on)'
+ Enable/disable self-heal. Unless you know what you are doing, do
+ not disable self-heal.
+
+4.3.1.6 Self Heal
+.................
+
+* When a 'lookup()/stat()' call is made on directory for the first
+time, a self-heal call is made, which checks for the consistancy of its
+child nodes. If an entry is present in storage node, but not in
+namespace, that entry is created in namespace, and vica-versa. There is
+an writedir() API introduced which is used for the same. It also checks
+for permissions, and uid/gid consistencies.
+
+ * This check is also done when an server goes down and comes up.
+
+ * If one starts with an empty namespace export, but has data in
+storage nodes, a 'find .>/dev/null' or 'ls -lR >/dev/null' should help
+to build namespace in one shot. Even otherwise, namespace is built on
+demand when a file is looked up for the first time.
+
+ NOTE: There are some issues (Kernel 'Oops' msgs) seen with
+fuse-2.6.3, when someone deletes namespace in backend, when glusterfs is
+running. But with fuse-2.6.5, this issue is not there.
+
+ ---------- Footnotes ----------
+
+ (1) Non-Uniform Memory Access:
+<http://en.wikipedia.org/wiki/Non-Uniform_Memory_Access>
+
+
+File: user-guide.info, Node: Replicate, Next: Stripe, Prev: Unify, Up: Clustering Translators
+
+4.3.2 Replicate (formerly AFR)
+------------------------------
+
+ type cluster/replicate
+
+ Replicate provides RAID-1 like functionality for GlusterFS.
+Replicate replicates files and directories across the subvolumes. Hence
+if Replicate has four subvolumes, there will be four copies of all
+files and directories. Replicate provides high-availability, i.e., in
+case one of the subvolumes go down (e. g. server crash, network
+disconnection) Replicate will still service the requests using the
+redundant copies.
+
+ Replicate also provides self-heal functionality, i.e., in case the
+crashed servers come up, the outdated files and directories will be
+updated with the latest versions. Replicate uses extended attributes of
+the backend file system to track the versioning of files and
+directories and provide the self-heal feature.
+
+ volume replicate-example
+ type cluster/replicate
+ subvolumes brick1 brick2 brick3
+ end-volume
+
+ This sample configuration will replicate all directories and files on
+brick1, brick2 and brick3.
+
+ All the read operations happen from the first alive child. If all the
+three sub-volumes are up, reads will be done from brick1; if brick1 is
+down read will be done from brick2. In case read() was being done on
+brick1 and it goes down, replicate transparently falls back to brick2.
+
+ The next release of GlusterFS will add the following features:
+ * Ability to specify the sub-volume from which read operations are
+ to be done (this will help users who have one of the sub-volumes
+ as a local storage volume).
+
+ * Allow scheduling of read operations amongst the sub-volumes in a
+ round-robin fashion.
+
+ The order of the subvolumes list should be same across all the
+'replicate's as they will be used for locking purposes.
+
+4.3.2.1 Self Heal
+.................
+
+Replicate has self-heal feature, which updates the outdated file and
+directory copies by the most recent versions. For example consider the
+following config:
+
+ volume replicate-example
+ type cluster/replicate
+ subvolumes brick1 brick2
+ end-volume
+
+4.3.2.2 File self-heal
+......................
+
+Now if we create a file foo.txt on replicate-example, the file will be
+created on brick1 and brick2. The file will have two extended
+attributes associated with it in the backend filesystem. One is
+trusted.afr.createtime and the other is trusted.afr.version. The
+trusted.afr.createtime xattr has the create time (in terms of seconds
+since epoch) and trusted.afr.version is a number that is incremented
+each time a file is modified. This increment happens during close
+(incase any write was done before close).
+
+ If brick1 goes down, we edit foo.txt the version gets incremented.
+Now the brick1 comes back up, when we open() on foo.txt replicate will
+check if their versions are same. If they are not same, the outdated
+copy is replaced by the latest copy and its version is updated. After
+the sync the open() proceeds in the usual manner and the application
+calling open() can continue on its access to the file.
+
+ If brick1 goes down, we delete foo.txt and create a file with the
+same name again i.e foo.txt. Now brick1 comes back up, clearly there is
+a chance that the version on brick1 being more than the version on
+brick2, this is where createtime extended attribute helps in deciding
+which the outdated copy is. Hence we need to consider both createtime
+and version to decide on the latest copy.
+
+ The version attribute is incremented during the close() call. Version
+will not be incremented in case there was no write() done. In case the
+fd that the close() gets was got by create() call, we also create the
+createtime extended attribute.
+
+4.3.2.3 Directory self-heal
+...........................
+
+Suppose brick1 goes down, we delete foo.txt, brick1 comes back up, now
+we should not create foo.txt on brick2 but we should delete foo.txt on
+brick1. We handle this situation by having the createtime and version
+attribute on the directory similar to the file. when lookup() is done
+on the directory, we compare the createtime/version attributes of the
+copies and see which files needs to be deleted and delete those files
+and update the extended attributes of the outdated directory copy.
+Each time a directory is modified (a file or a subdirectory is created
+or deleted inside the directory) and one of the subvols is down, we
+increment the directory's version.
+
+ lookup() is a call initiated by the kernel on a file or directory
+just before any access to that file or directory. In glusterfs, by
+default, lookup() will not be called in case it was called in the past
+one second on that particular file or directory.
+
+ The extended attributes can be seen in the backend filesystem using
+the `getfattr' command. (`getfattr -n trusted.afr.version <file>')
+
+`debug [on|off] (off)'
+
+`self-heal [on|off] (on)'
+
+`replicate <pattern> (*:1)'
+
+`lock-node <child_volume> (first child is used by default)'
+
+
+File: user-guide.info, Node: Stripe, Prev: Replicate, Up: Clustering Translators
+
+4.3.3 Stripe
+------------
+
+ type cluster/stripe
+
+ The stripe translator distributes the contents of a file over its
+sub-volumes. It does this by creating a file equal in size to the
+total size of the file on each of its sub-volumes. It then writes only
+a part of the file to each sub-volume, leaving the rest of it empty.
+These empty regions are called `holes' in Unix terminology. The holes
+do not consume any disk space.
+
+ The diagram below makes this clear.
+
+
+
+You can configure stripe so that only filenames matching a pattern are
+striped. You can also configure the size of the data to be stored on
+each sub-volume.
+
+`block-size <pattern>:<size> (*:0 no striping)'
+ Distribute files matching `<pattern>' over the sub-volumes,
+ storing at least `<size>' on each sub-volume. For example,
+
+ option block-size *.mpg:1M
+
+ distributes all files ending in `.mpg', storing at least 1 MB on
+ each sub-volume.
+
+ Any number of `block-size' option lines may be present, specifying
+ different sizes for different file name patterns.
+
+
+File: user-guide.info, Node: Performance Translators, Next: Features Translators, Prev: Clustering Translators, Up: Translators
+
+4.4 Performance Translators
+===========================
+
+* Menu:
+
+* Read Ahead::
+* Write Behind::
+* IO Threads::
+* IO Cache::
+* Booster::
+
+
+File: user-guide.info, Node: Read Ahead, Next: Write Behind, Up: Performance Translators
+
+4.4.1 Read Ahead
+----------------
+
+ type performance/read-ahead
+
+ The read-ahead translator pre-fetches data in advance on every read.
+This benefits applications that mostly process files in sequential
+order, since the next block of data will already be available by the
+time the application is done with the current one.
+
+ Additionally, the read-ahead translator also behaves as a
+read-aggregator. Many small read operations are combined and issued as
+fewer, larger read requests to the server.
+
+ Read-ahead deals in "pages" as the unit of data fetched. The page
+size is configurable, as is the "page count", which is the number of
+pages that are pre-fetched.
+
+ Read-ahead is best used with InfiniBand (using the ib-verbs
+transport). On FastEthernet and Gigabit Ethernet networks, GlusterFS
+can achieve the link-maximum throughput even without read-ahead, making
+it quite superflous.
+
+ Note that read-ahead only happens if the reads are perfectly
+sequential. If your application accesses data in a random fashion,
+using read-ahead might actually lead to a performance loss, since
+read-ahead will pointlessly fetch pages which won't be used by the
+application.
+
+ Options:
+`page-size <n> (256KB)'
+ The unit of data that is pre-fetched.
+
+`page-count <n> (2)'
+ The number of pages that are pre-fetched.
+
+`force-atime-update [on|off|yes|no] (off|no)'
+ Whether to force an access time (atime) update on the file on
+ every read. Without this, the atime will be slightly imprecise, as
+ it will reflect the time when the read-ahead translator read the
+ data, not when the application actually read it.
+
+
+File: user-guide.info, Node: Write Behind, Next: IO Threads, Prev: Read Ahead, Up: Performance Translators
+
+4.4.2 Write Behind
+------------------
+
+ type performance/write-behind
+
+ The write-behind translator improves the latency of a write
+operation. It does this by relegating the write operation to the
+background and returning to the application even as the write is in
+progress. Using the write-behind translator, successive write requests
+can be pipelined. This mode of write-behind operation is best used on
+the client side, to enable decreased write latency for the application.
+
+ The write-behind translator can also aggregate write requests. If the
+`aggregate-size' option is specified, then successive writes upto that
+size are accumulated and written in a single operation. This mode of
+operation is best used on the server side, as this will decrease the
+disk's head movement when multiple files are being written to in
+parallel.
+
+ The `aggregate-size' option has a default value of 128KB. Although
+this works well for most users, you should always experiment with
+different values to determine the one that will deliver maximum
+performance. This is because the performance of write-behind depends on
+your interconnect, size of RAM, and the work load.
+
+`aggregate-size <n> (128KB)'
+ Amount of data to accumulate before doing a write
+
+`flush-behind [on|yes|off|no] (off|no)'
+
+
+File: user-guide.info, Node: IO Threads, Next: IO Cache, Prev: Write Behind, Up: Performance Translators
+
+4.4.3 IO Threads
+----------------
+
+ type performance/io-threads
+
+ The IO threads translator is intended to increase the responsiveness
+of the server to metadata operations by doing file I/O (read, write) in
+a background thread. Since the GlusterFS server is single-threaded,
+using the IO threads translator can significantly improve performance.
+This translator is best used on the server side, loaded just below the
+server protocol translator.
+
+ IO threads operates by handing out read and write requests to a
+separate thread. The total number of threads in existence at a time is
+constant, and configurable.
+
+`thread-count <n> (1)'
+ Number of threads to use.
+
+
+File: user-guide.info, Node: IO Cache, Next: Booster, Prev: IO Threads, Up: Performance Translators
+
+4.4.4 IO Cache
+--------------
+
+ type performance/io-cache
+
+ The IO cache translator caches data that has been read. This is
+useful if many applications read the same data multiple times, and if
+reads are much more frequent than writes (for example, IO caching may be
+useful in a web hosting environment, where most clients will simply
+read some files and only a few will write to them).
+
+ The IO cache translator reads data from its child in `page-size'
+chunks. It caches data upto `cache-size' bytes. The cache is
+maintained as a prioritized least-recently-used (LRU) list, with
+priorities determined by user-specified patterns to match filenames.
+
+ When the IO cache translator detects a write operation, the cache
+for that file is flushed.
+
+ The IO cache translator periodically verifies the consistency of
+cached data, using the modification times on the files. The
+verification timeout is configurable.
+
+`page-size <n> (128KB)'
+ Size of a page.
+
+`cache-size (n) (32MB)'
+ Total amount of data to be cached.
+
+`force-revalidate-timeout <n> (1)'
+ Timeout to force a cache consistency verification, in seconds.
+
+`priority <pattern> (*:0)'
+ Filename patterns listed in order of priority.
+
+
+File: user-guide.info, Node: Booster, Prev: IO Cache, Up: Performance Translators
+
+4.4.5 Booster
+-------------
+
+ type performance/booster
+
+ The booster translator gives applications a faster path to
+communicate read and write requests to GlusterFS. Normally, all
+requests to GlusterFS from applications go through FUSE, as indicated
+in *Note Filesystems in Userspace::. Using the booster translator in
+conjunction with the GlusterFS booster shared library, an application
+can bypass the FUSE path and send read/write requests directly to the
+GlusterFS client process.
+
+ The booster mechanism consists of two parts: the booster translator,
+and the booster shared library. The booster translator is meant to be
+loaded on the client side, usually at the root of the translator tree.
+The booster shared library should be `LD_PRELOAD'ed with the
+application.
+
+ The booster translator when loaded opens a Unix domain socket and
+listens for read/write requests on it. The booster shared library
+intercepts read and write system calls and sends the requests to the
+GlusterFS process directly using the Unix domain socket, bypassing FUSE.
+This leads to superior performance.
+
+ Once you've loaded the booster translator in your volume
+specification file, you can start your application as:
+
+ $ LD_PRELOAD=/usr/local/bin/glusterfs-booster.so your_app
+
+ The booster translator accepts no options.
+
+
+File: user-guide.info, Node: Features Translators, Next: Miscellaneous Translators, Prev: Performance Translators, Up: Translators
+
+4.5 Features Translators
+========================
+
+* Menu:
+
+* POSIX Locks::
+* Fixed ID::
+
+
+File: user-guide.info, Node: POSIX Locks, Next: Fixed ID, Up: Features Translators
+
+4.5.1 POSIX Locks
+-----------------
+
+ type features/posix-locks
+
+ This translator provides storage independent POSIX record locking
+support (`fcntl' locking). Typically you'll want to load this on the
+server side, just above the POSIX storage translator. Using this
+translator you can get both advisory locking and mandatory locking
+support. It also handles `flock()' locks properly.
+
+ Caveat: Consider a file that does not have its mandatory locking bits
+(+setgid, -group execution) turned on. Assume that this file is now
+opened by a process on a client that has the write-behind xlator
+loaded. The write-behind xlator does not cache anything for files which
+have mandatory locking enabled, to avoid incoherence. Let's say that
+mandatory locking is now enabled on this file through another client.
+The former client will not know about this change, and write-behind may
+erroneously report a write as being successful when in fact it would
+fail due to the region it is writing to being locked.
+
+ There seems to be no easy way to fix this. To work around this
+problem, it is recommended that you never enable the mandatory bits on
+a file while it is open.
+
+`mandatory [on|off] (on)'
+ Turns mandatory locking on.
+
+
+File: user-guide.info, Node: Fixed ID, Prev: POSIX Locks, Up: Features Translators
+
+4.5.2 Fixed ID
+--------------
+
+ type features/fixed-id
+
+ The fixed ID translator makes all filesystem requests from the client
+to appear to be coming from a fixed, specified UID/GID, regardless of
+which user actually initiated the request.
+
+`fixed-uid <n> [if not set, not used]'
+ The UID to send to the server
+
+`fixed-gid <n> [if not set, not used]'
+ The GID to send to the server
+
+
+File: user-guide.info, Node: Miscellaneous Translators, Prev: Features Translators, Up: Translators
+
+4.6 Miscellaneous Translators
+=============================
+
+* Menu:
+
+* ROT-13::
+* Trace::
+
+
+File: user-guide.info, Node: ROT-13, Next: Trace, Up: Miscellaneous Translators
+
+4.6.1 ROT-13
+------------
+
+ type encryption/rot-13
+
+ ROT-13 is a toy translator that can "encrypt" and "decrypt" file
+contents using the ROT-13 algorithm. ROT-13 is a trivial algorithm that
+rotates each alphabet by thirteen places. Thus, 'A' becomes 'N', 'B'
+becomes 'O', and 'Z' becomes 'M'.
+
+ It goes without saying that you shouldn't use this translator if you
+need _real_ encryption (a future release of GlusterFS will have real
+encryption translators).
+
+`encrypt-write [on|off] (on)'
+ Whether to encrypt on write
+
+`decrypt-read [on|off] (on)'
+ Whether to decrypt on read
+
+
+File: user-guide.info, Node: Trace, Prev: ROT-13, Up: Miscellaneous Translators
+
+4.6.2 Trace
+-----------
+
+ type debug/trace
+
+ The trace translator is intended for debugging purposes. When
+loaded, it logs all the system calls received by the server or client
+(wherever trace is loaded), their arguments, and the results. You must
+use a GlusterFS log level of DEBUG (See *Note Running GlusterFS::) for
+trace to work.
+
+ Sample trace output (lines have been wrapped for readability):
+ 2007-10-30 00:08:58 D [trace.c:1579:trace_opendir] trace: callid: 68
+ (*this=0x8059e40, loc=0x8091984 {path=/iozone3_283, inode=0x8091f00},
+ fd=0x8091d50)
+
+ 2007-10-30 00:08:58 D [trace.c:630:trace_opendir_cbk] trace:
+ (*this=0x8059e40, op_ret=4, op_errno=1, fd=0x8091d50)
+
+ 2007-10-30 00:08:58 D [trace.c:1602:trace_readdir] trace: callid: 69
+ (*this=0x8059e40, size=4096, offset=0 fd=0x8091d50)
+
+ 2007-10-30 00:08:58 D [trace.c:215:trace_readdir_cbk] trace:
+ (*this=0x8059e40, op_ret=0, op_errno=0, count=4)
+
+ 2007-10-30 00:08:58 D [trace.c:1624:trace_closedir] trace: callid: 71
+ (*this=0x8059e40, *fd=0x8091d50)
+
+ 2007-10-30 00:08:58 D [trace.c:809:trace_closedir_cbk] trace:
+ (*this=0x8059e40, op_ret=0, op_errno=1)
+
+
+File: user-guide.info, Node: Usage Scenarios, Next: Troubleshooting, Prev: Translators, Up: Top
+
+5 Usage Scenarios
+*****************
+
+5.1 Advanced Striping
+=====================
+
+This section is based on the Advanced Striping tutorial written by
+Anand Avati on the GlusterFS wiki (1).
+
+5.1.1 Mixed Storage Requirements
+--------------------------------
+
+There are two ways of scheduling the I/O. One at file level (using
+unify translator) and other at block level (using stripe translator).
+Striped I/O is good for files that are potentially large and require
+high parallel throughput (for example, a single file of 400GB being
+accessed by 100s and 1000s of systems simultaneously and randomly). For
+most of the cases, file level scheduling works best.
+
+ In the real world, it is desirable to mix file level and block level
+scheduling on a single storage volume. Alternatively users can choose
+to have two separate volumes and hence two mount points, but the
+applications may demand a single storage system to host both.
+
+ This document explains how to mix file level scheduling with stripe.
+
+5.1.2 Configuration Brief
+-------------------------
+
+This setup demonstrates how users can configure unify translator with
+appropriate I/O scheduler for file level scheduling and strip for only
+matching patterns. This way, GlusterFS chooses appropriate I/O profile
+and knows how to efficiently handle both the types of data.
+
+ A simple technique to achieve this effect is to create a stripe set
+of unify and stripe blocks, where unify is the first sub-volume. Files
+that do not match the stripe policy passed on to first unify sub-volume
+and inturn scheduled arcoss the cluster using its file level I/O
+scheduler.
+
+ 5.1.3 Preparing GlusterFS Envoronment
+-------------------------------------
+
+Create the directories /export/namespace, /export/unify and
+/export/stripe on all the storage bricks.
+
+ Place the following server and client volume spec file under
+/etc/glusterfs (or appropriate installed path) and replace the IP
+addresses / access control fields to match your environment.
+
+ ## file: /etc/glusterfs/glusterfsd.vol
+ volume posix-unify
+ type storage/posix
+ option directory /export/for-unify
+ end-volume
+
+ volume posix-stripe
+ type storage/posix
+ option directory /export/for-stripe
+ end-volume
+
+ volume posix-namespace
+ type storage/posix
+ option directory /export/for-namespace
+ end-volume
+
+ volume server
+ type protocol/server
+ option transport-type tcp
+ option auth.addr.posix-unify.allow 192.168.1.*
+ option auth.addr.posix-stripe.allow 192.168.1.*
+ option auth.addr.posix-namespace.allow 192.168.1.*
+ subvolumes posix-unify posix-stripe posix-namespace
+ end-volume
+
+ ## file: /etc/glusterfs/glusterfs.vol
+ volume client-namespace
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.1
+ option remote-subvolume posix-namespace
+ end-volume
+
+ volume client-unify-1
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.1
+ option remote-subvolume posix-unify
+ end-volume
+
+ volume client-unify-2
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.2
+ option remote-subvolume posix-unify
+ end-volume
+
+ volume client-unify-3
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.3
+ option remote-subvolume posix-unify
+ end-volume
+
+ volume client-unify-4
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.4
+ option remote-subvolume posix-unify
+ end-volume
+
+ volume client-stripe-1
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.1
+ option remote-subvolume posix-stripe
+ end-volume
+
+ volume client-stripe-2
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.2
+ option remote-subvolume posix-stripe
+ end-volume
+
+ volume client-stripe-3
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.3
+ option remote-subvolume posix-stripe
+ end-volume
+
+ volume client-stripe-4
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.4
+ option remote-subvolume posix-stripe
+ end-volume
+
+ volume unify
+ type cluster/unify
+ option scheduler rr
+ subvolumes cluster-unify-1 cluster-unify-2 cluster-unify-3 cluster-unify-4
+ end-volume
+
+ volume stripe
+ type cluster/stripe
+ option block-size *.img:2MB # All files ending with .img are striped with 2MB stripe block size.
+ subvolumes unify cluster-stripe-1 cluster-stripe-2 cluster-stripe-3 cluster-stripe-4
+ end-volume
+
+ Bring up the Storage
+
+ Starting GlusterFS Server: If you have installed through binary
+package, you can start the service through init.d startup script. If
+not:
+
+ [root@server]# glusterfsd
+
+ Mounting GlusterFS Volumes:
+
+ [root@client]# glusterfs -s [BRICK-IP-ADDRESS] /mnt/cluster
+
+ Improving upon this Setup
+
+ Infiniband Verbs RDMA transport is much faster than TCP/IP GigE
+transport.
+
+ Use of performance translators such as read-ahead, write-behind,
+io-cache, io-threads, booster is recommended.
+
+ Replace round-robin (rr) scheduler with ALU to handle more dynamic
+storage environments.
+
+ ---------- Footnotes ----------
+
+ (1)
+http://gluster.org/docs/index.php/Mixing_Striped_and_Regular_Files
+
+
+File: user-guide.info, Node: Troubleshooting, Next: GNU Free Documentation Licence, Prev: Usage Scenarios, Up: Top
+
+6 Troubleshooting
+*****************
+
+This chapter is a general troubleshooting guide to GlusterFS. It lists
+common GlusterFS server and client error messages, debugging hints, and
+concludes with the suggested procedure to report bugs in GlusterFS.
+
+6.1 GlusterFS error messages
+============================
+
+6.1.1 Server errors
+-------------------
+
+ glusterfsd: FATAL: could not open specfile:
+ '/etc/glusterfs/glusterfsd.vol'
+
+ The GlusterFS server expects the volume specification file to be at
+`/etc/glusterfs/glusterfsd.vol'. The example specification file will be
+installed as `/etc/glusterfs/glusterfsd.vol.sample'. You need to edit
+it and rename it, or provide a different specification file using the
+`--spec-file' command line option (See *Note Server::).
+
+ gf_log_init: failed to open logfile "/usr/var/log/glusterfs/glusterfsd.log"
+ (Permission denied)
+
+ You don't have permission to create files in the
+`/usr/var/log/glusterfs' directory. Make sure you are running GlusterFS
+as root. Alternatively, specify a different path for the log file using
+the `--log-file' option (See *Note Server::).
+
+6.1.2 Client errors
+-------------------
+
+ fusermount: failed to access mountpoint /mnt:
+ Transport endpoint is not connected
+
+ A previous failed (or hung) mount of GlusterFS is preventing it from
+being mounted again in the same location. The fix is to do:
+
+ # umount /mnt
+
+ and try mounting again.
+
+ *"Transport endpoint is not connected".*
+
+ If you get this error when you try a command such as `ls' or `cat',
+it means the GlusterFS mount did not succeed. Try running GlusterFS in
+`DEBUG' logging level and study the log messages to discover the cause.
+
+ *"Connect to server failed", "SERVER-ADDRESS: Connection refused".*
+
+ GluserFS Server is not running or dead. Check your network
+connections and firewall settings. To check if the server is reachable,
+try:
+
+ telnet IP-ADDRESS 6996
+
+ If the server is accessible, your `telnet' command should connect and
+block. If not you will see an error message such as `telnet: Unable to
+connect to remote host: Connection refused'. 6996 is the default
+GlusterFS port. If you have changed it, then use the corresponding port
+instead.
+
+ gf_log_init: failed to open logfile "/usr/var/log/glusterfs/glusterfs.log"
+ (Permission denied)
+
+ You don't have permission to create files in the
+`/usr/var/log/glusterfs' directory. Make sure you are running GlusterFS
+as root. Alternatively, specify a different path for the log file using
+the `--log-file' option (See *Note Client::).
+
+6.2 FUSE error messages
+=======================
+
+`modprobe fuse' fails with: "Unknown symbol in module, or unknown
+parameter".
+
+ If you are using fuse-2.6.x on Redhat Enterprise Linux Work Station 4
+and Advanced Server 4 with 2.6.9-42.ELlargesmp, 2.6.9-42.ELsmp,
+2.6.9-42.EL kernels and get this error while loading FUSE kernel
+module, you need to apply the following patch.
+
+ For fuse-2.6.2:
+
+<http://ftp.zresearch.com/pub/gluster/glusterfs/fuse/fuse-2.6.2-rhel-build.patch>
+
+ For fuse-2.6.3:
+
+<http://ftp.zresearch.com/pub/gluster/glusterfs/fuse/fuse-2.6.3-rhel-build.patch>
+
+6.3 AppArmour and GlusterFS
+===========================
+
+Under OpenSuSE GNU/Linux, the AppArmour security feature does not allow
+GlusterFS to create temporary files or network socket connections even
+while running as root. You will see error messages like `Unable to open
+log file: Operation not permitted' or `Connection refused'. Disabling
+AppArmour using YaST or properly configuring AppArmour to recognize
+`glusterfsd' or `glusterfs'/`fusermount' should solve the problem.
+
+6.4 Reporting a bug
+===================
+
+If you encounter a bug in GlusterFS, please follow the below guidelines
+when you report it to the mailing list. Be sure to report it! User
+feedback is crucial to the health of the project and we value it highly.
+
+6.4.1 General instructions
+--------------------------
+
+When running GlusterFS in a non-production environment, be sure to
+build it with the following command:
+
+ $ make CFLAGS='-g -O0 -DDEBUG'
+
+ This includes debugging information which will be helpful in getting
+backtraces (see below) and also disable optimization. Enabling
+optimization can result in incorrect line numbers being reported to gdb.
+
+6.4.2 Volume specification files
+--------------------------------
+
+Attach all relevant server and client spec files you were using when
+you encountered the bug. Also tell us details of your setup, i.e., how
+many clients and how many servers.
+
+6.4.3 Log files
+---------------
+
+Set the loglevel of your client and server programs to DEBUG (by
+passing the -L DEBUG option) and attach the log files with your bug
+report. Obviously, if only the client is failing (for example), you
+only need to send us the client log file.
+
+6.4.4 Backtrace
+---------------
+
+If GlusterFS has encountered a segmentation fault or has crashed for
+some other reason, include the backtrace with the bug report. You can
+get the backtrace using the following procedure.
+
+ Run the GlusterFS client or server inside gdb.
+
+ $ gdb ./glusterfs
+ (gdb) set args -f client.spec -N -l/path/to/log/file -LDEBUG /mnt/point
+ (gdb) run
+
+ Now when the process segfaults, you can get the backtrace by typing:
+
+ (gdb) bt
+
+ If the GlusterFS process has crashed and dumped a core file (you can
+find this in / if running as a daemon and in the current directory
+otherwise), you can do:
+
+ $ gdb /path/to/glusterfs /path/to/core.<pid>
+
+ and then get the backtrace.
+
+ If the GlusterFS server or client seems to be hung, then you can get
+the backtrace by attaching gdb to the process. First get the `PID' of
+the process (using ps), and then do:
+
+ $ gdb ./glusterfs <pid>
+
+ Press Ctrl-C to interrupt the process and then generate the
+backtrace.
+
+6.4.5 Reproducing the bug
+-------------------------
+
+If the bug is reproducible, please include the steps necessary to do
+so. If the bug is not reproducible, send us the bug report anyway.
+
+6.4.6 Other information
+-----------------------
+
+If you think it is relevant, send us also the version of FUSE you're
+using, the kernel version, platform.
+
+
+File: user-guide.info, Node: GNU Free Documentation Licence, Next: Index, Prev: Troubleshooting, Up: Top
+
+Appendix A GNU Free Documentation Licence
+*****************************************
+
+ Version 1.2, November 2002
+
+ Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ 0. PREAMBLE
+
+ The purpose of this License is to make a manual, textbook, or other
+ functional and useful document "free" in the sense of freedom: to
+ assure everyone the effective freedom to copy and redistribute it,
+ with or without modifying it, either commercially or
+ noncommercially. Secondarily, this License preserves for the
+ author and publisher a way to get credit for their work, while not
+ being considered responsible for modifications made by others.
+
+ This License is a kind of "copyleft", which means that derivative
+ works of the document must themselves be free in the same sense.
+ It complements the GNU General Public License, which is a copyleft
+ license designed for free software.
+
+ We have designed this License in order to use it for manuals for
+ free software, because free software needs free documentation: a
+ free program should come with manuals providing the same freedoms
+ that the software does. But this License is not limited to
+ software manuals; it can be used for any textual work, regardless
+ of subject matter or whether it is published as a printed book.
+ We recommend this License principally for works whose purpose is
+ instruction or reference.
+
+ 1. APPLICABILITY AND DEFINITIONS
+
+ This License applies to any manual or other work, in any medium,
+ that contains a notice placed by the copyright holder saying it
+ can be distributed under the terms of this License. Such a notice
+ grants a world-wide, royalty-free license, unlimited in duration,
+ to use that work under the conditions stated herein. The
+ "Document", below, refers to any such manual or work. Any member
+ of the public is a licensee, and is addressed as "you". You
+ accept the license if you copy, modify or distribute the work in a
+ way requiring permission under copyright law.
+
+ A "Modified Version" of the Document means any work containing the
+ Document or a portion of it, either copied verbatim, or with
+ modifications and/or translated into another language.
+
+ A "Secondary Section" is a named appendix or a front-matter section
+ of the Document that deals exclusively with the relationship of the
+ publishers or authors of the Document to the Document's overall
+ subject (or to related matters) and contains nothing that could
+ fall directly within that overall subject. (Thus, if the Document
+ is in part a textbook of mathematics, a Secondary Section may not
+ explain any mathematics.) The relationship could be a matter of
+ historical connection with the subject or with related matters, or
+ of legal, commercial, philosophical, ethical or political position
+ regarding them.
+
+ The "Invariant Sections" are certain Secondary Sections whose
+ titles are designated, as being those of Invariant Sections, in
+ the notice that says that the Document is released under this
+ License. If a section does not fit the above definition of
+ Secondary then it is not allowed to be designated as Invariant.
+ The Document may contain zero Invariant Sections. If the Document
+ does not identify any Invariant Sections then there are none.
+
+ The "Cover Texts" are certain short passages of text that are
+ listed, as Front-Cover Texts or Back-Cover Texts, in the notice
+ that says that the Document is released under this License. A
+ Front-Cover Text may be at most 5 words, and a Back-Cover Text may
+ be at most 25 words.
+
+ A "Transparent" copy of the Document means a machine-readable copy,
+ represented in a format whose specification is available to the
+ general public, that is suitable for revising the document
+ straightforwardly with generic text editors or (for images
+ composed of pixels) generic paint programs or (for drawings) some
+ widely available drawing editor, and that is suitable for input to
+ text formatters or for automatic translation to a variety of
+ formats suitable for input to text formatters. A copy made in an
+ otherwise Transparent file format whose markup, or absence of
+ markup, has been arranged to thwart or discourage subsequent
+ modification by readers is not Transparent. An image format is
+ not Transparent if used for any substantial amount of text. A
+ copy that is not "Transparent" is called "Opaque".
+
+ Examples of suitable formats for Transparent copies include plain
+ ASCII without markup, Texinfo input format, LaTeX input format,
+ SGML or XML using a publicly available DTD, and
+ standard-conforming simple HTML, PostScript or PDF designed for
+ human modification. Examples of transparent image formats include
+ PNG, XCF and JPG. Opaque formats include proprietary formats that
+ can be read and edited only by proprietary word processors, SGML or
+ XML for which the DTD and/or processing tools are not generally
+ available, and the machine-generated HTML, PostScript or PDF
+ produced by some word processors for output purposes only.
+
+ The "Title Page" means, for a printed book, the title page itself,
+ plus such following pages as are needed to hold, legibly, the
+ material this License requires to appear in the title page. For
+ works in formats which do not have any title page as such, "Title
+ Page" means the text near the most prominent appearance of the
+ work's title, preceding the beginning of the body of the text.
+
+ A section "Entitled XYZ" means a named subunit of the Document
+ whose title either is precisely XYZ or contains XYZ in parentheses
+ following text that translates XYZ in another language. (Here XYZ
+ stands for a specific section name mentioned below, such as
+ "Acknowledgements", "Dedications", "Endorsements", or "History".)
+ To "Preserve the Title" of such a section when you modify the
+ Document means that it remains a section "Entitled XYZ" according
+ to this definition.
+
+ The Document may include Warranty Disclaimers next to the notice
+ which states that this License applies to the Document. These
+ Warranty Disclaimers are considered to be included by reference in
+ this License, but only as regards disclaiming warranties: any other
+ implication that these Warranty Disclaimers may have is void and
+ has no effect on the meaning of this License.
+
+ 2. VERBATIM COPYING
+
+ You may copy and distribute the Document in any medium, either
+ commercially or noncommercially, provided that this License, the
+ copyright notices, and the license notice saying this License
+ applies to the Document are reproduced in all copies, and that you
+ add no other conditions whatsoever to those of this License. You
+ may not use technical measures to obstruct or control the reading
+ or further copying of the copies you make or distribute. However,
+ you may accept compensation in exchange for copies. If you
+ distribute a large enough number of copies you must also follow
+ the conditions in section 3.
+
+ You may also lend copies, under the same conditions stated above,
+ and you may publicly display copies.
+
+ 3. COPYING IN QUANTITY
+
+ If you publish printed copies (or copies in media that commonly
+ have printed covers) of the Document, numbering more than 100, and
+ the Document's license notice requires Cover Texts, you must
+ enclose the copies in covers that carry, clearly and legibly, all
+ these Cover Texts: Front-Cover Texts on the front cover, and
+ Back-Cover Texts on the back cover. Both covers must also clearly
+ and legibly identify you as the publisher of these copies. The
+ front cover must present the full title with all words of the
+ title equally prominent and visible. You may add other material
+ on the covers in addition. Copying with changes limited to the
+ covers, as long as they preserve the title of the Document and
+ satisfy these conditions, can be treated as verbatim copying in
+ other respects.
+
+ If the required texts for either cover are too voluminous to fit
+ legibly, you should put the first ones listed (as many as fit
+ reasonably) on the actual cover, and continue the rest onto
+ adjacent pages.
+
+ If you publish or distribute Opaque copies of the Document
+ numbering more than 100, you must either include a
+ machine-readable Transparent copy along with each Opaque copy, or
+ state in or with each Opaque copy a computer-network location from
+ which the general network-using public has access to download
+ using public-standard network protocols a complete Transparent
+ copy of the Document, free of added material. If you use the
+ latter option, you must take reasonably prudent steps, when you
+ begin distribution of Opaque copies in quantity, to ensure that
+ this Transparent copy will remain thus accessible at the stated
+ location until at least one year after the last time you
+ distribute an Opaque copy (directly or through your agents or
+ retailers) of that edition to the public.
+
+ It is requested, but not required, that you contact the authors of
+ the Document well before redistributing any large number of
+ copies, to give them a chance to provide you with an updated
+ version of the Document.
+
+ 4. MODIFICATIONS
+
+ You may copy and distribute a Modified Version of the Document
+ under the conditions of sections 2 and 3 above, provided that you
+ release the Modified Version under precisely this License, with
+ the Modified Version filling the role of the Document, thus
+ licensing distribution and modification of the Modified Version to
+ whoever possesses a copy of it. In addition, you must do these
+ things in the Modified Version:
+
+ A. Use in the Title Page (and on the covers, if any) a title
+ distinct from that of the Document, and from those of
+ previous versions (which should, if there were any, be listed
+ in the History section of the Document). You may use the
+ same title as a previous version if the original publisher of
+ that version gives permission.
+
+ B. List on the Title Page, as authors, one or more persons or
+ entities responsible for authorship of the modifications in
+ the Modified Version, together with at least five of the
+ principal authors of the Document (all of its principal
+ authors, if it has fewer than five), unless they release you
+ from this requirement.
+
+ C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+
+ D. Preserve all the copyright notices of the Document.
+
+ E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+
+ F. Include, immediately after the copyright notices, a license
+ notice giving the public permission to use the Modified
+ Version under the terms of this License, in the form shown in
+ the Addendum below.
+
+ G. Preserve in that license notice the full lists of Invariant
+ Sections and required Cover Texts given in the Document's
+ license notice.
+
+ H. Include an unaltered copy of this License.
+
+ I. Preserve the section Entitled "History", Preserve its Title,
+ and add to it an item stating at least the title, year, new
+ authors, and publisher of the Modified Version as given on
+ the Title Page. If there is no section Entitled "History" in
+ the Document, create one stating the title, year, authors,
+ and publisher of the Document as given on its Title Page,
+ then add an item describing the Modified Version as stated in
+ the previous sentence.
+
+ J. Preserve the network location, if any, given in the Document
+ for public access to a Transparent copy of the Document, and
+ likewise the network locations given in the Document for
+ previous versions it was based on. These may be placed in
+ the "History" section. You may omit a network location for a
+ work that was published at least four years before the
+ Document itself, or if the original publisher of the version
+ it refers to gives permission.
+
+ K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the
+ section all the substance and tone of each of the contributor
+ acknowledgements and/or dedications given therein.
+
+ L. Preserve all the Invariant Sections of the Document,
+ unaltered in their text and in their titles. Section numbers
+ or the equivalent are not considered part of the section
+ titles.
+
+ M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+
+ N. Do not retitle any existing section to be Entitled
+ "Endorsements" or to conflict in title with any Invariant
+ Section.
+
+ O. Preserve any Warranty Disclaimers.
+
+ If the Modified Version includes new front-matter sections or
+ appendices that qualify as Secondary Sections and contain no
+ material copied from the Document, you may at your option
+ designate some or all of these sections as invariant. To do this,
+ add their titles to the list of Invariant Sections in the Modified
+ Version's license notice. These titles must be distinct from any
+ other section titles.
+
+ You may add a section Entitled "Endorsements", provided it contains
+ nothing but endorsements of your Modified Version by various
+ parties--for example, statements of peer review or that the text
+ has been approved by an organization as the authoritative
+ definition of a standard.
+
+ You may add a passage of up to five words as a Front-Cover Text,
+ and a passage of up to 25 words as a Back-Cover Text, to the end
+ of the list of Cover Texts in the Modified Version. Only one
+ passage of Front-Cover Text and one of Back-Cover Text may be
+ added by (or through arrangements made by) any one entity. If the
+ Document already includes a cover text for the same cover,
+ previously added by you or by arrangement made by the same entity
+ you are acting on behalf of, you may not add another; but you may
+ replace the old one, on explicit permission from the previous
+ publisher that added the old one.
+
+ The author(s) and publisher(s) of the Document do not by this
+ License give permission to use their names for publicity for or to
+ assert or imply endorsement of any Modified Version.
+
+ 5. COMBINING DOCUMENTS
+
+ You may combine the Document with other documents released under
+ this License, under the terms defined in section 4 above for
+ modified versions, provided that you include in the combination
+ all of the Invariant Sections of all of the original documents,
+ unmodified, and list them all as Invariant Sections of your
+ combined work in its license notice, and that you preserve all
+ their Warranty Disclaimers.
+
+ The combined work need only contain one copy of this License, and
+ multiple identical Invariant Sections may be replaced with a single
+ copy. If there are multiple Invariant Sections with the same name
+ but different contents, make the title of each such section unique
+ by adding at the end of it, in parentheses, the name of the
+ original author or publisher of that section if known, or else a
+ unique number. Make the same adjustment to the section titles in
+ the list of Invariant Sections in the license notice of the
+ combined work.
+
+ In the combination, you must combine any sections Entitled
+ "History" in the various original documents, forming one section
+ Entitled "History"; likewise combine any sections Entitled
+ "Acknowledgements", and any sections Entitled "Dedications". You
+ must delete all sections Entitled "Endorsements."
+
+ 6. COLLECTIONS OF DOCUMENTS
+
+ You may make a collection consisting of the Document and other
+ documents released under this License, and replace the individual
+ copies of this License in the various documents with a single copy
+ that is included in the collection, provided that you follow the
+ rules of this License for verbatim copying of each of the
+ documents in all other respects.
+
+ You may extract a single document from such a collection, and
+ distribute it individually under this License, provided you insert
+ a copy of this License into the extracted document, and follow
+ this License in all other respects regarding verbatim copying of
+ that document.
+
+ 7. AGGREGATION WITH INDEPENDENT WORKS
+
+ A compilation of the Document or its derivatives with other
+ separate and independent documents or works, in or on a volume of
+ a storage or distribution medium, is called an "aggregate" if the
+ copyright resulting from the compilation is not used to limit the
+ legal rights of the compilation's users beyond what the individual
+ works permit. When the Document is included in an aggregate, this
+ License does not apply to the other works in the aggregate which
+ are not themselves derivative works of the Document.
+
+ If the Cover Text requirement of section 3 is applicable to these
+ copies of the Document, then if the Document is less than one half
+ of the entire aggregate, the Document's Cover Texts may be placed
+ on covers that bracket the Document within the aggregate, or the
+ electronic equivalent of covers if the Document is in electronic
+ form. Otherwise they must appear on printed covers that bracket
+ the whole aggregate.
+
+ 8. TRANSLATION
+
+ Translation is considered a kind of modification, so you may
+ distribute translations of the Document under the terms of section
+ 4. Replacing Invariant Sections with translations requires special
+ permission from their copyright holders, but you may include
+ translations of some or all Invariant Sections in addition to the
+ original versions of these Invariant Sections. You may include a
+ translation of this License, and all the license notices in the
+ Document, and any Warranty Disclaimers, provided that you also
+ include the original English version of this License and the
+ original versions of those notices and disclaimers. In case of a
+ disagreement between the translation and the original version of
+ this License or a notice or disclaimer, the original version will
+ prevail.
+
+ If a section in the Document is Entitled "Acknowledgements",
+ "Dedications", or "History", the requirement (section 4) to
+ Preserve its Title (section 1) will typically require changing the
+ actual title.
+
+ 9. TERMINATION
+
+ You may not copy, modify, sublicense, or distribute the Document
+ except as expressly provided for under this License. Any other
+ attempt to copy, modify, sublicense or distribute the Document is
+ void, and will automatically terminate your rights under this
+ License. However, parties who have received copies, or rights,
+ from you under this License will not have their licenses
+ terminated so long as such parties remain in full compliance.
+
+ 10. FUTURE REVISIONS OF THIS LICENSE
+
+ The Free Software Foundation may publish new, revised versions of
+ the GNU Free Documentation License from time to time. Such new
+ versions will be similar in spirit to the present version, but may
+ differ in detail to address new problems or concerns. See
+ `http://www.gnu.org/copyleft/'.
+
+ Each version of the License is given a distinguishing version
+ number. If the Document specifies that a particular numbered
+ version of this License "or any later version" applies to it, you
+ have the option of following the terms and conditions either of
+ that specified version or of any later version that has been
+ published (not as a draft) by the Free Software Foundation. If
+ the Document does not specify a version number of this License,
+ you may choose any version ever published (not as a draft) by the
+ Free Software Foundation.
+
+A.0.1 ADDENDUM: How to use this License for your documents
+----------------------------------------------------------
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and license
+notices just after the title page:
+
+ Copyright (C) YEAR YOUR NAME.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+
+ If you have Invariant Sections, Front-Cover Texts and Back-Cover
+Texts, replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with
+ the Front-Cover Texts being LIST, and with the Back-Cover Texts
+ being LIST.
+
+ If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+ If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License, to
+permit their use in free software.
+
+
+File: user-guide.info, Node: Index, Prev: GNU Free Documentation Licence, Up: Top
+
+Index
+*****
+
+
+* Menu:
+
+* alu (scheduler): Unify. (line 49)
+* AppArmour: Troubleshooting. (line 96)
+* arch: Getting GlusterFS. (line 6)
+* booster: Booster. (line 6)
+* commercial support: Introduction. (line 36)
+* DNS round robin: Transport modules. (line 29)
+* fcntl: POSIX Locks. (line 6)
+* FDL, GNU Free Documentation License: GNU Free Documentation Licence.
+ (line 6)
+* fixed-id (translator): Fixed ID. (line 6)
+* GlusterFS client: Client. (line 6)
+* GlusterFS mailing list: Introduction. (line 28)
+* GlusterFS server: Server. (line 6)
+* infiniband transport: Transport modules. (line 58)
+* InfiniBand, installation: Pre requisites. (line 51)
+* io-cache (translator): IO Cache. (line 6)
+* io-threads (translator): IO Threads. (line 6)
+* IRC channel, #gluster: Introduction. (line 31)
+* libibverbs: Pre requisites. (line 51)
+* namespace: Unify. (line 207)
+* nufa (scheduler): Unify. (line 175)
+* OpenSuSE: Troubleshooting. (line 96)
+* posix-locks (translator): POSIX Locks. (line 6)
+* random (scheduler): Unify. (line 159)
+* read-ahead (translator): Read Ahead. (line 6)
+* record locking: POSIX Locks. (line 6)
+* Redhat Enterprise Linux: Troubleshooting. (line 78)
+* Replicate: Replicate. (line 6)
+* rot-13 (translator): ROT-13. (line 6)
+* rr (scheduler): Unify. (line 138)
+* scheduler (unify): Unify. (line 6)
+* self heal (replicate): Replicate. (line 46)
+* self heal (unify): Unify. (line 223)
+* stripe (translator): Stripe. (line 6)
+* trace (translator): Trace. (line 6)
+* unify (translator): Unify. (line 6)
+* unify invariants: Unify. (line 16)
+* write-behind (translator): Write Behind. (line 6)
+* Z Research, Inc.: Introduction. (line 36)
+
+
+
+Tag Table:
+Node: Top703
+Node: Acknowledgements2303
+Node: Introduction3213
+Node: Installation and Invocation4648
+Node: Pre requisites4932
+Node: Getting GlusterFS7022
+Ref: Getting GlusterFS-Footnote-17808
+Node: Building7856
+Node: Running GlusterFS9558
+Node: Server9769
+Node: Client11357
+Node: A Tutorial Introduction13563
+Node: Concepts17100
+Node: Filesystems in Userspace17315
+Node: Translator18456
+Node: Volume specification file21159
+Node: Translators23631
+Node: Storage Translators24200
+Ref: Storage Translators-Footnote-125007
+Node: POSIX25141
+Node: BDB25764
+Node: Client and Server Translators26821
+Node: Transport modules27297
+Node: Client protocol31444
+Node: Server protocol32383
+Node: Clustering Translators33372
+Node: Unify34259
+Ref: Unify-Footnote-143858
+Node: Replicate43950
+Node: Stripe49005
+Node: Performance Translators50163
+Node: Read Ahead50437
+Node: Write Behind52169
+Node: IO Threads53578
+Node: IO Cache54366
+Node: Booster55690
+Node: Features Translators57104
+Node: POSIX Locks57332
+Node: Fixed ID58649
+Node: Miscellaneous Translators59135
+Node: ROT-1359333
+Node: Trace60012
+Node: Usage Scenarios61281
+Ref: Usage Scenarios-Footnote-167214
+Node: Troubleshooting67289
+Node: GNU Free Documentation Licence73637
+Node: Index96086
+
+End Tag Table
diff --git a/doc/user-guide/user-guide.pdf b/doc/user-guide/user-guide.pdf
new file mode 100644
index 00000000000..ed7bd2a9907
--- /dev/null
+++ b/doc/user-guide/user-guide.pdf
Binary files differ
diff --git a/doc/user-guide/user-guide.texi b/doc/user-guide/user-guide.texi
new file mode 100644
index 00000000000..8365419a611
--- /dev/null
+++ b/doc/user-guide/user-guide.texi
@@ -0,0 +1,2226 @@
+\input texinfo
+@setfilename user-guide.info
+@settitle GlusterFS 2.0 User Guide
+@afourpaper
+
+@direntry
+* GlusterFS: (user-guide). GlusterFS distributed filesystem user guide
+@end direntry
+
+@copying
+This is the user manual for GlusterFS 2.0.
+
+Copyright @copyright{} 2008,2007 @email{@b{Z}} Research, Inc. Permission is granted to
+copy, distribute and/or modify this document under the terms of the
+@acronym{GNU} Free Documentation License, Version 1.2 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the
+license is included in the chapter entitled ``@acronym{GNU} Free
+Documentation License''.
+@end copying
+
+@titlepage
+@title GlusterFS 2.0 User Guide [DRAFT]
+@subtitle January 15, 2008
+@author http://gluster.org/core-team.php
+@author @email{@b{Z}} @b{Research}
+
+@page
+@vskip 0pt plus 1filll
+@insertcopying
+@end titlepage
+
+@c Info stuff
+@ifnottex
+@node Top
+@top GlusterFS 2.0 User Guide
+
+@insertcopying
+@menu
+* Acknowledgements::
+* Introduction::
+* Installation and Invocation::
+* Concepts::
+* Translators::
+* Usage Scenarios::
+* Troubleshooting::
+* GNU Free Documentation Licence::
+* Index::
+
+@detailmenu
+ --- The Detailed Node Listing ---
+
+Installation and Invocation
+
+* Pre requisites::
+* Getting GlusterFS::
+* Building::
+* Running GlusterFS::
+* A Tutorial Introduction::
+
+Running GlusterFS
+
+* Server::
+* Client::
+
+Concepts
+
+* Filesystems in Userspace::
+* Translator::
+* Volume specification file::
+
+Translators
+
+* Storage Translators::
+* Client and Server Translators::
+* Clustering Translators::
+* Performance Translators::
+* Features Translators::
+
+Storage Translators
+
+* POSIX::
+
+Client and Server Translators
+
+* Transport modules::
+* Client protocol::
+* Server protocol::
+
+Clustering Translators
+
+* Unify::
+* Replicate::
+* Stripe::
+
+Performance Translators
+
+* Read Ahead::
+* Write Behind::
+* IO Threads::
+* IO Cache::
+
+Features Translators
+
+* POSIX Locks::
+* Fixed ID::
+
+Miscellaneous Translators
+
+* ROT-13::
+* Trace::
+
+@end detailmenu
+@end menu
+
+@end ifnottex
+@c Info stuff end
+
+@contents
+
+@node Acknowledgements
+@unnumbered Acknowledgements
+GlusterFS continues to be a wonderful and enriching experience for all
+of us involved.
+
+GlusterFS development would not have been possible at this pace if
+not for our enthusiastic users. People from around the world have
+helped us with bug reports, performance numbers, and feature suggestions.
+A huge thanks to them all.
+
+Matthew Paine - for RPMs & general enthu
+
+Leonardo Rodrigues de Mello - for DEBs
+
+Julian Perez & Adam D'Auria - for multi-server tutorial
+
+Paul England - for HA spec
+
+Brent Nelson - for many bug reports
+
+Jacques Mattheij - for Europe mirror.
+
+Patrick Negri - for TCP non-blocking connect.
+@flushright
+http://gluster.org/core-team.php (@email{list-hacking@@zresearch.com})
+@email{@b{Z}} Research
+@end flushright
+
+@node Introduction
+@chapter Introduction
+
+GlusterFS is a distributed filesystem. It works at the file level,
+not block level.
+
+A network filesystem is one which allows us to access remote files. A
+distributed filesystem is one that stores data on multiple machines
+and makes them all appear to be a part of the same filesystem.
+
+Need for distributed filesystems
+
+@itemize @bullet
+@item Scalability: A distributed filesystem allows us to store more data than what can be stored on a single machine.
+
+@item Redundancy: We might want to replicate crucial data on to several machines.
+
+@item Uniform access: One can mount a remote volume (for example your home directory) from any machine and access the same data.
+@end itemize
+
+@section Contacting us
+You can reach us through the mailing list @strong{gluster-devel}
+(@email{gluster-devel@@nongnu.org}).
+@cindex GlusterFS mailing list
+
+You can also find many of the developers on @acronym{IRC}, on the @code{#gluster}
+channel on Freenode (@indicateurl{irc.freenode.net}).
+@cindex IRC channel, #gluster
+
+The GlusterFS documentation wiki is also useful: @*
+@indicateurl{http://gluster.org/docs/index.php/GlusterFS}
+
+For commercial support, you can contact @email{@b{Z}} Research at:
+@cindex commercial support
+@cindex Z Research, Inc.
+
+@display
+3194 Winding Vista Common
+Fremont, CA 94539
+USA.
+
+Phone: +1 (510) 354 6801
+Toll free: +1 (888) 813 6309
+Fax: +1 (510) 372 0604
+@end display
+
+You can also email us at @email{support@@zresearch.com}.
+
+@node Installation and Invocation
+@chapter Installation and Invocation
+
+@menu
+* Pre requisites::
+* Getting GlusterFS::
+* Building::
+* Running GlusterFS::
+* A Tutorial Introduction::
+@end menu
+
+@node Pre requisites
+@section Pre requisites
+
+Before installing GlusterFS make sure you have the
+following components installed.
+
+@subsection @acronym{FUSE}
+You'll need @acronym{FUSE} version 2.6.0 or higher to
+use GlusterFS. You can omit installing @acronym{FUSE} if you want to
+build @emph{only} the server. Note that you won't be able to mount
+a GlusterFS filesystem on a machine that does not have @acronym{FUSE}
+installed.
+
+@acronym{FUSE} can be downloaded from: @indicateurl{http://fuse.sourceforge.net/}
+
+To get the best performance from GlusterFS, however, it is recommended that you use
+our patched version of @acronym{FUSE}. See Patched FUSE for details.
+
+@subsection Patched FUSE
+
+The GlusterFS project maintains a patched version of @acronym{FUSE} meant to be used
+with GlusterFS. The patches increase GlusterFS performance. It is recommended that
+all users use the patched @acronym{FUSE}.
+
+The patched @acronym{FUSE} tarball can be downloaded from:
+
+@indicateurl{ftp://ftp.zresearch.com/pub/gluster/glusterfs/fuse/}
+
+The specific changes made to @acronym{FUSE} are:
+
+@itemize
+@item The communication channel size between @acronym{FUSE} kernel module and GlusterFS has been increased to 1MB, permitting large reads and writes to be sent in bigger chunks.
+
+@item The kernel's read-ahead boundry has been extended upto 1MB.
+
+@item Block size returned in the @command{stat()}/@command{fstat()} calls tuned to 1MB, to make cp and similar commands perform I/O using that block size.
+
+@item @command{flock()} locking support has been added (although some rework in GlusterFS is needed for perfect compliance).
+@end itemize
+
+@subsection libibverbs (optional)
+@cindex InfiniBand, installation
+@cindex libibverbs
+This is only needed if you want GlusterFS to use InfiniBand as the
+interconnect mechanism between server and client. You can get it from:
+
+@indicateurl{http://www.openfabrics.org/downloads.htm}.
+
+@subsection Bison and Flex
+These should be already installed on most Linux systems. If not, use your distribution's
+normal software installation procedures to install them. Make sure you install the
+relevant developer packages also.
+
+@node Getting GlusterFS
+@section Getting GlusterFS
+@cindex arch
+There are many ways to get hold of GlusterFS. For a production deployment,
+the recommended method is to download the latest release tarball.
+Release tarballs are available at: @indicateurl{http://gluster.org/download.php}.
+
+If you want the bleeding edge development source, you can get them
+from the @acronym{GNU}
+Arch@footnote{@indicateurl{http://www.gnu.org/software/gnu-arch/}}
+repository. First you must install @acronym{GNU} Arch itself. Then
+register the GlusterFS archive by doing:
+
+@example
+$ tla register-archive http://arch.sv.gnu.org/archives/gluster
+@end example
+
+Now you can check out the source itself:
+
+@example
+$ tla get -A gluster@@sv.gnu.org glusterfs--mainline--3.0
+@end example
+
+@node Building
+@section Building
+You can skip this section if you're installing from @acronym{RPM}s
+or @acronym{DEB}s.
+
+GlusterFS uses the Autotools mechanism to build. As such, the procedure
+is straight-forward. First, change into the GlusterFS source directory.
+
+@example
+$ cd glusterfs-<version>
+@end example
+
+If you checked out the source from the Arch repository, you'll need
+to run @command{./autogen.sh} first. Note that you'll need to have
+Autoconf and Automake installed for this.
+
+Run @command{configure}.
+
+@example
+$ ./configure
+@end example
+
+The configure script accepts the following options:
+
+@cartouche
+@table @code
+
+@item --disable-ibverbs
+Disable the InfiniBand transport mechanism.
+
+@item --disable-fuse-client
+Disable the @acronym{FUSE} client.
+
+@item --disable-server
+Disable building of the GlusterFS server.
+
+@item --disable-bdb
+Disable building of Berkeley DB based storage translator.
+
+@item --disable-mod_glusterfs
+Disable building of Apache/lighttpd glusterfs plugins.
+
+@item --disable-epoll
+Use poll instead of epoll.
+
+@item --disable-libglusterfsclient
+Disable building of libglusterfsclient
+
+@end table
+@end cartouche
+
+Build and install GlusterFS.
+
+@example
+# make install
+@end example
+
+The binaries (@command{glusterfsd} and @command{glusterfs}) will be by
+default installed in @command{/usr/local/sbin/}. Translator,
+scheduler, and transport shared libraries will be installed in
+@command{/usr/local/lib/glusterfs/<version>/}. Sample volume
+specification files will be in @command{/usr/local/etc/glusterfs/}.
+This document itself can be found in
+@command{/usr/local/share/doc/glusterfs/}. If you passed the @command{--prefix}
+argument to the configure script, then replace @command{/usr/local} in the preceding
+paths with the prefix.
+
+@node Running GlusterFS
+@section Running GlusterFS
+
+@menu
+* Server::
+* Client::
+@end menu
+
+@node Server
+@subsection Server
+@cindex GlusterFS server
+
+The GlusterFS server is necessary to export storage volumes to remote clients
+(See @ref{Server protocol} for more info). This section documents the invocation
+of the GlusterFS server program and all the command-line options accepted by it.
+
+@cartouche
+@table @code
+Basic Options
+@item -f, --volfile=<path>
+ Use the volume file as the volume specification.
+
+@item -s, --volfile-server=<hostname>
+ Server to get volume file from. This option overrides --volfile option.
+
+@item -l, --log-file=<path>
+ Specify the path for the log file.
+
+@item -L, --log-level=<level>
+ Set the log level for the server. Log level should be one of @acronym{DEBUG},
+@acronym{WARNING}, @acronym{ERROR}, @acronym{CRITICAL}, or @acronym{NONE}.
+
+Advanced Options
+@item --debug
+ Run in debug mode. This option sets --no-daemon, --log-level to DEBUG and
+ --log-file to console.
+
+@item -N, --no-daemon
+ Run glusterfsd as a foreground process.
+
+@item -p, --pid-file=<path>
+ Path for the @acronym{PID} file.
+
+@item --volfile-id=<key>
+ 'key' of the volfile to be fetched from server.
+
+@item --volfile-server-port=<port-number>
+ Listening port number of volfile server.
+
+@item --volfile-server-transport=[socket|ib-verbs]
+ Transport type to get volfile from server. [default: @command{socket}]
+
+@item --xlator-options=<volume-name.option=value>
+ Add/override a translator option for a volume with specified value.
+
+Miscellaneous Options
+@item -?, --help
+ Show this help text.
+
+@item --usage
+ Display a short usage message.
+
+@item -V, --version
+ Show version information.
+@end table
+@end cartouche
+
+@node Client
+@subsection Client
+@cindex GlusterFS client
+
+The GlusterFS client process is necessary to access remote storage volumes and
+mount them locally using @acronym{FUSE}. This section documents the invocation of the
+client process and all its command-line arguments.
+
+@example
+ # glusterfs [options] <mountpoint>
+@end example
+
+The @command{mountpoint} is the directory where you want the GlusterFS
+filesystem to appear. Example:
+
+@example
+ # glusterfs -f /usr/local/etc/glusterfs-client.vol /mnt
+@end example
+
+The command-line options are detailed below.
+
+@tex
+\vfill
+@end tex
+@page
+
+@cartouche
+@table @code
+
+Basic Options
+@item -f, --volfile=<path>
+ Use the volume file as the volume specification.
+
+@item -s, --volfile-server=<hostname>
+ Server to get volume file from. This option overrides --volfile option.
+
+@item -l, --log-file=<path>
+ Specify the path for the log file.
+
+@item -L, --log-level=<level>
+ Set the log level for the server. Log level should be one of @acronym{DEBUG},
+@acronym{WARNING}, @acronym{ERROR}, @acronym{CRITICAL}, or @acronym{NONE}.
+
+Advanced Options
+@item --debug
+ Run in debug mode. This option sets --no-daemon, --log-level to DEBUG and
+ --log-file to console.
+
+@item -N, --no-daemon
+ Run @command{glusterfs} as a foreground process.
+
+@item -p, --pid-file=<path>
+ Path for the @acronym{PID} file.
+
+@item --volfile-id=<key>
+ 'key' of the volfile to be fetched from server.
+
+@item --volfile-server-port=<port-number>
+ Listening port number of volfile server.
+
+@item --volfile-server-transport=[socket|ib-verbs]
+ Transport type to get volfile from server. [default: @command{socket}]
+
+@item --xlator-options=<volume-name.option=value>
+ Add/override a translator option for a volume with specified value.
+
+@item --volume-name=<volume name>
+ Volume name in client spec to use. Defaults to the root volume.
+
+@acronym{FUSE} Options
+@item --attribute-timeout=<n>
+ Attribute timeout for inodes in the kernel, in seconds. Defaults to 1 second.
+
+@item --disable-direct-io-mode
+ Disable direct @acronym{I/O} mode in @acronym{FUSE} kernel module.
+
+@item -e, --entry-timeout=<n>
+ Entry timeout for directory entries in the kernel, in seconds.
+ Defaults to 1 second.
+
+Missellaneous Options
+@item -?, --help
+ Show this help information.
+
+@item -V, --version
+ Show version information.
+@end table
+@end cartouche
+
+@node A Tutorial Introduction
+@section A Tutorial Introduction
+
+This section will show you how to quickly get GlusterFS up and running. We'll
+configure GlusterFS as a simple network filesystem, with one server and one client.
+In this mode of usage, GlusterFS can serve as a replacement for NFS.
+
+We'll make use of two machines; call them @emph{server} and
+@emph{client} (If you don't want to setup two machines, just run
+everything that follows on the same machine). In the examples that
+follow, the shell prompts will use these names to clarify the machine
+on which the command is being run. For example, a command that should
+be run on the server will be shown with the prompt:
+
+@example
+[root@@server]#
+@end example
+
+Our goal is to make a directory on the @emph{server} (say, @command{/export})
+accessible to the @emph{client}.
+
+First of all, get GlusterFS installed on both the machines, as described in the
+previous sections. Make sure you have the @acronym{FUSE} kernel module loaded. You
+can ensure this by running:
+
+@example
+[root@@server]# modprobe fuse
+@end example
+
+Before we can run the GlusterFS client or server programs, we need to write
+two files called @emph{volume specifications} (equivalently refered to as @emph{volfiles}).
+The volfile describes the @emph{translator tree} on a node. The next chapter will
+explain the concepts of `translator' and `volume specification' in detail. For now,
+just assume that the volfile is like an NFS @command{/etc/export} file.
+
+On the server, create a text file somewhere (we'll assume the path
+@command{/tmp/glusterfsd.vol}) with the following contents.
+
+@cartouche
+@example
+volume colon-o
+ type storage/posix
+ option directory /export
+end-volume
+
+volume server
+ type protocol/server
+ subvolumes colon-o
+ option transport-type tcp
+ option auth.addr.colon-o.allow *
+end-volume
+@end example
+@end cartouche
+
+A brief explanation of the file's contents. The first section defines a storage
+volume, named ``colon-o'' (the volume names are arbitrary), which exports the
+@command{/export} directory. The second section defines options for the translator
+which will make the storage volume accessible remotely. It specifies @command{colon-o} as
+a subvolume. This defines the @emph{translator tree}, about which more will be said
+in the next chapter. The two options specify that the @acronym{TCP} protocol is to be
+used (as opposed to InfiniBand, for example), and that access to the storage volume
+is to be provided to clients with any @acronym{IP} address at all. If you wanted to
+restrict access to this server to only your subnet for example, you'd specify
+something like @command{192.168.1.*} in the second option line.
+
+On the client machine, create the following text file (again, we'll assume
+the path to be @command{/tmp/glusterfs-client.vol}). Replace
+@emph{server-ip-address} with the @acronym{IP} address of your server machine. If you
+are doing all this on a single machine, use @command{127.0.0.1}.
+
+@cartouche
+@example
+volume client
+ type protocol/client
+ option transport-type tcp
+ option remote-host @emph{server-ip-address}
+ option remote-subvolume colon-o
+end-volume
+@end example
+@end cartouche
+
+Now we need to start both the server and client programs. To start the server:
+
+@example
+[root@@server]# glusterfsd -f /tmp/glusterfs-server.vol
+@end example
+
+To start the client:
+
+@example
+[root@@client]# glusterfs -f /tmp/glusterfs-client.vol /mnt/glusterfs
+@end example
+
+You should now be able to see the files under the server's @command{/export} directory
+in the @command{/mnt/glusterfs} directory on the client. That's it; GlusterFS is now
+working as a network file system.
+
+@node Concepts
+@chapter Concepts
+
+@menu
+* Filesystems in Userspace::
+* Translator::
+* Volume specification file::
+@end menu
+
+@node Filesystems in Userspace
+@section Filesystems in Userspace
+
+A filesystem is usually implemented in kernel space. Kernel space
+development is much harder than userspace development. @acronym{FUSE}
+is a kernel module/library that allows us to write a filesystem
+completely in userspace.
+
+@acronym{FUSE} consists of a kernel module which interacts with the userspace
+implementation using a device file @code{/dev/fuse}. When a process
+makes a syscall on a @acronym{FUSE} filesystem, @acronym{VFS} hands the request to the
+@acronym{FUSE} module, which writes the request to @code{/dev/fuse}. The
+userspace implementation polls @code{/dev/fuse}, and when a request arrives,
+processes it and writes the result back to @code{/dev/fuse}. The kernel then
+reads from the device file and returns the result to the user process.
+
+In case of GlusterFS, the userspace program is the GlusterFS client.
+The control flow is shown in the diagram below. The GlusterFS client
+services the request by sending it to the server, which in turn
+hands it to the local @acronym{POSIX} filesystem.
+
+@center @image{fuse,44pc,,,.pdf}
+@center Fig 1. Control flow in GlusterFS
+
+@node Translator
+@section Translator
+
+The @emph{translator} is the most important concept in GlusterFS. In
+fact, GlusterFS is nothing but a collection of translators working
+together, forming a translator @emph{tree}.
+
+The idea of a translator is perhaps best understood using an
+analogy. Consider the @acronym{VFS} in the Linux kernel. The
+@acronym{VFS} abstracts the various filesystem implementations (such
+as @acronym{EXT3}, ReiserFS, @acronym{XFS}, etc.) supported by the
+kernel. When an application calls the kernel to perform an operation
+on a file, the kernel passes the request on to the appropriate
+filesystem implementation.
+
+For example, let's say there are two partitions on a Linux machine:
+@command{/}, which is an @acronym{EXT3} partition, and @command{/usr},
+which is a ReiserFS partition. Now if an application wants to open a
+file called, say, @command{/etc/fstab}, then the kernel will
+internally pass the request to the @acronym{EXT3} implementation. If
+on the other hand, an application wants to read a file called
+@command{/usr/src/linux/CREDITS}, then the kernel will call upon the
+ReiserFS implementation to do the job.
+
+The ``filesystem implementation'' objects are analogous to GlusterFS
+translators. A GlusterFS translator implements all the filesystem
+operations. Whereas in @acronym{VFS} there is a two-level tree (with
+the kernel at the root and all the filesystem implementation as its
+children), in GlusterFS there exists a more elaborate tree structure.
+
+We can now define translators more precisely. A GlusterFS translator
+is a shared object (@command{.so}) that implements every filesystem
+call. GlusterFS translators can be arranged in an arbitrary tree
+structure (subject to constraints imposed by the translators). When
+GlusterFS receives a filesystem call, it passes it on to the
+translator at the root of the translator tree. The root translator may
+in turn pass it on to any or all of its children, and so on, until the
+leaf nodes are reached. The result of a filesystem call is
+communicated in the reverse fashion, from the leaf nodes up to the
+root node, and then on to the application.
+
+So what might a translator tree look like?
+
+@tex
+\vfill
+@end tex
+@page
+
+@center @image{xlator,44pc,,,.pdf}
+@center Fig 2. A sample translator tree
+
+The diagram depicts three servers and one GlusterFS client. It is important
+to note that conceptually, the translator tree spans machine boundaries.
+Thus, the client machine in the diagram, @command{10.0.0.1}, can access
+the aggregated storage of the filesystems on the server machines @command{10.0.0.2},
+@command{10.0.0.3}, and @command{10.0.0.4}. The translator diagram will make more
+sense once you've read the next chapter and understood the functions of the
+various translators.
+
+@node Volume specification file
+@section Volume specification file
+The volume specification file describes the translator tree for both the
+server and client programs.
+
+A volume specification file is a sequence of volume definitions.
+The syntax of a volume definition is explained below:
+
+@cartouche
+@example
+@strong{volume} @emph{volume-name}
+ @strong{type} @emph{translator-name}
+ @strong{option} @emph{option-name} @emph{option-value}
+ @dots{}
+ @strong{subvolumes} @emph{subvolume1} @emph{subvolume2} @dots{}
+@strong{end-volume}
+@end example
+
+@dots{}
+@end cartouche
+
+@table @asis
+@item @emph{volume-name}
+ An identifier for the volume. This is just a human-readable name,
+and can contain any alphanumeric character. For instance, ``storage-1'', ``colon-o'',
+or ``forty-two''.
+
+@item @emph{translator-name}
+ Name of one of the available translators. Example: @command{protocol/client},
+@command{cluster/unify}.
+
+@item @emph{option-name}
+ Name of a valid option for the translator.
+
+@item @emph{option-value}
+ Value for the option. Everything following the ``option'' keyword to the end of the
+line is considered the value; it is up to the translator to parse it.
+
+@item @emph{subvolume1}, @emph{subvolume2}, @dots{}
+ Volume names of sub-volumes. The sub-volumes must already have been defined earlier
+in the file.
+@end table
+
+There are a few rules you must follow when writing a volume specification file:
+
+@itemize
+@item Everything following a `@command{#}' is considered a comment and is ignored. Blank lines are also ignored.
+@item All names and keywords are case-sensitive.
+@item The order of options inside a volume definition does not matter.
+@item An option value may not span multiple lines.
+@item If an option is not specified, it will assume its default value.
+@item A sub-volume must have already been defined before it can be referenced. This means you have to write the specification file ``bottom-up'', starting from the leaf nodes of the translator tree and moving up to the root.
+@end itemize
+
+A simple example volume specification file is shown below:
+
+@cartouche
+@example
+# This is a comment line
+volume client
+ type protocol/client
+ option transport-type tcp
+ option remote-host localhost # Also a comment
+ option remote-subvolume brick
+# The subvolumes line may be absent
+end-volume
+
+volume iot
+ type performance/io-threads
+ option thread-count 4
+ subvolumes client
+end-volume
+
+volume wb
+ type performance/write-behind
+ subvolumes iot
+end-volume
+@end example
+@end cartouche
+
+@node Translators
+@chapter Translators
+
+@menu
+* Storage Translators::
+* Client and Server Translators::
+* Clustering Translators::
+* Performance Translators::
+* Features Translators::
+* Miscellaneous Translators::
+@end menu
+
+This chapter documents all the available GlusterFS translators in detail.
+Each translator section will show its name (for example, @command{cluster/unify}),
+briefly describe its purpose and workings, and list every option accepted by
+that translator and their meaning.
+
+@node Storage Translators
+@section Storage Translators
+
+The storage translators form the ``backend'' for GlusterFS. Currently,
+the only available storage translator is the @acronym{POSIX}
+translator, which stores files on a normal @acronym{POSIX}
+filesystem. A pleasant consequence of this is that your data will
+still be accessible if GlusterFS crashes or cannot be started.
+
+Other storage backends are planned for the future. One of the possibilities is an
+Amazon S3 translator. Amazon S3 is an unlimited online storage service accessible
+through a web services @acronym{API}. The S3 translator will allow you to access
+the storage as a normal @acronym{POSIX} filesystem.
+@footnote{Some more discussion about this can be found at:
+
+http://developer.amazonwebservices.com/connect/message.jspa?messageID=52873}
+
+@menu
+* POSIX::
+* BDB::
+@end menu
+
+@node POSIX
+@subsection POSIX
+@example
+type storage/posix
+@end example
+
+The @command{posix} translator uses a normal @acronym{POSIX}
+filesystem as its ``backend'' to actually store files and
+directories. This can be any filesystem that supports extended
+attributes (@acronym{EXT3}, ReiserFS, @acronym{XFS}, ...). Extended
+attributes are used by some translators to store metadata, for
+example, by the replicate and stripe translators. See
+@ref{Replicate} and @ref{Stripe}, respectively for details.
+
+@cartouche
+@table @code
+@item directory <path>
+The directory on the local filesystem which is to be used for storage.
+@end table
+@end cartouche
+
+@node BDB
+@subsection BDB
+@example
+type storage/bdb
+@end example
+
+The @command{BDB} translator uses a @acronym{Berkeley DB} database as its
+``backend'' to actually store files as key-value pair in the database and
+directories as regular @acronym{POSIX} directories. Note that @acronym{BDB}
+does not provide extended attribute support for regular files. Do not use
+@acronym{BDB} as storage translator while using any translator that demands
+extended attributes on ``backend''.
+
+@cartouche
+@table @code
+@item directory <path>
+The directory on the local filesystem which is to be used for storage.
+@item mode [cache|persistent] (cache)
+When @acronym{BDB} is run in @command{cache} mode, recovery of back-end is not completely
+guaranteed. @command{persistent} guarantees that @acronym{BDB} can recover back-end from
+@acronym{Berkeley DB} even if GlusterFS crashes.
+@item errfile <path>
+The path of the file to be used as @command{errfile} for @acronym{Berkeley DB} to report
+detailed error messages, if any. Note that all the contents of this file will be written
+by @acronym{Berkeley DB}, not GlusterFS.
+@item logdir <path>
+
+
+@end table
+@end cartouche
+
+@node Client and Server Translators, Clustering Translators, Storage Translators, Translators
+@section Client and Server Translators
+
+The client and server translator enable GlusterFS to export a
+translator tree over the network or access a remote GlusterFS
+server. These two translators implement GlusterFS's network protocol.
+
+@menu
+* Transport modules::
+* Client protocol::
+* Server protocol::
+@end menu
+
+@node Transport modules
+@subsection Transport modules
+The client and server translators are capable of using any of the
+pluggable transport modules. Currently available transport modules are
+@command{tcp}, which uses a @acronym{TCP} connection between client
+and server to communicate; @command{ib-sdp}, which uses a
+@acronym{TCP} connection over InfiniBand, and @command{ibverbs}, which
+uses high-speed InfiniBand connections.
+
+Each transport module comes in two different versions, one to be used on
+the server side and the other on the client side.
+
+@subsubsection TCP
+
+The @acronym{TCP} transport module uses a @acronym{TCP/IP} connection between
+the server and the client.
+
+@example
+ option transport-type tcp
+@end example
+
+The @acronym{TCP} client module accepts the following options:
+
+@cartouche
+@table @code
+@item non-blocking-connect [no|off|on|yes] (on)
+Whether to make the connection attempt asynchronous.
+@item remote-port <n> (6996)
+Server port to connect to.
+@cindex DNS round robin
+@item remote-host <hostname> *
+Hostname or @acronym{IP} address of the server. If the host name resolves to
+multiple IP addresses, all of them will be tried in a round-robin fashion. This
+feature can be used to implement fail-over.
+@end table
+@end cartouche
+
+The @acronym{TCP} server module accepts the following options:
+
+@cartouche
+@table @code
+@item bind-address <address> (0.0.0.0)
+The local interface on which the server should listen to requests. Default is to
+listen on all interfaces.
+@item listen-port <n> (6996)
+The local port to listen on.
+@end table
+@end cartouche
+
+@subsubsection IB-SDP
+@example
+ option transport-type ib-sdp
+@end example
+
+kernel implements socket interface for ib hardware. SDP is over ib-verbs.
+This module accepts the same options as @command{tcp}
+
+@subsubsection ibverbs
+
+@example
+ option transport-type tcp
+@end example
+
+@cindex infiniband transport
+
+InfiniBand is a scalable switched fabric interconnect mechanism
+primarily used in high-performance computing. InfiniBand can deliver
+data throughput of the order of 10 Gbit/s, with latencies of 4-5 ms.
+
+The @command{ib-verbs} transport accesses the InfiniBand hardware through
+the ``verbs'' @acronym{API}, which is the lowest level of software access possible
+and which gives the highest performance. On InfiniBand hardware, it is always
+best to use @command{ib-verbs}. Use @command{ib-sdp} only if you cannot get
+@command{ib-verbs} working for some reason.
+
+The @command{ib-verbs} client module accepts the following options:
+
+@cartouche
+@table @code
+@item non-blocking-connect [no|off|on|yes] (on)
+Whether to make the connection attempt asynchronous.
+@item remote-port <n> (6996)
+Server port to connect to.
+@cindex DNS round robin
+@item remote-host <hostname> *
+Hostname or @acronym{IP} address of the server. If the host name resolves to
+multiple IP addresses, all of them will be tried in a round-robin fashion. This
+feature can be used to implement fail-over.
+@end table
+@end cartouche
+
+The @command{ib-verbs} server module accepts the following options:
+
+@cartouche
+@table @code
+@item bind-address <address> (0.0.0.0)
+The local interface on which the server should listen to requests. Default is to
+listen on all interfaces.
+@item listen-port <n> (6996)
+The local port to listen on.
+@end table
+@end cartouche
+
+The following options are common to both the client and server modules:
+
+If you are familiar with InfiniBand jargon,
+the mode is used by GlusterFS is ``reliable connection-oriented channel transfer''.
+
+@cartouche
+@table @code
+@item ib-verbs-work-request-send-count <n> (64)
+Length of the send queue in datagrams. [Reason to increase/decrease?]
+
+@item ib-verbs-work-request-recv-count <n> (64)
+Length of the receive queue in datagrams. [Reason to increase/decrease?]
+
+@item ib-verbs-work-request-send-size <size> (128KB)
+Size of each datagram that is sent. [Reason to increase/decrease?]
+
+@item ib-verbs-work-request-recv-size <size> (128KB)
+Size of each datagram that is received. [Reason to increase/decrease?]
+
+@item ib-verbs-port <n> (1)
+Port number for ib-verbs.
+
+@item ib-verbs-mtu [256|512|1024|2048|4096] (2048)
+The Maximum Transmission Unit [Reason to increase/decrease?]
+
+@item ib-verbs-device-name <device-name> (first device in the list)
+InfiniBand device to be used.
+@end table
+@end cartouche
+
+For maximum performance, you should ensure that the send/receive counts on both
+the client and server are the same.
+
+ib-verbs is preferred over ib-sdp.
+
+@node Client protocol
+@subsection Client
+@example
+type procotol/client
+@end example
+
+The client translator enables the GlusterFS client to access a remote server's
+translator tree.
+
+@cartouche
+@table @code
+
+@item transport-type [tcp,ib-sdp,ib-verbs] (tcp)
+The transport type to use. You should use the client versions of all the
+transport modules (@command{tcp}, @command{ib-sdp},
+@command{ib-verbs}).
+@item remote-subvolume <volume_name> *
+The name of the volume on the remote host to attach to. Note that
+this is @emph{not} the name of the @command{protocol/server} volume on the
+server. It should be any volume under the server.
+@item transport-timeout <n> (120- seconds)
+Inactivity timeout. If a reply is expected and no activity takes place
+on the connection within this time, the transport connection will be
+broken, and a new connection will be attempted.
+@end table
+@end cartouche
+
+@node Server protocol
+@subsection Server
+@example
+type protocol/server
+@end example
+
+The server translator exports a translator tree and makes it accessible to
+remote GlusterFS clients.
+
+@cartouche
+@table @code
+@item client-volume-filename <path> (<CONFDIR>/glusterfs-client.vol)
+The volume specification file to use for the client. This is the file the
+client will receive when it is invoked with the @command{--server} option
+(@ref{Client}).
+
+@item transport-type [tcp,ib-verbs,ib-sdp] (tcp)
+The transport to use. You should use the server versions of all the transport
+modules (@command{tcp}, @command{ib-sdp}, @command{ib-verbs}).
+
+@item auth.addr.<volume name>.allow <IP address wildcard pattern>
+IP addresses of the clients that are allowed to attach to the specified volume.
+This can be a wildcard. For example, a wildcard of the form @command{192.168.*.*}
+allows any host in the @command{192.168.x.x} subnet to connect to the server.
+
+@end table
+@end cartouche
+
+@node Clustering Translators
+@section Clustering Translators
+
+The clustering translators are the most important GlusterFS
+translators, since it is these that make GlusterFS a cluster
+filesystem. These translators together enable GlusterFS to access an
+arbitrarily large amount of storage, and provide @acronym{RAID}-like
+redundancy and distribution over the entire cluster.
+
+There are three clustering translators: @strong{unify}, @strong{replicate},
+and @strong{stripe}. The unify translator aggregates storage from
+many server nodes. The replicate translator provides file replication. The stripe
+translator allows a file to be spread across many server nodes. The following sections
+look at each of these translators in detail.
+
+@menu
+* Unify::
+* Replicate::
+* Stripe::
+@end menu
+
+@node Unify
+@subsection Unify
+@cindex unify (translator)
+@cindex scheduler (unify)
+@example
+type cluster/unify
+@end example
+
+The unify translator presents a `unified' view of all its sub-volumes. That is,
+it makes the union of all its sub-volumes appear as a single volume. It is the
+unify translator that gives GlusterFS the ability to access an arbitrarily
+large amount of storage.
+
+For unify to work correctly, certain invariants need to be maintained across
+the entire network. These are:
+
+@cindex unify invariants
+@itemize
+@item The directory structure of all the sub-volumes must be identical.
+@item A particular file can exist on only one of the sub-volumes. Phrasing it in another way, a pathname such as @command{/home/calvin/homework.txt}) is unique across the entire cluster.
+@end itemize
+
+@tex
+\vfill
+@end tex
+@page
+
+@center @image{unify,44pc,,,.pdf}
+
+Looking at the second requirement, you might wonder how one can
+accomplish storing redundant copies of a file, if no file can exist
+multiple times. To answer, we must remember that these invariants are
+from @emph{unify's perspective}. A translator such as replicate at a lower
+level in the translator tree than unify may subvert this picture.
+
+The first invariant might seem quite tedious to ensure. We shall see
+later that this is not so, since unify's @emph{self-heal} mechanism
+takes care of maintaining it.
+
+The second invariant implies that unify needs some way to decide which file goes where.
+Unify makes use of @emph{scheduler} modules for this purpose.
+
+When a file needs to be created, unify's scheduler decides upon the
+sub-volume to be used to store the file. There are many schedulers
+available, each using a different algorithm and suitable for different
+purposes.
+
+The various schedulers are described in detail in the sections that follow.
+
+@subsubsection ALU
+@cindex alu (scheduler)
+
+@example
+ option scheduler alu
+@end example
+
+ALU stands for "Adaptive Least Usage". It is the most advanced
+scheduler available in GlusterFS. It balances the load across volumes
+taking several factors in account. It adapts itself to changing I/O
+patterns according to its configuration. When properly configured, it
+can eliminate the need for regular tuning of the filesystem to keep
+volume load nicely balanced.
+
+The ALU scheduler is composed of multiple least-usage
+sub-schedulers. Each sub-scheduler keeps track of a certain type of
+load, for each of the sub-volumes, getting statistics from
+the sub-volumes themselves. The sub-schedulers are these:
+
+@itemize
+@item disk-usage: The used and free disk space on the volume.
+
+@item read-usage: The amount of reading done from this volume.
+
+@item write-usage: The amount of writing done to this volume.
+
+@item open-files-usage: The number of files currently open from this volume.
+
+@item disk-speed-usage: The speed at which the disks are spinning. This is a constant value and therefore not very useful.
+@end itemize
+
+The ALU scheduler needs to know which of these sub-schedulers to use,
+and in which order to evaluate them. This is done through the
+@command{option alu.order} configuration directive.
+
+Each sub-scheduler needs to know two things: when to kick in (the
+entry-threshold), and how long to stay in control (the
+exit-threshold). For example: when unifying three disks of 100GB,
+keeping an exact balance of disk-usage is not necesary. Instead, there
+could be a 1GB margin, which can be used to nicely balance other
+factors, such as read-usage. The disk-usage scheduler can be told to
+kick in only when a certain threshold of discrepancy is passed, such
+as 1GB. When it assumes control under this condition, it will write
+all subsequent data to the least-used volume. If it is doing so, it is
+unwise to stop right after the values are below the entry-threshold
+again, since that would make it very likely that the situation will
+occur again very soon. Such a situation would cause the ALU to spend
+most of its time disk-usage scheduling, which is unfair to the other
+sub-schedulers. The exit-threshold therefore defines the amount of
+data that needs to be written to the least-used disk, before control
+is relinquished again.
+
+In addition to the sub-schedulers, the ALU scheduler also has "limits"
+options. These can stop the creation of new files on a volume once
+values drop below a certain threshold. For example, setting
+@command{option alu.limits.min-free-disk 5GB} will stop the scheduling
+of files to volumes that have less than 5GB of free disk space,
+leaving the files on that disk some room to grow.
+
+The actual values you assign to the thresholds for sub-schedulers and
+limits depend on your situation. If you have fast-growing files,
+you'll want to stop file-creation on a disk much earlier than when
+hardly any of your files are growing. If you care less about
+disk-usage balance than about read-usage balance, you'll want a bigger
+disk-usage scheduler entry-threshold and a smaller read-usage
+scheduler entry-threshold.
+
+For thresholds defining a size, values specifying "KB", "MB" and "GB"
+are allowed. For example: @command{option alu.limits.min-free-disk 5GB}.
+
+@cartouche
+@table @code
+@item alu.order <order> * ("disk-usage:write-usage:read-usage:open-files-usage:disk-speed")
+@item alu.disk-usage.entry-threshold <size> (1GB)
+@item alu.disk-usage.exit-threshold <size> (512MB)
+@item alu.write-usage.entry-threshold <%> (25)
+@item alu.write-usage.exit-threshold <%> (5)
+@item alu.read-usage.entry-threshold <%> (25)
+@item alu.read-usage.exit-threshold <%> (5)
+@item alu.open-files-usage.entry-threshold <n> (1000)
+@item alu.open-files-usage.exit-threshold <n> (100)
+@item alu.limits.min-free-disk <%>
+@item alu.limits.max-open-files <n>
+@end table
+@end cartouche
+
+@subsubsection Round Robin (RR)
+@cindex rr (scheduler)
+
+@example
+ option scheduler rr
+@end example
+
+Round-Robin (RR) scheduler creates files in a round-robin
+fashion. Each client will have its own round-robin loop. When your
+files are mostly similar in size and I/O access pattern, this
+scheduler is a good choice. RR scheduler checks for free disk space
+on the server before scheduling, so you can know when to add
+another server node. The default value of min-free-disk is 5% and is
+checked on file creation calls, with atleast 10 seconds (by default)
+elapsing between two checks.
+
+Options:
+@cartouche
+@table @code
+@item rr.limits.min-free-disk <%> (5)
+Minimum free disk space a node must have for RR to schedule a file to it.
+@item rr.refresh-interval <t> (10 seconds)
+Time between two successive free disk space checks.
+@end table
+@end cartouche
+
+@subsubsection Random
+@cindex random (scheduler)
+
+@example
+ option scheduler random
+@end example
+
+The random scheduler schedules file creation randomly among its child nodes.
+Like the round-robin scheduler, it also checks for a minimum amount of free disk
+space before scheduling a file to a node.
+
+@cartouche
+@table @code
+@item random.limits.min-free-disk <%> (5)
+Minimum free disk space a node must have for random to schedule a file to it.
+@item random.refresh-interval <t> (10 seconds)
+Time between two successive free disk space checks.
+@end table
+@end cartouche
+
+@subsubsection NUFA
+@cindex nufa (scheduler)
+
+@example
+ option scheduler nufa
+@end example
+
+It is common in many GlusterFS computing environments for all deployed
+machines to act as both servers and clients. For example, a
+research lab may have 40 workstations each with its own storage. All
+of these workstations might act as servers exporting a volume as well
+as clients accessing the entire cluster's storage. In such a
+situation, it makes sense to store locally created files on the local
+workstation itself (assuming files are accessed most by the
+workstation that created them). The Non-Uniform File Allocation (@acronym{NUFA})
+scheduler accomplishes that.
+
+@acronym{NUFA} gives the local system first priority for file creation
+over other nodes. If the local volume does not have more free disk space
+than a specified amount (5% by default) then @acronym{NUFA} schedules files
+among the other child volumes in a round-robin fashion.
+
+@acronym{NUFA} is named after the similar strategy used for memory access,
+@acronym{NUMA}@footnote{Non-Uniform Memory Access:
+@indicateurl{http://en.wikipedia.org/wiki/Non-Uniform_Memory_Access}}.
+
+@cartouche
+@table @code
+@item nufa.limits.min-free-disk <%> (5)
+Minimum disk space that must be free (local or remote) for @acronym{NUFA} to schedule a
+file to it.
+@item nufa.refresh-interval <t> (10 seconds)
+Time between two successive free disk space checks.
+@item nufa.local-volume-name <volume>
+The name of the volume corresponding to the local system. This volume must be
+one of the children of the unify volume. This option is mandatory.
+@end table
+@end cartouche
+
+@cindex namespace
+@subsubsection Namespace
+Namespace volume needed because:
+ - persistent inode numbers.
+ - file exists even when node is down.
+
+namespace files are simply touched. on every lookup it is checked.
+
+@cartouche
+@table @code
+@item namespace <volume> *
+Name of the namespace volume (which should be one of the unify volume's children).
+@item self-heal [on|off] (on)
+Enable/disable self-heal. Unless you know what you are doing, do not disable self-heal.
+@end table
+@end cartouche
+
+@cindex self heal (unify)
+@subsubsection Self Heal
+ * When a 'lookup()/stat()' call is made on directory for the first
+time, a self-heal call is made, which checks for the consistancy of
+its child nodes. If an entry is present in storage node, but not in
+namespace, that entry is created in namespace, and vica-versa. There
+is an writedir() API introduced which is used for the same. It also
+checks for permissions, and uid/gid consistencies.
+
+ * This check is also done when an server goes down and comes up.
+
+ * If one starts with an empty namespace export, but has data in
+storage nodes, a 'find .>/dev/null' or 'ls -lR >/dev/null' should help
+to build namespace in one shot. Even otherwise, namespace is built on
+demand when a file is looked up for the first time.
+
+NOTE: There are some issues (Kernel 'Oops' msgs) seen with fuse-2.6.3,
+when someone deletes namespace in backend, when glusterfs is
+running. But with fuse-2.6.5, this issue is not there.
+
+@node Replicate
+@subsection Replicate (formerly AFR)
+@cindex Replicate
+@example
+type cluster/replicate
+@end example
+
+Replicate provides @acronym{RAID}-1 like functionality for
+GlusterFS. Replicate replicates files and directories across the
+subvolumes. Hence if Replicate has four subvolumes, there will be
+four copies of all files and directories. Replicate provides
+high-availability, i.e., in case one of the subvolumes go down
+(e. g. server crash, network disconnection) Replicate will still
+service the requests using the redundant copies.
+
+Replicate also provides self-heal functionality, i.e., in case the
+crashed servers come up, the outdated files and directories will be
+updated with the latest versions. Replicate uses extended
+attributes of the backend file system to track the versioning of files
+and directories and provide the self-heal feature.
+
+@example
+volume replicate-example
+ type cluster/replicate
+ subvolumes brick1 brick2 brick3
+end-volume
+@end example
+
+This sample configuration will replicate all directories and files on
+brick1, brick2 and brick3.
+
+All the read operations happen from the first alive child. If all the
+three sub-volumes are up, reads will be done from brick1; if brick1 is
+down read will be done from brick2. In case read() was being done on
+brick1 and it goes down, replicate transparently falls back to
+brick2.
+
+The next release of GlusterFS will add the following features:
+@itemize
+@item Ability to specify the sub-volume from which read operations are to be done (this will help users who have one of the sub-volumes as a local storage volume).
+@item Allow scheduling of read operations amongst the sub-volumes in a round-robin fashion.
+@end itemize
+
+The order of the subvolumes list should be same across all the 'replicate's as
+they will be used for locking purposes.
+
+@cindex self heal (replicate)
+@subsubsection Self Heal
+Replicate has self-heal feature, which updates the outdated file and
+directory copies by the most recent versions. For example consider the
+following config:
+
+@example
+volume replicate-example
+ type cluster/replicate
+ subvolumes brick1 brick2
+end-volume
+@end example
+
+@subsubsection File self-heal
+
+Now if we create a file foo.txt on replicate-example, the file will be created
+on brick1 and brick2. The file will have two extended attributes associated
+with it in the backend filesystem. One is trusted.afr.createtime and the
+other is trusted.afr.version. The trusted.afr.createtime xattr has the
+create time (in terms of seconds since epoch) and trusted.afr.version
+is a number that is incremented each time a file is modified. This increment
+happens during close (incase any write was done before close).
+
+If brick1 goes down, we edit foo.txt the version gets incremented. Now
+the brick1 comes back up, when we open() on foo.txt replicate will check if
+their versions are same. If they are not same, the outdated copy is
+replaced by the latest copy and its version is updated. After the sync
+the open() proceeds in the usual manner and the application calling open()
+can continue on its access to the file.
+
+If brick1 goes down, we delete foo.txt and create a file with the same
+name again i.e foo.txt. Now brick1 comes back up, clearly there is a
+chance that the version on brick1 being more than the version on brick2,
+this is where createtime extended attribute helps in deciding which
+the outdated copy is. Hence we need to consider both createtime and
+version to decide on the latest copy.
+
+The version attribute is incremented during the close() call. Version
+will not be incremented in case there was no write() done. In case the
+fd that the close() gets was got by create() call, we also create
+the createtime extended attribute.
+
+@subsubsection Directory self-heal
+
+Suppose brick1 goes down, we delete foo.txt, brick1 comes back up, now
+we should not create foo.txt on brick2 but we should delete foo.txt
+on brick1. We handle this situation by having the createtime and version
+attribute on the directory similar to the file. when lookup() is done
+on the directory, we compare the createtime/version attributes of the
+copies and see which files needs to be deleted and delete those files
+and update the extended attributes of the outdated directory copy.
+Each time a directory is modified (a file or a subdirectory is created
+or deleted inside the directory) and one of the subvols is down, we
+increment the directory's version.
+
+lookup() is a call initiated by the kernel on a file or directory
+just before any access to that file or directory. In glusterfs, by
+default, lookup() will not be called in case it was called in the
+past one second on that particular file or directory.
+
+The extended attributes can be seen in the backend filesystem using
+the @command{getfattr} command. (@command{getfattr -n trusted.afr.version <file>})
+
+@cartouche
+@table @code
+@item debug [on|off] (off)
+@item self-heal [on|off] (on)
+@item replicate <pattern> (*:1)
+@item lock-node <child_volume> (first child is used by default)
+@end table
+@end cartouche
+
+@node Stripe
+@subsection Stripe
+@cindex stripe (translator)
+@example
+type cluster/stripe
+@end example
+
+The stripe translator distributes the contents of a file over its
+sub-volumes. It does this by creating a file equal in size to the
+total size of the file on each of its sub-volumes. It then writes only
+a part of the file to each sub-volume, leaving the rest of it empty.
+These empty regions are called `holes' in Unix terminology. The holes
+do not consume any disk space.
+
+The diagram below makes this clear.
+
+@center @image{stripe,44pc,,,.pdf}
+
+You can configure stripe so that only filenames matching a pattern
+are striped. You can also configure the size of the data to be stored
+on each sub-volume.
+
+@cartouche
+@table @code
+@item block-size <pattern>:<size> (*:0 no striping)
+Distribute files matching @command{<pattern>} over the sub-volumes,
+storing at least @command{<size>} on each sub-volume. For example,
+
+@example
+ option block-size *.mpg:1M
+@end example
+
+distributes all files ending in @command{.mpg}, storing at least 1 MB on
+each sub-volume.
+
+Any number of @command{block-size} option lines may be present, specifying
+different sizes for different file name patterns.
+@end table
+@end cartouche
+
+@node Performance Translators
+@section Performance Translators
+
+@menu
+* Read Ahead::
+* Write Behind::
+* IO Threads::
+* IO Cache::
+* Booster::
+@end menu
+
+@node Read Ahead
+@subsection Read Ahead
+@cindex read-ahead (translator)
+@example
+type performance/read-ahead
+@end example
+
+The read-ahead translator pre-fetches data in advance on every read.
+This benefits applications that mostly process files in sequential order,
+since the next block of data will already be available by the time the
+application is done with the current one.
+
+Additionally, the read-ahead translator also behaves as a read-aggregator.
+Many small read operations are combined and issued as fewer, larger read
+requests to the server.
+
+Read-ahead deals in ``pages'' as the unit of data fetched. The page size
+is configurable, as is the ``page count'', which is the number of pages
+that are pre-fetched.
+
+Read-ahead is best used with InfiniBand (using the ib-verbs transport).
+On FastEthernet and Gigabit Ethernet networks,
+GlusterFS can achieve the link-maximum throughput even without
+read-ahead, making it quite superflous.
+
+Note that read-ahead only happens if the reads are perfectly
+sequential. If your application accesses data in a random fashion,
+using read-ahead might actually lead to a performance loss, since
+read-ahead will pointlessly fetch pages which won't be used by the
+application.
+
+@cartouche
+Options:
+@table @code
+@item page-size <n> (256KB)
+The unit of data that is pre-fetched.
+@item page-count <n> (2)
+The number of pages that are pre-fetched.
+@item force-atime-update [on|off|yes|no] (off|no)
+Whether to force an access time (atime) update on the file on every read. Without
+this, the atime will be slightly imprecise, as it will reflect the time when
+the read-ahead translator read the data, not when the application actually read it.
+@end table
+@end cartouche
+
+@node Write Behind
+@subsection Write Behind
+@cindex write-behind (translator)
+@example
+type performance/write-behind
+@end example
+
+The write-behind translator improves the latency of a write operation.
+It does this by relegating the write operation to the background and
+returning to the application even as the write is in progress. Using the
+write-behind translator, successive write requests can be pipelined.
+This mode of write-behind operation is best used on the client side, to
+enable decreased write latency for the application.
+
+The write-behind translator can also aggregate write requests. If the
+@command{aggregate-size} option is specified, then successive writes upto that
+size are accumulated and written in a single operation. This mode of operation
+is best used on the server side, as this will decrease the disk's head movement
+when multiple files are being written to in parallel.
+
+The @command{aggregate-size} option has a default value of 128KB. Although
+this works well for most users, you should always experiment with different values
+to determine the one that will deliver maximum performance. This is because the
+performance of write-behind depends on your interconnect, size of RAM, and the
+work load.
+
+@cartouche
+@table @code
+@item aggregate-size <n> (128KB)
+Amount of data to accumulate before doing a write
+@item flush-behind [on|yes|off|no] (off|no)
+
+@end table
+@end cartouche
+
+@node IO Threads
+@subsection IO Threads
+@cindex io-threads (translator)
+@example
+type performance/io-threads
+@end example
+
+The IO threads translator is intended to increase the responsiveness
+of the server to metadata operations by doing file I/O (read, write)
+in a background thread. Since the GlusterFS server is
+single-threaded, using the IO threads translator can significantly
+improve performance. This translator is best used on the server side,
+loaded just below the server protocol translator.
+
+IO threads operates by handing out read and write requests to a separate thread.
+The total number of threads in existence at a time is constant, and configurable.
+
+@cartouche
+@table @code
+@item thread-count <n> (1)
+Number of threads to use.
+@end table
+@end cartouche
+
+@node IO Cache
+@subsection IO Cache
+@cindex io-cache (translator)
+@example
+type performance/io-cache
+@end example
+
+The IO cache translator caches data that has been read. This is useful
+if many applications read the same data multiple times, and if reads
+are much more frequent than writes (for example, IO caching may be
+useful in a web hosting environment, where most clients will simply
+read some files and only a few will write to them).
+
+The IO cache translator reads data from its child in @command{page-size} chunks.
+It caches data upto @command{cache-size} bytes. The cache is maintained as
+a prioritized least-recently-used (@acronym{LRU}) list, with priorities determined
+by user-specified patterns to match filenames.
+
+When the IO cache translator detects a write operation, the
+cache for that file is flushed.
+
+The IO cache translator periodically verifies the consistency of
+cached data, using the modification times on the files. The verification timeout
+is configurable.
+
+@cartouche
+@table @code
+@item page-size <n> (128KB)
+Size of a page.
+@item cache-size (n) (32MB)
+Total amount of data to be cached.
+@item force-revalidate-timeout <n> (1)
+Timeout to force a cache consistency verification, in seconds.
+@item priority <pattern> (*:0)
+Filename patterns listed in order of priority.
+@end table
+@end cartouche
+
+@node Booster
+@subsection Booster
+@cindex booster
+@example
+ type performance/booster
+@end example
+
+The booster translator gives applications a faster path to communicate
+read and write requests to GlusterFS. Normally, all requests to GlusterFS from
+applications go through FUSE, as indicated in @ref{Filesystems in Userspace}.
+Using the booster translator in conjunction with the GlusterFS booster shared
+library, an application can bypass the FUSE path and send read/write requests
+directly to the GlusterFS client process.
+
+The booster mechanism consists of two parts: the booster translator,
+and the booster shared library. The booster translator is meant to be
+loaded on the client side, usually at the root of the translator tree.
+The booster shared library should be @command{LD_PRELOAD}ed with the
+application.
+
+The booster translator when loaded opens a Unix domain socket and
+listens for read/write requests on it. The booster shared library
+intercepts read and write system calls and sends the requests to the
+GlusterFS process directly using the Unix domain socket, bypassing FUSE.
+This leads to superior performance.
+
+Once you've loaded the booster translator in your volume specification file, you
+can start your application as:
+
+@example
+ $ LD_PRELOAD=/usr/local/bin/glusterfs-booster.so your_app
+@end example
+
+The booster translator accepts no options.
+
+@node Features Translators
+@section Features Translators
+
+@menu
+* POSIX Locks::
+* Fixed ID::
+@end menu
+
+@node POSIX Locks
+@subsection POSIX Locks
+@cindex record locking
+@cindex fcntl
+@cindex posix-locks (translator)
+@example
+type features/posix-locks
+@end example
+
+This translator provides storage independent POSIX record locking
+support (@command{fcntl} locking). Typically you'll want to load this on the
+server side, just above the @acronym{POSIX} storage translator. Using this
+translator you can get both advisory locking and mandatory locking
+support. It also handles @command{flock()} locks properly.
+
+Caveat: Consider a file that does not have its mandatory locking bits
+(+setgid, -group execution) turned on. Assume that this file is now
+opened by a process on a client that has the write-behind xlator
+loaded. The write-behind xlator does not cache anything for files
+which have mandatory locking enabled, to avoid incoherence. Let's say
+that mandatory locking is now enabled on this file through another
+client. The former client will not know about this change, and
+write-behind may erroneously report a write as being successful when
+in fact it would fail due to the region it is writing to being locked.
+
+There seems to be no easy way to fix this. To work around this
+problem, it is recommended that you never enable the mandatory bits on
+a file while it is open.
+
+@cartouche
+@table @code
+@item mandatory [on|off] (on)
+Turns mandatory locking on.
+@end table
+@end cartouche
+
+@node Fixed ID
+@subsection Fixed ID
+@cindex fixed-id (translator)
+@example
+type features/fixed-id
+@end example
+
+The fixed ID translator makes all filesystem requests from the client
+to appear to be coming from a fixed, specified
+@acronym{UID}/@acronym{GID}, regardless of which user actually
+initiated the request.
+
+@cartouche
+@table @code
+@item fixed-uid <n> [if not set, not used]
+The @acronym{UID} to send to the server
+@item fixed-gid <n> [if not set, not used]
+The @acronym{GID} to send to the server
+@end table
+@end cartouche
+
+@node Miscellaneous Translators
+@section Miscellaneous Translators
+
+@menu
+* ROT-13::
+* Trace::
+@end menu
+
+@node ROT-13
+@subsection ROT-13
+@cindex rot-13 (translator)
+@example
+type encryption/rot-13
+@end example
+
+@acronym{ROT-13} is a toy translator that can ``encrypt'' and ``decrypt'' file
+contents using the @acronym{ROT-13} algorithm. @acronym{ROT-13} is a trivial
+algorithm that rotates each alphabet by thirteen places. Thus, 'A' becomes 'N',
+'B' becomes 'O', and 'Z' becomes 'M'.
+
+It goes without saying that you shouldn't use this translator if you need
+@emph{real} encryption (a future release of GlusterFS will have real encryption
+translators).
+
+@cartouche
+@table @code
+@item encrypt-write [on|off] (on)
+Whether to encrypt on write
+@item decrypt-read [on|off] (on)
+Whether to decrypt on read
+@end table
+@end cartouche
+
+@node Trace
+@subsection Trace
+@cindex trace (translator)
+@example
+type debug/trace
+@end example
+
+The trace translator is intended for debugging purposes. When loaded, it
+logs all the system calls received by the server or client (wherever
+trace is loaded), their arguments, and the results. You must use a GlusterFS log
+level of DEBUG (See @ref{Running GlusterFS}) for trace to work.
+
+Sample trace output (lines have been wrapped for readability):
+@cartouche
+@example
+2007-10-30 00:08:58 D [trace.c:1579:trace_opendir] trace: callid: 68
+(*this=0x8059e40, loc=0x8091984 @{path=/iozone3_283, inode=0x8091f00@},
+ fd=0x8091d50)
+
+2007-10-30 00:08:58 D [trace.c:630:trace_opendir_cbk] trace:
+(*this=0x8059e40, op_ret=4, op_errno=1, fd=0x8091d50)
+
+2007-10-30 00:08:58 D [trace.c:1602:trace_readdir] trace: callid: 69
+(*this=0x8059e40, size=4096, offset=0 fd=0x8091d50)
+
+2007-10-30 00:08:58 D [trace.c:215:trace_readdir_cbk] trace:
+(*this=0x8059e40, op_ret=0, op_errno=0, count=4)
+
+2007-10-30 00:08:58 D [trace.c:1624:trace_closedir] trace: callid: 71
+(*this=0x8059e40, *fd=0x8091d50)
+
+2007-10-30 00:08:58 D [trace.c:809:trace_closedir_cbk] trace:
+(*this=0x8059e40, op_ret=0, op_errno=1)
+@end example
+@end cartouche
+
+@node Usage Scenarios
+@chapter Usage Scenarios
+
+@section Advanced Striping
+
+This section is based on the Advanced Striping tutorial written by
+Anand Avati on the GlusterFS wiki
+@footnote{http://gluster.org/docs/index.php/Mixing_Striped_and_Regular_Files}.
+
+@subsection Mixed Storage Requirements
+
+There are two ways of scheduling the I/O. One at file level (using
+unify translator) and other at block level (using stripe
+translator). Striped I/O is good for files that are potentially large
+and require high parallel throughput (for example, a single file of
+400GB being accessed by 100s and 1000s of systems simultaneously and
+randomly). For most of the cases, file level scheduling works best.
+
+In the real world, it is desirable to mix file level and block level
+scheduling on a single storage volume. Alternatively users can choose
+to have two separate volumes and hence two mount points, but the
+applications may demand a single storage system to host both.
+
+This document explains how to mix file level scheduling with stripe.
+
+@subsection Configuration Brief
+
+This setup demonstrates how users can configure unify translator with
+appropriate I/O scheduler for file level scheduling and strip for only
+matching patterns. This way, GlusterFS chooses appropriate I/O profile
+and knows how to efficiently handle both the types of data.
+
+A simple technique to achieve this effect is to create a stripe set of
+unify and stripe blocks, where unify is the first sub-volume. Files
+that do not match the stripe policy passed on to first unify
+sub-volume and inturn scheduled arcoss the cluster using its file
+level I/O scheduler.
+
+@image{advanced-stripe,44pc,,,.pdf}
+
+@subsection Preparing GlusterFS Envoronment
+
+Create the directories /export/namespace, /export/unify and
+/export/stripe on all the storage bricks.
+
+ Place the following server and client volume spec file under
+/etc/glusterfs (or appropriate installed path) and replace the IP
+addresses / access control fields to match your environment.
+
+@cartouche
+@example
+ ## file: /etc/glusterfs/glusterfsd.vol
+ volume posix-unify
+ type storage/posix
+ option directory /export/for-unify
+ end-volume
+
+ volume posix-stripe
+ type storage/posix
+ option directory /export/for-stripe
+ end-volume
+
+ volume posix-namespace
+ type storage/posix
+ option directory /export/for-namespace
+ end-volume
+
+ volume server
+ type protocol/server
+ option transport-type tcp
+ option auth.addr.posix-unify.allow 192.168.1.*
+ option auth.addr.posix-stripe.allow 192.168.1.*
+ option auth.addr.posix-namespace.allow 192.168.1.*
+ subvolumes posix-unify posix-stripe posix-namespace
+ end-volume
+@end example
+@end cartouche
+
+@cartouche
+@example
+ ## file: /etc/glusterfs/glusterfs.vol
+ volume client-namespace
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.1
+ option remote-subvolume posix-namespace
+ end-volume
+
+ volume client-unify-1
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.1
+ option remote-subvolume posix-unify
+ end-volume
+
+ volume client-unify-2
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.2
+ option remote-subvolume posix-unify
+ end-volume
+
+ volume client-unify-3
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.3
+ option remote-subvolume posix-unify
+ end-volume
+
+ volume client-unify-4
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.4
+ option remote-subvolume posix-unify
+ end-volume
+
+ volume client-stripe-1
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.1
+ option remote-subvolume posix-stripe
+ end-volume
+
+ volume client-stripe-2
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.2
+ option remote-subvolume posix-stripe
+ end-volume
+
+ volume client-stripe-3
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.3
+ option remote-subvolume posix-stripe
+ end-volume
+
+ volume client-stripe-4
+ type protocol/client
+ option transport-type tcp
+ option remote-host 192.168.1.4
+ option remote-subvolume posix-stripe
+ end-volume
+
+ volume unify
+ type cluster/unify
+ option scheduler rr
+ subvolumes cluster-unify-1 cluster-unify-2 cluster-unify-3 cluster-unify-4
+ end-volume
+
+ volume stripe
+ type cluster/stripe
+ option block-size *.img:2MB # All files ending with .img are striped with 2MB stripe block size.
+ subvolumes unify cluster-stripe-1 cluster-stripe-2 cluster-stripe-3 cluster-stripe-4
+ end-volume
+@end example
+@end cartouche
+
+
+Bring up the Storage
+
+Starting GlusterFS Server: If you have installed through binary
+package, you can start the service through init.d startup script. If
+not:
+
+@example
+[root@@server]# glusterfsd
+@end example
+
+Mounting GlusterFS Volumes:
+
+@example
+[root@@client]# glusterfs -s [BRICK-IP-ADDRESS] /mnt/cluster
+@end example
+
+Improving upon this Setup
+
+Infiniband Verbs RDMA transport is much faster than TCP/IP GigE
+transport.
+
+Use of performance translators such as read-ahead, write-behind,
+io-cache, io-threads, booster is recommended.
+
+Replace round-robin (rr) scheduler with ALU to handle more dynamic
+storage environments.
+
+@node Troubleshooting
+@chapter Troubleshooting
+
+This chapter is a general troubleshooting guide to GlusterFS. It lists
+common GlusterFS server and client error messages, debugging hints, and
+concludes with the suggested procedure to report bugs in GlusterFS.
+
+@section GlusterFS error messages
+
+@subsection Server errors
+
+@example
+glusterfsd: FATAL: could not open specfile:
+'/etc/glusterfs/glusterfsd.vol'
+@end example
+
+The GlusterFS server expects the volume specification file to be
+at @command{/etc/glusterfs/glusterfsd.vol}. The example
+specification file will be installed as
+@command{/etc/glusterfs/glusterfsd.vol.sample}. You need to edit
+it and rename it, or provide a different specification file using
+the @command{--spec-file} command line option (See @ref{Server}).
+
+@vskip 4ex
+
+@example
+gf_log_init: failed to open logfile "/usr/var/log/glusterfs/glusterfsd.log"
+ (Permission denied)
+@end example
+
+You don't have permission to create files in the
+@command{/usr/var/log/glusterfs} directory. Make sure you are running
+GlusterFS as root. Alternatively, specify a different path for the log
+file using the @command{--log-file} option (See @ref{Server}).
+
+@subsection Client errors
+
+@example
+fusermount: failed to access mountpoint /mnt:
+ Transport endpoint is not connected
+@end example
+
+A previous failed (or hung) mount of GlusterFS is preventing it from being
+mounted again in the same location. The fix is to do:
+
+@example
+# umount /mnt
+@end example
+
+and try mounting again.
+
+@vskip 4ex
+
+@strong{``Transport endpoint is not connected''.}
+
+If you get this error when you try a command such as @command{ls} or @command{cat},
+it means the GlusterFS mount did not succeed. Try running GlusterFS in @command{DEBUG}
+logging level and study the log messages to discover the cause.
+
+@vskip 4ex
+
+@strong{``Connect to server failed'', ``SERVER-ADDRESS: Connection refused''.}
+
+GluserFS Server is not running or dead. Check your network
+connections and firewall settings. To check if the server is reachable,
+try:
+
+@example
+telnet IP-ADDRESS 6996
+@end example
+
+If the server is accessible, your `telnet' command should connect and
+block. If not you will see an error message such as @command{telnet: Unable to
+connect to remote host: Connection refused}. 6996 is the default
+GlusterFS port. If you have changed it, then use the corresponding
+port instead.
+
+@vskip 4ex
+
+@example
+gf_log_init: failed to open logfile "/usr/var/log/glusterfs/glusterfs.log"
+ (Permission denied)
+@end example
+
+You don't have permission to create files in the
+@command{/usr/var/log/glusterfs} directory. Make sure you are running
+GlusterFS as root. Alternatively, specify a different path for the log
+file using the @command{--log-file} option (See @ref{Client}).
+
+@section FUSE error messages
+@command{modprobe fuse} fails with: ``Unknown symbol in module, or unknown parameter''.
+@cindex Redhat Enterprise Linux
+
+If you are using fuse-2.6.x on Redhat Enterprise Linux Work Station 4
+and Advanced Server 4 with 2.6.9-42.ELlargesmp, 2.6.9-42.ELsmp,
+2.6.9-42.EL kernels and get this error while loading @acronym{FUSE} kernel
+module, you need to apply the following patch.
+
+For fuse-2.6.2:
+
+@indicateurl{http://ftp.zresearch.com/pub/gluster/glusterfs/fuse/fuse-2.6.2-rhel-build.patch}
+
+For fuse-2.6.3:
+
+@indicateurl{http://ftp.zresearch.com/pub/gluster/glusterfs/fuse/fuse-2.6.3-rhel-build.patch}
+
+@section AppArmour and GlusterFS
+@cindex AppArmour
+@cindex OpenSuSE
+Under OpenSuSE GNU/Linux, the AppArmour security feature does not
+allow GlusterFS to create temporary files or network socket
+connections even while running as root. You will see error messages
+like `Unable to open log file: Operation not permitted' or `Connection
+refused'. Disabling AppArmour using YaST or properly configuring
+AppArmour to recognize @command{glusterfsd} or @command{glusterfs}/@command{fusermount}
+should solve the problem.
+
+@section Reporting a bug
+
+If you encounter a bug in GlusterFS, please follow the below
+guidelines when you report it to the mailing list. Be sure to report
+it! User feedback is crucial to the health of the project and we value
+it highly.
+
+@subsection General instructions
+
+When running GlusterFS in a non-production environment, be sure to
+build it with the following command:
+
+@example
+ $ make CFLAGS='-g -O0 -DDEBUG'
+@end example
+
+This includes debugging information which will be helpful in getting
+backtraces (see below) and also disable optimization. Enabling
+optimization can result in incorrect line numbers being reported to
+gdb.
+
+@subsection Volume specification files
+
+Attach all relevant server and client spec files you were using when
+you encountered the bug. Also tell us details of your setup, i.e., how
+many clients and how many servers.
+
+@subsection Log files
+
+Set the loglevel of your client and server programs to @acronym{DEBUG} (by
+passing the -L @acronym{DEBUG} option) and attach the log files with your bug
+report. Obviously, if only the client is failing (for example), you
+only need to send us the client log file.
+
+@subsection Backtrace
+
+If GlusterFS has encountered a segmentation fault or has crashed for
+some other reason, include the backtrace with the bug report. You can
+get the backtrace using the following procedure.
+
+Run the GlusterFS client or server inside gdb.
+
+@example
+ $ gdb ./glusterfs
+ (gdb) set args -f client.spec -N -l/path/to/log/file -LDEBUG /mnt/point
+ (gdb) run
+@end example
+
+Now when the process segfaults, you can get the backtrace by typing:
+
+@example
+ (gdb) bt
+@end example
+
+If the GlusterFS process has crashed and dumped a core file (you can
+find this in / if running as a daemon and in the current directory
+otherwise), you can do:
+
+@example
+ $ gdb /path/to/glusterfs /path/to/core.<pid>
+@end example
+
+and then get the backtrace.
+
+If the GlusterFS server or client seems to be hung, then you can get
+the backtrace by attaching gdb to the process. First get the @command{PID} of
+the process (using ps), and then do:
+
+@example
+ $ gdb ./glusterfs <pid>
+@end example
+
+Press Ctrl-C to interrupt the process and then generate the backtrace.
+
+@subsection Reproducing the bug
+
+If the bug is reproducible, please include the steps necessary to do
+so. If the bug is not reproducible, send us the bug report anyway.
+
+@subsection Other information
+
+If you think it is relevant, send us also the version of @acronym{FUSE} you're
+using, the kernel version, platform.
+
+@node GNU Free Documentation Licence
+@appendix GNU Free Documentation Licence
+@include fdl.texi
+
+@node Index
+@unnumbered Index
+@printindex cp
+
+@bye
diff --git a/doc/user-guide/xlator.odg b/doc/user-guide/xlator.odg
new file mode 100644
index 00000000000..179a65f6e26
--- /dev/null
+++ b/doc/user-guide/xlator.odg
Binary files differ
diff --git a/doc/user-guide/xlator.pdf b/doc/user-guide/xlator.pdf
new file mode 100644
index 00000000000..a07e14d67d2
--- /dev/null
+++ b/doc/user-guide/xlator.pdf
Binary files differ