Equivalent to: FreeBSD rev 1.82
[dragonfly.git] / sys / sys / mountctl.h
1 /*
2  * Copyright (c) 2004 The DragonFly Project.  All rights reserved.
3  * 
4  * This code is derived from software contributed to The DragonFly Project
5  * by Matthew Dillon <dillon@backplane.com>
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  * $DragonFly: src/sys/sys/mountctl.h,v 1.1 2004/12/24 05:00:22 dillon Exp $
35  */
36
37 /*
38  * Data structures for the journaling API
39  */
40
41 #define MOUNTCTL_INSTALL_VFS_JOURNAL    1
42 #define MOUNTCTL_REMOVE_VFS_JOURNAL     2
43 #define MOUNTCTL_RESYNC_VFS_JOURNAL     3
44 #define MOUNTCTL_JOURNAL_VFS_STATUS     4
45
46 #define MOUNTCTL_INSTALL_BLK_JOURNAL    8
47 #define MOUNTCTL_REMOVE_BLK_JOURNAL     9
48 #define MOUNTCTL_RESYNC_BLK_JOURNAL     10
49 #define MOUNTCTL_JOURNAL_BLK_STATUS     11
50
51 struct mountctl_install_journal {
52         int     id;             /* journal identifier */
53         int     flags;          /* journaling flags */
54         int     fd;             /* streaming descriptor (-1 to close) */
55         int     unused01;
56         int64_t membufsize;     /* backing store */
57         int64_t swapbufsize;    /* backing store */
58         int64_t transid;        /* starting with specified transaction id */
59         int64_t unused02;
60         int     stallwarn;      /* stall warning (seconds) */
61         int     stallerror;     /* stall error (seconds) */
62         int     unused03;
63         int     unused04;
64 };
65
66 #define MC_JOURNAL_REVERSABLE           0x00000001      /* reversable log */
67 #define MC_JOURNAL_BINARY               0x00000002      /* use binary format */
68 #define MC_JOURNAL_UNUSED04             0x00000004
69 #define MC_JOURNAL_STREAM_TWO_WAY       0x00000008      /* trans id ack */
70 #define MC_JOURNAL_FD_PROVIDED          0x00000100      /* stream desc */
71 #define MC_JOURNAL_MBSIZE_PROVIDED      0x00000200      /* data space */
72 #define MC_JOURNAL_SWSIZE_PROVIDED      0x00000400      /* data space */
73 #define MC_JOURNAL_TRANSID_PROVIDED     0x00000800      /* restart transid */
74 #define MC_JOURNAL_STALLWARN_PROVIDED   0x00001000      /* restart transid */
75 #define MC_JOURNAL_STALLERROR_PROVIDED  0x00002000      /* restart transid */
76
77 struct mountctl_remove_journal {
78         int     id;
79         int     flags;
80 };
81
82 #define MC_JOURNAL_REMOVE_TRASH         0x00000001      /* data -> trash */
83 #define MC_JOURNAL_REMOVE_ASSYNC        0x00000002      /* asynchronous op */
84
85 struct mountctl_journal_status {
86         int     id;
87         int     flags;
88         int     fd;
89         int64_t membufsize;
90         int64_t membufused;
91         int64_t membufqueued;
92         int64_t swapbufsize;
93         int64_t swapbufused;
94         int64_t swapbufqueued;
95         int64_t transidstart;
96         int64_t transidcurrent;
97         int64_t transidqueued;
98         int64_t transidacked;
99         int64_t bytessent;
100         int64_t bytesacked;
101         struct timeval lastack;
102 };
103
104 #define MC_JOURNAL_STATUS_NEXT          0x80000000      /* find next id */
105
106