document puffs_fs_suspend()

This commit is contained in:
pooka 2007-01-26 23:55:27 +00:00
parent 3238d589b2
commit f4e2aba8ce
3 changed files with 99 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.12 2007/01/26 23:00:33 pooka Exp $
# $NetBSD: Makefile,v 1.13 2007/01/26 23:55:27 pooka Exp $
#
.include <bsd.own.mk>
@ -9,7 +9,7 @@ LIB= puffs
SRCS= puffs.c callcontext.c creds.c flush.c null.c opdump.c \
paths.c pnode.c requests.c subr.c suspend.c
MAN= puffs.3 puffs_cc.3 puffs_flush.3 puffs_node.3 \
puffs_path.3 puffs_req.3
puffs_path.3 puffs_req.3 puffs_suspend.3
INCS= puffs.h puffsdump.h
INCSDIR= /usr/include
LINTFLAGS+=-S -w

View File

@ -1,4 +1,4 @@
.\" $NetBSD: puffs.3,v 1.11 2007/01/20 15:10:38 pooka Exp $
.\" $NetBSD: puffs.3,v 1.12 2007/01/26 23:55:27 pooka Exp $
.\"
.\" Copyright (c) 2006, 2007 Antti Kantee. All rights reserved.
.\"
@ -588,6 +588,7 @@ If this is zero, the kernel will call reclaim immediately.
.Xr puffs_node 3 ,
.Xr puffs_path 3 ,
.Xr puffs_req 3 ,
.Xr puffs_suspend 3 ,
.Xr puffs 4
.Sh HISTORY
An unsupported experimental version of

View File

@ -0,0 +1,95 @@
.\" $NetBSD: puffs_suspend.3,v 1.1 2007/01/26 23:55:27 pooka Exp $
.\"
.\" Copyright (c) 2007 Antti Kantee. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd January 27, 2007
.Dt PUFFS_SUSPEND 3
.Os
.Sh NAME
.Nm puffs_suspend
.Nd puffs file system suspension and snapshotting
.Sh LIBRARY
.Lb libpuffs
.Sh SYNOPSIS
.In puffs.h
.Ft int
.Fn puffs_fs_suspend "struct puffs_usermount *pu"
.Sh DESCRIPTION
.Em IMPORTANT NOTE!
This document describes interfaces which are not yet guaranteed to be
stable.
In case you update your system sources, please recompile everything
and fix complation errors.
If your sources are out-of-sync, incorrect operation may result.
The interfaces in this document will most likely be hugely simplified
in later versions or made transparent to the implementation.
.Pp
The function
.Fn puffs_fs_suspend
requests the kernel to suspend operations to the file system indicated by
.Fa pu .
There are several possible outcomes: nothing, an error or success.
These will be indicated through the callback of the same name.
The file system must set this callback if it wants to be notified of
file system suspension.
The interface call itself returns 0 on success or \-1 on error and
sets
.Va errno .
In case an error is returned, the callback will never be called.
However, the converse does not hold and the callback may never be
called even if the library call is succesful.
.Pp
In case the kernel is succesful to start suspending the file system,
the callback is called with status
.Dv PUFFS_SUSPEND START .
The file system implementation may use this as a hint on how to handle
following operations.
Once the file system has succesfully been suspended, the status
.Dv PUFFS_SUSPEND_SUSPENDED
will be delivered.
In case there was an error while suspending,
.Dv PUFFS_SUSPEND_ERROR
is given.
This effectively nullifies any
.Dv PUFFS_SUSPEND_START
given earlier.
Operation will automatically resume after suspension and the status
.Dv PUFFS_SUSPEND_RESUME
is delivered to the callback.
Error or success is always provided in case start is given.
.Pp
The file system is supposed to do a file system specific snapshotting
routine when it receives
.Dv PUFFS_SUSPEND_SUSPENDED .
.Sh SEE ALSO
.Xr puffs 3 ,
.Xr puffs_cc 3
.Sh BUGS
Currently the implementation works only for single-threaded file systems
which do not use
.Nm puffs_cc .
.Pp
File system data and metadata are not always totally correctly
synchronized at suspend.
This will be fixed soon.