Home | History | Annotate | only in /src/lib/libpuffs
History log of /src/lib/libpuffs
RevisionDateAuthorComments
 1.30 05-Sep-2023  mrg apply -Wno-dangling-pointer to callcontext.c.

puffs_cc_getcc() uses a mask against a stack variable to find the
struct puffs_cc stashed below the stack, triggering the dangling
pointer problem.
 1.29 31-Mar-2023  rillig libpuffs: ignore lint warning about nested extern for now

This should be properly fixed by someone familiar with puffs.
 1.28 28-Mar-2023  rillig lint: warn about extern declarations outside headers

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
 1.27 22-Jan-2022  pho Allow calling puffs_mount(3) before puffs_daemon(3)

puffs_daemon(3) creates a pipe before forking, and the parent process
waits for the child to either complete puffs_mount(3) or fail. If a
user calls puffs_daemon(3) after puffs_mount(3), the function
deadlocks. While this error-reporting functionality is really a nice
thing to have, deadlocking is not great. If the filesystem has already
been mounted, puffs_mount(3) should just daemonize the process and
return.

This became an issue because fuse_daemonize(3) in FUSE API had no such
requirement and some FUSE filesystems in the wild suffered deadlocks.
 1.26 23-Jan-2016  christos Define _KERNTYPES for things that need it.
 1.25 21-Mar-2012  matt These directories default to WARNS?=5
 1.24 06-Dec-2010  pooka branches: 1.24.6;
Remove PUFFS_WITH_THREADS ifdef garbage, just use libc weak symbols.
 1.23 05-Dec-2009  pooka Remove suspension support from here too.
 1.22 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.21 26-Oct-2007  pooka Add some very initial support for a threading worker model as an
alternative to the (vastly superior ;) continuation model. This
is very preliminary stuff and not compiled by default (which it
even won't do without some other patches I cannot commit yet).

The raison d'commit of the patch is a snippet which ensures proper
in-order dispatching of all operations, including those which don't
require a response. Previously many of them would be dispatched
simultaneosly, e.g. fsync and reclaim on the same node, which
obviously isn't all that nice for correct operation.
 1.20 18-Jul-2007  pooka branches: 1.20.4; 1.20.6;
get rid of DBG=
 1.19 28-May-2007  tls Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry. RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros. Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default. Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
 1.18 11-May-2007  pooka move puffs request dispatching code into it's own module.
no functional change
 1.17 05-May-2007  pooka add stubby version of puffs_framebuf manual page. proper one
forthcoming to an internet near you Real Soon Now(tm)
 1.16 05-May-2007  pooka Add puffs "frame buffers", which are an abstraction of the buffering
and event handling mechanisms required in file servers with blocking
I/O backends. puffs_framebuf is built on the concept of puffs_cc
and uses those to multiplex execution where needed.

File systems are required to implement three methods:
* read frame
* write frame
* compare if frame is a response to the given one

Memory management is provided by puffs_framebuf, but the file
systems must still, of course, interpret the protocol and do e.g.
byte order conversion.

As always, puffs_framebuf is work in progress. Current users are
mount_psshfs and mount_9p.
 1.15 16-Apr-2007  pooka Move file system and node callbacks into their own manual page.
Improve markup and descriptions a bit (not completely finished yet).
 1.14 22-Mar-2007  pooka document credentials & access control methods
 1.13 26-Jan-2007  pooka document puffs_fs_suspend()
 1.12 26-Jan-2007  pooka add interfaces for suspending the file system
 1.11 20-Jan-2007  pooka document request handling routines
 1.10 19-Jan-2007  pooka Bring the documentation slightly more into sync with the current
reality. It's still really a far cry from proper documentation,
though.
 1.9 15-Jan-2007  pooka Checkpoint some more work in progress: for the benefit those file
system backends which operate purely based on paths, push out more
path management into the library and make path management more
abstract: enable a file system to define a bunch of path management
callbacks, which are used by the framework. Management of normal
/this/is/a/path type paths is provided by the library.
 1.8 11-Jan-2007  pooka Add preliminary code for a nullfs layer, which can be used to mount
a directory hierarchy to another point, just like with the kernel
nullfs. This is not really a layering scheme yet, but it should
evolve into one. Currently it can just be used to do 1:1 mapping.
 1.7 09-Jan-2007  pooka lib interface for invalidation routines
 1.6 29-Dec-2006  pooka checkpoint some experimental work-in-progress, namely:

Add support for having multiple outstanding operations. This is done
by exposing enough interfaces so that it is convenient to have the
main event loop in the implementation itself and by providing a
continuation framework for convinient blocking and rescheduling.

works fine, but will undergo further cleanup & development
 1.5 07-Dec-2006  pooka outline & export code for interfacing with kernel GET/PUT requests
 1.4 09-Nov-2006  pooka initial documentation for the puffs library interface
 1.3 23-Oct-2006  christos pass lint; fix install.
 1.2 22-Oct-2006  dogcow add the .include <bsd.own.mk>, so .d and .o files don't end up in the CWD.
remove INCDIR=/usr/include, as my leenooks system doesn't have puffs .h files.
 1.1 22-Oct-2006  pooka add libpuffs - the userspace programming interface for puffs

This work was initially started and completed for Google SoC 2005
and tweaked to work a bit better in the past few weeks. While
being far from complete, it is functional enough to be able and
stable to host a fairly general-purpose in-memory file system in
userspace. Even so, puffs should be considered experimental and
no binary compatibility for interfaces or crash-freedom or zero
security implications should be relied upon just yet.

The GSoC project was mentored by William Studenmund and the final
review for the code was done by Christos.
 1.20.6.2 18-Jul-2007  pooka get rid of DBG=
 1.20.6.1 18-Jul-2007  pooka file Makefile was added on branch matt-mips64 on 2007-07-18 22:38:59 +0000
 1.20.4.2 09-Jan-2008  matt sync with HEAD
 1.20.4.1 06-Nov-2007  matt sync with HEAD
 1.24.6.1 17-Apr-2012  yamt sync with head
 1.3 19-Jul-2007  pooka branches: 1.3.16;
stuff
 1.2 01-Jul-2007  pooka pid is gone
 1.1 19-May-2007  pooka quick TODO-list. very incomplete
 1.3.16.2 19-Jul-2007  pooka stuff
 1.3.16.1 19-Jul-2007  pooka file TODO was added on branch matt-mips64 on 2007-07-19 07:48:11 +0000
 1.1 03-Apr-2013  agc branches: 1.1.2;
file Version.map was initially added on branch agc-symver.
 1.1.2.1 03-Apr-2013  agc Add symbol versioning information for the following libraries:

libbluetooth
libbsdmalloc
libexecinfo
libform
libintl
libipsec
libkvm
liblwres
libnpf
libp2k
libpci
libperfuse
libppath
libprop
libpuffs
librefuse
librpcsvc
librt
librumpclient
librumphijack
librumpuser
libukfs
libusbhid
libwrap
 1.30 09-Jul-2018  christos revert previous now that MAP_ALIGNED has been fixed.
 1.29 08-Jul-2018  christos correct previous cast.
 1.28 08-Jul-2018  christos cast for lint
 1.27 06-Dec-2011  skrll branches: 1.27.38; 1.27.40;
Deal with __MACHINE_STACK_GROWS_UP machines.

constify the other psize while I'm here.

Thanks to Christos for looking.
 1.26 02-Nov-2011  yamt branches: 1.26.2;
puffs_cc_yield: fix a cc leak. PR/44679
 1.25 04-Mar-2011  yamt puffs__cc_destroy: clear PCC_HASCALLER. the caller info is not
necessarily relevant to the next life of the cc. this also fixes
the failure of the assertion in the next line.
 1.24 10-Jan-2011  yamt branches: 1.24.2;
typo in a comment
 1.23 11-Aug-2008  pooka clear cached puffs_cc's in puffs_exit()
 1.22 11-Aug-2008  pooka * make sure we come out of mainloop in the main context. otherwise in
certain cases the server would jump to hyperspace when unmounted
* sprinkle some debug prints
 1.21 28-Jan-2008  pooka branches: 1.21.6;
Don't add asserts between testing and commit - especially not
if you're going to write "assert(foo = 0)"
 1.20 28-Jan-2008  pooka Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed. Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts. The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
 1.19 17-Jan-2008  pooka Fix fakecc case.

Noticed by Pavel Jirout on current-users
 1.18 16-Jan-2008  pooka Cache a number of execution contexts instead of re-initializing
them every time. Speeds up pure in-memory file systems such as
sysctlfs or dtfs quite a bit. For actual I/O-workhorses the result
is of course less tasty.
 1.17 16-Jan-2008  pooka Use PROT_NONE page to protect bottom of stack from overrun
 1.16 16-Dec-2007  pooka * nuke puffs_cc_get{specific,usermount} for good
* move prototypes for puffs_docc and puffs_dopufbuf into the
public header, as they are should be exposed
 1.15 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.14 29-Nov-2007  pooka * allocate pcc as a slice from the stack instead of allocating it
separately
* provide puffs_cc_getcc()

This is in preparation for the removal of you-should-guess-what as
an argument to routines here and there and everywhere.
 1.13 31-Oct-2007  pooka Fix a few bugs and memleaks with the threading code.
 1.12 26-Oct-2007  pooka Add some very initial support for a threading worker model as an
alternative to the (vastly superior ;) continuation model. This
is very preliminary stuff and not compiled by default (which it
even won't do without some other patches I cannot commit yet).

The raison d'commit of the patch is a snippet which ensures proper
in-order dispatching of all operations, including those which don't
require a response. Previously many of them would be dispatched
simultaneosly, e.g. fsync and reclaim on the same node, which
obviously isn't all that nice for correct operation.
 1.11 26-Oct-2007  pooka mmap stacks, makes it possible to align them
 1.10 21-Oct-2007  pooka Add puffs_cc_schedule() which marks a pcc runnable and will pass
execution to it when in the main loop the next time.
 1.9 21-Oct-2007  pooka Always provide caller information from the kernel based on curlwp.
(but don't deprecate the old puffs_cid interface just yet)
 1.8 11-Oct-2007  pooka Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

* since the kernel-user communication is not purely request-response
anymore (hasn't been since 2006), try to rename some "request" to
"message". more similar mangling will take place in the future.

* completely rework how messages are allocated. previously most of
them were borrowed from the stack (originally *all* of them),
but now always allocate dynamically. this makes the structure
of the code much cleaner. also makes it possible to fix a
locking order violation. it enables plenty of future enhancements.

* start generalizing the transport interface to be independent of puffs

* move transport interface to read/write instead of ioctl. the
old one had legacy design problems, and besides, ioctl's suck.
implement a very generic version for now; this will be
worked on later hopefully some day reaching "highly optimized".

* implement libpuffs support behind existing library request
interfaces. this will change eventually (I hate those interfaces)
 1.7 06-Jun-2007  pooka branches: 1.7.4;
Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.6 15-May-2007  pooka Step 3 and currently final step of a more general purpose event loop:
support removal and addition of i/o file descriptors on the fly.

* detect closed file descriptors
* automatically free waiters of a dead file descriptor
* give the file server the possibility to specify a callback which
notifies of a dead file descriptor
* move loop function to be a property of the mainloop instead of
framebuf (doesn't change effective behaviour)
* add the possibility to configure a timespec parameter which
attempts to call the loop function periodically
* move the event loop functions from the puffs_framebuf namespace
to puffs_framev to differential between pure memory management
functions
 1.5 10-May-2007  pooka assert that yield/continue is done only with a real continuation
 1.4 19-Apr-2007  pooka add puffs_cc_getspecific(pcc), which is shorthand for:
puffs_getspecific(puffs_cc_getusermount(pcc))
 1.3 17-Feb-2007  pooka #include <ucontext.h>
 1.2 06-Jan-2007  pooka * get rid of the mount callback; it's no great surprise to the
server that it needs to mount the file system backend if it wants
to call mount
* provide some options for getmntopts(), assume that callers will parse
command line (or fstab) args
* reorganize the puffs_cc interface just a bit, preparing for a bigger
revamp later
 1.1 29-Dec-2006  pooka checkpoint some experimental work-in-progress, namely:

Add support for having multiple outstanding operations. This is done
by exposing enough interfaces so that it is convenient to have the
main event loop in the implementation itself and by providing a
continuation framework for convinient blocking and rescheduling.

works fine, but will undergo further cleanup & development
 1.7.4.3 23-Mar-2008  matt sync with HEAD
 1.7.4.2 09-Jan-2008  matt sync with HEAD
 1.7.4.1 06-Nov-2007  matt sync with HEAD
 1.21.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.24.2.1 05-Mar-2011  bouyer Sync with HEAD
 1.26.2.1 17-Apr-2012  yamt sync with head
 1.27.40.1 10-Jun-2019  christos Sync with HEAD
 1.27.38.1 28-Jul-2018  pgoyette Sync with HEAD
 1.16 15-Mar-2012  njoly Use puffs_access() return value in the VA_UTIMES_NULL case.
 1.15 20-Nov-2009  pooka branches: 1.15.6; 1.15.8;
In getgroups(), copy only up to the number of supplementary groups
that actually exist.
 1.14 08-Dec-2007  pooka branches: 1.14.12; 1.14.18;
Now that "l" is gone both as an argument to operations and from
componentname, remove all vestiges of puffs_cid.
 1.13 18-Oct-2007  pooka * Change type of boolean functions to, well, boolean instead of int.
* add puffs_cid_isequal() which can be used to test if the two caller
id's refer to the same process/lwp.
 1.12 01-Jul-2007  pooka branches: 1.12.4;
Instead of supplying a plain pid, supply an abstract struct puffs_cid *,
which can currently be used to query the pid and lwpid.
 1.11 01-Jul-2007  pooka make puffs_cred an opaque type
 1.10 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.9 22-Mar-2007  pooka allow kernel creds in addition to superuser creds when checking for access
 1.8 22-Mar-2007  pooka unify the location of *pcr in puffs_access_*
 1.7 22-Mar-2007  pooka copy ngroups * sizeof(gid_t) groups instead of just ngroups
 1.6 22-Mar-2007  pooka * return -1 and set errno instead of returning errno directly
* introduce puffs_cred_isregular() which checks if the cred structure
has regular uid/gid (i.e. "person" credentials and not kernel creds)
 1.5 21-Mar-2007  pooka add routiens which check against ufs semantics for permission to
chown, chmod and change a/mtime
 1.4 20-Mar-2007  pooka implement counterpart of vaccess()
 1.3 23-Oct-2006  christos fix a lint warning.
 1.2 23-Oct-2006  christos pass lint; fix install.
 1.1 22-Oct-2006  pooka add libpuffs - the userspace programming interface for puffs

This work was initially started and completed for Google SoC 2005
and tweaked to work a bit better in the past few weeks. While
being far from complete, it is functional enough to be able and
stable to host a fairly general-purpose in-memory file system in
userspace. Even so, puffs should be considered experimental and
no binary compatibility for interfaces or crash-freedom or zero
security implications should be relied upon just yet.

The GSoC project was mentored by William Studenmund and the final
review for the code was done by Christos.
 1.12.4.2 09-Jan-2008  matt sync with HEAD
 1.12.4.1 06-Nov-2007  matt sync with HEAD
 1.14.18.1 21-Apr-2010  matt sync to netbsd-5
 1.14.12.1 28-Nov-2009  bouyer Pull up following revision(s) (requested by pooka in ticket #1155):
lib/libpuffs/creds.c: revision 1.15
In getgroups(), copy only up to the number of supplementary groups
that actually exist.
 1.15.8.1 03-Nov-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1140):
lib/libperfuse/ops.c 1.63-1.69
lib/libperfuse/perfuse.c 1.32-1.33
lib/libperfuse/perfuse_priv.h 1.32-1.34
lib/libperfuse/subr.c 1.20
lib/libpuffs/creds.c 1.16
lib/libpuffs/dispatcher.c 1.47
lib/libpuffs/puffs.h 1.125
lib/libpuffs/puffs_ops.3 1.37-1.38
lib/libpuffs/requests.c 1.24
sys/fs/puffs/puffs_msgif.h 1.81
sys/fs/puffs/puffs_sys.h 1.85
sys/fs/puffs/puffs_vnops.c 1.183
usr.sbin/perfused/msg.c 1.22
Bring libpuffs, libperfuse and perfused on par with -current:
- implement FUSE direct I/O
- remove useless code and warnings
- fix missing GETATTR bugs
- fix exended attribute get and list operations
 1.15.6.1 17-Apr-2012  yamt sync with head
 1.50 11-Dec-2023  mlelstv pathconf needs to return EINVAL when the variable is invalid
or cannot be associated with a file. This also needs to be true
when the node doesn't implement the pathconf function at all.
 1.49 08-Mar-2021  christos branches: 1.49.6;
cast to the proper enums for lint
 1.48 31-Oct-2014  manu libpuffs support for fallocate and fdiscard operations
 1.47 16-Aug-2014  manu Add an open2 method, like open but with an additionnal oflags used
by the filesystem to send back information about the file.
This is used to implement PUFFS_OPEN_IO_DIRECT by which the filesystem
tells the kernel that read/write should bypass the page cache.
 1.46 06-Nov-2013  christos branches: 1.46.4;
revert previous, will turn off globally.
 1.45 06-Nov-2013  christos XXX: gcc initialization (mc68k gcc-4.5.x gcc-4.8.x)
 1.44 16-Aug-2012  manu Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.

The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.

It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.

- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.

- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.

- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.43 10-Aug-2012  manu Fix race condition between (create|mknod|mkdir|symlino) and reclaim, just
like we did it between lookup and reclaim.
 1.42 21-Jul-2012  manu - Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.

The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.

We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.

- Fix lookup/reclaim race condition.

The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.

We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
 1.41 27-Jun-2012  manu Pass the FAF flag to handlers:
- setattr_ttl is updated to add a flag argument. Since it was not present in
a previous release, we can change its API
- write2 is introduced, this is write with an extra flag for FAF.
- fsync already has the FAF information in a flag and needs no change
- for other operations, FAF is unconditional
 1.40 18-Apr-2012  manu - When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM (how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
 1.39 08-Apr-2012  manu Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
 1.38 25-Nov-2011  manu branches: 1.38.2;
Rollback previous change as it breaks autmates tests
 1.37 24-Nov-2011  manu Remove files specified in pcn.

When remove files using name from pnode, another link on this file
can be unlinked. E.g. "touch 1; ln 1 2; rm 2" will remove file named
"1". Thus puffs_null_node_remove should remove directory entry which
name is provided by pcn (as said in puffs_ops.3). Caller should
provide appropriately initialized pcn.

From Evgeniy Ivanov <lolkaantimat@gmail.com>
 1.36 04-Jul-2011  manu branches: 1.36.2;
Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.

There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
extattr_list_file(2), which is obtanined by setting the
EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)

This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
 1.35 06-Dec-2010  pooka Remove PUFFS_WITH_THREADS ifdef garbage, just use libc weak symbols.
 1.34 21-May-2010  pooka * support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
 1.33 17-Oct-2009  pooka Dispatch puffs_node_abortop().

Note: We use the storage of puffs_cache_write from puffs_ops for
this purpose. It's not issued by the kernel and hence currently
unused, and this saves us from the trouble of bumping the lib major
version.
 1.32 12-Aug-2008  pooka branches: 1.32.4; 1.32.10;
Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.31 20-Mar-2008  pooka branches: 1.31.4;
Reserve enough memory for ops which return more than they receive.
 1.30 28-Jan-2008  pooka branches: 1.30.2;
Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed. Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts. The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
 1.29 16-Jan-2008  pooka Comment out the puffs_executor hacks for now, they have races.
The issue should be solved in another fashion anyway.
 1.28 16-Jan-2008  pooka Cache a number of execution contexts instead of re-initializing
them every time. Speeds up pure in-memory file systems such as
sysctlfs or dtfs quite a bit. For actual I/O-workhorses the result
is of course less tasty.
 1.27 16-Dec-2007  pooka * nuke puffs_cc_get{specific,usermount} for good
* move prototypes for puffs_docc and puffs_dopufbuf into the
public header, as they are should be exposed
 1.26 08-Dec-2007  pooka Now that "l" is gone both as an argument to operations and from
componentname, remove all vestiges of puffs_cid.
 1.25 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.24 30-Nov-2007  pooka Rototill.

Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?). Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it. This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
 1.23 29-Nov-2007  pooka * allocate pcc as a slice from the stack instead of allocating it
separately
* provide puffs_cc_getcc()

This is in preparation for the removal of you-should-guess-what as
an argument to routines here and there and everywhere.
 1.22 27-Nov-2007  pooka Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces. puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
 1.21 31-Oct-2007  pooka Fix a few bugs and memleaks with the threading code.
 1.20 29-Oct-2007  pooka lock massage, although I don't think there's a happy ending here
 1.19 29-Oct-2007  pooka Sprinkle some hackish locks here and there, just enough to allow
libp2k & rump to run multithreaded.
 1.18 28-Oct-2007  pooka Add possibility to set pre- and post callbacks which will be called
for all operations before or after executing the specific callback
(the api is not be final yet, though).
 1.17 26-Oct-2007  pooka Add some very initial support for a threading worker model as an
alternative to the (vastly superior ;) continuation model. This
is very preliminary stuff and not compiled by default (which it
even won't do without some other patches I cannot commit yet).

The raison d'commit of the patch is a snippet which ensures proper
in-order dispatching of all operations, including those which don't
require a response. Previously many of them would be dispatched
simultaneosly, e.g. fsync and reclaim on the same node, which
obviously isn't all that nice for correct operation.
 1.16 21-Oct-2007  pooka Always provide caller information from the kernel based on curlwp.
(but don't deprecate the old puffs_cid interface just yet)
 1.15 11-Oct-2007  pooka Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

* since the kernel-user communication is not purely request-response
anymore (hasn't been since 2006), try to rename some "request" to
"message". more similar mangling will take place in the future.

* completely rework how messages are allocated. previously most of
them were borrowed from the stack (originally *all* of them),
but now always allocate dynamically. this makes the structure
of the code much cleaner. also makes it possible to fix a
locking order violation. it enables plenty of future enhancements.

* start generalizing the transport interface to be independent of puffs

* move transport interface to read/write instead of ioctl. the
old one had legacy design problems, and besides, ioctl's suck.
implement a very generic version for now; this will be
worked on later hopefully some day reaching "highly optimized".

* implement libpuffs support behind existing library request
interfaces. this will change eventually (I hate those interfaces)
 1.14 09-Oct-2007  pooka g/c #if 0'd code which isn't likely to get used any time soon
 1.13 01-Oct-2007  pooka Pass reason string to pu_errnotify. Print it in the default
version before aborting.
 1.12 27-Sep-2007  pooka Add error notifications, which are used to deliver errors from the
kernel to the file server for silly things the file server did,
e.g. attempting to create a file with size VSIZENOTSET. The file
server can handle these as it chooses, but the default action is
for it to throw its hands in the air and sing "goodbye, cruel world,
it's over, walk on by".
 1.11 27-Jul-2007  pooka branches: 1.11.4; 1.11.6;
mmap fflags -> prot
 1.10 02-Jul-2007  pooka Get rid of the "int *refs" parameter to inactive: the same can be
accomplished now with puffs_setbacks.
 1.9 01-Jul-2007  pooka Instead of requesting various pieces of information from node-creating
methods using "please fill me"-pointers, pass "struct puffs_newinfo *"
and provide methods to fill in new node info.
 1.8 01-Jul-2007  pooka Instead of supplying a plain pid, supply an abstract struct puffs_cid *,
which can currently be used to query the pid and lwpid.
 1.7 01-Jul-2007  pooka make puffs_cred an opaque type
 1.6 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.5 18-May-2007  pooka default refcount to 1 in inactive
 1.4 18-May-2007  pooka dispatch PUFFS_VN_POLL
 1.3 15-May-2007  pooka Step 3 and currently final step of a more general purpose event loop:
support removal and addition of i/o file descriptors on the fly.

* detect closed file descriptors
* automatically free waiters of a dead file descriptor
* give the file server the possibility to specify a callback which
notifies of a dead file descriptor
* move loop function to be a property of the mainloop instead of
framebuf (doesn't change effective behaviour)
* add the possibility to configure a timespec parameter which
attempts to call the loop function periodically
* move the event loop functions from the puffs_framebuf namespace
to puffs_framev to differential between pure memory management
functions
 1.2 11-May-2007  pooka copyright adjustment
 1.1 11-May-2007  pooka move puffs request dispatching code into it's own module.
no functional change
 1.11.6.2 27-Jul-2007  pooka mmap fflags -> prot
 1.11.6.1 27-Jul-2007  pooka file dispatcher.c was added on branch matt-mips64 on 2007-07-27 08:28:17 +0000
 1.11.4.3 23-Mar-2008  matt sync with HEAD
 1.11.4.2 09-Jan-2008  matt sync with HEAD
 1.11.4.1 06-Nov-2007  matt sync with HEAD
 1.30.2.1 24-Mar-2008  keiichi sync with head.
 1.31.4.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.10.1 21-Apr-2010  matt sync to netbsd-5
 1.32.4.2 17-Jul-2011  riz Pull up following revision(s) (requested by manu in ticket #1645):
lib/libc/sys/Makefile.inc 1.207 via patch
lib/libc/sys/extattr_get_file.2 patch
lib/libpuffs/dispatcher.c 1.34,1.36 via patch
lib/libpuffs/puffs.c 1.107 via patch
lib/libpuffs/puffs.h 1.115,1.118 via patch
sys/fs/puffs/puffs_msgif.h 1.71,1.76 via patch
sys/fs/puffs/puffs_vfsops.c 1.88 via patch
sys/fs/puffs/puffs_vnops.c 1.145,1.154 via patch
sys/kern/vfs_xattr.c 1.24-1.27 via patch
sys/kern/vnode_if.c 1.87 via patch
sys/sys/Makefile 1.133 via patch
sys/sys/extattr.h 1.6 via patch
sys/sys/vnode_if.h 1.81 via patch
sys/ufs/ffs/ffs_vnops.c patch
sys/ufs/ufs/ufs_extattr.c 1.31,1.34 via patch

* support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
Support extended attributes.
Fix multiple non compliances in our Linux-like extattr API, and make it
public so that it can be used.
Improve a bit listxattr(2). It attemps to list both system and user
extended attributes, and it faled if calling user did not have privilege
for reading system EA. Now we just lise user EA and skip system EA in
reading them is not allowed.
Fix bug introduced in previous commuit: Do not vrele() a vnode we did not
obtained.
Improve UFS1 extended attributes usability
- autocreate attribute backing file for new attributes
- autoload attributes when issuing extattrctl start
- when autoloading attributes, do not display garbage warning when looking
up entries that got ENOENT
Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.
There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
extattr_list_file(2), which is obtanined by setting the
EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)
This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
 1.32.4.1 18-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1100):
lib/libpuffs/dispatcher.c: revision 1.33
lib/libpuffs/puffs.c: revision 1.99
lib/libpuffs/puffs.h: revision 1.111
sys/fs/puffs/puffs_msgif.h: revision 1.67 via patch
sys/fs/puffs/puffs_vnops.c: revision 1.136

Support VOP_ABORTOP() in puffs.
 1.36.2.3 30-Oct-2012  yamt sync with head
 1.36.2.2 23-May-2012  yamt sync with head.
 1.36.2.1 17-Apr-2012  yamt sync with head
 1.38.2.5 03-Nov-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1140):
lib/libperfuse/ops.c 1.63-1.69
lib/libperfuse/perfuse.c 1.32-1.33
lib/libperfuse/perfuse_priv.h 1.32-1.34
lib/libperfuse/subr.c 1.20
lib/libpuffs/creds.c 1.16
lib/libpuffs/dispatcher.c 1.47
lib/libpuffs/puffs.h 1.125
lib/libpuffs/puffs_ops.3 1.37-1.38
lib/libpuffs/requests.c 1.24
sys/fs/puffs/puffs_msgif.h 1.81
sys/fs/puffs/puffs_sys.h 1.85
sys/fs/puffs/puffs_vnops.c 1.183
usr.sbin/perfused/msg.c 1.22
Bring libpuffs, libperfuse and perfused on par with -current:
- implement FUSE direct I/O
- remove useless code and warnings
- fix missing GETATTR bugs
- fix exended attribute get and list operations
 1.38.2.4 13-Sep-2012  riz Pull up following revision(s) (requested by manu in ticket #525):
lib/libpuffs/dispatcher.c: revision 1.44
lib/libp2k/p2k.c: revision 1.57
lib/libpuffs/puffs_ops.3: revision 1.35
lib/libpuffs/pnode.c: revision 1.13
lib/libpuffs/puffs.3: revision 1.56
lib/libpuffs/puffs.h: revision 1.124
Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.
The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.
It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.
- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.
- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.
- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.38.2.3 12-Aug-2012  martin branches: 1.38.2.3.2;
Pull up following revision(s) (requested by manu in ticket #438):
lib/libperfuse/perfuse_priv.h: revision 1.31
sys/fs/puffs/puffs_msgif.h: revision 1.80
sys/fs/puffs/puffs_vnops.c: revision 1.171
lib/libpuffs/puffs_ops.3: revision 1.31
sys/fs/puffs/puffs_vnops.c: revision 1.172
sys/fs/puffs/puffs_vnops.c: revision 1.173
sys/fs/puffs/puffs_vnops.c: revision 1.174
usr.sbin/perfused/perfused.c: revision 1.24
sys/fs/puffs/puffs_sys.h: revision 1.80
sys/fs/puffs/puffs_sys.h: revision 1.81
sys/fs/puffs/puffs_sys.h: revision 1.82
lib/libperfuse/subr.c: revision 1.19
lib/libperfuse/perfuse.c: revision 1.30
sys/fs/puffs/puffs_msgif.c: revision 1.90
sys/fs/puffs/puffs_msgif.c: revision 1.91
sys/fs/puffs/puffs_msgif.c: revision 1.92
lib/libperfuse/ops.c: revision 1.59
lib/libpuffs/puffs.3: revision 1.53
lib/libperfuse/debug.c: revision 1.12
lib/libpuffs/puffs.3: revision 1.54
sys/fs/puffs/puffs_vnops.c: revision 1.167
sys/fs/puffs/puffs_msgif.h: revision 1.79
usr.sbin/perfused/msg.c: revision 1.21
sys/fs/puffs/puffs_vfsops.c: revision 1.102
sys/fs/puffs/puffs_vfsops.c: revision 1.103
sys/fs/puffs/puffs_vfsops.c: revision 1.105
lib/libpuffs/puffs.h: revision 1.123
lib/libperfuse/perfuse_if.h: revision 1.20
lib/libperfuse/perfuse.c: revision 1.29
lib/libpuffs/dispatcher.c: revision 1.42
lib/libpuffs/dispatcher.c: revision 1.43
- Fix same vnodes associated with multiple cookies
The scheme used to retreive known nodes on lookup was flawed, as it only
used parent and name. This produced a different cookie for the same file
if it was renamed, when looking up ../ or when dealing with multiple files
associated with the same name through link(2).
We therefore abandon the use of node name and introduce hashed lists of
inodes. This causes a huge rewrite of reclaim code, which do not attempt
to keep parents allocated until all their children are reclaimed
- Fix race conditions in reclaim
There are a few situations where we issue multiple FUSE operations for
a PUFFS operation. On reclaim, we therefore have to wait for all FUSE
operation to complete, not just the current exchanges. We do this by
introducing node reference count with node_ref() and node_rele().
- Detect data loss caused by FAF
VOP_PUTPAGES causes FAF writes where the kernel does not check the
operation result. At least issue a warning on error.
- Enjoy FAF shortcut on setattr
No need to wait for the result if the kernel does not want it. There is
however an exception for setattr that touch the size, we need to wait
for completion because we have other operations queued for after the
resize.
- Fix fchmod() on write-open file
fchmod() on a node open with write privilege will send setattr with both mode
and size set. This confuses some FUSE filesystem. Therefore we send two FUSE
operations, one for mode, and one for size.
- Remove node TTL handling for netbsd-5 for simplicity sake. The code
still builds on netbsd-5 but does not have the node TTL feature anymore.
It works fine with kernel support on netbsd-6.
- Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.
The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.
We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.
- Fix lookup/reclaim race condition.
The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.
We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
Fix hang unmount bug introduced by last commit.
We introduced a slow queue for delayed reclaims, while the existing
queue for unmount, flush and exist has been renamed fast queue. Both
queues had timestamp for when an operation should be done, but it was
useless for the fast queue, which is always used to run an operation
ASAP. And the timestamp test had an error that turned ASAP into "at next
tick", but nobody what there to wake the thread at next tick, hence
the hang. The fix is to remove the useless and buggy timestamp test for
fast queue.
Rename slow sopreq queue into node sopreq queue, to refet the fact that
is only intended for postponed node reclaims.
When purging the node sopreq queue, do not call puffs_msg_sendresp(), as
it makes no sense.
Fix race condition between (create|mknod|mkdir|symlino) and reclaim, just
like we did it between lookup and reclaim.
Missing bit in previous commit (prevent race between create|mknod|mkdir|symlink
and reclaim)
Bump date for previous.
New sentence, new line; remove trailing whitespace; fix typos;
punctuation nits.
Add PUFFS_KFLAG_CACHE_DOTDOT so that vnodes hold a reference on their
parent, keeping them active, and allowing to lookup .. without sending
a request to the filesystem.
Enable the featuure for perfused, as this is how FUSE works.
Missing bit in previous commit (PUFFS_KFLAG_CACHE_DOTDOT option to avoid
looking up ..)
 1.38.2.2 05-Jul-2012  riz Pull up following revision(s) (requested by manu in ticket #392):
lib/libpuffs/puffs_ops.3: revision 1.32
lib/libperfuse/ops.c: revision 1.58
lib/libpuffs/puffs.h: revision 1.122
lib/libpuffs/dispatcher.c: revision 1.41
lib/libperfuse/perfuse_priv.h: revision 1.30
Pass the FAF flag to handlers:
- setattr_ttl is updated to add a flag argument. Since it was not
present in
a previous release, we can change its API
- write2 is introduced, this is write with an extra flag for FAF.
- fsync already has the FAF information in a flag and needs no change
- for other operations, FAF is unconditional
Fix the build by adding (unused) flags argument to
perfuse_node_setattr_ttl
 1.38.2.1 23-Apr-2012  riz Pull up following revision(s) (requested by manu in ticket #195):
lib/libskey/skeysubr.c: revision 1.27
lib/libkvm/kvm_getloadavg.c: revision 1.11
lib/libwrap/update.c: revision 1.9
lib/liby/yyerror.c: revision 1.9
lib/libpuffs/puffs_ops.3: revision 1.30
lib/libwrap/misc.c: revision 1.10
lib/libwrap/hosts_access.c: revision 1.20
lib/libpuffs/pnode.c: revision 1.11
lib/libperfuse/subr.c: revision 1.17
lib/libpuffs/pnode.c: revision 1.12
lib/libperfuse/subr.c: revision 1.18
lib/libwrap/options.c: revision 1.15
lib/libwrap/fix_options.c: revision 1.11
lib/libperfuse/ops.c: revision 1.52
lib/libperfuse/ops.c: revision 1.53
lib/libperfuse/ops.c: revision 1.54
lib/libwrap/hosts_ctl.c: revision 1.5
lib/libintl/gettext.c: revision 1.27
lib/libwrap/shell_cmd.c: revision 1.6
lib/libpuffs/dispatcher.c: revision 1.39
lib/libperfuse/perfuse_priv.h: revision 1.27
lib/libwrap/socket.c: revision 1.19
lib/libpuffs/puffs.3: revision 1.50
lib/libperfuse/perfuse_priv.h: revision 1.28
lib/libpuffs/puffs_priv.h: revision 1.45
lib/libpuffs/puffs.3: revision 1.51
lib/libperfuse/perfuse_priv.h: revision 1.29
lib/libwrap/percent_x.c: revision 1.5
lib/libpuffs/puffs.3: revision 1.52
lib/libperfuse/debug.c: revision 1.11
sys/fs/puffs/puffs_vnops.c: revision 1.165
lib/libwrap/tcpd.h: revision 1.13
sys/fs/puffs/puffs_vnops.c: revision 1.166
lib/libwrap/eval.c: revision 1.7
sys/fs/puffs/puffs_msgif.h: revision 1.78
sys/fs/puffs/puffs_vfsops.c: revision 1.101
lib/libwrap/rfc931.c: revision 1.9
lib/libwrap/clean_exit.c: revision 1.5
lib/libpuffs/puffs.h: revision 1.120
lib/libc/stdlib/jemalloc.c: revision 1.27
lib/librmt/rmtlib.c: revision 1.26
lib/libpuffs/puffs.h: revision 1.121
sys/fs/puffs/puffs_sys.h: revision 1.79
lib/librumpclient/rumpclient.c: revision 1.48
lib/libwrap/refuse.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.26
lib/libperfuse/perfuse.c: revision 1.27
tests/fs/puffs/t_fuzz.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.28
lib/libpuffs/dispatcher.c: revision 1.40
sys/fs/puffs/puffs_node.c: revision 1.24
lib/libwrap/diag.c: revision 1.9
lib/libintl/textdomain.c: revision 1.13
Use C89 function definition
Add name and atttribute cache with filesytem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
Use new PUFFS_KFLAG_CACHE_FS_TTL option to puffs_init(3) so that
FUSE TTL on name and attributes are used. This save many PUFFS
operations and improves performances.
PUFFS_KFLAG_CACHE_FS_TTL is #ifdef'ed in many places for now so that
libperfuse can still be used on netbsd-5.
Split file system.
Comma fixes.
Remove dangling &quot;and&quot;.
Bump date for previous.
- Makesure update_va does not change vnode size when it should not. For
instance when doing a fault-issued VOP_GETPAGES within VOP_WRITE, changing
size leads to panic: genfs_getpages: past eof.
-Handle ticks wrap around for vnode name andattribute timeout
- When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM
(how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
Do not set PUFFS_KFLAG_CACHE_FS_TTL for PUFFS tests
 1.38.2.3.2.1 01-Nov-2012  matt sync with netbsd-6-0-RELEASE.
 1.46.4.2 05-Nov-2014  snj Pull up following revision(s) (requested by manu in ticket #181):
lib/libperfuse/fuse.h: revision 1.6
lib/libperfuse/ops.c: revision 1.78
lib/libperfuse/perfuse.c: revision 1.35
lib/libperfuse/perfuse_priv.h: revision 1.36
lib/libpuffs/dispatcher.c: revision 1.48
lib/libpuffs/opdump.c: revision 1.37
lib/libpuffs/puffs.c: revision 1.118
lib/libpuffs/puffs.h: revision 1.126
lib/libpuffs/puffs_ops.3: revisions 1.40-1.41
sys/fs/puffs/puffs_msgif.h: revision 1.82-1.83
sys/fs/puffs/puffs_msgif.h: revision 1.82
sys/fs/puffs/puffs_vnops.c: revision 1.196
Add PUFFS support for fallocate and fdiscard operations
--
libpuffs support for fallocate and fdiscard operations
--
Add PUFFS_HAVE_FALLOCATE in puffs_msgif.h so that filesystem can decide
at build time wether fallocate is usable
--
FUSE fallocate support
There seems to be no fdiscard FUSE operation at the moment, hence that
one is left unused.
 1.46.4.1 24-Aug-2014  martin Pull up following revision(s) (requested by manu in ticket #52):
lib/libperfuse/perfuse_priv.h: revision 1.33
lib/libperfuse/ops.c: revision 1.67
lib/libpuffs/dispatcher.c: revision 1.47
lib/libperfuse/perfuse_priv.h: revision 1.34
lib/libperfuse/ops.c: revision 1.68
lib/libperfuse/ops.c: revision 1.69
lib/libpuffs/puffs_ops.3: revision 1.37
lib/libpuffs/puffs_ops.3: revision 1.38
lib/libperfuse/perfuse.c: revision 1.32
lib/libperfuse/perfuse.c: revision 1.33
usr.sbin/perfused/msg.c: revision 1.22
lib/libpuffs/puffs.h: revision 1.125
Implement FUSE direct I/O.
Remove useless code and warnings
 1.49.6.1 11-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #833):

lib/libpuffs/dispatcher.c: revision 1.50

pathconf needs to return EINVAL when the variable is invalid
or cannot be associated with a file. This also needs to be true
when the node doesn't implement the pathconf function at all.
 1.16 12-Aug-2008  pooka Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.15 05-Dec-2007  pooka branches: 1.15.8;
free flushbuffer after use
 1.14 05-Dec-2007  pooka Send a response message for flush operations from the kernel instead
of abusing the return value of write(2).
 1.13 12-Nov-2007  pooka * split the putter header into a kernel version and a userland version
+ install latter to /usr/include/dev/putter
* remove last dependencies to puffs from putter, it's completely
independent now
 1.12 11-Oct-2007  pooka Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

* since the kernel-user communication is not purely request-response
anymore (hasn't been since 2006), try to rename some "request" to
"message". more similar mangling will take place in the future.

* completely rework how messages are allocated. previously most of
them were borrowed from the stack (originally *all* of them),
but now always allocate dynamically. this makes the structure
of the code much cleaner. also makes it possible to fix a
locking order violation. it enables plenty of future enhancements.

* start generalizing the transport interface to be independent of puffs

* move transport interface to read/write instead of ioctl. the
old one had legacy design problems, and besides, ioctl's suck.
implement a very generic version for now; this will be
worked on later hopefully some day reaching "highly optimized".

* implement libpuffs support behind existing library request
interfaces. this will change eventually (I hate those interfaces)
 1.11 19-Jul-2007  pooka branches: 1.11.4; 1.11.6;
Don't float puffs_kargs needlessly around after mount, saves
a couple k of memory (and there was much rejoycing!)
 1.10 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.9 13-Apr-2007  pooka Instead of keeping on adding parameters to puffs_mount(), make it
only take the bare essentials, which currently means removing
"maxreqlen" from the argument list (all current callers I'm aware
of set it as 0 anyway). Introduce puffs_init(), which provides a
context for setting various parameters and puffs_domount(), which
can be used to mount the file system. Keep puffs_mount() as a
shortcut for the above two for simple file systems.

Bump development ABI version to 13. After all, it's Friday the 13th.
Watch out! Bad things can happen on Friday the 13th. --No carrier--
 1.8 12-Apr-2007  pooka Hide struct puffs_usermount from the rest of the world and provide
accessors for interesting data in it. Namely, you can now get
pu->pu_privdata with puffs_getspecific(), pu->pu_pn_root with
puffs_set/getroot() and pu->pu_maxreqlen with puffs_getmaxreqlen().
 1.7 06-Apr-2007  pooka support page cache flushing
 1.6 06-Apr-2007  pooka use range invalidation op also for invalidating entire page cache of a node
 1.5 06-Apr-2007  pooka implement puffs_inval_pagecache_node_range()
 1.4 20-Mar-2007  pooka g/c unused debug variable
 1.3 20-Mar-2007  pooka initial support for cacheops
 1.2 09-Jan-2007  pooka rename name cache invalidation interface to be in sync with the
kernel operation names, i.e. contain "namecache" instead of just "name"
 1.1 09-Jan-2007  pooka lib interface for invalidation routines
 1.11.6.2 19-Jul-2007  pooka Don't float puffs_kargs needlessly around after mount, saves
a couple k of memory (and there was much rejoycing!)
 1.11.6.1 19-Jul-2007  pooka file flush.c was added on branch matt-mips64 on 2007-07-19 12:52:29 +0000
 1.11.4.2 09-Jan-2008  matt sync with HEAD
 1.11.4.1 06-Nov-2007  matt sync with HEAD
 1.15.8.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.37 19-Apr-2022  rillig lib: remove CONSTCOND comment

Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
 1.36 30-Oct-2021  nia puffs(3): Replace realloc(x * y) with reallocarr
 1.35 14-Jun-2017  christos remove now unnecessary casts.
 1.34 31-May-2017  christos Adjust to prototype.
 1.33 09-May-2017  christos Only add a write filter for sockets. It is not supported for vnodes, or
for 1/2 closed fifos (which we both have now).
 1.32 25-Jun-2012  abs branches: 1.32.22;
Update old-style definitions to ANSI, remove a couple of register
definitions along the way. Fixed gcc 4.1 build (thank you vax)
 1.31 19-Dec-2011  riastradh Fix error reporting in puffs_framev_enqueue_waitevent and callers.

ok christos
 1.30 12-Jan-2010  pooka branches: 1.30.6;
Add convenience routine puffs_unmountonsignal(), which does exactly that.
 1.29 04-Sep-2008  pooka Fix double free when i/o descriptor is violently closed. Bug was
introduced in rev 1.27.

fix provided by Taylor R Campbell in lib/39353
 1.28 29-Jan-2008  pooka branches: 1.28.6;
Fix a weirdosity in the framebuf gotfb interface: hand buffer
ownership to the called routine instead of keeping it. This means
that callees must now destroy the buffer once they are done with it.
 1.27 28-Jan-2008  pooka Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed. Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts. The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
 1.26 16-Dec-2007  pooka * nuke puffs_cc_get{specific,usermount} for good
* move prototypes for puffs_docc and puffs_dopufbuf into the
public header, as they are should be exposed
 1.25 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.24 04-Dec-2007  pooka realloc() len+incr, not offset+incr. Makes space reservation
actually work properly.
 1.23 06-Sep-2007  pooka document puffs_framev_framebuf_ccpromote()
 1.22 06-Sep-2007  pooka Give cmpframe() the ability to shortcircuit the comparison loop by
signalling back that the buffer under examination is not a response
at all.
 1.21 01-Sep-2007  pooka Add gotframe callback, which is called if an incoming frame matches
no outstanding request.
 1.20 25-Aug-2007  pooka branches: 1.20.2;
Pass usermount to errnotify, it might not be available there through
other structures. CID 4496
 1.19 21-Jul-2007  pooka branches: 1.19.4;
Return -1 and errno from puffs_framev_enqueue_waitevent instead of
a direct error value.
 1.18 20-Jul-2007  pooka simplify send loop
 1.17 20-Jul-2007  pooka Add puffs_framev_enqueue_waitevent, which waits for read/write/error
events from an i/o descriptor. It yields until an event happens
and continues execution when the event loop notices the event has
happened.
 1.16 08-Jul-2007  pooka g/c leftover
 1.15 08-Jul-2007  pooka make notifyfunction optional and do not call removeonclose() if
none is given.
 1.14 07-Jul-2007  pooka Make puffs_framebuf better suited from environments with multiple sources:

* in addition add/remove, allow enable/disable, which can be used
to control events for descriptors without having to remove all the
data associated with them
* add directsend/receive, which can be used to pass the same buffer
from the caller to read/writeframe and back again
* add flags to enqueue functions and allow urgent buffers to be
processed as the next PDU
 1.13 20-May-2007  pooka Introduce puffs_framev_framebuf_ccpromote, which can be used to
turn a reference to puffs_framebuf in the file system from a
cb/justsend operation to a cc wait, should the file system find
itself desiring the result.
 1.12 20-May-2007  pooka Change the signature of puffs_respcmp to return -1,0,1 for smaller,
equal, larger, respectively instead of 0/1 for non/equal. This
will allow sorting the buffers for faster matching in libpuffs.
While here, change the name from respcmp to framecmp, as that better
reflects the purpose.

NOTE! there is no obvious way to make compilation fail for file
systems which may already be using this feature (although I don't
think there are any outside our tree, as the feature is two weeks
old). Nevertheless, non-updated file systems will fail very quickly.
 1.11 19-May-2007  pooka Allocate buf in 4k chunks instead of 64k chunks. If we are seriously
reclaiming and the network/server is slow, we might have thousands
of buffers allocated at the same time causing the process to run
out of vm space. Rate limiting the number of outstanding ops would
be a nicer choice, but that requires more complex changes.
 1.10 16-May-2007  pooka Add error parameter to puffs_framev_cb to signal if there is a
result of if the function should just do resource cleanup.
 1.9 16-May-2007  pooka switch the arbitrary default errno value for network i/o from
ECONNABORTED to ECONNRESET, which is at least a little bit better
 1.8 15-May-2007  pooka Step 3 and currently final step of a more general purpose event loop:
support removal and addition of i/o file descriptors on the fly.

* detect closed file descriptors
* automatically free waiters of a dead file descriptor
* give the file server the possibility to specify a callback which
notifies of a dead file descriptor
* move loop function to be a property of the mainloop instead of
framebuf (doesn't change effective behaviour)
* add the possibility to configure a timespec parameter which
attempts to call the loop function periodically
* move the event loop functions from the puffs_framebuf namespace
to puffs_framev to differential between pure memory management
functions
 1.7 12-May-2007  pooka use size_t instead of int to calm over-eager lint
 1.6 11-May-2007  pooka Step 2 of general-purpose eventloop: get rid of puffs_framebuf_eventloop().
puffs_mainloop() now handles that functionality as well.
 1.5 11-May-2007  pooka Step 1 in moving towards a general-purpose eventloop: allow the
framebuf event loop to take n i/o fd's as parameters and also allow
dynamic add/remove of fd's. (not tested except for one fd, but more
changes coming soon)
 1.4 09-May-2007  pooka Remove the puffs_usermount argument from puffs_req_handle(). It can
be found from the other arguments and this way puffs_req_handle() is
more symmetric with the other puffs_req() routines.
 1.3 06-May-2007  pooka implement the conveniently-already-prototyped puffs_framebuf_remaining(),
which is just shorthand for tellsize() - telloff()
 1.2 06-May-2007  pooka Remove the user-specified argument for the framebuf loop callback.
It can be generated through other means if it is desired.
 1.1 05-May-2007  pooka Add puffs "frame buffers", which are an abstraction of the buffering
and event handling mechanisms required in file servers with blocking
I/O backends. puffs_framebuf is built on the concept of puffs_cc
and uses those to multiplex execution where needed.

File systems are required to implement three methods:
* read frame
* write frame
* compare if frame is a response to the given one

Memory management is provided by puffs_framebuf, but the file
systems must still, of course, interpret the protocol and do e.g.
byte order conversion.

As always, puffs_framebuf is work in progress. Current users are
mount_psshfs and mount_9p.
 1.19.4.2 21-Jul-2007  pooka Return -1 and errno from puffs_framev_enqueue_waitevent instead of
a direct error value.
 1.19.4.1 21-Jul-2007  pooka file framebuf.c was added on branch matt-mips64 on 2007-07-21 09:29:08 +0000
 1.20.2.3 23-Mar-2008  matt sync with HEAD
 1.20.2.2 09-Jan-2008  matt sync with HEAD
 1.20.2.1 06-Nov-2007  matt sync with HEAD
 1.28.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.30.6.2 30-Oct-2012  yamt sync with head
 1.30.6.1 17-Apr-2012  yamt sync with head
 1.32.22.1 11-May-2017  pgoyette Sync with HEAD
 1.36 11-Sep-2021  andvar Add missing double p and d for stopped and overriden accordingly.
Fix few more typos along the way, mainly in copy-pasted comments.
 1.35 02-Nov-2019  tnn puffs_null_node_fsync: don't leak directory handle

Directory handles returned by opendir must be closed by closedir.
Also directory(3) says we mustn't close(2) descriptors returned by dirfd(3)
 1.34 23-Sep-2019  christos Restore binary compatibility by using the statvfs90 structure internally.
 1.33 25-Nov-2011  manu branches: 1.33.40;
Rollback previous change as it breaks autmates tests
 1.32 24-Nov-2011  manu Remove files specified in pcn.

When remove files using name from pnode, another link on this file
can be unlinked. E.g. "touch 1; ln 1 2; rm 2" will remove file named
"1". Thus puffs_null_node_remove should remove directory entry which
name is provided by pcn (as said in puffs_ops.3). Caller should
provide appropriately initialized pcn.

From Evgeniy Ivanov <lolkaantimat@gmail.com>
 1.31 24-Nov-2011  manu Remove pnode of overwritten file.

When puffs_null_node_rename() overwrites existing file, its pnode
must�be removed, because src pnode already represents this file.

From Evgeniy Ivanov <lolkaantimat@gmail.com>
 1.30 27-Jun-2011  manu branches: 1.30.2;
From Evgeniy Ivanov: puffs_node_readdir() should set eofflag to one, when
end-of-directory is reached.
 1.29 24-Jun-2011  manu Commit fix for misc/45029.
Approved by pooka@
 1.28 18-Oct-2009  pooka include some headers we use
 1.27 08-Jan-2009  lukem Cast a value to time_t (not unsigned) when comparing to timespec tv_sec
 1.26 26-Nov-2008  pooka support:
a) readdir cookies and eofflag
b) file handle routines.

File handle routines are REALLY ugly and are not stable, i.e.
the file handle will be lost if the file server goes byebye.
They probably should be redone to not use getfh(), but for nullfs
I wanted to make them the same as when the file system is accessed
without the null layer. Well, turns out it doesn't pass anyway
since the kernel adds the fsid tags for fhandle_t. Anyway, it's
useful for some limited hacking purposes, so I'll commit this
since it works .. kinda.
 1.25 12-Aug-2008  pooka Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.24 30-Nov-2007  pooka branches: 1.24.8;
Rototill.

Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?). Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it. This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
 1.23 27-Nov-2007  pooka Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces. puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
 1.22 05-Nov-2007  pooka Call puffs_genfs_reclaim directly instead of through an extra jumpgate.
 1.21 01-Jul-2007  pooka branches: 1.21.4;
Instead of requesting various pieces of information from node-creating
methods using "please fill me"-pointers, pass "struct puffs_newinfo *"
and provide methods to fill in new node info.
 1.20 01-Jul-2007  pooka Instead of supplying a plain pid, supply an abstract struct puffs_cid *,
which can currently be used to query the pid and lwpid.
 1.19 25-Jun-2007  pooka fold in common code for node creation. no functional change.
 1.18 24-Jun-2007  pooka Since we locate in-memory nodes based on the inode number, stat a
file always after creation to cache the inode number given by the
backend file system. Otherwise we would not find a newly created
node from incore and create another one. In practise this was
pretty well hidden by the kernel name cache.
 1.17 24-Jun-2007  pooka Introduce puffs_null_setops(), which initializes the ops vector with
puffs nullfs ops.
 1.16 24-Jun-2007  pooka Introduce puffs_pn_remove() to signal that a node has been deleted
and destroyed, but not yet reclaimed. This prevents puffs_pn_nodewalk()
from returning stale entries. Make nullfs use this (some file
systems are a bit too happy with recycling inode numbers).
 1.15 24-Jun-2007  pooka don't return errno from a function which returns an fd - there's
a "little" room for confusion. instead, return -1 and let the
caller grab errno.
 1.14 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.13 12-Apr-2007  pooka Hide struct puffs_usermount from the rest of the world and provide
accessors for interesting data in it. Namely, you can now get
pu->pu_privdata with puffs_getspecific(), pu->pu_pn_root with
puffs_set/getroot() and pu->pu_maxreqlen with puffs_getmaxreqlen().
 1.12 11-Apr-2007  pooka * support nodetofh and fhtonode callbacks
* use new signature of node_readdir
 1.11 16-Mar-2007  pooka va->va_mode doesn't contain the full argument to the mknod() system call,
so introduce puffs_addvtype2mode() and use that in null.c to generate the
proper syscall argument
 1.10 16-Mar-2007  pooka return errno instead of -1 if file is not present in lookup
 1.9 13-Mar-2007  pooka Create in-memory nodes only per unique inode, not unique pathname.
Solves problem with e.g. cache coherency of hardlinked files.
 1.8 15-Feb-2007  pooka Readlink should place the length of the link (without terminating
nul) in the length field. Make it so.
 1.7 15-Feb-2007  pooka use puffs_path_walkcmp() instead of a homegrown comparison routine
 1.6 15-Feb-2007  pooka * get rid of the holy kernel-given ISDOTDOT, and instead define a
macro which does strcmp against ".." and (the untranslated)
componentname
* make PUFFS_FLAG_BUILDPATH build paths also if dotdot is the case,
and adapt the regular path objects to this
* make nullfs lookup readable because we can now get rid of dotdot
processing there
 1.5 27-Jan-2007  agc If we can't set the attributes when making the directory, use rmdir to
remove the directory, not unlink.
 1.4 15-Jan-2007  pooka Checkpoint some more work in progress: for the benefit those file
system backends which operate purely based on paths, push out more
path management into the library and make path management more
abstract: enable a file system to define a bunch of path management
callbacks, which are used by the framework. Management of normal
/this/is/a/path type paths is provided by the library.
 1.3 11-Jan-2007  pooka implement fsync
 1.2 11-Jan-2007  pooka * do the l-variations of syscalls, since some nodes are symlinks
* truncate only regular files to set size
* do the chmod()-dance for cache flush to now write-protected files
until I can think of a nicer way to solve this
 1.1 11-Jan-2007  pooka Add preliminary code for a nullfs layer, which can be used to mount
a directory hierarchy to another point, just like with the kernel
nullfs. This is not really a layering scheme yet, but it should
evolve into one. Currently it can just be used to do 1:1 mapping.
 1.21.4.2 09-Jan-2008  matt sync with HEAD
 1.21.4.1 06-Nov-2007  matt sync with HEAD
 1.24.8.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.30.2.1 17-Apr-2012  yamt sync with head
 1.33.40.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.38 08-Mar-2021  christos cast to the proper enums for lint
 1.37 31-Oct-2014  manu libpuffs support for fallocate and fdiscard operations
 1.36 15-Mar-2012  joerg branches: 1.36.10;
Add __printflike attribution to use vprintf and friends with an argument
as format string.
 1.35 20-Aug-2010  pooka branches: 1.35.6;
print to stderr instead of stdout
 1.34 11-Jul-2010  pooka Export the opid -> opstr tables (for outside debugging use).
 1.33 21-May-2010  pooka adjust for protocol changes
 1.32 21-May-2010  pooka Don't try to print the names of messages we don't know about.
 1.31 20-May-2010  pooka * fix typo
* fix "that's not supposed to be there" causing off-by-one in array
* make compile regardless of dev_t size
 1.30 07-Jan-2010  pooka Be slightly more forgiving about unknown operation types.
 1.29 07-Jan-2010  pooka Dump contents of struct vattr -- i never remember which members
the kernel passes when, so this helps tapping that info.
 1.28 07-Jan-2010  pooka * make indentation a little less ridiculous
* note that interfaces provided by <puffsdump.h> are not stable and
are to be used only for debug builds
* remove a few unimplemented/used dump interfaces
 1.27 06-Apr-2009  pooka dump readdir offset
 1.26 06-Apr-2009  pooka * dump op-specific return info before the generic one
* dump readdir response values
 1.25 28-Dec-2008  christos branches: 1.25.2;
fix for dev_t 64 bits.
 1.24 12-Aug-2008  pooka Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.23 27-Jan-2008  pooka branches: 1.23.6;
For operations with a target (remove, rmdir, link), print the
target cookie.
 1.22 25-Dec-2007  pooka * dump r/w return resid
* fix RV dump order to be more logical
 1.21 09-Dec-2007  pooka print newnode cookie value for operations which create nodes
 1.20 04-Dec-2007  pooka add flushops
 1.19 29-Nov-2007  pooka print mode in open
 1.18 16-Nov-2007  pooka dump lookup return values
 1.17 29-Oct-2007  pooka Sprinkle some hackish locks here and there, just enough to allow
libp2k & rump to run multithreaded.
 1.16 26-Oct-2007  pooka dump pid/lwp of caller
 1.15 11-Oct-2007  pooka Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

* since the kernel-user communication is not purely request-response
anymore (hasn't been since 2006), try to rename some "request" to
"message". more similar mangling will take place in the future.

* completely rework how messages are allocated. previously most of
them were borrowed from the stack (originally *all* of them),
but now always allocate dynamically. this makes the structure
of the code much cleaner. also makes it possible to fix a
locking order violation. it enables plenty of future enhancements.

* start generalizing the transport interface to be independent of puffs

* move transport interface to read/write instead of ioctl. the
old one had legacy design problems, and besides, ioctl's suck.
implement a very generic version for now; this will be
worked on later hopefully some day reaching "highly optimized".

* implement libpuffs support behind existing library request
interfaces. this will change eventually (I hate those interfaces)
 1.14 29-Sep-2007  pooka support error notifications
 1.13 22-Aug-2007  pooka branches: 1.13.2;
Dump lookup/componentname specific info in opdump.
(sigh, I guess I guess I'll never do opdump properly at this rate)
 1.12 07-Aug-2007  pooka dump further info for read/write
 1.11 30-Jun-2007  pooka print time elapsed between calls
 1.10 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.9 20-Mar-2007  pooka initial support for cacheops
 1.8 18-Feb-2007  pooka dump return values for operations
 1.7 26-Jan-2007  pooka add interfaces for suspending the file system
 1.6 05-Dec-2006  pooka adapt to kernel change:
Allow multiple requests to be transferred in each GET/PUTOP
 1.5 07-Nov-2006  pooka * support FAF (Fire-And-Forget) class operations
* adapt to new lookup
 1.4 23-Oct-2006  pooka dump correct name for vfs operations
 1.3 23-Oct-2006  christos use portable prints
 1.2 23-Oct-2006  christos pass lint; fix install.
 1.1 22-Oct-2006  pooka add libpuffs - the userspace programming interface for puffs

This work was initially started and completed for Google SoC 2005
and tweaked to work a bit better in the past few weeks. While
being far from complete, it is functional enough to be able and
stable to host a fairly general-purpose in-memory file system in
userspace. Even so, puffs should be considered experimental and
no binary compatibility for interfaces or crash-freedom or zero
security implications should be relied upon just yet.

The GSoC project was mentored by William Studenmund and the final
review for the code was done by Christos.
 1.13.2.3 23-Mar-2008  matt sync with HEAD
 1.13.2.2 09-Jan-2008  matt sync with HEAD
 1.13.2.1 06-Nov-2007  matt sync with HEAD
 1.23.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.25.2.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.35.6.1 17-Apr-2012  yamt sync with head
 1.36.10.1 05-Nov-2014  snj Pull up following revision(s) (requested by manu in ticket #181):
lib/libperfuse/fuse.h: revision 1.6
lib/libperfuse/ops.c: revision 1.78
lib/libperfuse/perfuse.c: revision 1.35
lib/libperfuse/perfuse_priv.h: revision 1.36
lib/libpuffs/dispatcher.c: revision 1.48
lib/libpuffs/opdump.c: revision 1.37
lib/libpuffs/puffs.c: revision 1.118
lib/libpuffs/puffs.h: revision 1.126
lib/libpuffs/puffs_ops.3: revisions 1.40-1.41
sys/fs/puffs/puffs_msgif.h: revision 1.82-1.83
sys/fs/puffs/puffs_msgif.h: revision 1.82
sys/fs/puffs/puffs_vnops.c: revision 1.196
Add PUFFS support for fallocate and fdiscard operations
--
libpuffs support for fallocate and fdiscard operations
--
Add PUFFS_HAVE_FALLOCATE in puffs_msgif.h so that filesystem can decide
at build time wether fallocate is usable
--
FUSE fallocate support
There seems to be no fdiscard FUSE operation at the moment, hence that
one is left unused.
 1.8 12-Aug-2008  pooka Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.7 06-Jun-2007  pooka branches: 1.7.12;
Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.6 01-May-2007  pooka Introduce PUFFS_FLAG_HASHPATH, which for PUFFS_FLAG_BUILDPATH file servers
creates a hash of the node's path into po->po_hash to avoid a full pathcmp
every time.
 1.5 15-Feb-2007  pooka in case rootpath is "/", make dotdot lookup in "/foo" build
a path of "/", not ""
 1.4 15-Feb-2007  pooka Introduce puffs_path_walkcmp(), which is to be called from nodewalk
and compares the path of the node against the given pathobject.
Also make comparison method take a flag to indicate if it should
check if the second path is a true prefix of the first.

plus some namespace cleanup
 1.3 15-Feb-2007  pooka * get rid of the holy kernel-given ISDOTDOT, and instead define a
macro which does strcmp against ".." and (the untranslated)
componentname
* make PUFFS_FLAG_BUILDPATH build paths also if dotdot is the case,
and adapt the regular path objects to this
* make nullfs lookup readable because we can now get rid of dotdot
processing there
 1.2 06-Feb-2007  pooka make it possible for the root path to be "/" and the next path to
be "/foo" instead of "//foo"
 1.1 15-Jan-2007  pooka Checkpoint some more work in progress: for the benefit those file
system backends which operate purely based on paths, push out more
path management into the library and make path management more
abstract: enable a file system to define a bunch of path management
callbacks, which are used by the framework. Management of normal
/this/is/a/path type paths is provided by the library.
 1.7.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.13 16-Aug-2012  manu Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.

The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.

It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.

- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.

- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.

- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.12 18-Apr-2012  manu - When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM (how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
 1.11 08-Apr-2012  manu Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
 1.10 12-Aug-2008  pooka branches: 1.10.2; 1.10.20;
Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.9 17-Aug-2007  pooka branches: 1.9.10;
Add accessors for struct puffs_node to prepare for removal from
exported headers.
 1.8 01-Jul-2007  pooka Instead of requesting various pieces of information from node-creating
methods using "please fill me"-pointers, pass "struct puffs_newinfo *"
and provide methods to fill in new node info.
 1.7 24-Jun-2007  pooka Introduce puffs_pn_remove() to signal that a node has been deleted
and destroyed, but not yet reclaimed. This prevents puffs_pn_nodewalk()
from returning stale entries. Make nullfs use this (some file
systems are a bit too happy with recycling inode numbers).
 1.6 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.5 12-Apr-2007  pooka Hide struct puffs_usermount from the rest of the world and provide
accessors for interesting data in it. Namely, you can now get
pu->pu_privdata with puffs_getspecific(), pu->pu_pn_root with
puffs_set/getroot() and pu->pu_maxreqlen with puffs_getmaxreqlen().
 1.4 29-Mar-2007  pooka Remove check against null parameter along with the XXX comment wondering
why the check was there. CID 4408
 1.3 15-Jan-2007  pooka Checkpoint some more work in progress: for the benefit those file
system backends which operate purely based on paths, push out more
path management into the library and make path management more
abstract: enable a file system to define a bunch of path management
callbacks, which are used by the framework. Management of normal
/this/is/a/path type paths is provided by the library.
 1.2 11-Jan-2007  pooka Add preliminary code for a nullfs layer, which can be used to mount
a directory hierarchy to another point, just like with the kernel
nullfs. This is not really a layering scheme yet, but it should
evolve into one. Currently it can just be used to do 1:1 mapping.
 1.1 29-Dec-2006  pooka checkpoint some experimental work-in-progress, namely:

Add support for having multiple outstanding operations. This is done
by exposing enough interfaces so that it is convenient to have the
main event loop in the implementation itself and by providing a
continuation framework for convinient blocking and rescheduling.

works fine, but will undergo further cleanup & development
 1.9.10.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.10.20.2 13-Sep-2012  riz Pull up following revision(s) (requested by manu in ticket #525):
lib/libpuffs/dispatcher.c: revision 1.44
lib/libp2k/p2k.c: revision 1.57
lib/libpuffs/puffs_ops.3: revision 1.35
lib/libpuffs/pnode.c: revision 1.13
lib/libpuffs/puffs.3: revision 1.56
lib/libpuffs/puffs.h: revision 1.124
Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.
The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.
It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.
- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.
- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.
- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.10.20.1 23-Apr-2012  riz branches: 1.10.20.1.2;
Pull up following revision(s) (requested by manu in ticket #195):
lib/libskey/skeysubr.c: revision 1.27
lib/libkvm/kvm_getloadavg.c: revision 1.11
lib/libwrap/update.c: revision 1.9
lib/liby/yyerror.c: revision 1.9
lib/libpuffs/puffs_ops.3: revision 1.30
lib/libwrap/misc.c: revision 1.10
lib/libwrap/hosts_access.c: revision 1.20
lib/libpuffs/pnode.c: revision 1.11
lib/libperfuse/subr.c: revision 1.17
lib/libpuffs/pnode.c: revision 1.12
lib/libperfuse/subr.c: revision 1.18
lib/libwrap/options.c: revision 1.15
lib/libwrap/fix_options.c: revision 1.11
lib/libperfuse/ops.c: revision 1.52
lib/libperfuse/ops.c: revision 1.53
lib/libperfuse/ops.c: revision 1.54
lib/libwrap/hosts_ctl.c: revision 1.5
lib/libintl/gettext.c: revision 1.27
lib/libwrap/shell_cmd.c: revision 1.6
lib/libpuffs/dispatcher.c: revision 1.39
lib/libperfuse/perfuse_priv.h: revision 1.27
lib/libwrap/socket.c: revision 1.19
lib/libpuffs/puffs.3: revision 1.50
lib/libperfuse/perfuse_priv.h: revision 1.28
lib/libpuffs/puffs_priv.h: revision 1.45
lib/libpuffs/puffs.3: revision 1.51
lib/libperfuse/perfuse_priv.h: revision 1.29
lib/libwrap/percent_x.c: revision 1.5
lib/libpuffs/puffs.3: revision 1.52
lib/libperfuse/debug.c: revision 1.11
sys/fs/puffs/puffs_vnops.c: revision 1.165
lib/libwrap/tcpd.h: revision 1.13
sys/fs/puffs/puffs_vnops.c: revision 1.166
lib/libwrap/eval.c: revision 1.7
sys/fs/puffs/puffs_msgif.h: revision 1.78
sys/fs/puffs/puffs_vfsops.c: revision 1.101
lib/libwrap/rfc931.c: revision 1.9
lib/libwrap/clean_exit.c: revision 1.5
lib/libpuffs/puffs.h: revision 1.120
lib/libc/stdlib/jemalloc.c: revision 1.27
lib/librmt/rmtlib.c: revision 1.26
lib/libpuffs/puffs.h: revision 1.121
sys/fs/puffs/puffs_sys.h: revision 1.79
lib/librumpclient/rumpclient.c: revision 1.48
lib/libwrap/refuse.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.26
lib/libperfuse/perfuse.c: revision 1.27
tests/fs/puffs/t_fuzz.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.28
lib/libpuffs/dispatcher.c: revision 1.40
sys/fs/puffs/puffs_node.c: revision 1.24
lib/libwrap/diag.c: revision 1.9
lib/libintl/textdomain.c: revision 1.13
Use C89 function definition
Add name and atttribute cache with filesytem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
Use new PUFFS_KFLAG_CACHE_FS_TTL option to puffs_init(3) so that
FUSE TTL on name and attributes are used. This save many PUFFS
operations and improves performances.
PUFFS_KFLAG_CACHE_FS_TTL is #ifdef'ed in many places for now so that
libperfuse can still be used on netbsd-5.
Split file system.
Comma fixes.
Remove dangling &quot;and&quot;.
Bump date for previous.
- Makesure update_va does not change vnode size when it should not. For
instance when doing a fault-issued VOP_GETPAGES within VOP_WRITE, changing
size leads to panic: genfs_getpages: past eof.
-Handle ticks wrap around for vnode name andattribute timeout
- When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM
(how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
Do not set PUFFS_KFLAG_CACHE_FS_TTL for PUFFS tests
 1.10.20.1.2.1 01-Nov-2012  matt sync with netbsd-6-0-RELEASE.
 1.10.2.3 30-Oct-2012  yamt sync with head
 1.10.2.2 23-May-2012  yamt sync with head.
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.67 22-Jan-2022  pho Allow calling puffs_mount(3) before puffs_daemon(3)

puffs_daemon(3) creates a pipe before forking, and the parent process
waits for the child to either complete puffs_mount(3) or fail. If a
user calls puffs_daemon(3) after puffs_mount(3), the function
deadlocks. While this error-reporting functionality is really a nice
thing to have, deadlocking is not great. If the filesystem has already
been mounted, puffs_mount(3) should just daemonize the process and
return.

This became an issue because fuse_daemonize(3) in FUSE API had no such
requirement and some FUSE filesystems in the wild suffered deadlocks.
 1.66 03-Dec-2021  pho Use size_t in place of voff_t in puffs_setrootinfo(3)

Chuck Silvers pointed out that voff_t was also supposed to be
kernel-only. The correct type to use in userland would be off_t, but
since changing vsize_t to either voff_t or off_t is an ABI change on
32-bit platforms, we use size_t knowing that it is technically
incorrect.
 1.65 03-Dec-2021  pho Avoid using register_t or vsize_t in <puffs.h>

<puffs.h> is a user-space header, and should not use any of
kernel-only types. It's not reasonable to require user-land
filesystems to #define _KERNTYPES.
 1.64 27-Dec-2019  msaitoh s/conjuction/conjunction/
 1.63 03-Jul-2017  wiz branches: 1.63.6;
Remove workaround for ancient HTML generation code.
 1.62 11-Apr-2016  christos there is no pflags, just flags.
 1.61 16-Feb-2015  wiz Bump date for previous.
filesystem -> file system
 1.60 15-Feb-2015  manu Add PUFFS_KFLAG_NOFLUSH_META to prevent sending metadata flush to FUSE

FUSE filesystems do not expect to get metadata updates for [amc]time
and size, they updates the value on their own after operations.

The PUFFS PUFFS_KFLAG_NOFLUSH_META option prevents regular metadata cache
flushes to the filesystem , and libperfuse uses it to match Linux FUSE
behavior.

While there, fix a bug in SETATTR: do not update kernel metadata cache
from SETATTR reply when the request is asynchronous, as we do not have
the reply yet.
 1.59 18-Mar-2014  riastradh branches: 1.59.4;
Merge riastradh-drm2 to HEAD.
 1.58 20-Jul-2013  wiz Use Mt for email addresses.
 1.57 16-Aug-2012  wiz branches: 1.57.2; 1.57.4;
Bump date for previous.
 1.56 16-Aug-2012  manu Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.

The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.

It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.

- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.

- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.

- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.55 10-Aug-2012  wiz Use more markup. New sentence, new line. Bump date for previous.
 1.54 10-Aug-2012  manu Add PUFFS_KFLAG_CACHE_DOTDOT so that vnodes hold a reference on their
parent, keeping them active, and allowing to lookup .. without sending
a request to the filesystem.

Enable the featuure for perfused, as this is how FUSE works.
 1.53 18-Apr-2012  wiz Bump date for previous.
New sentence, new line; remove trailing whitespace; fix typos;
punctuation nits.
 1.52 18-Apr-2012  manu - When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM (how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
 1.51 08-Apr-2012  wiz Split file system.
Comma fixes.
Remove dangling "and".
Bump date for previous.
 1.50 08-Apr-2012  manu Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
 1.49 26-Dec-2011  njoly branches: 1.49.2;
Remove obsolete puffs_suspend(3) xref.
 1.48 24-Nov-2011  manu Documentation fix

Evgeniy Ivanov <lolkaantimat@gmail.com>
 1.47 12-Jan-2010  pooka branches: 1.47.6;
Add convenience routine puffs_unmountonsignal(), which does exactly that.
 1.46 20-Feb-2009  pooka Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.45 12-Dec-2008  pooka branches: 1.45.2;
add:
puffs_setspecific(pu, private)
Can be used to set the specific data after the call to
puffs_init().
 1.44 14-Nov-2008  pooka note that puffs_daemon() must be called *before* puffs_mount()
 1.43 14-Nov-2008  pooka fix typographical snafu
 1.42 06-Sep-2008  pooka branches: 1.42.4;
Add AsiaBSDCon 2008 paper to SEE ALSO.
 1.41 12-Aug-2008  pooka Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.40 25-May-2008  wiz Remove trailing whitespace.
 1.39 28-Jan-2008  pooka branches: 1.39.4; 1.39.6;
Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed. Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts. The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
 1.38 14-Jan-2008  pooka Introduce PUFFS_STACKSIZE_MIN to avoid overloading 0 and getting
a warning from the library when really wanting to say "just the
minimum, please".
 1.37 15-Dec-2007  pooka document puffs_dopufbuf
 1.36 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.35 01-Dec-2007  wiz Fix a typo that has migrated across files.
 1.34 01-Dec-2007  wiz Typo fixes.
 1.33 16-Nov-2007  pooka Introduce puffs_daemon(), which works like daemon(3) except that it
also synchronizes with puffs_mount() and does not return (exit) in the
parent process until the file system has been mounted. This makes
it possible to reliably run e.g. mount_foo jippi /kai ; cd /kai/ee
 1.32 06-Nov-2007  pooka Open the kernel descriptor as part of mount(), not init(). Then
it doesn't matter if someone fork()s or does other tricks between
init() and mount() (and besides, now it's where it logically should be).
 1.31 05-Nov-2007  pooka Pull the daemonizing code out of the library mainloop into the file
servers. Calling daemon() (i.e. fork()ing) inside a library can
cause nice surprises for e.g. threaded programs. As discussed with
Greg Oster & others.
 1.30 05-Oct-2007  pooka SEE ALSO paper
 1.29 24-Sep-2007  pooka Add refuse paper to SEE ALSO
 1.28 03-Sep-2007  pooka xref refuse, don't bump date
 1.27 18-Jul-2007  pooka branches: 1.27.4; 1.27.6;
update
 1.26 05-Jul-2007  pooka document PUFFS_KFLAG_LOOKUP_FULLPNBUF
 1.25 24-Jun-2007  pooka document KFLAG_NOCACHE{_PAGE,_NAME,}
 1.24 17-May-2007  pooka reflect today's mount changes
 1.23 15-May-2007  pooka Step 3 and currently final step of a more general purpose event loop:
support removal and addition of i/o file descriptors on the fly.

* detect closed file descriptors
* automatically free waiters of a dead file descriptor
* give the file server the possibility to specify a callback which
notifies of a dead file descriptor
* move loop function to be a property of the mainloop instead of
framebuf (doesn't change effective behaviour)
* add the possibility to configure a timespec parameter which
attempts to call the loop function periodically
* move the event loop functions from the puffs_framebuf namespace
to puffs_framev to differential between pure memory management
functions
 1.22 09-May-2007  pooka List all current ways to write a file system. Also, add a reference
to puffs_req(3) for the manual operation case.
 1.21 09-May-2007  pooka document PUFFS_KFLAG_WTCACHE and PUFFS_KFLAG_IAONDEMAND
 1.20 01-May-2007  pooka Introduce PUFFS_FLAG_HASHPATH, which for PUFFS_FLAG_BUILDPATH file servers
creates a hash of the node's path into po->po_hash to avoid a full pathcmp
every time.
 1.19 16-Apr-2007  pooka Move file system and node callbacks into their own manual page.
Improve markup and descriptions a bit (not completely finished yet).
 1.18 16-Apr-2007  pooka document new interfaces
 1.17 12-Apr-2007  pooka document accessor routines added when making struct puffs_usermount
implementation private
 1.16 22-Mar-2007  pooka document credentials & access control methods
 1.15 20-Mar-2007  pooka match puffs_node_access prototype with reality
 1.14 13-Mar-2007  pooka add puffs paper presented at AsiaBSDCon 2007 to "SEE ALSO"
 1.13 08-Feb-2007  pooka Nm the manual puffs instead of libpuffs
 1.12 26-Jan-2007  pooka document puffs_fs_suspend()
 1.11 20-Jan-2007  pooka xref puffs_req
 1.10 20-Jan-2007  pooka document puffs_getstate() and puffs_setstacksize()
 1.9 20-Jan-2007  wiz Sort SEE ALSO.
 1.8 19-Jan-2007  pooka Bring the documentation slightly more into sync with the current
reality. It's still really a far cry from proper documentation,
though.
 1.7 01-Dec-2006  pooka sauce catchup
 1.6 30-Nov-2006  pooka update with reality
 1.5 23-Nov-2006  pooka * document open, close and access
* nomenclature improvements
 1.4 19-Nov-2006  wiz Some mdoc and grammar nits.
 1.3 13-Nov-2006  pooka add note to BUGS about the questionable nature of puffs_node
 1.2 13-Nov-2006  pooka sync with change to lookup
 1.1 09-Nov-2006  pooka initial documentation for the puffs library interface
 1.27.6.2 18-Jul-2007  pooka update
 1.27.6.1 18-Jul-2007  pooka file puffs.3 was added on branch matt-mips64 on 2007-07-18 22:23:38 +0000
 1.27.4.4 23-Mar-2008  matt sync with HEAD
 1.27.4.3 09-Jan-2008  matt sync with HEAD
 1.27.4.2 08-Nov-2007  matt sync with -HEAD
 1.27.4.1 06-Nov-2007  matt sync with HEAD
 1.39.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.39.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.39.4.1 04-Jun-2008  yamt sync with head
 1.42.4.2 16-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1094):
lib/libpuffs/puffs.3: revision 1.45
lib/libpuffs/puffs.c: revision 1.93
lib/libpuffs/puffs.h: revision 1.109

Add function puffs_setspecific(pu, private) which can be used to set the
specific data after the call to puffs_init().
 1.42.4.1 24-Feb-2009  snj branches: 1.42.4.1.4;
Pull up following revision(s) (requested by pooka in ticket #484):
lib/libpuffs/puffs.3: revision 1.46
lib/libpuffs/puffs_cc.3: revision 1.13
lib/libpuffs/puffs_cred.3: revision 1.4
lib/libpuffs/puffs_flush.3: revision 1.8
lib/libpuffs/puffs_framebuf.3: revision 1.26
lib/libpuffs/puffs_node.3: revision 1.4
lib/libpuffs/puffs_ops.3: revision 1.23
lib/libpuffs/puffs_path.3: revision 1.4
lib/libpuffs/puffs_suspend.3: revision 1.3
Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.42.4.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.45.2.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.47.6.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.47.6.3 30-Oct-2012  yamt sync with head
 1.47.6.2 23-May-2012  yamt sync with head.
 1.47.6.1 17-Apr-2012  yamt sync with head
 1.49.2.4 27-Feb-2015  martin Pull up following revision(s) (requested by manu in ticket #1260):
lib/libpuffs/puffs.3: revision 1,55,1.60
sys/fs/puffs/puffs_msgif.h: revision 1.84
lib/libperfuse/ops.c: revision 1.83
sys/fs/puffs/puffs_sys.h: revision 1.89
sys/fs/puffs/puffs_vfsops.c: revision 1.116
lib/libperfuse/perfuse.c: revision 1.36
sys/fs/puffs/puffs_vnops.c: revision 1.200-1.202

Use more markup. New sentence, new line. Bump date for previous.

Add PUFFS_KFLAG_NOFLUSH_META to prevent sending metadata flush to FUSE
FUSE filesystems do not expect to get metadata updates for [amc]time
and size, they updates the value on their own after operations.

The PUFFS PUFFS_KFLAG_NOFLUSH_META option prevents regular metadata cache
flushes to the filesystem , and libperfuse uses it to match Linux FUSE
behavior.

While there, fix a bug in SETATTR: do not update kernel metadata cache
from SETATTR reply when the request is asynchronous, as we do not have
the reply yet.

Update file size after write without metadata flush
If we do not use metadata flush, we must make sure the size is updated
in the filesystem after a write, otherwise the next GETATTR will get us
a stale value and the file will be truncated.
 1.49.2.3 13-Sep-2012  riz Pull up following revision(s) (requested by manu in ticket #525):
lib/libpuffs/dispatcher.c: revision 1.44
lib/libp2k/p2k.c: revision 1.57
lib/libpuffs/puffs_ops.3: revision 1.35
lib/libpuffs/pnode.c: revision 1.13
lib/libpuffs/puffs.3: revision 1.56
lib/libpuffs/puffs.h: revision 1.124
Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.
The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.
It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.
- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.
- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.
- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.49.2.2 12-Aug-2012  martin branches: 1.49.2.2.2;
Pull up following revision(s) (requested by manu in ticket #438):
lib/libperfuse/perfuse_priv.h: revision 1.31
sys/fs/puffs/puffs_msgif.h: revision 1.80
sys/fs/puffs/puffs_vnops.c: revision 1.171
lib/libpuffs/puffs_ops.3: revision 1.31
sys/fs/puffs/puffs_vnops.c: revision 1.172
sys/fs/puffs/puffs_vnops.c: revision 1.173
sys/fs/puffs/puffs_vnops.c: revision 1.174
usr.sbin/perfused/perfused.c: revision 1.24
sys/fs/puffs/puffs_sys.h: revision 1.80
sys/fs/puffs/puffs_sys.h: revision 1.81
sys/fs/puffs/puffs_sys.h: revision 1.82
lib/libperfuse/subr.c: revision 1.19
lib/libperfuse/perfuse.c: revision 1.30
sys/fs/puffs/puffs_msgif.c: revision 1.90
sys/fs/puffs/puffs_msgif.c: revision 1.91
sys/fs/puffs/puffs_msgif.c: revision 1.92
lib/libperfuse/ops.c: revision 1.59
lib/libpuffs/puffs.3: revision 1.53
lib/libperfuse/debug.c: revision 1.12
lib/libpuffs/puffs.3: revision 1.54
sys/fs/puffs/puffs_vnops.c: revision 1.167
sys/fs/puffs/puffs_msgif.h: revision 1.79
usr.sbin/perfused/msg.c: revision 1.21
sys/fs/puffs/puffs_vfsops.c: revision 1.102
sys/fs/puffs/puffs_vfsops.c: revision 1.103
sys/fs/puffs/puffs_vfsops.c: revision 1.105
lib/libpuffs/puffs.h: revision 1.123
lib/libperfuse/perfuse_if.h: revision 1.20
lib/libperfuse/perfuse.c: revision 1.29
lib/libpuffs/dispatcher.c: revision 1.42
lib/libpuffs/dispatcher.c: revision 1.43
- Fix same vnodes associated with multiple cookies
The scheme used to retreive known nodes on lookup was flawed, as it only
used parent and name. This produced a different cookie for the same file
if it was renamed, when looking up ../ or when dealing with multiple files
associated with the same name through link(2).
We therefore abandon the use of node name and introduce hashed lists of
inodes. This causes a huge rewrite of reclaim code, which do not attempt
to keep parents allocated until all their children are reclaimed
- Fix race conditions in reclaim
There are a few situations where we issue multiple FUSE operations for
a PUFFS operation. On reclaim, we therefore have to wait for all FUSE
operation to complete, not just the current exchanges. We do this by
introducing node reference count with node_ref() and node_rele().
- Detect data loss caused by FAF
VOP_PUTPAGES causes FAF writes where the kernel does not check the
operation result. At least issue a warning on error.
- Enjoy FAF shortcut on setattr
No need to wait for the result if the kernel does not want it. There is
however an exception for setattr that touch the size, we need to wait
for completion because we have other operations queued for after the
resize.
- Fix fchmod() on write-open file
fchmod() on a node open with write privilege will send setattr with both mode
and size set. This confuses some FUSE filesystem. Therefore we send two FUSE
operations, one for mode, and one for size.
- Remove node TTL handling for netbsd-5 for simplicity sake. The code
still builds on netbsd-5 but does not have the node TTL feature anymore.
It works fine with kernel support on netbsd-6.
- Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.
The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.
We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.
- Fix lookup/reclaim race condition.
The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.
We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
Fix hang unmount bug introduced by last commit.
We introduced a slow queue for delayed reclaims, while the existing
queue for unmount, flush and exist has been renamed fast queue. Both
queues had timestamp for when an operation should be done, but it was
useless for the fast queue, which is always used to run an operation
ASAP. And the timestamp test had an error that turned ASAP into "at next
tick", but nobody what there to wake the thread at next tick, hence
the hang. The fix is to remove the useless and buggy timestamp test for
fast queue.
Rename slow sopreq queue into node sopreq queue, to refet the fact that
is only intended for postponed node reclaims.
When purging the node sopreq queue, do not call puffs_msg_sendresp(), as
it makes no sense.
Fix race condition between (create|mknod|mkdir|symlino) and reclaim, just
like we did it between lookup and reclaim.
Missing bit in previous commit (prevent race between create|mknod|mkdir|symlink
and reclaim)
Bump date for previous.
New sentence, new line; remove trailing whitespace; fix typos;
punctuation nits.
Add PUFFS_KFLAG_CACHE_DOTDOT so that vnodes hold a reference on their
parent, keeping them active, and allowing to lookup .. without sending
a request to the filesystem.
Enable the featuure for perfused, as this is how FUSE works.
Missing bit in previous commit (PUFFS_KFLAG_CACHE_DOTDOT option to avoid
looking up ..)
 1.49.2.1 23-Apr-2012  riz Pull up following revision(s) (requested by manu in ticket #195):
lib/libskey/skeysubr.c: revision 1.27
lib/libkvm/kvm_getloadavg.c: revision 1.11
lib/libwrap/update.c: revision 1.9
lib/liby/yyerror.c: revision 1.9
lib/libpuffs/puffs_ops.3: revision 1.30
lib/libwrap/misc.c: revision 1.10
lib/libwrap/hosts_access.c: revision 1.20
lib/libpuffs/pnode.c: revision 1.11
lib/libperfuse/subr.c: revision 1.17
lib/libpuffs/pnode.c: revision 1.12
lib/libperfuse/subr.c: revision 1.18
lib/libwrap/options.c: revision 1.15
lib/libwrap/fix_options.c: revision 1.11
lib/libperfuse/ops.c: revision 1.52
lib/libperfuse/ops.c: revision 1.53
lib/libperfuse/ops.c: revision 1.54
lib/libwrap/hosts_ctl.c: revision 1.5
lib/libintl/gettext.c: revision 1.27
lib/libwrap/shell_cmd.c: revision 1.6
lib/libpuffs/dispatcher.c: revision 1.39
lib/libperfuse/perfuse_priv.h: revision 1.27
lib/libwrap/socket.c: revision 1.19
lib/libpuffs/puffs.3: revision 1.50
lib/libperfuse/perfuse_priv.h: revision 1.28
lib/libpuffs/puffs_priv.h: revision 1.45
lib/libpuffs/puffs.3: revision 1.51
lib/libperfuse/perfuse_priv.h: revision 1.29
lib/libwrap/percent_x.c: revision 1.5
lib/libpuffs/puffs.3: revision 1.52
lib/libperfuse/debug.c: revision 1.11
sys/fs/puffs/puffs_vnops.c: revision 1.165
lib/libwrap/tcpd.h: revision 1.13
sys/fs/puffs/puffs_vnops.c: revision 1.166
lib/libwrap/eval.c: revision 1.7
sys/fs/puffs/puffs_msgif.h: revision 1.78
sys/fs/puffs/puffs_vfsops.c: revision 1.101
lib/libwrap/rfc931.c: revision 1.9
lib/libwrap/clean_exit.c: revision 1.5
lib/libpuffs/puffs.h: revision 1.120
lib/libc/stdlib/jemalloc.c: revision 1.27
lib/librmt/rmtlib.c: revision 1.26
lib/libpuffs/puffs.h: revision 1.121
sys/fs/puffs/puffs_sys.h: revision 1.79
lib/librumpclient/rumpclient.c: revision 1.48
lib/libwrap/refuse.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.26
lib/libperfuse/perfuse.c: revision 1.27
tests/fs/puffs/t_fuzz.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.28
lib/libpuffs/dispatcher.c: revision 1.40
sys/fs/puffs/puffs_node.c: revision 1.24
lib/libwrap/diag.c: revision 1.9
lib/libintl/textdomain.c: revision 1.13
Use C89 function definition
Add name and atttribute cache with filesytem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
Use new PUFFS_KFLAG_CACHE_FS_TTL option to puffs_init(3) so that
FUSE TTL on name and attributes are used. This save many PUFFS
operations and improves performances.
PUFFS_KFLAG_CACHE_FS_TTL is #ifdef'ed in many places for now so that
libperfuse can still be used on netbsd-5.
Split file system.
Comma fixes.
Remove dangling &quot;and&quot;.
Bump date for previous.
- Makesure update_va does not change vnode size when it should not. For
instance when doing a fault-issued VOP_GETPAGES within VOP_WRITE, changing
size leads to panic: genfs_getpages: past eof.
-Handle ticks wrap around for vnode name andattribute timeout
- When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM
(how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
Do not set PUFFS_KFLAG_CACHE_FS_TTL for PUFFS tests
 1.49.2.2.2.1 01-Nov-2012  matt sync with netbsd-6-0-RELEASE.
 1.57.4.1 23-Jul-2013  riastradh sync with HEAD
 1.57.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.59.4.1 27-Feb-2015  martin Pull up following revision(s) (requested by manu in ticket #555):
lib/libpuffs/puffs.3: revision 1.60
sys/fs/puffs/puffs_msgif.h: revision 1.84
lib/libperfuse/ops.c: revision 1.83
sys/fs/puffs/puffs_sys.h: revision 1.89
sys/fs/puffs/puffs_vfsops.c: revision 1.116
lib/libperfuse/perfuse.c: revision 1.36
sys/fs/puffs/puffs_vnops.c: revision 1.200-1.202

Add PUFFS_KFLAG_NOFLUSH_META to prevent sending metadata flush to FUSE

FUSE filesystems do not expect to get metadata updates for [amc]time
and size, they updates the value on their own after operations.

The PUFFS PUFFS_KFLAG_NOFLUSH_META option prevents regular metadata cache
flushes to the filesystem , and libperfuse uses it to match Linux FUSE
behavior.

While there, fix a bug in SETATTR: do not update kernel metadata cache
from SETATTR reply when the request is asynchronous, as we do not have
the reply yet.

Update file size after write without metadata flush
If we do not use metadata flush, we must make sure the size is updated
in the filesystem after a write, otherwise the next GETATTR will get us
a stale value and the file will be truncated.
 1.63.6.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.129 19-Apr-2022  rillig lib: remove CONSTCOND comment

Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
 1.128 22-Jan-2022  pho Allow calling puffs_mount(3) before puffs_daemon(3)

puffs_daemon(3) creates a pipe before forking, and the parent process
waits for the child to either complete puffs_mount(3) or fail. If a
user calls puffs_daemon(3) after puffs_mount(3), the function
deadlocks. While this error-reporting functionality is really a nice
thing to have, deadlocking is not great. If the filesystem has already
been mounted, puffs_mount(3) should just daemonize the process and
return.

This became an issue because fuse_daemonize(3) in FUSE API had no such
requirement and some FUSE filesystems in the wild suffered deadlocks.
 1.127 03-Dec-2021  pho Use size_t in place of voff_t in puffs_setrootinfo(3)

Chuck Silvers pointed out that voff_t was also supposed to be
kernel-only. The correct type to use in userland would be off_t, but
since changing vsize_t to either voff_t or off_t is an ABI change on
32-bit platforms, we use size_t knowing that it is technically
incorrect.
 1.126 03-Dec-2021  pho Avoid using register_t or vsize_t in <puffs.h>

<puffs.h> is a user-space header, and should not use any of
kernel-only types. It's not reasonable to require user-land
filesystems to #define _KERNTYPES.
 1.125 30-Oct-2021  nia puffs(3): Replace realloc(x * y) with reallocarr
 1.124 30-Jun-2018  christos use a switch.
 1.123 08-Feb-2018  dholland branches: 1.123.2; 1.123.4;
Typos.
 1.122 05-Nov-2017  christos fix error messages (use __func__, quotes)
also differentiate between canonical and non-relative.
 1.121 31-May-2017  christos Adjust to prototype.
 1.120 17-Jun-2015  christos fix error messages
 1.119 22-Dec-2014  manu Do not warn about relative path because of trailing slash

libpuffs calls realpath() to obtain an absolute path to use for mounting.
If the obtained path is different from the one given by the caller, a
warning is issued. This included the situation where the path passed by
the caller just have trailing slashes, a situation where we just want them
to be striped without a warning.
 1.118 31-Oct-2014  manu libpuffs support for fallocate and fdiscard operations
 1.117 14-Nov-2011  chs branches: 1.117.18;
fix crashes caused by using the results of getcontext()
after the caller returns.
 1.116 03-May-2011  manu branches: 1.116.4;
Call advlock method if supplied
 1.115 06-Dec-2010  pooka Remove PUFFS_WITH_THREADS ifdef garbage, just use libc weak symbols.
 1.114 06-Jul-2010  pooka unwhine lint
 1.113 06-Jul-2010  pooka stat mount target path only if we're actually goint to use it.
This avoids errors from the comfd case when the mount target does
not exist in our local namespace.
 1.112 06-Jul-2010  pooka set time_t compat where necessary
 1.111 06-Jul-2010  pooka When using the top secret PUFFS_COMFD model, write out size of the
puffs kernel args before the contents. This allows parties which
have no clue about the contents to proxy the protocol easily.
 1.110 07-Jun-2010  pooka Reenable pathconf now that the retval argument is register_t.
 1.109 06-Jun-2010  pooka Actually, disable pathconf for a while longer: the retval needs a
little finetuning (not that everyone is jumping right to using it,
but fixing will have to wait until tomorrow, and who knows what
i'll forget during the night and how long it will eventually take).
 1.108 06-Jun-2010  pooka signal pathconf in the vector of supported ops
 1.107 21-May-2010  pooka * support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
 1.106 19-May-2010  pooka remove three years out-of-date comment
 1.105 12-Jan-2010  pooka Add convenience routine puffs_unmountonsignal(), which does exactly that.
 1.104 07-Jan-2010  pooka Use typecast instead of ULL for a less whiny lint on LP64.
 1.103 07-Jan-2010  pooka Rewrite puffs_exit() in terms of the PUFFSOP_UNMOUNT kernel request.
Now server exit is a lot quite cleaner than previously.
 1.102 07-Jan-2010  pooka Set high bit on server->kernel requests to better differentiate
between the direction of the request.
 1.101 05-Dec-2009  pooka Add an error handler which syslogs but does not abort() and make it
the default. Most servers just shovel bits from their backend to
the kernel without checking the contents and dumping core in case
the backend gives garbage is a bit harsh.
 1.100 18-Oct-2009  pooka Make it possible to supply parameters to puffs_init() later (but
before puffs_mount()).
 1.99 17-Oct-2009  pooka Dispatch puffs_node_abortop().

Note: We use the storage of puffs_cache_write from puffs_ops for
this purpose. It's not issued by the kernel and hence currently
unused, and this saves us from the trouble of bumping the lib major
version.
 1.98 08-Jan-2009  lukem fix some sign comparison warnings
 1.97 13-Dec-2008  dsl Actually we need 'long int' to avoif a stupid 'truncating long to int'
warning.
 1.96 13-Dec-2008  dsl Change type of 'n' to 'int' so that it can be printed with %d.
The domain of the value is [-1..sizeof (int)] so a type of 'int' is fine.
 1.95 12-Dec-2008  pooka Close write-end of daemonpipe in reader to get EOF if the writer
goes awol.
 1.94 12-Dec-2008  pooka Add puffs_cancel(), which allows to back down after puffs_init()
and before puffs_mount().
(this should actually be integrated with puffs_exit(), but that
routine is currently so non-sensible that I didn't bother now)
 1.93 12-Dec-2008  pooka add:
puffs_setspecific(pu, private)
Can be used to set the specific data after the call to
puffs_init().
 1.92 12-Aug-2008  pooka branches: 1.92.4; 1.92.8;
Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.91 11-Aug-2008  pooka clear cached puffs_cc's in puffs_exit()
 1.90 11-Aug-2008  pooka * make sure we come out of mainloop in the main context. otherwise in
certain cases the server would jump to hyperspace when unmounted
* sprinkle some debug prints
 1.89 28-Jan-2008  pooka branches: 1.89.6;
Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed. Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts. The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
 1.88 16-Jan-2008  pooka Cache a number of execution contexts instead of re-initializing
them every time. Speeds up pure in-memory file systems such as
sysctlfs or dtfs quite a bit. For actual I/O-workhorses the result
is of course less tasty.
 1.87 16-Jan-2008  pooka Use PROT_NONE page to protect bottom of stack from overrun
 1.86 14-Jan-2008  pooka Introduce PUFFS_STACKSIZE_MIN to avoid overloading 0 and getting
a warning from the library when really wanting to say "just the
minimum, please".
 1.85 08-Jan-2008  pooka liberate gas-huffin crack-puffin' assert
 1.84 02-Jan-2008  pooka fix pasto
 1.83 02-Jan-2008  pooka Also pass fromname in the "distributed" case.
 1.82 02-Jan-2008  pooka Provide some transparent "support" for "distributed" file systems.
If the env variable PUFFS_COMFD is set, the descriptor value
contained in it is used for communication instead of opening
/dev/puffs and doing mount(2).

This feature is obviously very undocumented and should not be used
without adult supervision.
 1.81 25-Dec-2007  pooka Add a public interface for setting a cookie mapper.
 1.80 05-Dec-2007  pooka Send a response message for flush operations from the kernel instead
of abusing the return value of write(2).
 1.79 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.78 29-Nov-2007  pooka * allocate pcc as a slice from the stack instead of allocating it
separately
* provide puffs_cc_getcc()

This is in preparation for the removal of you-should-guess-what as
an argument to routines here and there and everywhere.
 1.77 26-Nov-2007  pooka print more info when receiving an abort
 1.76 17-Nov-2007  pooka puffs_mount():
* initialize values better
* always go through "fail" to see if puffs_daemon() needs to be
woken up
* open device r/w instead of r/o
 1.75 16-Nov-2007  pooka Introduce puffs_daemon(), which works like daemon(3) except that it
also synchronizes with puffs_mount() and does not return (exit) in the
parent process until the file system has been mounted. This makes
it possible to reliably run e.g. mount_foo jippi /kai ; cd /kai/ee
 1.74 06-Nov-2007  pooka Open the kernel descriptor as part of mount(), not init(). Then
it doesn't matter if someone fork()s or does other tricks between
init() and mount() (and besides, now it's where it logically should be).
 1.73 05-Nov-2007  pooka Pull the daemonizing code out of the library mainloop into the file
servers. Calling daemon() (i.e. fork()ing) inside a library can
cause nice surprises for e.g. threaded programs. As discussed with
Greg Oster & others.
 1.72 29-Oct-2007  pooka Sprinkle some hackish locks here and there, just enough to allow
libp2k & rump to run multithreaded.
 1.71 28-Oct-2007  pooka Add possibility to set pre- and post callbacks which will be called
for all operations before or after executing the specific callback
(the api is not be final yet, though).
 1.70 26-Oct-2007  pooka Add some very initial support for a threading worker model as an
alternative to the (vastly superior ;) continuation model. This
is very preliminary stuff and not compiled by default (which it
even won't do without some other patches I cannot commit yet).

The raison d'commit of the patch is a snippet which ensures proper
in-order dispatching of all operations, including those which don't
require a response. Previously many of them would be dispatched
simultaneosly, e.g. fsync and reclaim on the same node, which
obviously isn't all that nice for correct operation.
 1.69 26-Oct-2007  pooka mmap stacks, makes it possible to align them
 1.68 25-Oct-2007  pooka Make pu_haskq a flag instead of its own variable.
 1.67 21-Oct-2007  pooka Add puffs_cc_schedule() which marks a pcc runnable and will pass
execution to it when in the main loop the next time.
 1.66 11-Oct-2007  pooka Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

* since the kernel-user communication is not purely request-response
anymore (hasn't been since 2006), try to rename some "request" to
"message". more similar mangling will take place in the future.

* completely rework how messages are allocated. previously most of
them were borrowed from the stack (originally *all* of them),
but now always allocate dynamically. this makes the structure
of the code much cleaner. also makes it possible to fix a
locking order violation. it enables plenty of future enhancements.

* start generalizing the transport interface to be independent of puffs

* move transport interface to read/write instead of ioctl. the
old one had legacy design problems, and besides, ioctl's suck.
implement a very generic version for now; this will be
worked on later hopefully some day reaching "highly optimized".

* implement libpuffs support behind existing library request
interfaces. this will change eventually (I hate those interfaces)
 1.65 01-Oct-2007  pooka Pass reason string to pu_errnotify. Print it in the default
version before aborting.
 1.64 27-Sep-2007  pooka silence lint. also noticed by xtraeme
 1.63 27-Sep-2007  pooka Add error notifications, which are used to deliver errors from the
kernel to the file server for silly things the file server did,
e.g. attempting to create a file with size VSIZENOTSET. The file
server can handle these as it chooses, but the default action is
for it to throw its hands in the air and sing "goodbye, cruel world,
it's over, walk on by".
 1.62 11-Aug-2007  pooka branches: 1.62.2;
run realpath() on the mountpath
 1.61 20-Jul-2007  pooka branches: 1.61.4;
Add puffs_framev_enqueue_waitevent, which waits for read/write/error
events from an i/o descriptor. It yields until an event happens
and continues execution when the event loop notices the event has
happened.
 1.60 19-Jul-2007  pooka Don't float puffs_kargs needlessly around after mount, saves
a couple k of memory (and there was much rejoycing!)
 1.59 19-Jul-2007  pooka Use ioctl(PUFFSREQSIZEOP) instead of mount(MNT_GETARGS) to fetch
the maximum request size after mount. Calling mount(MNT_GETARGS)
from the file server is currently not kosher, as it vrele()s the
root vnode, potentially causing an inactive, which the file server
cannot handle while it itself is inactive in the kernel (deadlock).
 1.58 17-Jul-2007  pooka * add mntfromname parameter to puffs_init()
* set it in file servers
 1.57 14-Jul-2007  dsl Add new 'data_len' parameter to mount system call.
Add an additional call with MNT_GETARGS to retrieve the modified
information instead of relying on the kernel code abusing the mount
interface during mount.
 1.56 07-Jul-2007  pooka Make puffs_framebuf better suited from environments with multiple sources:

* in addition add/remove, allow enable/disable, which can be used
to control events for descriptors without having to remove all the
data associated with them
* add directsend/receive, which can be used to pass the same buffer
from the caller to read/writeframe and back again
* add flags to enqueue functions and allow urgent buffers to be
processed as the next PDU
 1.55 05-Jul-2007  pooka * reorder calls to get results processed even if our I/O descriptors
go back to zero
* don't give up on the read-side of an fd if there is still unreceived data
 1.54 02-Jul-2007  pooka Get rid of the "int *refs" parameter to inactive: the same can be
accomplished now with puffs_setbacks.
 1.53 11-Jun-2007  pooka print a specific warning if /dev/puffs cannot be opened in init
 1.52 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.51 21-May-2007  pooka remember to put the results of the final operations (including unmount)
to the kernel in mainloop
 1.50 18-May-2007  pooka * stuff results back to kernel before calling kevent - the file server
loop function might generate some results. and this is still "after"
event handling (except for the first call, but I'm not too keen on
optimizing for that)
* don't be such a baby about EINTR from kevent(). if we get it, suck
it up and continue instead of quitting
 1.49 17-May-2007  pooka Reflect kernel changes for supplying root node information in mount
instead of puffs_start(). Get completely rid of puffs_start(), as
everything it used to do is now handled by the mount routine.
Introduce an optional pre-mount call puffs_setrootinfo() for setting
non-default root node information. As the old puffs_mount() is
now virtually useless, say byebye to it and rename the old
puffs_domount() to puffs_mount(), but add a root cookie parameter
to compensate for the late puffs_start().
 1.48 16-May-2007  pooka switch the arbitrary default errno value for network i/o from
ECONNABORTED to ECONNRESET, which is at least a little bit better
 1.47 15-May-2007  pooka memset freshly allocated puffs_usermount to 0
 1.46 15-May-2007  pooka Step 3 and currently final step of a more general purpose event loop:
support removal and addition of i/o file descriptors on the fly.

* detect closed file descriptors
* automatically free waiters of a dead file descriptor
* give the file server the possibility to specify a callback which
notifies of a dead file descriptor
* move loop function to be a property of the mainloop instead of
framebuf (doesn't change effective behaviour)
* add the possibility to configure a timespec parameter which
attempts to call the loop function periodically
* move the event loop functions from the puffs_framebuf namespace
to puffs_framev to differential between pure memory management
functions
 1.45 11-May-2007  pooka move puffs request dispatching code into it's own module.
no functional change
 1.44 11-May-2007  pooka Step 2 of general-purpose eventloop: get rid of puffs_framebuf_eventloop().
puffs_mainloop() now handles that functionality as well.
 1.43 10-May-2007  pooka Add some kludges to be able to execute requests on the regular program
stack instead of the continuation stack. This is for lib/36011, where
pthread gets confused since we aren't running on the regular stack.
I'm not really sure which direction to go to with this quite yet, so
make the hack hard to enable on purpose. The whole request dispatch
code needs cleaning anyway.
 1.42 09-May-2007  pooka Remove the puffs_usermount argument from puffs_req_handle(). It can
be found from the other arguments and this way puffs_req_handle() is
more symmetric with the other puffs_req() routines.
 1.41 09-May-2007  pooka Return 0 from puffs_mainloop() if no error occurs.
pointed out by Phil Nelson
 1.40 07-May-2007  pooka Add puffs_setback(), which can be used to set setbacks for nodes before
the call returns to the kernel. Currently it can be called only from
open(), mmap(), remove() and rmdir(). (But that might change)
 1.39 20-Apr-2007  pooka assert that the file server doesn't try to return more cookies than
it was supposed to
 1.38 16-Apr-2007  pooka alloc to set flags when setting fhsize
 1.37 16-Apr-2007  pooka some routines for setting mount parameters
 1.36 13-Apr-2007  pooka Instead of keeping on adding parameters to puffs_mount(), make it
only take the bare essentials, which currently means removing
"maxreqlen" from the argument list (all current callers I'm aware
of set it as 0 anyway). Introduce puffs_init(), which provides a
context for setting various parameters and puffs_domount(), which
can be used to mount the file system. Keep puffs_mount() as a
shortcut for the above two for simple file systems.

Bump development ABI version to 13. After all, it's Friday the 13th.
Watch out! Bad things can happen on Friday the 13th. --No carrier--
 1.35 12-Apr-2007  pooka Hide struct puffs_usermount from the rest of the world and provide
accessors for interesting data in it. Namely, you can now get
pu->pu_privdata with puffs_getspecific(), pu->pu_pn_root with
puffs_set/getroot() and pu->pu_maxreqlen with puffs_getmaxreqlen().
 1.34 11-Apr-2007  pooka * support nodetofh and fhtonode callbacks
* use new signature of node_readdir
 1.33 20-Mar-2007  pooka initial support for cacheops
 1.32 18-Feb-2007  pooka Until someone can sort non-priviledged mounts and kauth, force
MNT_NOSUID | MNT_NODEV for mounts with geteuid() != 0. I'm tired
of typing them on the command line every time I test a file system.
 1.31 18-Feb-2007  pooka dump return values for operations
 1.30 15-Feb-2007  pooka Introduce puffs_path_walkcmp(), which is to be called from nodewalk
and compares the path of the node against the given pathobject.
Also make comparison method take a flag to indicate if it should
check if the second path is a true prefix of the first.

plus some namespace cleanup
 1.29 15-Feb-2007  pooka * get rid of the holy kernel-given ISDOTDOT, and instead define a
macro which does strcmp against ".." and (the untranslated)
componentname
* make PUFFS_FLAG_BUILDPATH build paths also if dotdot is the case,
and adapt the regular path objects to this
* make nullfs lookup readable because we can now get rid of dotdot
processing there
 1.28 26-Jan-2007  pooka add interfaces for suspending the file system
 1.27 20-Jan-2007  pooka Be consistent with the rest of the framework about the argument
order of puffs_docc and puffs_dopreq
 1.26 20-Jan-2007  pooka be consistent in naming request handlers
 1.25 16-Jan-2007  pooka revoke revoke
 1.24 15-Jan-2007  pooka Checkpoint some more work in progress: for the benefit those file
system backends which operate purely based on paths, push out more
path management into the library and make path management more
abstract: enable a file system to define a bunch of path management
callbacks, which are used by the framework. Management of normal
/this/is/a/path type paths is provided by the library.
 1.23 11-Jan-2007  pooka For directory renames we need to rename all the child nodes for
the given directory if the file system wants paths (PUFFS_FLAG_BUILDPATH).
Do this by walking the nodelist and adjusting the path prefix of
each matching node.
 1.22 10-Jan-2007  pooka * don't chdir in possible daemon() call for the benefit of file systems
which specify a relative path as the root
* if (buildpath), build link source full pathname for the duration of
the operation
 1.21 06-Jan-2007  pooka * get rid of the mount callback; it's no great surprise to the
server that it needs to mount the file system backend if it wants
to call mount
* provide some options for getmntopts(), assume that callers will parse
command line (or fstab) args
* reorganize the puffs_cc interface just a bit, preparing for a bigger
revamp later
 1.20 02-Jan-2007  pooka * inform kernel of our version
* homegrown lib ABI check (to avoid bumping major a ludicrillion times
before reaching stability)
 1.19 29-Dec-2006  pooka checkpoint some experimental work-in-progress, namely:

Add support for having multiple outstanding operations. This is done
by exposing enough interfaces so that it is convenient to have the
main event loop in the implementation itself and by providing a
continuation framework for convinient blocking and rescheduling.

works fine, but will undergo further cleanup & development
 1.18 14-Dec-2006  alc CID4360: don't leak `buf' upon return
ok pooka@
 1.17 07-Dec-2006  pooka outline & export code for interfacing with kernel GET/PUT requests
 1.16 07-Dec-2006  pooka g/c out-of-date comment
 1.15 07-Dec-2006  pooka support mmap
 1.14 07-Dec-2006  pooka cleanup generated stuff from comments
 1.13 07-Dec-2006  pooka rototill the operation callbacks: unify the ops under struct puffs_ops
and namespace them
 1.12 05-Dec-2006  pooka adapt to kernel change:
Allow multiple requests to be transferred in each GET/PUTOP
 1.11 01-Dec-2006  pooka PUFFSFLAG -> PUFFS_FLAG to be consistent with the kernel
 1.10 01-Dec-2006  pooka build & send implemented operations list to kernel
 1.9 30-Nov-2006  pooka summon daemon(3) in mainloop unless the nodaemon flag is given
 1.8 18-Nov-2006  pooka * call statvfs() at mount() time, pass that info along
* start is gone
 1.7 17-Nov-2006  pooka shuffle flags a bit
 1.6 09-Nov-2006  pooka * catch up with kernel changes
* better error handling when mounting
 1.5 07-Nov-2006  pooka * support FAF (Fire-And-Forget) class operations
* adapt to new lookup
 1.4 26-Oct-2006  pooka pass rdev for specfs support
 1.3 25-Oct-2006  pooka handle PUFFS_VN_INACTIVE
 1.2 23-Oct-2006  christos pass lint; fix install.
 1.1 22-Oct-2006  pooka add libpuffs - the userspace programming interface for puffs

This work was initially started and completed for Google SoC 2005
and tweaked to work a bit better in the past few weeks. While
being far from complete, it is functional enough to be able and
stable to host a fairly general-purpose in-memory file system in
userspace. Even so, puffs should be considered experimental and
no binary compatibility for interfaces or crash-freedom or zero
security implications should be relied upon just yet.

The GSoC project was mentored by William Studenmund and the final
review for the code was done by Christos.
 1.61.4.2 20-Jul-2007  pooka Add puffs_framev_enqueue_waitevent, which waits for read/write/error
events from an i/o descriptor. It yields until an event happens
and continues execution when the event loop notices the event has
happened.
 1.61.4.1 20-Jul-2007  pooka file puffs.c was added on branch matt-mips64 on 2007-07-20 13:14:56 +0000
 1.62.2.4 23-Mar-2008  matt sync with HEAD
 1.62.2.3 09-Jan-2008  matt sync with HEAD
 1.62.2.2 08-Nov-2007  matt sync with -HEAD
 1.62.2.1 06-Nov-2007  matt sync with HEAD
 1.89.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.92.8.1 21-Apr-2010  matt sync to netbsd-5
 1.92.4.7 25-Jan-2012  riz Pull up following revision(s) (requested by manu in ticket #1706):
lib/libpuffs/puffs.c: revision 1.108
signal pathconf in the vector of supported ops
 1.92.4.6 17-Jul-2011  riz Pull up following revision(s) (requested by manu in ticket #1645):
lib/libc/sys/Makefile.inc 1.207 via patch
lib/libc/sys/extattr_get_file.2 patch
lib/libpuffs/dispatcher.c 1.34,1.36 via patch
lib/libpuffs/puffs.c 1.107 via patch
lib/libpuffs/puffs.h 1.115,1.118 via patch
sys/fs/puffs/puffs_msgif.h 1.71,1.76 via patch
sys/fs/puffs/puffs_vfsops.c 1.88 via patch
sys/fs/puffs/puffs_vnops.c 1.145,1.154 via patch
sys/kern/vfs_xattr.c 1.24-1.27 via patch
sys/kern/vnode_if.c 1.87 via patch
sys/sys/Makefile 1.133 via patch
sys/sys/extattr.h 1.6 via patch
sys/sys/vnode_if.h 1.81 via patch
sys/ufs/ffs/ffs_vnops.c patch
sys/ufs/ufs/ufs_extattr.c 1.31,1.34 via patch

* support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
Support extended attributes.
Fix multiple non compliances in our Linux-like extattr API, and make it
public so that it can be used.
Improve a bit listxattr(2). It attemps to list both system and user
extended attributes, and it faled if calling user did not have privilege
for reading system EA. Now we just lise user EA and skip system EA in
reading them is not allowed.
Fix bug introduced in previous commuit: Do not vrele() a vnode we did not
obtained.
Improve UFS1 extended attributes usability
- autocreate attribute backing file for new attributes
- autoload attributes when issuing extattrctl start
- when autoloading attributes, do not display garbage warning when looking
up entries that got ENOENT
Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.
There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
extattr_list_file(2), which is obtanined by setting the
EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)
This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
 1.92.4.5 18-Jun-2011  bouyer Pull up following revision(s) (requested by manu in ticket #1623):
lib/libpuffs/puffs.c: revision 1.116 via patch
sys/fs/puffs/puffs_vnops.c: revision 1.151 via patch
Call advlock method if supplied
 1.92.4.4 27-Oct-2009  bouyer Pull up following revision(s) (requested by pooka in ticket #1105):
lib/libpuffs/puffs.h: revision 1.112
lib/libpuffs/puffs.c: revision 1.100
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
lib/libpuffs/shlib_version: patch

Make it possible to supply parameters to puffs_init() later (but
before puffs_mount()).
 1.92.4.3 18-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1100):
lib/libpuffs/dispatcher.c: revision 1.33
lib/libpuffs/puffs.c: revision 1.99
lib/libpuffs/puffs.h: revision 1.111
sys/fs/puffs/puffs_msgif.h: revision 1.67 via patch
sys/fs/puffs/puffs_vnops.c: revision 1.136

Support VOP_ABORTOP() in puffs.
 1.92.4.2 16-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1095):
lib/libpuffs/puffs.c: revision 1.94
lib/libpuffs/puffs.h: revision 1.110

Add puffs_cancel(), which allows to back down after puffs_init()
and before puffs_mount().
 1.92.4.1 16-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1094):
lib/libpuffs/puffs.3: revision 1.45
lib/libpuffs/puffs.c: revision 1.93
lib/libpuffs/puffs.h: revision 1.109

Add function puffs_setspecific(pu, private) which can be used to set the
specific data after the call to puffs_init().
 1.116.4.1 17-Apr-2012  yamt sync with head
 1.117.18.1 05-Nov-2014  snj Pull up following revision(s) (requested by manu in ticket #181):
lib/libperfuse/fuse.h: revision 1.6
lib/libperfuse/ops.c: revision 1.78
lib/libperfuse/perfuse.c: revision 1.35
lib/libperfuse/perfuse_priv.h: revision 1.36
lib/libpuffs/dispatcher.c: revision 1.48
lib/libpuffs/opdump.c: revision 1.37
lib/libpuffs/puffs.c: revision 1.118
lib/libpuffs/puffs.h: revision 1.126
lib/libpuffs/puffs_ops.3: revisions 1.40-1.41
sys/fs/puffs/puffs_msgif.h: revision 1.82-1.83
sys/fs/puffs/puffs_msgif.h: revision 1.82
sys/fs/puffs/puffs_vnops.c: revision 1.196
Add PUFFS support for fallocate and fdiscard operations
--
libpuffs support for fallocate and fdiscard operations
--
Add PUFFS_HAVE_FALLOCATE in puffs_msgif.h so that filesystem can decide
at build time wether fallocate is usable
--
FUSE fallocate support
There seems to be no fdiscard FUSE operation at the moment, hence that
one is left unused.
 1.123.4.1 10-Jun-2019  christos Sync with HEAD
 1.123.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.1 21-Nov-2024  riastradh branches: 1.1.4;
libpuffs: Add expected symbols list.

NOTE: This exports a symbol pu_lock which is only mentioned in
libpuffs/puffs_priv.h which looks very internal. Intentional?

PR lib/58838: shared libraries in base should all have expsym lists
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 21-Nov-2024  perseant file puffs.expsym was added on branch perseant-exfatfs on 2025-08-02 05:54:56 +0000
 1.130 03-Dec-2021  pho Use size_t in place of voff_t in puffs_setrootinfo(3)

Chuck Silvers pointed out that voff_t was also supposed to be
kernel-only. The correct type to use in userland would be off_t, but
since changing vsize_t to either voff_t or off_t is an ABI change on
32-bit platforms, we use size_t knowing that it is technically
incorrect.
 1.129 03-Dec-2021  pho Avoid using register_t or vsize_t in <puffs.h>

<puffs.h> is a user-space header, and should not use any of
kernel-only types. It's not reasonable to require user-land
filesystems to #define _KERNTYPES.
 1.128 23-Sep-2019  christos Restore binary compatibility by using the statvfs90 structure internally.
 1.127 12-Nov-2015  christos branches: 1.127.16;
consistency fixes.
 1.126 31-Oct-2014  manu libpuffs support for fallocate and fdiscard operations
 1.125 16-Aug-2014  manu Add an open2 method, like open but with an additionnal oflags used
by the filesystem to send back information about the file.
This is used to implement PUFFS_OPEN_IO_DIRECT by which the filesystem
tells the kernel that read/write should bypass the page cache.
 1.124 16-Aug-2012  manu branches: 1.124.10;
Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.

The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.

It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.

- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.

- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.

- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.123 21-Jul-2012  manu - Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.

The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.

We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.

- Fix lookup/reclaim race condition.

The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.

We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
 1.122 27-Jun-2012  manu Pass the FAF flag to handlers:
- setattr_ttl is updated to add a flag argument. Since it was not present in
a previous release, we can change its API
- write2 is introduced, this is write with an extra flag for FAF.
- fsync already has the FAF information in a flag and needs no change
- for other operations, FAF is unconditional
 1.121 18-Apr-2012  manu - When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM (how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
 1.120 08-Apr-2012  manu Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
 1.119 29-Aug-2011  joerg branches: 1.119.2; 1.119.4;
Use __dead
 1.118 04-Jul-2011  manu Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.

There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
extattr_list_file(2), which is obtanined by setting the
EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)

This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
 1.117 07-Jun-2010  pooka Make retval argument for pathconf a register_t to match VOP_PATHCONF.
This makes the size the same on 64bit archs. Don't bother bumping
any version, since you'd have explicitly had to jump through some
hoops to use pathconf before.
 1.116 21-May-2010  pooka add option string for no attribute cache
(foreseeing the odd event I might actually implement one some day)
 1.115 21-May-2010  pooka * support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
 1.114 12-Jan-2010  pooka Add convenience routine puffs_unmountonsignal(), which does exactly that.
 1.113 05-Dec-2009  pooka Add an error handler which syslogs but does not abort() and make it
the default. Most servers just shovel bits from their backend to
the kernel without checking the contents and dumping core in case
the backend gives garbage is a bit harsh.
 1.112 18-Oct-2009  pooka Make it possible to supply parameters to puffs_init() later (but
before puffs_mount()).
 1.111 17-Oct-2009  pooka Dispatch puffs_node_abortop().

Note: We use the storage of puffs_cache_write from puffs_ops for
this purpose. It's not issued by the kernel and hence currently
unused, and this saves us from the trouble of bumping the lib major
version.
 1.110 12-Dec-2008  pooka Add puffs_cancel(), which allows to back down after puffs_init()
and before puffs_mount().
(this should actually be integrated with puffs_exit(), but that
routine is currently so non-sensible that I didn't bother now)
 1.109 12-Dec-2008  pooka add:
puffs_setspecific(pu, private)
Can be used to set the specific data after the call to
puffs_init().
 1.108 12-Aug-2008  pooka branches: 1.108.4; 1.108.8;
Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.107 29-Jan-2008  pooka branches: 1.107.6;
Fix a weirdosity in the framebuf gotfb interface: hand buffer
ownership to the called routine instead of keeping it. This means
that callees must now destroy the buffer once they are done with it.
 1.106 28-Jan-2008  pooka Bump version for lazy contexts (probably not necessary, but it's
been a long time since I bumbed the version ;)
 1.105 28-Jan-2008  pooka Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed. Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts. The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
 1.104 14-Jan-2008  pooka Introduce PUFFS_STACKSIZE_MIN to avoid overloading 0 and getting
a warning from the library when really wanting to say "just the
minimum, please".
 1.103 25-Dec-2007  pooka Add a public interface for setting a cookie mapper.
 1.102 19-Dec-2007  pooka Add generic getattr routine.
 1.101 16-Dec-2007  pooka * nuke puffs_cc_get{specific,usermount} for good
* move prototypes for puffs_docc and puffs_dopufbuf into the
public header, as they are should be exposed
 1.100 11-Dec-2007  pooka nuke #define whose purpose has ceased to be
 1.99 08-Dec-2007  pooka Now that "l" is gone both as an argument to operations and from
componentname, remove all vestiges of puffs_cid.
 1.98 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.97 30-Nov-2007  pooka Rototill.

Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?). Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it. This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
 1.96 29-Nov-2007  pooka * allocate pcc as a slice from the stack instead of allocating it
separately
* provide puffs_cc_getcc()

This is in preparation for the removal of you-should-guess-what as
an argument to routines here and there and everywhere.
 1.95 27-Nov-2007  pooka Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces. puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
 1.94 16-Nov-2007  pooka Introduce puffs_daemon(), which works like daemon(3) except that it
also synchronizes with puffs_mount() and does not return (exit) in the
parent process until the file system has been mounted. This makes
it possible to reliably run e.g. mount_foo jippi /kai ; cd /kai/ee
 1.93 05-Nov-2007  pooka remember to bump version for puffs_mainloop() change
 1.92 05-Nov-2007  pooka Pull the daemonizing code out of the library mainloop into the file
servers. Calling daemon() (i.e. fork()ing) inside a library can
cause nice surprises for e.g. threaded programs. As discussed with
Greg Oster & others.
 1.91 28-Oct-2007  pooka Add possibility to set pre- and post callbacks which will be called
for all operations before or after executing the specific callback
(the api is not be final yet, though).
 1.90 26-Oct-2007  pooka mmap stacks, makes it possible to align them
 1.89 21-Oct-2007  pooka Add puffs_cc_schedule() which marks a pcc runnable and will pass
execution to it when in the main loop the next time.
 1.88 21-Oct-2007  pooka Always provide caller information from the kernel based on curlwp.
(but don't deprecate the old puffs_cid interface just yet)
 1.87 18-Oct-2007  pooka * Change type of boolean functions to, well, boolean instead of int.
* add puffs_cid_isequal() which can be used to test if the two caller
id's refer to the same process/lwp.
 1.86 11-Oct-2007  pooka Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

* since the kernel-user communication is not purely request-response
anymore (hasn't been since 2006), try to rename some "request" to
"message". more similar mangling will take place in the future.

* completely rework how messages are allocated. previously most of
them were borrowed from the stack (originally *all* of them),
but now always allocate dynamically. this makes the structure
of the code much cleaner. also makes it possible to fix a
locking order violation. it enables plenty of future enhancements.

* start generalizing the transport interface to be independent of puffs

* move transport interface to read/write instead of ioctl. the
old one had legacy design problems, and besides, ioctl's suck.
implement a very generic version for now; this will be
worked on later hopefully some day reaching "highly optimized".

* implement libpuffs support behind existing library request
interfaces. this will change eventually (I hate those interfaces)
 1.85 01-Oct-2007  pooka Pass reason string to pu_errnotify. Print it in the default
version before aborting.
 1.84 27-Sep-2007  pooka Add error notifications, which are used to deliver errors from the
kernel to the file server for silly things the file server did,
e.g. attempting to create a file with size VSIZENOTSET. The file
server can handle these as it chooses, but the default action is
for it to throw its hands in the air and sing "goodbye, cruel world,
it's over, walk on by".
 1.83 06-Sep-2007  pooka Give cmpframe() the ability to shortcircuit the comparison loop by
signalling back that the buffer under examination is not a response
at all.
 1.82 01-Sep-2007  pooka Add gotframe callback, which is called if an incoming frame matches
no outstanding request.
 1.81 22-Aug-2007  pooka branches: 1.81.2;
Mimic namei structure changes for puffs. bump both kernel & lib version.
 1.80 18-Aug-2007  pooka puffs_cc_create/destroy aren't supposed to be exported to the user
 1.79 17-Aug-2007  pooka Add accessors for struct puffs_node to prepare for removal from
exported headers.
 1.78 15-Aug-2007  pooka Nuke PUFFSLOOKUP_FOO and move to NAMEI_FOO
 1.77 27-Jul-2007  pooka branches: 1.77.4;
mmap fflags -> prot
 1.76 20-Jul-2007  pooka Add puffs_framev_enqueue_waitevent, which waits for read/write/error
events from an i/o descriptor. It yields until an event happens
and continues execution when the event loop notices the event has
happened.
 1.75 17-Jul-2007  pooka * add mntfromname parameter to puffs_init()
* set it in file servers
 1.74 09-Jul-2007  pooka add IO_NDELAY
 1.73 08-Jul-2007  pooka g/c leftover
 1.72 08-Jul-2007  pooka make notifyfunction optional and do not call removeonclose() if
none is given.
 1.71 07-Jul-2007  pooka Make puffs_framebuf better suited from environments with multiple sources:

* in addition add/remove, allow enable/disable, which can be used
to control events for descriptors without having to remove all the
data associated with them
* add directsend/receive, which can be used to pass the same buffer
from the caller to read/writeframe and back again
* add flags to enqueue functions and allow urgent buffers to be
processed as the next PDU
 1.70 02-Jul-2007  pooka Get rid of the "int *refs" parameter to inactive: the same can be
accomplished now with puffs_setbacks.
 1.69 01-Jul-2007  pooka Instead of requesting various pieces of information from node-creating
methods using "please fill me"-pointers, pass "struct puffs_newinfo *"
and provide methods to fill in new node info.
 1.68 01-Jul-2007  pooka Instead of supplying a plain pid, supply an abstract struct puffs_cid *,
which can currently be used to query the pid and lwpid.
 1.67 01-Jul-2007  pooka make puffs_cred an opaque type
 1.66 24-Jun-2007  pooka Actually, keep PUFFS_KFLAG_NOCACHE and -o cache around as shorthand
to neither page- nor namecache.
 1.65 24-Jun-2007  pooka PUFFS_KFLAG_NOCACHE became two, so introduce the command line options
-o nonamecache and -o nopagecache and adapt file systems where necessary.
 1.64 24-Jun-2007  pooka Introduce puffs_null_setops(), which initializes the ops vector with
puffs nullfs ops.
 1.63 24-Jun-2007  pooka Introduce puffs_pn_remove() to signal that a node has been deleted
and destroyed, but not yet reclaimed. This prevents puffs_pn_nodewalk()
from returning stale entries. Make nullfs use this (some file
systems are a bit too happy with recycling inode numbers).
 1.62 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.61 20-May-2007  pooka Introduce puffs_framev_framebuf_ccpromote, which can be used to
turn a reference to puffs_framebuf in the file system from a
cb/justsend operation to a cc wait, should the file system find
itself desiring the result.
 1.60 20-May-2007  pooka Change the signature of puffs_respcmp to return -1,0,1 for smaller,
equal, larger, respectively instead of 0/1 for non/equal. This
will allow sorting the buffers for faster matching in libpuffs.
While here, change the name from respcmp to framecmp, as that better
reflects the purpose.

NOTE! there is no obvious way to make compilation fail for file
systems which may already be using this feature (although I don't
think there are any outside our tree, as the feature is two weeks
old). Nevertheless, non-updated file systems will fail very quickly.
 1.59 18-May-2007  pooka dispatch PUFFS_VN_POLL
 1.58 17-May-2007  pooka Reflect kernel changes for supplying root node information in mount
instead of puffs_start(). Get completely rid of puffs_start(), as
everything it used to do is now handled by the mount routine.
Introduce an optional pre-mount call puffs_setrootinfo() for setting
non-default root node information. As the old puffs_mount() is
now virtually useless, say byebye to it and rename the old
puffs_domount() to puffs_mount(), but add a root cookie parameter
to compensate for the late puffs_start().
 1.57 16-May-2007  pooka Add error parameter to puffs_framev_cb to signal if there is a
result of if the function should just do resource cleanup.
 1.56 15-May-2007  pooka Step 3 and currently final step of a more general purpose event loop:
support removal and addition of i/o file descriptors on the fly.

* detect closed file descriptors
* automatically free waiters of a dead file descriptor
* give the file server the possibility to specify a callback which
notifies of a dead file descriptor
* move loop function to be a property of the mainloop instead of
framebuf (doesn't change effective behaviour)
* add the possibility to configure a timespec parameter which
attempts to call the loop function periodically
* move the event loop functions from the puffs_framebuf namespace
to puffs_framev to differential between pure memory management
functions
 1.55 11-May-2007  pooka Step 2 of general-purpose eventloop: get rid of puffs_framebuf_eventloop().
puffs_mainloop() now handles that functionality as well.
 1.54 11-May-2007  pooka Step 1 in moving towards a general-purpose eventloop: allow the
framebuf event loop to take n i/o fd's as parameters and also allow
dynamic add/remove of fd's. (not tested except for one fd, but more
changes coming soon)
 1.53 09-May-2007  pooka Remove the puffs_usermount argument from puffs_req_handle(). It can
be found from the other arguments and this way puffs_req_handle() is
more symmetric with the other puffs_req() routines.
 1.52 07-May-2007  pooka Add puffs_setback(), which can be used to set setbacks for nodes before
the call returns to the kernel. Currently it can be called only from
open(), mmap(), remove() and rmdir(). (But that might change)
 1.51 06-May-2007  pooka Remove the user-specified argument for the framebuf loop callback.
It can be generated through other means if it is desired.
 1.50 05-May-2007  pooka Add puffs "frame buffers", which are an abstraction of the buffering
and event handling mechanisms required in file servers with blocking
I/O backends. puffs_framebuf is built on the concept of puffs_cc
and uses those to multiplex execution where needed.

File systems are required to implement three methods:
* read frame
* write frame
* compare if frame is a response to the given one

Memory management is provided by puffs_framebuf, but the file
systems must still, of course, interpret the protocol and do e.g.
byte order conversion.

As always, puffs_framebuf is work in progress. Current users are
mount_psshfs and mount_9p.
 1.49 01-May-2007  pooka Introduce PUFFS_FLAG_HASHPATH, which for PUFFS_FLAG_BUILDPATH file servers
creates a hash of the node's path into po->po_hash to avoid a full pathcmp
every time.
 1.48 22-Apr-2007  pooka use more accurate flag masking
 1.47 19-Apr-2007  pooka add puffs_cc_getspecific(pcc), which is shorthand for:
puffs_getspecific(puffs_cc_getusermount(pcc))
 1.46 17-Apr-2007  pooka Introduce PUFFS_STORE_DCOOKIE, which stores a directory cookie for a
given offset iff the directory read in question wants cookies.
 1.45 16-Apr-2007  pooka alloc to set flags when setting fhsize
 1.44 16-Apr-2007  pooka some routines for setting mount parameters
 1.43 13-Apr-2007  pooka Instead of keeping on adding parameters to puffs_mount(), make it
only take the bare essentials, which currently means removing
"maxreqlen" from the argument list (all current callers I'm aware
of set it as 0 anyway). Introduce puffs_init(), which provides a
context for setting various parameters and puffs_domount(), which
can be used to mount the file system. Keep puffs_mount() as a
shortcut for the above two for simple file systems.

Bump development ABI version to 13. After all, it's Friday the 13th.
Watch out! Bad things can happen on Friday the 13th. --No carrier--
 1.42 12-Apr-2007  pooka Hide struct puffs_usermount from the rest of the world and provide
accessors for interesting data in it. Namely, you can now get
pu->pu_privdata with puffs_getspecific(), pu->pu_pn_root with
puffs_set/getroot() and pu->pu_maxreqlen with puffs_getmaxreqlen().
 1.41 11-Apr-2007  pooka * support nodetofh and fhtonode callbacks
* use new signature of node_readdir
 1.40 06-Apr-2007  pooka support page cache flushing
 1.39 06-Apr-2007  pooka implement puffs_inval_pagecache_node_range()
 1.38 22-Mar-2007  pooka unify the location of *pcr in puffs_access_*
 1.37 22-Mar-2007  pooka * return -1 and set errno instead of returning errno directly
* introduce puffs_cred_isregular() which checks if the cred structure
has regular uid/gid (i.e. "person" credentials and not kernel creds)
 1.36 22-Mar-2007  pooka remove variable names from header
 1.35 21-Mar-2007  pooka add routiens which check against ufs semantics for permission to
chown, chmod and change a/mtime
 1.34 20-Mar-2007  pooka implement counterpart of vaccess()
 1.33 20-Mar-2007  pooka initial support for cacheops
 1.32 16-Mar-2007  pooka va->va_mode doesn't contain the full argument to the mknod() system call,
so introduce puffs_addvtype2mode() and use that in null.c to generate the
proper syscall argument
 1.31 15-Feb-2007  pooka Introduce puffs_path_walkcmp(), which is to be called from nodewalk
and compares the path of the node against the given pathobject.
Also make comparison method take a flag to indicate if it should
check if the second path is a true prefix of the first.

plus some namespace cleanup
 1.30 15-Feb-2007  pooka * get rid of the holy kernel-given ISDOTDOT, and instead define a
macro which does strcmp against ".." and (the untranslated)
componentname
* make PUFFS_FLAG_BUILDPATH build paths also if dotdot is the case,
and adapt the regular path objects to this
* make nullfs lookup readable because we can now get rid of dotdot
processing there
 1.29 26-Jan-2007  pooka add interfaces for suspending the file system
 1.28 20-Jan-2007  pooka Be consistent with the rest of the framework about the argument
order of puffs_docc and puffs_dopreq
 1.27 20-Jan-2007  pooka be consistent in naming request handlers
 1.26 16-Jan-2007  pooka revoke revoke
 1.25 15-Jan-2007  pooka Checkpoint some more work in progress: for the benefit those file
system backends which operate purely based on paths, push out more
path management into the library and make path management more
abstract: enable a file system to define a bunch of path management
callbacks, which are used by the framework. Management of normal
/this/is/a/path type paths is provided by the library.
 1.24 11-Jan-2007  pooka implement fsync
 1.23 11-Jan-2007  pooka Add preliminary code for a nullfs layer, which can be used to mount
a directory hierarchy to another point, just like with the kernel
nullfs. This is not really a layering scheme yet, but it should
evolve into one. Currently it can just be used to do 1:1 mapping.
 1.22 10-Jan-2007  pooka Be less shy about the default stack size, it's a only virtual memory space.
TODO: put a guard page at the end
 1.21 09-Jan-2007  pooka rename name cache invalidation interface to be in sync with the
kernel operation names, i.e. contain "namecache" instead of just "name"
 1.20 09-Jan-2007  pooka lib interface for invalidation routines
 1.19 06-Jan-2007  pooka * get rid of the mount callback; it's no great surprise to the
server that it needs to mount the file system backend if it wants
to call mount
* provide some options for getmntopts(), assume that callers will parse
command line (or fstab) args
* reorganize the puffs_cc interface just a bit, preparing for a bigger
revamp later
 1.18 02-Jan-2007  pooka * inform kernel of our version
* homegrown lib ABI check (to avoid bumping major a ludicrillion times
before reaching stability)
 1.17 29-Dec-2006  pooka checkpoint some experimental work-in-progress, namely:

Add support for having multiple outstanding operations. This is done
by exposing enough interfaces so that it is convenient to have the
main event loop in the implementation itself and by providing a
continuation framework for convinient blocking and rescheduling.

works fine, but will undergo further cleanup & development
 1.16 07-Dec-2006  pooka outline & export code for interfacing with kernel GET/PUT requests
 1.15 07-Dec-2006  pooka support mmap
 1.14 07-Dec-2006  pooka rototill the operation callbacks: unify the ops under struct puffs_ops
and namespace them
 1.13 01-Dec-2006  pooka PUFFSFLAG -> PUFFS_FLAG to be consistent with the kernel
 1.12 30-Nov-2006  pooka summon daemon(3) in mainloop unless the nodaemon flag is given
 1.11 23-Nov-2006  pooka const coherence
 1.10 21-Nov-2006  pooka mode_t to enum vtype conversion
 1.9 18-Nov-2006  pooka * call statvfs() at mount() time, pass that info along
* start is gone
 1.8 17-Nov-2006  pooka shuffle flags a bit
 1.7 14-Nov-2006  pooka namespace previous change under puffs_vfsnop to avoid confusions
 1.6 14-Nov-2006  pooka implement unmount, sync and statvfs as dummies for file system which
couldn't care less about implementing them
 1.5 09-Nov-2006  pooka * catch up with kernel changes
* better error handling when mounting
 1.4 07-Nov-2006  pooka * support FAF (Fire-And-Forget) class operations
* adapt to new lookup
 1.3 26-Oct-2006  pooka pass rdev for specfs support
 1.2 25-Oct-2006  pooka handle PUFFS_VN_INACTIVE
 1.1 22-Oct-2006  pooka add libpuffs - the userspace programming interface for puffs

This work was initially started and completed for Google SoC 2005
and tweaked to work a bit better in the past few weeks. While
being far from complete, it is functional enough to be able and
stable to host a fairly general-purpose in-memory file system in
userspace. Even so, puffs should be considered experimental and
no binary compatibility for interfaces or crash-freedom or zero
security implications should be relied upon just yet.

The GSoC project was mentored by William Studenmund and the final
review for the code was done by Christos.
 1.77.4.2 27-Jul-2007  pooka mmap fflags -> prot
 1.77.4.1 27-Jul-2007  pooka file puffs.h was added on branch matt-mips64 on 2007-07-27 08:28:17 +0000
 1.81.2.3 23-Mar-2008  matt sync with HEAD
 1.81.2.2 09-Jan-2008  matt sync with HEAD
 1.81.2.1 06-Nov-2007  matt sync with HEAD
 1.107.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.108.8.1 21-Apr-2010  matt sync to netbsd-5
 1.108.4.5 17-Jul-2011  riz Pull up following revision(s) (requested by manu in ticket #1645):
lib/libc/sys/Makefile.inc 1.207 via patch
lib/libc/sys/extattr_get_file.2 patch
lib/libpuffs/dispatcher.c 1.34,1.36 via patch
lib/libpuffs/puffs.c 1.107 via patch
lib/libpuffs/puffs.h 1.115,1.118 via patch
sys/fs/puffs/puffs_msgif.h 1.71,1.76 via patch
sys/fs/puffs/puffs_vfsops.c 1.88 via patch
sys/fs/puffs/puffs_vnops.c 1.145,1.154 via patch
sys/kern/vfs_xattr.c 1.24-1.27 via patch
sys/kern/vnode_if.c 1.87 via patch
sys/sys/Makefile 1.133 via patch
sys/sys/extattr.h 1.6 via patch
sys/sys/vnode_if.h 1.81 via patch
sys/ufs/ffs/ffs_vnops.c patch
sys/ufs/ufs/ufs_extattr.c 1.31,1.34 via patch

* support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
Support extended attributes.
Fix multiple non compliances in our Linux-like extattr API, and make it
public so that it can be used.
Improve a bit listxattr(2). It attemps to list both system and user
extended attributes, and it faled if calling user did not have privilege
for reading system EA. Now we just lise user EA and skip system EA in
reading them is not allowed.
Fix bug introduced in previous commuit: Do not vrele() a vnode we did not
obtained.
Improve UFS1 extended attributes usability
- autocreate attribute backing file for new attributes
- autoload attributes when issuing extattrctl start
- when autoloading attributes, do not display garbage warning when looking
up entries that got ENOENT
Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.
There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
extattr_list_file(2), which is obtanined by setting the
EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)
This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
 1.108.4.4 27-Oct-2009  bouyer Pull up following revision(s) (requested by pooka in ticket #1105):
lib/libpuffs/puffs.h: revision 1.112
lib/libpuffs/puffs.c: revision 1.100
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
lib/libpuffs/shlib_version: patch

Make it possible to supply parameters to puffs_init() later (but
before puffs_mount()).
 1.108.4.3 18-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1100):
lib/libpuffs/dispatcher.c: revision 1.33
lib/libpuffs/puffs.c: revision 1.99
lib/libpuffs/puffs.h: revision 1.111
sys/fs/puffs/puffs_msgif.h: revision 1.67 via patch
sys/fs/puffs/puffs_vnops.c: revision 1.136

Support VOP_ABORTOP() in puffs.
 1.108.4.2 16-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1095):
lib/libpuffs/puffs.c: revision 1.94
lib/libpuffs/puffs.h: revision 1.110

Add puffs_cancel(), which allows to back down after puffs_init()
and before puffs_mount().
 1.108.4.1 16-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1094):
lib/libpuffs/puffs.3: revision 1.45
lib/libpuffs/puffs.c: revision 1.93
lib/libpuffs/puffs.h: revision 1.109

Add function puffs_setspecific(pu, private) which can be used to set the
specific data after the call to puffs_init().
 1.119.4.5 03-Nov-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1140):
lib/libperfuse/ops.c 1.63-1.69
lib/libperfuse/perfuse.c 1.32-1.33
lib/libperfuse/perfuse_priv.h 1.32-1.34
lib/libperfuse/subr.c 1.20
lib/libpuffs/creds.c 1.16
lib/libpuffs/dispatcher.c 1.47
lib/libpuffs/puffs.h 1.125
lib/libpuffs/puffs_ops.3 1.37-1.38
lib/libpuffs/requests.c 1.24
sys/fs/puffs/puffs_msgif.h 1.81
sys/fs/puffs/puffs_sys.h 1.85
sys/fs/puffs/puffs_vnops.c 1.183
usr.sbin/perfused/msg.c 1.22
Bring libpuffs, libperfuse and perfused on par with -current:
- implement FUSE direct I/O
- remove useless code and warnings
- fix missing GETATTR bugs
- fix exended attribute get and list operations
 1.119.4.4 13-Sep-2012  riz Pull up following revision(s) (requested by manu in ticket #525):
lib/libpuffs/dispatcher.c: revision 1.44
lib/libp2k/p2k.c: revision 1.57
lib/libpuffs/puffs_ops.3: revision 1.35
lib/libpuffs/pnode.c: revision 1.13
lib/libpuffs/puffs.3: revision 1.56
lib/libpuffs/puffs.h: revision 1.124
Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.
The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.
It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.
- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.
- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.
- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.119.4.3 12-Aug-2012  martin branches: 1.119.4.3.2;
Pull up following revision(s) (requested by manu in ticket #438):
lib/libperfuse/perfuse_priv.h: revision 1.31
sys/fs/puffs/puffs_msgif.h: revision 1.80
sys/fs/puffs/puffs_vnops.c: revision 1.171
lib/libpuffs/puffs_ops.3: revision 1.31
sys/fs/puffs/puffs_vnops.c: revision 1.172
sys/fs/puffs/puffs_vnops.c: revision 1.173
sys/fs/puffs/puffs_vnops.c: revision 1.174
usr.sbin/perfused/perfused.c: revision 1.24
sys/fs/puffs/puffs_sys.h: revision 1.80
sys/fs/puffs/puffs_sys.h: revision 1.81
sys/fs/puffs/puffs_sys.h: revision 1.82
lib/libperfuse/subr.c: revision 1.19
lib/libperfuse/perfuse.c: revision 1.30
sys/fs/puffs/puffs_msgif.c: revision 1.90
sys/fs/puffs/puffs_msgif.c: revision 1.91
sys/fs/puffs/puffs_msgif.c: revision 1.92
lib/libperfuse/ops.c: revision 1.59
lib/libpuffs/puffs.3: revision 1.53
lib/libperfuse/debug.c: revision 1.12
lib/libpuffs/puffs.3: revision 1.54
sys/fs/puffs/puffs_vnops.c: revision 1.167
sys/fs/puffs/puffs_msgif.h: revision 1.79
usr.sbin/perfused/msg.c: revision 1.21
sys/fs/puffs/puffs_vfsops.c: revision 1.102
sys/fs/puffs/puffs_vfsops.c: revision 1.103
sys/fs/puffs/puffs_vfsops.c: revision 1.105
lib/libpuffs/puffs.h: revision 1.123
lib/libperfuse/perfuse_if.h: revision 1.20
lib/libperfuse/perfuse.c: revision 1.29
lib/libpuffs/dispatcher.c: revision 1.42
lib/libpuffs/dispatcher.c: revision 1.43
- Fix same vnodes associated with multiple cookies
The scheme used to retreive known nodes on lookup was flawed, as it only
used parent and name. This produced a different cookie for the same file
if it was renamed, when looking up ../ or when dealing with multiple files
associated with the same name through link(2).
We therefore abandon the use of node name and introduce hashed lists of
inodes. This causes a huge rewrite of reclaim code, which do not attempt
to keep parents allocated until all their children are reclaimed
- Fix race conditions in reclaim
There are a few situations where we issue multiple FUSE operations for
a PUFFS operation. On reclaim, we therefore have to wait for all FUSE
operation to complete, not just the current exchanges. We do this by
introducing node reference count with node_ref() and node_rele().
- Detect data loss caused by FAF
VOP_PUTPAGES causes FAF writes where the kernel does not check the
operation result. At least issue a warning on error.
- Enjoy FAF shortcut on setattr
No need to wait for the result if the kernel does not want it. There is
however an exception for setattr that touch the size, we need to wait
for completion because we have other operations queued for after the
resize.
- Fix fchmod() on write-open file
fchmod() on a node open with write privilege will send setattr with both mode
and size set. This confuses some FUSE filesystem. Therefore we send two FUSE
operations, one for mode, and one for size.
- Remove node TTL handling for netbsd-5 for simplicity sake. The code
still builds on netbsd-5 but does not have the node TTL feature anymore.
It works fine with kernel support on netbsd-6.
- Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.
The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.
We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.
- Fix lookup/reclaim race condition.
The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.
We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
Fix hang unmount bug introduced by last commit.
We introduced a slow queue for delayed reclaims, while the existing
queue for unmount, flush and exist has been renamed fast queue. Both
queues had timestamp for when an operation should be done, but it was
useless for the fast queue, which is always used to run an operation
ASAP. And the timestamp test had an error that turned ASAP into "at next
tick", but nobody what there to wake the thread at next tick, hence
the hang. The fix is to remove the useless and buggy timestamp test for
fast queue.
Rename slow sopreq queue into node sopreq queue, to refet the fact that
is only intended for postponed node reclaims.
When purging the node sopreq queue, do not call puffs_msg_sendresp(), as
it makes no sense.
Fix race condition between (create|mknod|mkdir|symlino) and reclaim, just
like we did it between lookup and reclaim.
Missing bit in previous commit (prevent race between create|mknod|mkdir|symlink
and reclaim)
Bump date for previous.
New sentence, new line; remove trailing whitespace; fix typos;
punctuation nits.
Add PUFFS_KFLAG_CACHE_DOTDOT so that vnodes hold a reference on their
parent, keeping them active, and allowing to lookup .. without sending
a request to the filesystem.
Enable the featuure for perfused, as this is how FUSE works.
Missing bit in previous commit (PUFFS_KFLAG_CACHE_DOTDOT option to avoid
looking up ..)
 1.119.4.2 05-Jul-2012  riz Pull up following revision(s) (requested by manu in ticket #392):
lib/libpuffs/puffs_ops.3: revision 1.32
lib/libperfuse/ops.c: revision 1.58
lib/libpuffs/puffs.h: revision 1.122
lib/libpuffs/dispatcher.c: revision 1.41
lib/libperfuse/perfuse_priv.h: revision 1.30
Pass the FAF flag to handlers:
- setattr_ttl is updated to add a flag argument. Since it was not
present in
a previous release, we can change its API
- write2 is introduced, this is write with an extra flag for FAF.
- fsync already has the FAF information in a flag and needs no change
- for other operations, FAF is unconditional
Fix the build by adding (unused) flags argument to
perfuse_node_setattr_ttl
 1.119.4.1 23-Apr-2012  riz Pull up following revision(s) (requested by manu in ticket #195):
lib/libskey/skeysubr.c: revision 1.27
lib/libkvm/kvm_getloadavg.c: revision 1.11
lib/libwrap/update.c: revision 1.9
lib/liby/yyerror.c: revision 1.9
lib/libpuffs/puffs_ops.3: revision 1.30
lib/libwrap/misc.c: revision 1.10
lib/libwrap/hosts_access.c: revision 1.20
lib/libpuffs/pnode.c: revision 1.11
lib/libperfuse/subr.c: revision 1.17
lib/libpuffs/pnode.c: revision 1.12
lib/libperfuse/subr.c: revision 1.18
lib/libwrap/options.c: revision 1.15
lib/libwrap/fix_options.c: revision 1.11
lib/libperfuse/ops.c: revision 1.52
lib/libperfuse/ops.c: revision 1.53
lib/libperfuse/ops.c: revision 1.54
lib/libwrap/hosts_ctl.c: revision 1.5
lib/libintl/gettext.c: revision 1.27
lib/libwrap/shell_cmd.c: revision 1.6
lib/libpuffs/dispatcher.c: revision 1.39
lib/libperfuse/perfuse_priv.h: revision 1.27
lib/libwrap/socket.c: revision 1.19
lib/libpuffs/puffs.3: revision 1.50
lib/libperfuse/perfuse_priv.h: revision 1.28
lib/libpuffs/puffs_priv.h: revision 1.45
lib/libpuffs/puffs.3: revision 1.51
lib/libperfuse/perfuse_priv.h: revision 1.29
lib/libwrap/percent_x.c: revision 1.5
lib/libpuffs/puffs.3: revision 1.52
lib/libperfuse/debug.c: revision 1.11
sys/fs/puffs/puffs_vnops.c: revision 1.165
lib/libwrap/tcpd.h: revision 1.13
sys/fs/puffs/puffs_vnops.c: revision 1.166
lib/libwrap/eval.c: revision 1.7
sys/fs/puffs/puffs_msgif.h: revision 1.78
sys/fs/puffs/puffs_vfsops.c: revision 1.101
lib/libwrap/rfc931.c: revision 1.9
lib/libwrap/clean_exit.c: revision 1.5
lib/libpuffs/puffs.h: revision 1.120
lib/libc/stdlib/jemalloc.c: revision 1.27
lib/librmt/rmtlib.c: revision 1.26
lib/libpuffs/puffs.h: revision 1.121
sys/fs/puffs/puffs_sys.h: revision 1.79
lib/librumpclient/rumpclient.c: revision 1.48
lib/libwrap/refuse.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.26
lib/libperfuse/perfuse.c: revision 1.27
tests/fs/puffs/t_fuzz.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.28
lib/libpuffs/dispatcher.c: revision 1.40
sys/fs/puffs/puffs_node.c: revision 1.24
lib/libwrap/diag.c: revision 1.9
lib/libintl/textdomain.c: revision 1.13
Use C89 function definition
Add name and atttribute cache with filesytem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
Use new PUFFS_KFLAG_CACHE_FS_TTL option to puffs_init(3) so that
FUSE TTL on name and attributes are used. This save many PUFFS
operations and improves performances.
PUFFS_KFLAG_CACHE_FS_TTL is #ifdef'ed in many places for now so that
libperfuse can still be used on netbsd-5.
Split file system.
Comma fixes.
Remove dangling &quot;and&quot;.
Bump date for previous.
- Makesure update_va does not change vnode size when it should not. For
instance when doing a fault-issued VOP_GETPAGES within VOP_WRITE, changing
size leads to panic: genfs_getpages: past eof.
-Handle ticks wrap around for vnode name andattribute timeout
- When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM
(how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
Do not set PUFFS_KFLAG_CACHE_FS_TTL for PUFFS tests
 1.119.4.3.2.1 01-Nov-2012  matt sync with netbsd-6-0-RELEASE.
 1.119.2.3 30-Oct-2012  yamt sync with head
 1.119.2.2 23-May-2012  yamt sync with head.
 1.119.2.1 17-Apr-2012  yamt sync with head
 1.124.10.2 05-Nov-2014  snj Pull up following revision(s) (requested by manu in ticket #181):
lib/libperfuse/fuse.h: revision 1.6
lib/libperfuse/ops.c: revision 1.78
lib/libperfuse/perfuse.c: revision 1.35
lib/libperfuse/perfuse_priv.h: revision 1.36
lib/libpuffs/dispatcher.c: revision 1.48
lib/libpuffs/opdump.c: revision 1.37
lib/libpuffs/puffs.c: revision 1.118
lib/libpuffs/puffs.h: revision 1.126
lib/libpuffs/puffs_ops.3: revisions 1.40-1.41
sys/fs/puffs/puffs_msgif.h: revision 1.82-1.83
sys/fs/puffs/puffs_msgif.h: revision 1.82
sys/fs/puffs/puffs_vnops.c: revision 1.196
Add PUFFS support for fallocate and fdiscard operations
--
libpuffs support for fallocate and fdiscard operations
--
Add PUFFS_HAVE_FALLOCATE in puffs_msgif.h so that filesystem can decide
at build time wether fallocate is usable
--
FUSE fallocate support
There seems to be no fdiscard FUSE operation at the moment, hence that
one is left unused.
 1.124.10.1 24-Aug-2014  martin Pull up following revision(s) (requested by manu in ticket #52):
lib/libperfuse/perfuse_priv.h: revision 1.33
lib/libperfuse/ops.c: revision 1.67
lib/libpuffs/dispatcher.c: revision 1.47
lib/libperfuse/perfuse_priv.h: revision 1.34
lib/libperfuse/ops.c: revision 1.68
lib/libperfuse/ops.c: revision 1.69
lib/libpuffs/puffs_ops.3: revision 1.37
lib/libpuffs/puffs_ops.3: revision 1.38
lib/libperfuse/perfuse.c: revision 1.32
lib/libperfuse/perfuse.c: revision 1.33
usr.sbin/perfused/msg.c: revision 1.22
lib/libpuffs/puffs.h: revision 1.125
Implement FUSE direct I/O.
Remove useless code and warnings
 1.127.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.14 11-Apr-2009  wiz New sentence, new line.
 1.13 20-Feb-2009  pooka Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.12 25-May-2008  wiz branches: 1.12.4; 1.12.6;
Punctuation markup nit.
 1.11 28-Jan-2008  pooka branches: 1.11.4; 1.11.6;
Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed. Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts. The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
 1.10 15-Dec-2007  pooka update to match reality
 1.9 07-Dec-2007  pooka puffs_cc_getusermount(), puffs_cc_getspecific() and puffs_docc() are dead.
 1.8 01-Dec-2007  wiz Fix a typo that has migrated across files.
 1.7 21-Oct-2007  pooka Add puffs_cc_schedule() which marks a pcc runnable and will pass
execution to it when in the main loop the next time.
 1.6 06-May-2007  pooka branches: 1.6.4;
Xr puffs_framebuf
 1.5 19-Apr-2007  pooka improve descriptions and markup
 1.4 19-Apr-2007  pooka add puffs_cc_getspecific(pcc), which is shorthand for:
puffs_getspecific(puffs_cc_getusermount(pcc))
 1.3 20-Jan-2007  pooka document puffs_docc
 1.2 20-Jan-2007  wiz Sort SEE ALSO.
 1.1 19-Jan-2007  pooka Bring the documentation slightly more into sync with the current
reality. It's still really a far cry from proper documentation,
though.
 1.6.4.3 23-Mar-2008  matt sync with HEAD
 1.6.4.2 09-Jan-2008  matt sync with HEAD
 1.6.4.1 06-Nov-2007  matt sync with HEAD
 1.11.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.11.4.1 04-Jun-2008  yamt sync with head
 1.12.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.12.4.1 24-Feb-2009  snj Pull up following revision(s) (requested by pooka in ticket #484):
lib/libpuffs/puffs.3: revision 1.46
lib/libpuffs/puffs_cc.3: revision 1.13
lib/libpuffs/puffs_cred.3: revision 1.4
lib/libpuffs/puffs_flush.3: revision 1.8
lib/libpuffs/puffs_framebuf.3: revision 1.26
lib/libpuffs/puffs_node.3: revision 1.4
lib/libpuffs/puffs_ops.3: revision 1.23
lib/libpuffs/puffs_path.3: revision 1.4
lib/libpuffs/puffs_suspend.3: revision 1.3
Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.5 11-Apr-2009  joerg Fix missing quote.
 1.4 20-Feb-2009  pooka Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.3 01-Dec-2007  wiz branches: 1.3.12; 1.3.14;
Fix a typo that has migrated across files.
 1.2 18-Oct-2007  pooka * Change type of boolean functions to, well, boolean instead of int.
* add puffs_cid_isequal() which can be used to test if the two caller
id's refer to the same process/lwp.
 1.1 22-Mar-2007  pooka branches: 1.1.4;
document credentials & access control methods
 1.1.4.2 09-Jan-2008  matt sync with HEAD
 1.1.4.1 06-Nov-2007  matt sync with HEAD
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.3.12.1 24-Feb-2009  snj Pull up following revision(s) (requested by pooka in ticket #484):
lib/libpuffs/puffs.3: revision 1.46
lib/libpuffs/puffs_cc.3: revision 1.13
lib/libpuffs/puffs_cred.3: revision 1.4
lib/libpuffs/puffs_flush.3: revision 1.8
lib/libpuffs/puffs_framebuf.3: revision 1.26
lib/libpuffs/puffs_node.3: revision 1.4
lib/libpuffs/puffs_ops.3: revision 1.23
lib/libpuffs/puffs_path.3: revision 1.4
lib/libpuffs/puffs_suspend.3: revision 1.3
Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.8 20-Feb-2009  pooka Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.7 12-Aug-2008  pooka branches: 1.7.4; 1.7.6;
Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.6 01-Dec-2007  wiz branches: 1.6.8;
Fix another persistent spello.
 1.5 01-Dec-2007  wiz Fix a typo that has migrated across files.
 1.4 17-May-2007  pooka branches: 1.4.4;
struct puffs_usermoint does sound more lively, but be serious and
fix the typos to puffs_usermount
 1.3 06-Apr-2007  pooka document the flush routines
 1.2 06-Apr-2007  pooka document puffs_inval_pagecache_node{,_range}
 1.1 19-Jan-2007  pooka Bring the documentation slightly more into sync with the current
reality. It's still really a far cry from proper documentation,
though.
 1.4.4.1 09-Jan-2008  matt sync with HEAD
 1.6.8.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.7.4.1 24-Feb-2009  snj Pull up following revision(s) (requested by pooka in ticket #484):
lib/libpuffs/puffs.3: revision 1.46
lib/libpuffs/puffs_cc.3: revision 1.13
lib/libpuffs/puffs_cred.3: revision 1.4
lib/libpuffs/puffs_flush.3: revision 1.8
lib/libpuffs/puffs_framebuf.3: revision 1.26
lib/libpuffs/puffs_node.3: revision 1.4
lib/libpuffs/puffs_ops.3: revision 1.23
lib/libpuffs/puffs_path.3: revision 1.4
lib/libpuffs/puffs_suspend.3: revision 1.3
Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.30 16-Feb-2015  wiz Sort sections.
 1.29 01-Apr-2010  pooka fix a few pastos
 1.28 04-Jan-2010  pooka fix typography
 1.27 22-Nov-2009  mbalmer s/the the/the/
 1.26 20-Feb-2009  pooka Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.25 06-Sep-2008  wiz branches: 1.25.4; 1.25.6;
Drop trailing whitespace.
 1.24 06-Sep-2008  pooka Add AsiaBSDCon 2008 paper to SEE ALSO.
 1.23 29-Jan-2008  pooka branches: 1.23.6;
whoops, bump date - pretty significant change
 1.22 29-Jan-2008  pooka Fix a weirdosity in the framebuf gotfb interface: hand buffer
ownership to the called routine instead of keeping it. This means
that callees must now destroy the buffer once they are done with it.
 1.21 08-Dec-2007  wiz Fix typo, remove superfluous minus and describe "fd" as file descriptor
in two places.
 1.20 04-Dec-2007  pooka tyop: reserver -> reserve
 1.19 02-Dec-2007  wiz Add comma in enumeration. Punctuation nits. Fix a typo.
 1.18 01-Dec-2007  wiz Fix another persistent spello.
 1.17 01-Dec-2007  wiz Fix a typo that has migrated across files.
 1.16 01-Dec-2007  pooka fix gotframe signature to match code
 1.15 05-Oct-2007  pooka SEE ALSO paper
 1.14 02-Oct-2007  pooka minor updates/clarifications
 1.13 06-Sep-2007  pooka document puffs_framev_framebuf_ccpromote()
 1.12 06-Sep-2007  pooka Give cmpframe() the ability to shortcircuit the comparison loop by
signalling back that the buffer under examination is not a response
at all.
 1.11 01-Sep-2007  pooka Add gotframe callback, which is called if an incoming frame matches
no outstanding request.
 1.10 21-Jul-2007  pooka branches: 1.10.4; 1.10.6;
document puffs_framev_enqueue_waitevent
 1.9 08-Jul-2007  pooka bring up-to-date
 1.8 06-Jul-2007  pooka make few function types match reality
 1.7 20-May-2007  pooka Change the signature of puffs_respcmp to return -1,0,1 for smaller,
equal, larger, respectively instead of 0/1 for non/equal. This
will allow sorting the buffers for faster matching in libpuffs.
While here, change the name from respcmp to framecmp, as that better
reflects the purpose.

NOTE! there is no obvious way to make compilation fail for file
systems which may already be using this feature (although I don't
think there are any outside our tree, as the feature is two weeks
old). Nevertheless, non-updated file systems will fail very quickly.
 1.6 16-May-2007  pooka remember to document puffs_framev_cb error parameter addition
 1.5 16-May-2007  pooka switch the arbitrary default errno value for network i/o from
ECONNABORTED to ECONNRESET, which is at least a little bit better
 1.4 16-May-2007  pooka update .Nd to reflect current reality better
 1.3 15-May-2007  pooka Step 3 and currently final step of a more general purpose event loop:
support removal and addition of i/o file descriptors on the fly.

* detect closed file descriptors
* automatically free waiters of a dead file descriptor
* give the file server the possibility to specify a callback which
notifies of a dead file descriptor
* move loop function to be a property of the mainloop instead of
framebuf (doesn't change effective behaviour)
* add the possibility to configure a timespec parameter which
attempts to call the loop function periodically
* move the event loop functions from the puffs_framebuf namespace
to puffs_framev to differential between pure memory management
functions
 1.2 06-May-2007  pooka document puffs_framebuf
 1.1 05-May-2007  pooka add stubby version of puffs_framebuf manual page. proper one
forthcoming to an internet near you Real Soon Now(tm)
 1.10.6.2 21-Jul-2007  pooka document puffs_framev_enqueue_waitevent
 1.10.6.1 21-Jul-2007  pooka file puffs_framebuf.3 was added on branch matt-mips64 on 2007-07-21 09:36:50 +0000
 1.10.4.3 23-Mar-2008  matt sync with HEAD
 1.10.4.2 09-Jan-2008  matt sync with HEAD
 1.10.4.1 06-Nov-2007  matt sync with HEAD
 1.23.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.25.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.25.4.1 24-Feb-2009  snj Pull up following revision(s) (requested by pooka in ticket #484):
lib/libpuffs/puffs.3: revision 1.46
lib/libpuffs/puffs_cc.3: revision 1.13
lib/libpuffs/puffs_cred.3: revision 1.4
lib/libpuffs/puffs_flush.3: revision 1.8
lib/libpuffs/puffs_framebuf.3: revision 1.26
lib/libpuffs/puffs_node.3: revision 1.4
lib/libpuffs/puffs_ops.3: revision 1.23
lib/libpuffs/puffs_path.3: revision 1.4
lib/libpuffs/puffs_suspend.3: revision 1.3
Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.6 04-Aug-2021  andvar fix typos in puffs man pages.
 1.5 13-May-2009  wiz No Pp needed before El.
 1.4 20-Feb-2009  pooka Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.3 01-Dec-2007  wiz branches: 1.3.12; 1.3.14;
Fix a typo that has migrated across files.
 1.2 24-Jun-2007  pooka branches: 1.2.4;
* document puffs_pn_remove
* all-around improve the manual page
 1.1 19-Jan-2007  pooka Bring the documentation slightly more into sync with the current
reality. It's still really a far cry from proper documentation,
though.
 1.2.4.1 09-Jan-2008  matt sync with HEAD
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.3.12.1 24-Feb-2009  snj Pull up following revision(s) (requested by pooka in ticket #484):
lib/libpuffs/puffs.3: revision 1.46
lib/libpuffs/puffs_cc.3: revision 1.13
lib/libpuffs/puffs_cred.3: revision 1.4
lib/libpuffs/puffs_flush.3: revision 1.8
lib/libpuffs/puffs_framebuf.3: revision 1.26
lib/libpuffs/puffs_node.3: revision 1.4
lib/libpuffs/puffs_ops.3: revision 1.23
lib/libpuffs/puffs_path.3: revision 1.4
lib/libpuffs/puffs_suspend.3: revision 1.3
Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.48 03-Dec-2021  pho Avoid using register_t or vsize_t in <puffs.h>

<puffs.h> is a user-space header, and should not use any of
kernel-only types. It's not reasonable to require user-land
filesystems to #define _KERNTYPES.
 1.47 04-Aug-2021  andvar fix typos in puffs man pages.
 1.46 03-Jul-2017  wiz Remove workaround for ancient HTML generation code.
 1.45 29-Aug-2016  tnn mention puffs_node_pathconf and puffs_node_advlock
 1.44 12-Nov-2015  christos consistency fixes.
 1.43 09-Nov-2015  christos fix return type
 1.42 16-Feb-2015  wiz filesystem -> file system
 1.41 31-Oct-2014  wiz Bump date for previous. Remove trailing space.
 1.40 31-Oct-2014  manu libpuffs support for fallocate and fdiscard operations
 1.39 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.38 16-Aug-2014  wiz Bump date for previous.
 1.37 16-Aug-2014  manu Add an open2 method, like open but with an additionnal oflags used
by the filesystem to send back information about the file.
This is used to implement PUFFS_OPEN_IO_DIRECT by which the filesystem
tells the kernel that read/write should bypass the page cache.
 1.36 16-Aug-2012  wiz branches: 1.36.10;
Whitespace fixes. Bump date for previous.
 1.35 16-Aug-2012  manu Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.

The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.

It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.

- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.

- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.

- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.34 28-Jul-2012  njoly Kill extra Fc macro.
 1.33 27-Jun-2012  wiz Bump date for previous, remove trailing whitespace.
 1.32 27-Jun-2012  manu Pass the FAF flag to handlers:
- setattr_ttl is updated to add a flag argument. Since it was not present in
a previous release, we can change its API
- write2 is introduced, this is write with an extra flag for FAF.
- fsync already has the FAF information in a flag and needs no change
- for other operations, FAF is unconditional
 1.31 18-Apr-2012  wiz Bump date for previous.
New sentence, new line; remove trailing whitespace; fix typos;
punctuation nits.
 1.30 18-Apr-2012  manu - When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM (how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
 1.29 04-Jul-2011  manu branches: 1.29.2; 1.29.4;
Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.

There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
extattr_list_file(2), which is obtanined by setting the
EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)

This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
 1.28 19-Apr-2011  manu In node_lookup() ops, pcn->pcn_nameiop contains a NAMEI_* constant, not
PUFFSLOOKUP_*
 1.27 13-Dec-2010  pooka document abortop. part of PR kern/44208
 1.26 21-May-2010  pooka mention extended attribute ops
 1.25 11-Apr-2009  wiz New sentence, new line.
 1.24 11-Apr-2009  joerg Fix markup.
 1.23 20-Feb-2009  pooka Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.22 25-Nov-2008  pooka branches: 1.22.2;
i'm almost certain that puffs_cooie_t is supposed to be puffs_cookie_t
 1.21 12-Aug-2008  pooka branches: 1.21.4;
Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.20 16-Dec-2007  pooka branches: 1.20.6;
Clarify that link_target in node_symlink is null-terminated.
 1.19 02-Dec-2007  wiz Add comma in enumeration.
 1.18 01-Dec-2007  wiz Fix a typo that has migrated across files.
 1.17 30-Nov-2007  pooka Rototill.

Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?). Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it. This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
 1.16 27-Nov-2007  pooka Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces. puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
 1.15 31-Jul-2007  pooka branches: 1.15.2; 1.15.4;
Per rumble's lead in vnodeops, clarify the bit about readdir cookies.
 1.14 25-Jul-2007  pooka * add missing credential handle to fsync args
* and now with more cosmetic attack
 1.13 25-Jul-2007  pooka pure cosmetics: minor facelift
 1.12 20-Jul-2007  pooka note caveat with puffs_node_poll
 1.11 19-Jul-2007  wiz Use HTML escapes. Drop trailing whitespace. Punctuation nits.
 1.10 19-Jul-2007  pooka wizd reminded me that if I provide the synopsis for puffs_node_seek(),
I would do well to also describe what it does. so make it so.
 1.9 18-Jul-2007  pooka uncomment puffs_node_seek - it's supported and in use
 1.8 18-Jul-2007  pooka puffs_cid* is always const
 1.7 05-Jul-2007  pooka apply ketchup to recent source changes in libpuffs
 1.6 18-May-2007  pooka document puffs_node_poll
 1.5 09-May-2007  pooka document puffs_setback()
 1.4 18-Apr-2007  pooka fix readdir prototype
 1.3 17-Apr-2007  pooka * describe fhtonode, nodetofh and suspend
* update description of readdir to match reality
 1.2 17-Apr-2007  pooka improve markup and descriptions
 1.1 16-Apr-2007  pooka Move file system and node callbacks into their own manual page.
Improve markup and descriptions a bit (not completely finished yet).
 1.15.4.2 31-Jul-2007  pooka Per rumble's lead in vnodeops, clarify the bit about readdir cookies.
 1.15.4.1 31-Jul-2007  pooka file puffs_ops.3 was added on branch matt-mips64 on 2007-07-31 21:48:19 +0000
 1.15.2.1 09-Jan-2008  matt sync with HEAD
 1.20.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.21.4.2 12-Apr-2009  snj Pull up following revision(s) (requested by joerg in ticket #691):
lib/libpuffs/puffs_ops.3: revision 1.24
Fix markup.
 1.21.4.1 24-Feb-2009  snj Pull up following revision(s) (requested by pooka in ticket #484):
lib/libpuffs/puffs.3: revision 1.46
lib/libpuffs/puffs_cc.3: revision 1.13
lib/libpuffs/puffs_cred.3: revision 1.4
lib/libpuffs/puffs_flush.3: revision 1.8
lib/libpuffs/puffs_framebuf.3: revision 1.26
lib/libpuffs/puffs_node.3: revision 1.4
lib/libpuffs/puffs_ops.3: revision 1.23
lib/libpuffs/puffs_path.3: revision 1.4
lib/libpuffs/puffs_suspend.3: revision 1.3
Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.22.2.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.29.4.5 03-Nov-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1140):
lib/libperfuse/ops.c 1.63-1.69
lib/libperfuse/perfuse.c 1.32-1.33
lib/libperfuse/perfuse_priv.h 1.32-1.34
lib/libperfuse/subr.c 1.20
lib/libpuffs/creds.c 1.16
lib/libpuffs/dispatcher.c 1.47
lib/libpuffs/puffs.h 1.125
lib/libpuffs/puffs_ops.3 1.37-1.38
lib/libpuffs/requests.c 1.24
sys/fs/puffs/puffs_msgif.h 1.81
sys/fs/puffs/puffs_sys.h 1.85
sys/fs/puffs/puffs_vnops.c 1.183
usr.sbin/perfused/msg.c 1.22
Bring libpuffs, libperfuse and perfused on par with -current:
- implement FUSE direct I/O
- remove useless code and warnings
- fix missing GETATTR bugs
- fix exended attribute get and list operations
 1.29.4.4 13-Sep-2012  riz Pull up following revision(s) (requested by manu in ticket #525):
lib/libpuffs/dispatcher.c: revision 1.44
lib/libp2k/p2k.c: revision 1.57
lib/libpuffs/puffs_ops.3: revision 1.35
lib/libpuffs/pnode.c: revision 1.13
lib/libpuffs/puffs.3: revision 1.56
lib/libpuffs/puffs.h: revision 1.124
Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.
The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.
It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.
- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.
- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.
- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
 1.29.4.3 12-Aug-2012  martin branches: 1.29.4.3.2;
Pull up following revision(s) (requested by manu in ticket #438):
lib/libperfuse/perfuse_priv.h: revision 1.31
sys/fs/puffs/puffs_msgif.h: revision 1.80
sys/fs/puffs/puffs_vnops.c: revision 1.171
lib/libpuffs/puffs_ops.3: revision 1.31
sys/fs/puffs/puffs_vnops.c: revision 1.172
sys/fs/puffs/puffs_vnops.c: revision 1.173
sys/fs/puffs/puffs_vnops.c: revision 1.174
usr.sbin/perfused/perfused.c: revision 1.24
sys/fs/puffs/puffs_sys.h: revision 1.80
sys/fs/puffs/puffs_sys.h: revision 1.81
sys/fs/puffs/puffs_sys.h: revision 1.82
lib/libperfuse/subr.c: revision 1.19
lib/libperfuse/perfuse.c: revision 1.30
sys/fs/puffs/puffs_msgif.c: revision 1.90
sys/fs/puffs/puffs_msgif.c: revision 1.91
sys/fs/puffs/puffs_msgif.c: revision 1.92
lib/libperfuse/ops.c: revision 1.59
lib/libpuffs/puffs.3: revision 1.53
lib/libperfuse/debug.c: revision 1.12
lib/libpuffs/puffs.3: revision 1.54
sys/fs/puffs/puffs_vnops.c: revision 1.167
sys/fs/puffs/puffs_msgif.h: revision 1.79
usr.sbin/perfused/msg.c: revision 1.21
sys/fs/puffs/puffs_vfsops.c: revision 1.102
sys/fs/puffs/puffs_vfsops.c: revision 1.103
sys/fs/puffs/puffs_vfsops.c: revision 1.105
lib/libpuffs/puffs.h: revision 1.123
lib/libperfuse/perfuse_if.h: revision 1.20
lib/libperfuse/perfuse.c: revision 1.29
lib/libpuffs/dispatcher.c: revision 1.42
lib/libpuffs/dispatcher.c: revision 1.43
- Fix same vnodes associated with multiple cookies
The scheme used to retreive known nodes on lookup was flawed, as it only
used parent and name. This produced a different cookie for the same file
if it was renamed, when looking up ../ or when dealing with multiple files
associated with the same name through link(2).
We therefore abandon the use of node name and introduce hashed lists of
inodes. This causes a huge rewrite of reclaim code, which do not attempt
to keep parents allocated until all their children are reclaimed
- Fix race conditions in reclaim
There are a few situations where we issue multiple FUSE operations for
a PUFFS operation. On reclaim, we therefore have to wait for all FUSE
operation to complete, not just the current exchanges. We do this by
introducing node reference count with node_ref() and node_rele().
- Detect data loss caused by FAF
VOP_PUTPAGES causes FAF writes where the kernel does not check the
operation result. At least issue a warning on error.
- Enjoy FAF shortcut on setattr
No need to wait for the result if the kernel does not want it. There is
however an exception for setattr that touch the size, we need to wait
for completion because we have other operations queued for after the
resize.
- Fix fchmod() on write-open file
fchmod() on a node open with write privilege will send setattr with both mode
and size set. This confuses some FUSE filesystem. Therefore we send two FUSE
operations, one for mode, and one for size.
- Remove node TTL handling for netbsd-5 for simplicity sake. The code
still builds on netbsd-5 but does not have the node TTL feature anymore.
It works fine with kernel support on netbsd-6.
- Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.
The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.
We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.
- Fix lookup/reclaim race condition.
The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.
We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
Fix hang unmount bug introduced by last commit.
We introduced a slow queue for delayed reclaims, while the existing
queue for unmount, flush and exist has been renamed fast queue. Both
queues had timestamp for when an operation should be done, but it was
useless for the fast queue, which is always used to run an operation
ASAP. And the timestamp test had an error that turned ASAP into "at next
tick", but nobody what there to wake the thread at next tick, hence
the hang. The fix is to remove the useless and buggy timestamp test for
fast queue.
Rename slow sopreq queue into node sopreq queue, to refet the fact that
is only intended for postponed node reclaims.
When purging the node sopreq queue, do not call puffs_msg_sendresp(), as
it makes no sense.
Fix race condition between (create|mknod|mkdir|symlino) and reclaim, just
like we did it between lookup and reclaim.
Missing bit in previous commit (prevent race between create|mknod|mkdir|symlink
and reclaim)
Bump date for previous.
New sentence, new line; remove trailing whitespace; fix typos;
punctuation nits.
Add PUFFS_KFLAG_CACHE_DOTDOT so that vnodes hold a reference on their
parent, keeping them active, and allowing to lookup .. without sending
a request to the filesystem.
Enable the featuure for perfused, as this is how FUSE works.
Missing bit in previous commit (PUFFS_KFLAG_CACHE_DOTDOT option to avoid
looking up ..)
 1.29.4.2 05-Jul-2012  riz Pull up following revision(s) (requested by manu in ticket #392):
lib/libpuffs/puffs_ops.3: revision 1.32
lib/libperfuse/ops.c: revision 1.58
lib/libpuffs/puffs.h: revision 1.122
lib/libpuffs/dispatcher.c: revision 1.41
lib/libperfuse/perfuse_priv.h: revision 1.30
Pass the FAF flag to handlers:
- setattr_ttl is updated to add a flag argument. Since it was not
present in
a previous release, we can change its API
- write2 is introduced, this is write with an extra flag for FAF.
- fsync already has the FAF information in a flag and needs no change
- for other operations, FAF is unconditional
Fix the build by adding (unused) flags argument to
perfuse_node_setattr_ttl
 1.29.4.1 23-Apr-2012  riz Pull up following revision(s) (requested by manu in ticket #195):
lib/libskey/skeysubr.c: revision 1.27
lib/libkvm/kvm_getloadavg.c: revision 1.11
lib/libwrap/update.c: revision 1.9
lib/liby/yyerror.c: revision 1.9
lib/libpuffs/puffs_ops.3: revision 1.30
lib/libwrap/misc.c: revision 1.10
lib/libwrap/hosts_access.c: revision 1.20
lib/libpuffs/pnode.c: revision 1.11
lib/libperfuse/subr.c: revision 1.17
lib/libpuffs/pnode.c: revision 1.12
lib/libperfuse/subr.c: revision 1.18
lib/libwrap/options.c: revision 1.15
lib/libwrap/fix_options.c: revision 1.11
lib/libperfuse/ops.c: revision 1.52
lib/libperfuse/ops.c: revision 1.53
lib/libperfuse/ops.c: revision 1.54
lib/libwrap/hosts_ctl.c: revision 1.5
lib/libintl/gettext.c: revision 1.27
lib/libwrap/shell_cmd.c: revision 1.6
lib/libpuffs/dispatcher.c: revision 1.39
lib/libperfuse/perfuse_priv.h: revision 1.27
lib/libwrap/socket.c: revision 1.19
lib/libpuffs/puffs.3: revision 1.50
lib/libperfuse/perfuse_priv.h: revision 1.28
lib/libpuffs/puffs_priv.h: revision 1.45
lib/libpuffs/puffs.3: revision 1.51
lib/libperfuse/perfuse_priv.h: revision 1.29
lib/libwrap/percent_x.c: revision 1.5
lib/libpuffs/puffs.3: revision 1.52
lib/libperfuse/debug.c: revision 1.11
sys/fs/puffs/puffs_vnops.c: revision 1.165
lib/libwrap/tcpd.h: revision 1.13
sys/fs/puffs/puffs_vnops.c: revision 1.166
lib/libwrap/eval.c: revision 1.7
sys/fs/puffs/puffs_msgif.h: revision 1.78
sys/fs/puffs/puffs_vfsops.c: revision 1.101
lib/libwrap/rfc931.c: revision 1.9
lib/libwrap/clean_exit.c: revision 1.5
lib/libpuffs/puffs.h: revision 1.120
lib/libc/stdlib/jemalloc.c: revision 1.27
lib/librmt/rmtlib.c: revision 1.26
lib/libpuffs/puffs.h: revision 1.121
sys/fs/puffs/puffs_sys.h: revision 1.79
lib/librumpclient/rumpclient.c: revision 1.48
lib/libwrap/refuse.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.26
lib/libperfuse/perfuse.c: revision 1.27
tests/fs/puffs/t_fuzz.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.28
lib/libpuffs/dispatcher.c: revision 1.40
sys/fs/puffs/puffs_node.c: revision 1.24
lib/libwrap/diag.c: revision 1.9
lib/libintl/textdomain.c: revision 1.13
Use C89 function definition
Add name and atttribute cache with filesytem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
Use new PUFFS_KFLAG_CACHE_FS_TTL option to puffs_init(3) so that
FUSE TTL on name and attributes are used. This save many PUFFS
operations and improves performances.
PUFFS_KFLAG_CACHE_FS_TTL is #ifdef'ed in many places for now so that
libperfuse can still be used on netbsd-5.
Split file system.
Comma fixes.
Remove dangling &quot;and&quot;.
Bump date for previous.
- Makesure update_va does not change vnode size when it should not. For
instance when doing a fault-issued VOP_GETPAGES within VOP_WRITE, changing
size leads to panic: genfs_getpages: past eof.
-Handle ticks wrap around for vnode name andattribute timeout
- When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM
(how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
Do not set PUFFS_KFLAG_CACHE_FS_TTL for PUFFS tests
 1.29.4.3.2.1 01-Nov-2012  matt sync with netbsd-6-0-RELEASE.
 1.29.2.2 30-Oct-2012  yamt sync with head
 1.29.2.1 23-May-2012  yamt sync with head.
 1.36.10.2 05-Nov-2014  snj Pull up following revision(s) (requested by manu in ticket #181):
lib/libperfuse/fuse.h: revision 1.6
lib/libperfuse/ops.c: revision 1.78
lib/libperfuse/perfuse.c: revision 1.35
lib/libperfuse/perfuse_priv.h: revision 1.36
lib/libpuffs/dispatcher.c: revision 1.48
lib/libpuffs/opdump.c: revision 1.37
lib/libpuffs/puffs.c: revision 1.118
lib/libpuffs/puffs.h: revision 1.126
lib/libpuffs/puffs_ops.3: revisions 1.40-1.41
sys/fs/puffs/puffs_msgif.h: revision 1.82-1.83
sys/fs/puffs/puffs_msgif.h: revision 1.82
sys/fs/puffs/puffs_vnops.c: revision 1.196
Add PUFFS support for fallocate and fdiscard operations
--
libpuffs support for fallocate and fdiscard operations
--
Add PUFFS_HAVE_FALLOCATE in puffs_msgif.h so that filesystem can decide
at build time wether fallocate is usable
--
FUSE fallocate support
There seems to be no fdiscard FUSE operation at the moment, hence that
one is left unused.
 1.36.10.1 24-Aug-2014  martin Pull up following revision(s) (requested by manu in ticket #52):
lib/libperfuse/perfuse_priv.h: revision 1.33
lib/libperfuse/ops.c: revision 1.67
lib/libpuffs/dispatcher.c: revision 1.47
lib/libperfuse/perfuse_priv.h: revision 1.34
lib/libperfuse/ops.c: revision 1.68
lib/libperfuse/ops.c: revision 1.69
lib/libpuffs/puffs_ops.3: revision 1.37
lib/libpuffs/puffs_ops.3: revision 1.38
lib/libperfuse/perfuse.c: revision 1.32
lib/libperfuse/perfuse.c: revision 1.33
usr.sbin/perfused/msg.c: revision 1.22
lib/libpuffs/puffs.h: revision 1.125
Implement FUSE direct I/O.
Remove useless code and warnings
 1.4 20-Feb-2009  pooka Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.3 27-Dec-2007  pooka branches: 1.3.10; 1.3.12;
Flesh this out a bit more. Unfortunately it's still unfinished,
and I don't know when I'll get a chance to finish it.
 1.2 01-Dec-2007  wiz Fix a typo that has migrated across files.
 1.1 19-Jan-2007  pooka branches: 1.1.4;
Bring the documentation slightly more into sync with the current
reality. It's still really a far cry from proper documentation,
though.
 1.1.4.1 09-Jan-2008  matt sync with HEAD
 1.3.12.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.3.10.1 24-Feb-2009  snj Pull up following revision(s) (requested by pooka in ticket #484):
lib/libpuffs/puffs.3: revision 1.46
lib/libpuffs/puffs_cc.3: revision 1.13
lib/libpuffs/puffs_cred.3: revision 1.4
lib/libpuffs/puffs_flush.3: revision 1.8
lib/libpuffs/puffs_framebuf.3: revision 1.26
lib/libpuffs/puffs_node.3: revision 1.4
lib/libpuffs/puffs_ops.3: revision 1.23
lib/libpuffs/puffs_path.3: revision 1.4
lib/libpuffs/puffs_suspend.3: revision 1.3
Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.46 22-Jan-2022  pho Allow calling puffs_mount(3) before puffs_daemon(3)

puffs_daemon(3) creates a pipe before forking, and the parent process
waits for the child to either complete puffs_mount(3) or fail. If a
user calls puffs_daemon(3) after puffs_mount(3), the function
deadlocks. While this error-reporting functionality is really a nice
thing to have, deadlocking is not great. If the filesystem has already
been mounted, puffs_mount(3) should just daemonize the process and
return.

This became an issue because fuse_daemonize(3) in FUSE API had no such
requirement and some FUSE filesystems in the wild suffered deadlocks.
 1.45 18-Apr-2012  manu - When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM (how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
 1.44 20-Jun-2011  mrg branches: 1.44.2; 1.44.4;
various build fixes for gcc 4.5. from chuq. XXX i'm not sure all of
these work properly wtf pointer aliasing, but there are no casts at
least...

the lib/libpuffs/puffs_priv.h is definately a real bug fix.

from chuq.
 1.43 06-Dec-2010  pooka branches: 1.43.4;
Remove PUFFS_WITH_THREADS ifdef garbage, just use libc weak symbols.
 1.42 12-Jan-2010  pooka Add convenience routine puffs_unmountonsignal(), which does exactly that.
 1.41 11-Aug-2008  pooka clear cached puffs_cc's in puffs_exit()
 1.40 11-Aug-2008  pooka * make sure we come out of mainloop in the main context. otherwise in
certain cases the server would jump to hyperspace when unmounted
* sprinkle some debug prints
 1.39 28-Jan-2008  pooka branches: 1.39.6;
Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed. Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts. The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
 1.38 16-Jan-2008  pooka Cache a number of execution contexts instead of re-initializing
them every time. Speeds up pure in-memory file systems such as
sysctlfs or dtfs quite a bit. For actual I/O-workhorses the result
is of course less tasty.
 1.37 25-Dec-2007  pooka Add a public interface for setting a cookie mapper.
 1.36 16-Dec-2007  pooka * nuke puffs_cc_get{specific,usermount} for good
* move prototypes for puffs_docc and puffs_dopufbuf into the
public header, as they are should be exposed
 1.35 08-Dec-2007  pooka Now that "l" is gone both as an argument to operations and from
componentname, remove all vestiges of puffs_cid.
 1.34 05-Dec-2007  pooka Send a response message for flush operations from the kernel instead
of abusing the return value of write(2).
 1.33 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.32 16-Nov-2007  pooka Introduce puffs_daemon(), which works like daemon(3) except that it
also synchronizes with puffs_mount() and does not return (exit) in the
parent process until the file system has been mounted. This makes
it possible to reliably run e.g. mount_foo jippi /kai ; cd /kai/ee
 1.31 31-Oct-2007  pooka Fix a few bugs and memleaks with the threading code.
 1.30 29-Oct-2007  pooka Sprinkle some hackish locks here and there, just enough to allow
libp2k & rump to run multithreaded.
 1.29 28-Oct-2007  pooka Add possibility to set pre- and post callbacks which will be called
for all operations before or after executing the specific callback
(the api is not be final yet, though).
 1.28 26-Oct-2007  pooka Add some very initial support for a threading worker model as an
alternative to the (vastly superior ;) continuation model. This
is very preliminary stuff and not compiled by default (which it
even won't do without some other patches I cannot commit yet).

The raison d'commit of the patch is a snippet which ensures proper
in-order dispatching of all operations, including those which don't
require a response. Previously many of them would be dispatched
simultaneosly, e.g. fsync and reclaim on the same node, which
obviously isn't all that nice for correct operation.
 1.27 26-Oct-2007  pooka mmap stacks, makes it possible to align them
 1.26 25-Oct-2007  pooka Make pu_haskq a flag instead of its own variable.
 1.25 21-Oct-2007  pooka Add puffs_cc_schedule() which marks a pcc runnable and will pass
execution to it when in the main loop the next time.
 1.24 21-Oct-2007  pooka Always provide caller information from the kernel based on curlwp.
(but don't deprecate the old puffs_cid interface just yet)
 1.23 11-Oct-2007  pooka Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

* since the kernel-user communication is not purely request-response
anymore (hasn't been since 2006), try to rename some "request" to
"message". more similar mangling will take place in the future.

* completely rework how messages are allocated. previously most of
them were borrowed from the stack (originally *all* of them),
but now always allocate dynamically. this makes the structure
of the code much cleaner. also makes it possible to fix a
locking order violation. it enables plenty of future enhancements.

* start generalizing the transport interface to be independent of puffs

* move transport interface to read/write instead of ioctl. the
old one had legacy design problems, and besides, ioctl's suck.
implement a very generic version for now; this will be
worked on later hopefully some day reaching "highly optimized".

* implement libpuffs support behind existing library request
interfaces. this will change eventually (I hate those interfaces)
 1.22 27-Sep-2007  pooka Add error notifications, which are used to deliver errors from the
kernel to the file server for silly things the file server did,
e.g. attempting to create a file with size VSIZENOTSET. The file
server can handle these as it chooses, but the default action is
for it to throw its hands in the air and sing "goodbye, cruel world,
it's over, walk on by".
 1.21 01-Sep-2007  pooka Add gotframe callback, which is called if an incoming frame matches
no outstanding request.
 1.20 18-Aug-2007  pooka branches: 1.20.2;
puffs_cc_create/destroy aren't supposed to be exported to the user
 1.19 20-Jul-2007  pooka branches: 1.19.4;
Add puffs_framev_enqueue_waitevent, which waits for read/write/error
events from an i/o descriptor. It yields until an event happens
and continues execution when the event loop notices the event has
happened.
 1.18 19-Jul-2007  pooka Don't float puffs_kargs needlessly around after mount, saves
a couple k of memory (and there was much rejoycing!)
 1.17 07-Jul-2007  pooka Make puffs_framebuf better suited from environments with multiple sources:

* in addition add/remove, allow enable/disable, which can be used
to control events for descriptors without having to remove all the
data associated with them
* add directsend/receive, which can be used to pass the same buffer
from the caller to read/writeframe and back again
* add flags to enqueue functions and allow urgent buffers to be
processed as the next PDU
 1.16 01-Jul-2007  pooka Instead of requesting various pieces of information from node-creating
methods using "please fill me"-pointers, pass "struct puffs_newinfo *"
and provide methods to fill in new node info.
 1.15 01-Jul-2007  pooka cast to void * instead of actual (albeit incomplete) type to silence
gcc about type punning with -fstrict-alias
 1.14 01-Jul-2007  pooka Instead of supplying a plain pid, supply an abstract struct puffs_cid *,
which can currently be used to query the pid and lwpid.
 1.13 01-Jul-2007  pooka make puffs_cred an opaque type
 1.12 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.11 20-May-2007  pooka Change the signature of puffs_respcmp to return -1,0,1 for smaller,
equal, larger, respectively instead of 0/1 for non/equal. This
will allow sorting the buffers for faster matching in libpuffs.
While here, change the name from respcmp to framecmp, as that better
reflects the purpose.

NOTE! there is no obvious way to make compilation fail for file
systems which may already be using this feature (although I don't
think there are any outside our tree, as the feature is two weeks
old). Nevertheless, non-updated file systems will fail very quickly.
 1.10 15-May-2007  pooka Step 3 and currently final step of a more general purpose event loop:
support removal and addition of i/o file descriptors on the fly.

* detect closed file descriptors
* automatically free waiters of a dead file descriptor
* give the file server the possibility to specify a callback which
notifies of a dead file descriptor
* move loop function to be a property of the mainloop instead of
framebuf (doesn't change effective behaviour)
* add the possibility to configure a timespec parameter which
attempts to call the loop function periodically
* move the event loop functions from the puffs_framebuf namespace
to puffs_framev to differential between pure memory management
functions
 1.9 11-May-2007  pooka Step 2 of general-purpose eventloop: get rid of puffs_framebuf_eventloop().
puffs_mainloop() now handles that functionality as well.
 1.8 10-May-2007  pooka Add some kludges to be able to execute requests on the regular program
stack instead of the continuation stack. This is for lib/36011, where
pthread gets confused since we aren't running on the regular stack.
I'm not really sure which direction to go to with this quite yet, so
make the hack hard to enable on purpose. The whole request dispatch
code needs cleaning anyway.
 1.7 05-May-2007  pooka Add puffs "frame buffers", which are an abstraction of the buffering
and event handling mechanisms required in file servers with blocking
I/O backends. puffs_framebuf is built on the concept of puffs_cc
and uses those to multiplex execution where needed.

File systems are required to implement three methods:
* read frame
* write frame
* compare if frame is a response to the given one

Memory management is provided by puffs_framebuf, but the file
systems must still, of course, interpret the protocol and do e.g.
byte order conversion.

As always, puffs_framebuf is work in progress. Current users are
mount_psshfs and mount_9p.
 1.6 13-Apr-2007  pooka Instead of keeping on adding parameters to puffs_mount(), make it
only take the bare essentials, which currently means removing
"maxreqlen" from the argument list (all current callers I'm aware
of set it as 0 anyway). Introduce puffs_init(), which provides a
context for setting various parameters and puffs_domount(), which
can be used to mount the file system. Keep puffs_mount() as a
shortcut for the above two for simple file systems.

Bump development ABI version to 13. After all, it's Friday the 13th.
Watch out! Bad things can happen on Friday the 13th. --No carrier--
 1.5 12-Apr-2007  pooka Hide struct puffs_usermount from the rest of the world and provide
accessors for interesting data in it. Namely, you can now get
pu->pu_privdata with puffs_getspecific(), pu->pu_pn_root with
puffs_set/getroot() and pu->pu_maxreqlen with puffs_getmaxreqlen().
 1.4 15-Jan-2007  pooka Checkpoint some more work in progress: for the benefit those file
system backends which operate purely based on paths, push out more
path management into the library and make path management more
abstract: enable a file system to define a bunch of path management
callbacks, which are used by the framework. Management of normal
/this/is/a/path type paths is provided by the library.
 1.3 06-Jan-2007  pooka * get rid of the mount callback; it's no great surprise to the
server that it needs to mount the file system backend if it wants
to call mount
* provide some options for getmntopts(), assume that callers will parse
command line (or fstab) args
* reorganize the puffs_cc interface just a bit, preparing for a bigger
revamp later
 1.2 29-Dec-2006  pooka checkpoint some experimental work-in-progress, namely:

Add support for having multiple outstanding operations. This is done
by exposing enough interfaces so that it is convenient to have the
main event loop in the implementation itself and by providing a
continuation framework for convinient blocking and rescheduling.

works fine, but will undergo further cleanup & development
 1.1 07-Dec-2006  pooka outline & export code for interfacing with kernel GET/PUT requests
 1.19.4.2 20-Jul-2007  pooka Add puffs_framev_enqueue_waitevent, which waits for read/write/error
events from an i/o descriptor. It yields until an event happens
and continues execution when the event loop notices the event has
happened.
 1.19.4.1 20-Jul-2007  pooka file puffs_priv.h was added on branch matt-mips64 on 2007-07-20 13:14:57 +0000
 1.20.2.3 23-Mar-2008  matt sync with HEAD
 1.20.2.2 09-Jan-2008  matt sync with HEAD
 1.20.2.1 06-Nov-2007  matt sync with HEAD
 1.39.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.43.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.44.4.1 23-Apr-2012  riz Pull up following revision(s) (requested by manu in ticket #195):
lib/libskey/skeysubr.c: revision 1.27
lib/libkvm/kvm_getloadavg.c: revision 1.11
lib/libwrap/update.c: revision 1.9
lib/liby/yyerror.c: revision 1.9
lib/libpuffs/puffs_ops.3: revision 1.30
lib/libwrap/misc.c: revision 1.10
lib/libwrap/hosts_access.c: revision 1.20
lib/libpuffs/pnode.c: revision 1.11
lib/libperfuse/subr.c: revision 1.17
lib/libpuffs/pnode.c: revision 1.12
lib/libperfuse/subr.c: revision 1.18
lib/libwrap/options.c: revision 1.15
lib/libwrap/fix_options.c: revision 1.11
lib/libperfuse/ops.c: revision 1.52
lib/libperfuse/ops.c: revision 1.53
lib/libperfuse/ops.c: revision 1.54
lib/libwrap/hosts_ctl.c: revision 1.5
lib/libintl/gettext.c: revision 1.27
lib/libwrap/shell_cmd.c: revision 1.6
lib/libpuffs/dispatcher.c: revision 1.39
lib/libperfuse/perfuse_priv.h: revision 1.27
lib/libwrap/socket.c: revision 1.19
lib/libpuffs/puffs.3: revision 1.50
lib/libperfuse/perfuse_priv.h: revision 1.28
lib/libpuffs/puffs_priv.h: revision 1.45
lib/libpuffs/puffs.3: revision 1.51
lib/libperfuse/perfuse_priv.h: revision 1.29
lib/libwrap/percent_x.c: revision 1.5
lib/libpuffs/puffs.3: revision 1.52
lib/libperfuse/debug.c: revision 1.11
sys/fs/puffs/puffs_vnops.c: revision 1.165
lib/libwrap/tcpd.h: revision 1.13
sys/fs/puffs/puffs_vnops.c: revision 1.166
lib/libwrap/eval.c: revision 1.7
sys/fs/puffs/puffs_msgif.h: revision 1.78
sys/fs/puffs/puffs_vfsops.c: revision 1.101
lib/libwrap/rfc931.c: revision 1.9
lib/libwrap/clean_exit.c: revision 1.5
lib/libpuffs/puffs.h: revision 1.120
lib/libc/stdlib/jemalloc.c: revision 1.27
lib/librmt/rmtlib.c: revision 1.26
lib/libpuffs/puffs.h: revision 1.121
sys/fs/puffs/puffs_sys.h: revision 1.79
lib/librumpclient/rumpclient.c: revision 1.48
lib/libwrap/refuse.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.26
lib/libperfuse/perfuse.c: revision 1.27
tests/fs/puffs/t_fuzz.c: revision 1.5
lib/libperfuse/perfuse.c: revision 1.28
lib/libpuffs/dispatcher.c: revision 1.40
sys/fs/puffs/puffs_node.c: revision 1.24
lib/libwrap/diag.c: revision 1.9
lib/libintl/textdomain.c: revision 1.13
Use C89 function definition
Add name and atttribute cache with filesytem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
Use new PUFFS_KFLAG_CACHE_FS_TTL option to puffs_init(3) so that
FUSE TTL on name and attributes are used. This save many PUFFS
operations and improves performances.
PUFFS_KFLAG_CACHE_FS_TTL is #ifdef'ed in many places for now so that
libperfuse can still be used on netbsd-5.
Split file system.
Comma fixes.
Remove dangling &quot;and&quot;.
Bump date for previous.
- Makesure update_va does not change vnode size when it should not. For
instance when doing a fault-issued VOP_GETPAGES within VOP_WRITE, changing
size leads to panic: genfs_getpages: past eof.
-Handle ticks wrap around for vnode name andattribute timeout
- When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
attribute and TTL fora newly created node. Instead extend puffs_newinfo
and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
a newly created vnode but has been made redundant along time ago since
uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and RECLAIM
(how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()
Do not set PUFFS_KFLAG_CACHE_FS_TTL for PUFFS tests
 1.44.2.1 23-May-2012  yamt sync with head.
 1.6 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.5 01-Dec-2007  wiz Fix another persistent spello.
 1.4 01-Dec-2007  wiz Fix a typo that has migrated across files.
 1.3 09-May-2007  pooka branches: 1.3.4;
Remove the puffs_usermount argument from puffs_req_handle(). It can
be found from the other arguments and this way puffs_req_handle() is
more symmetric with the other puffs_req() routines.
 1.2 20-Jan-2007  wiz New sentence, new line.
 1.1 20-Jan-2007  pooka document request handling routines
 1.3.4.1 23-Mar-2008  matt sync with HEAD
 1.4 05-Dec-2009  pooka Remove suspension support from here too.
 1.3 20-Feb-2009  pooka Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.2 28-Jan-2007  wiz branches: 1.2.18; 1.2.20;
Fix spellos.
 1.1 26-Jan-2007  pooka document puffs_fs_suspend()
 1.2.20.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.2.18.1 24-Feb-2009  snj Pull up following revision(s) (requested by pooka in ticket #484):
lib/libpuffs/puffs.3: revision 1.46
lib/libpuffs/puffs_cc.3: revision 1.13
lib/libpuffs/puffs_cred.3: revision 1.4
lib/libpuffs/puffs_flush.3: revision 1.8
lib/libpuffs/puffs_framebuf.3: revision 1.26
lib/libpuffs/puffs_node.3: revision 1.4
lib/libpuffs/puffs_ops.3: revision 1.23
lib/libpuffs/puffs_path.3: revision 1.4
lib/libpuffs/puffs_suspend.3: revision 1.3
Remove the paragraph saying interfaces will change without warning.
Note that a stable version of puffs first appeared in NetBSD 5.0.
 1.15 11-Jul-2010  pooka Export the opid -> opstr tables (for outside debugging use).
 1.14 07-Jan-2010  pooka Dump contents of struct vattr -- i never remember which members
the kernel passes when, so this helps tapping that info.
 1.13 07-Jan-2010  pooka * make indentation a little less ridiculous
* note that interfaces provided by <puffsdump.h> are not stable and
are to be used only for debug builds
* remove a few unimplemented/used dump interfaces
 1.12 06-Apr-2009  pooka dump readdir offset
 1.11 06-Apr-2009  pooka * dump op-specific return info before the generic one
* dump readdir response values
 1.10 12-Aug-2008  pooka branches: 1.10.6;
Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.9 27-Jan-2008  pooka branches: 1.9.6;
For operations with a target (remove, rmdir, link), print the
target cookie.
 1.8 25-Dec-2007  pooka * dump r/w return resid
* fix RV dump order to be more logical
 1.7 09-Dec-2007  pooka print newnode cookie value for operations which create nodes
 1.6 29-Nov-2007  pooka print mode in open
 1.5 22-Aug-2007  pooka branches: 1.5.2;
Dump lookup/componentname specific info in opdump.
(sigh, I guess I guess I'll never do opdump properly at this rate)
 1.4 07-Aug-2007  pooka dump further info for read/write
 1.3 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.2 18-Feb-2007  pooka dump return values for operations
 1.1 22-Oct-2006  pooka add libpuffs - the userspace programming interface for puffs

This work was initially started and completed for Google SoC 2005
and tweaked to work a bit better in the past few weeks. While
being far from complete, it is functional enough to be able and
stable to host a fairly general-purpose in-memory file system in
userspace. Even so, puffs should be considered experimental and
no binary compatibility for interfaces or crash-freedom or zero
security implications should be relied upon just yet.

The GSoC project was mentored by William Studenmund and the final
review for the code was done by Christos.
 1.5.2.2 23-Mar-2008  matt sync with HEAD
 1.5.2.1 09-Jan-2008  matt sync with HEAD
 1.9.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.10.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.24 23-Jan-2013  riastradh Assert equality, not assignment, in puffs__fsframe_cmp.
 1.23 29-Jan-2008  pooka branches: 1.23.26; 1.23.28; 1.23.32;
When reading a request from the kernel, only allocate as much memory
as needed to read a request instead of the maximum message size.
Insanely enough, this makes "cheap backend I/O" file systems such
dtfs and sysctlfs perform 10-30% better (depending on the average
size of incoming requests).
 1.22 29-Jan-2008  pooka Fix a weirdosity in the framebuf gotfb interface: hand buffer
ownership to the called routine instead of keeping it. This means
that callees must now destroy the buffer once they are done with it.
 1.21 28-Jan-2008  pooka Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed. Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts. The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
 1.20 05-Dec-2007  pooka inverse inverse logic
 1.19 05-Dec-2007  pooka apply previous in a more readable way
 1.18 05-Dec-2007  dogcow "fix" complaints about type-punned pointers with some icky casts.
 1.17 04-Dec-2007  pooka Part 3/n of extensive changes to message handling:

Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests. It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format. Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle. Keep an eye out for the sequels: Parts 3+m/n.
 1.16 12-Nov-2007  pooka * split the putter header into a kernel version and a userland version
+ install latter to /usr/include/dev/putter
* remove last dependencies to puffs from putter, it's completely
independent now
 1.15 31-Oct-2007  pooka Fix a few bugs and memleaks with the threading code.
 1.14 29-Oct-2007  pooka Sprinkle some hackish locks here and there, just enough to allow
libp2k & rump to run multithreaded.
 1.13 26-Oct-2007  pooka Add some very initial support for a threading worker model as an
alternative to the (vastly superior ;) continuation model. This
is very preliminary stuff and not compiled by default (which it
even won't do without some other patches I cannot commit yet).

The raison d'commit of the patch is a snippet which ensures proper
in-order dispatching of all operations, including those which don't
require a response. Previously many of them would be dispatched
simultaneosly, e.g. fsync and reclaim on the same node, which
obviously isn't all that nice for correct operation.
 1.12 21-Oct-2007  he To work around lint problems, add a LINTED comment on pooka's request.
 1.11 19-Oct-2007  pooka When doing a read operation, don't copy the whole kernel buffer to
userspace, since it doesn't contain any information yet. I should
still rework this more so this is just a quickie to get the read/write
style interface more up to speed with the ioctl version.
 1.10 11-Oct-2007  pooka Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

* since the kernel-user communication is not purely request-response
anymore (hasn't been since 2006), try to rename some "request" to
"message". more similar mangling will take place in the future.

* completely rework how messages are allocated. previously most of
them were borrowed from the stack (originally *all* of them),
but now always allocate dynamically. this makes the structure
of the code much cleaner. also makes it possible to fix a
locking order violation. it enables plenty of future enhancements.

* start generalizing the transport interface to be independent of puffs

* move transport interface to read/write instead of ioctl. the
old one had legacy design problems, and besides, ioctl's suck.
implement a very generic version for now; this will be
worked on later hopefully some day reaching "highly optimized".

* implement libpuffs support behind existing library request
interfaces. this will change eventually (I hate those interfaces)
 1.9 19-Jul-2007  pooka branches: 1.9.4; 1.9.6;
Don't float puffs_kargs needlessly around after mount, saves
a couple k of memory (and there was much rejoycing!)
 1.8 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.7 11-May-2007  pooka Step 2 of general-purpose eventloop: get rid of puffs_framebuf_eventloop().
puffs_mainloop() now handles that functionality as well.
 1.6 09-May-2007  pooka Remove the puffs_usermount argument from puffs_req_handle(). It can
be found from the other arguments and this way puffs_req_handle() is
more symmetric with the other puffs_req() routines.
 1.5 13-Apr-2007  pooka Instead of keeping on adding parameters to puffs_mount(), make it
only take the bare essentials, which currently means removing
"maxreqlen" from the argument list (all current callers I'm aware
of set it as 0 anyway). Introduce puffs_init(), which provides a
context for setting various parameters and puffs_domount(), which
can be used to mount the file system. Keep puffs_mount() as a
shortcut for the above two for simple file systems.

Bump development ABI version to 13. After all, it's Friday the 13th.
Watch out! Bad things can happen on Friday the 13th. --No carrier--
 1.4 20-Jan-2007  pooka Be consistent with the rest of the framework about the argument
order of puffs_docc and puffs_dopreq
 1.3 20-Jan-2007  pooka be consistent in naming request handlers
 1.2 29-Dec-2006  pooka checkpoint some experimental work-in-progress, namely:

Add support for having multiple outstanding operations. This is done
by exposing enough interfaces so that it is convenient to have the
main event loop in the implementation itself and by providing a
continuation framework for convinient blocking and rescheduling.

works fine, but will undergo further cleanup & development
 1.1 07-Dec-2006  pooka outline & export code for interfacing with kernel GET/PUT requests
 1.9.6.2 19-Jul-2007  pooka Don't float puffs_kargs needlessly around after mount, saves
a couple k of memory (and there was much rejoycing!)
 1.9.6.1 19-Jul-2007  pooka file requests.c was added on branch matt-mips64 on 2007-07-19 12:52:29 +0000
 1.9.4.3 23-Mar-2008  matt sync with HEAD
 1.9.4.2 09-Jan-2008  matt sync with HEAD
 1.9.4.1 06-Nov-2007  matt sync with HEAD
 1.23.32.1 25-Feb-2013  tls resync with head
 1.23.28.1 03-Nov-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1140):
lib/libperfuse/ops.c 1.63-1.69
lib/libperfuse/perfuse.c 1.32-1.33
lib/libperfuse/perfuse_priv.h 1.32-1.34
lib/libperfuse/subr.c 1.20
lib/libpuffs/creds.c 1.16
lib/libpuffs/dispatcher.c 1.47
lib/libpuffs/puffs.h 1.125
lib/libpuffs/puffs_ops.3 1.37-1.38
lib/libpuffs/requests.c 1.24
sys/fs/puffs/puffs_msgif.h 1.81
sys/fs/puffs/puffs_sys.h 1.85
sys/fs/puffs/puffs_vnops.c 1.183
usr.sbin/perfused/msg.c 1.22
Bring libpuffs, libperfuse and perfused on par with -current:
- implement FUSE direct I/O
- remove useless code and warnings
- fix missing GETATTR bugs
- fix exended attribute get and list operations
 1.23.26.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5 21-May-2010  pooka * support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
 1.4 18-Oct-2009  pooka bump minor for puffs_setmntinfo()
 1.3 17-Oct-2009  pooka Add some comments on how to act when major is bumped the next time.
 1.2 11-Jan-2009  christos bump shared libraries.
 1.1 22-Oct-2006  pooka branches: 1.1.24; 1.1.28;
add libpuffs - the userspace programming interface for puffs

This work was initially started and completed for Google SoC 2005
and tweaked to work a bit better in the past few weeks. While
being far from complete, it is functional enough to be able and
stable to host a fairly general-purpose in-memory file system in
userspace. Even so, puffs should be considered experimental and
no binary compatibility for interfaces or crash-freedom or zero
security implications should be relied upon just yet.

The GSoC project was mentored by William Studenmund and the final
review for the code was done by Christos.
 1.1.28.1 21-Apr-2010  matt sync to netbsd-5
 1.1.24.1 27-Oct-2009  bouyer Pull up following revision(s) (requested by pooka in ticket #1105):
lib/libpuffs/puffs.h: revision 1.112
lib/libpuffs/puffs.c: revision 1.100
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
lib/libpuffs/shlib_version: patch

Make it possible to supply parameters to puffs_init() later (but
before puffs_mount()).
 1.28 23-Sep-2019  christos Restore binary compatibility by using the statvfs90 structure internally.
 1.27 17-Feb-2011  pooka branches: 1.27.44;
Support rest of file types in vtype -> s_ifmt
 1.26 17-Feb-2011  pooka st_blocks is in units of DEV_BSIZE, not st_blksize.

from Derrik Pates
 1.25 15-Jul-2010  pooka branches: 1.25.2;
Default f_namemax to MAXNAMLEN, mostly for initial statvfs struct
passed to kernel in mount.

XXX: there's currently no way for a file server to override the
one passed in mount.
 1.24 28-Dec-2008  christos fix for dev_t 64 bits.
 1.23 12-Aug-2008  pooka Replace void * by puffs_cookie_t where appropriate. No functional change.
 1.22 19-Dec-2007  pooka branches: 1.22.6;
Add generic getattr routine.
 1.21 30-Nov-2007  pooka Rototill.

Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?). Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it. This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
 1.20 27-Nov-2007  pooka Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces. puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
 1.19 21-Oct-2007  pooka typo in comment
 1.18 01-Jul-2007  pooka branches: 1.18.4;
Instead of supplying a plain pid, supply an abstract struct puffs_cid *,
which can currently be used to query the pid and lwpid.
 1.17 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.16 20-Mar-2007  pooka implement counterpart of vaccess()
 1.15 16-Mar-2007  pooka va->va_mode doesn't contain the full argument to the mknod() system call,
so introduce puffs_addvtype2mode() and use that in null.c to generate the
proper syscall argument
 1.14 15-Feb-2007  pooka generic node reclaim, which just puts a puffs_node
 1.13 11-Jan-2007  pooka Add preliminary code for a nullfs layer, which can be used to mount
a directory hierarchy to another point, just like with the kernel
nullfs. This is not really a layering scheme yet, but it should
evolve into one. Currently it can just be used to do 1:1 mapping.
 1.12 06-Jan-2007  pooka * get rid of the mount callback; it's no great surprise to the
server that it needs to mount the file system backend if it wants
to call mount
* provide some options for getmntopts(), assume that callers will parse
command line (or fstab) args
* reorganize the puffs_cc interface just a bit, preparing for a bigger
revamp later
 1.11 29-Dec-2006  pooka checkpoint some experimental work-in-progress, namely:

Add support for having multiple outstanding operations. This is done
by exposing enough interfaces so that it is convenient to have the
main event loop in the implementation itself and by providing a
continuation framework for convinient blocking and rescheduling.

works fine, but will undergo further cleanup & development
 1.10 07-Dec-2006  pooka rototill the operation callbacks: unify the ops under struct puffs_ops
and namespace them
 1.9 21-Nov-2006  pooka mode_t to enum vtype conversion
 1.8 14-Nov-2006  pooka namespace previous change under puffs_vfsnop to avoid confusions
 1.7 14-Nov-2006  pooka implement unmount, sync and statvfs as dummies for file system which
couldn't care less about implementing them
 1.6 23-Oct-2006  mrg use casts to properly truncate some assignments. (sparc64 gcc complained.)
 1.5 23-Oct-2006  christos put back the comparison in a lint friendly way to appease pooka.
 1.4 23-Oct-2006  dogcow comment out comparison of unsigned expression to >= 0
 1.3 23-Oct-2006  pooka still check for array bounds, fix off-by-one
 1.2 23-Oct-2006  christos pass lint; fix install.
 1.1 22-Oct-2006  pooka add libpuffs - the userspace programming interface for puffs

This work was initially started and completed for Google SoC 2005
and tweaked to work a bit better in the past few weeks. While
being far from complete, it is functional enough to be able and
stable to host a fairly general-purpose in-memory file system in
userspace. Even so, puffs should be considered experimental and
no binary compatibility for interfaces or crash-freedom or zero
security implications should be relied upon just yet.

The GSoC project was mentored by William Studenmund and the final
review for the code was done by Christos.
 1.18.4.2 09-Jan-2008  matt sync with HEAD
 1.18.4.1 06-Nov-2007  matt sync with HEAD
 1.22.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.25.2.1 05-Mar-2011  bouyer Sync with HEAD
 1.27.44.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.10 05-Dec-2009  pooka Remove suspension support from here too.
 1.9 17-Nov-2007  pooka fix request size
 1.8 12-Nov-2007  pooka remove header that was never committed
 1.7 12-Nov-2007  pooka * split the putter header into a kernel version and a userland version
+ install latter to /usr/include/dev/putter
* remove last dependencies to puffs from putter, it's completely
independent now
 1.6 11-Oct-2007  pooka Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

* since the kernel-user communication is not purely request-response
anymore (hasn't been since 2006), try to rename some "request" to
"message". more similar mangling will take place in the future.

* completely rework how messages are allocated. previously most of
them were borrowed from the stack (originally *all* of them),
but now always allocate dynamically. this makes the structure
of the code much cleaner. also makes it possible to fix a
locking order violation. it enables plenty of future enhancements.

* start generalizing the transport interface to be independent of puffs

* move transport interface to read/write instead of ioctl. the
old one had legacy design problems, and besides, ioctl's suck.
implement a very generic version for now; this will be
worked on later hopefully some day reaching "highly optimized".

* implement libpuffs support behind existing library request
interfaces. this will change eventually (I hate those interfaces)
 1.5 19-Jul-2007  pooka branches: 1.5.4; 1.5.6;
Don't float puffs_kargs needlessly around after mount, saves
a couple k of memory (and there was much rejoycing!)
 1.4 06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.3 13-Apr-2007  pooka Instead of keeping on adding parameters to puffs_mount(), make it
only take the bare essentials, which currently means removing
"maxreqlen" from the argument list (all current callers I'm aware
of set it as 0 anyway). Introduce puffs_init(), which provides a
context for setting various parameters and puffs_domount(), which
can be used to mount the file system. Keep puffs_mount() as a
shortcut for the above two for simple file systems.

Bump development ABI version to 13. After all, it's Friday the 13th.
Watch out! Bad things can happen on Friday the 13th. --No carrier--
 1.2 12-Apr-2007  pooka Hide struct puffs_usermount from the rest of the world and provide
accessors for interesting data in it. Namely, you can now get
pu->pu_privdata with puffs_getspecific(), pu->pu_pn_root with
puffs_set/getroot() and pu->pu_maxreqlen with puffs_getmaxreqlen().
 1.1 26-Jan-2007  pooka add interfaces for suspending the file system
 1.5.6.2 19-Jul-2007  pooka Don't float puffs_kargs needlessly around after mount, saves
a couple k of memory (and there was much rejoycing!)
 1.5.6.1 19-Jul-2007  pooka file suspend.c was added on branch matt-mips64 on 2007-07-19 12:52:29 +0000
 1.5.4.2 09-Jan-2008  matt sync with HEAD
 1.5.4.1 06-Nov-2007  matt sync with HEAD

RSS XML Feed