4060eb9dc90500f1c1833a5d82a0dfcee581a4ec
[dragonfly.git] / lib / libhammer / libhammer_snapshot.3
1 .\"
2 .\" Copyright (c) 2015 The DragonFly Project.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to The DragonFly Project
5 .\" by Antonio Huete Jimenez <tuxillo@quantumachine.net>
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\"
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in
15 .\"    the documentation and/or other materials provided with the
16 .\"    distribution.
17 .\" 3. Neither the name of The DragonFly Project nor the names of its
18 .\"    contributors may be used to endorse or promote products derived
19 .\"    from this software without specific, prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" SUCH DAMAGE.
33 .\"
34 .Dd February 19, 2015
35 .Dt LIBHAMMER 3
36 .Os
37 .Sh NAME
38 .Nm libhammer_pfs_get_snapshots ,
39 .Nm libhammer_get_next_snap ,
40 .Nm libhammer_get_prev_snap ,
41 .Nm libhammer_get_first_snap ,
42 .Nm libhammer_get_last_snap ,
43 .Nm libhammer_pfs_free_snapshots
44 .Nd libhammer snapshot functions
45 .Sh LIBRARY
46 .Lb libhammer
47 .Sh SYNOPSIS
48 .In libhammer.h
49 .Ft int
50 .Fn libhammer_pfs_get_snapshots "libhammer_fsinfo_t fsinfo" "libhammer_pfsinfo_t pip"
51 .Ft libhammer_snapinfo_t
52 .Fn libhammer_get_first_snap "libhammer_pfsinfo_t pip"
53 .Ft libhammer_snapinfo_t
54 .Fn libhammer_get_last_snap "libhammer_pfsinfo_t pip"
55 .Ft libhammer_snapinfo_t
56 .Fn libhammer_get_next_snap "libhammer_snapinfo_t sip"
57 .Ft libhammer_snapinfo_t
58 .Fn libhammer_get_prev_snap "libhammer_snapinfo_t sip"
59 .Ft void
60 .Fn libhammer_pfs_free_snapshots "libhammer_pfsinfo_t pip"
61 .Sh DESCRIPTION
62 The
63 .Fn libhammer_pfs_get_snapshots
64 gathers all the snapshot information for the PFS specified in
65 .Fa pip .
66 .Pp
67 The list of snapshots can be iterated with
68 .Fn libhammer_get_first_snap ,
69 .Fn libhammer_get_last_snap ,
70 .Fn libhammer_get_next_snap
71 and
72 .Fn libhammer_get_prev_snap .
73 .Pp
74 Note that to use the next and previous functions described above you need
75 to store the returning
76 .Vt libhammer_snapinfo_t
77 value from the first and last functions.
78 .Pp
79 The
80 .Fn libhammer_pfs_free_snapshots
81 function releases all the resources used to hold the information of the
82 snapshots for a particular PFS.
83 .Sh RETURN VALUES
84 .Fn libhammer_pfs_get_snapshots
85 returns 0 when successful and -1 in the case of failure.
86 The
87 .Vt errno
88 value indicating the error is stored within the passed
89 .Vt libhammer_pfsinfo_t
90 in the
91 .Vt libhammer_head
92 struct.
93 .Pp
94 .Fn libhammer_get_first_snap
95 and
96 .Fn libhammer_get_last_snap
97 must return a
98 .Vt libhammer_snapinfo_t
99 if the
100 .Fa pip
101 passed in is valid.
102 .Fn libhammer_get_next_snap
103 and
104 .Fn libhammer_get_prev_snap
105 return a
106 .Vt libhammer_snapinfo_t
107 or
108 .Dv NULL
109 in case there are no more elements.
110 .Sh SEE ALSO
111 .Xr HAMMER 5 ,
112 .Xr hammer 8 ,
113 .Xr libhammer 3 ,
114 .Xr libhammer_fsinfo 3 ,
115 .Xr libhammer_stats 3
116 .Sh AUTHORS
117 This manpage was written by
118 .An Antonio Huete Jimenez Aq Mt tuxillo@quantumachine.net .