2 * Copyright (c) 2004 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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
34 * $DragonFly: src/sys/sys/mountctl.h,v 1.2 2004/12/29 02:40:03 dillon Exp $
41 #define JIDMAX 32 /* id string buf[] size (incls \0) */
44 * Data structures for the journaling API
47 #define MOUNTCTL_INSTALL_VFS_JOURNAL 1
48 #define MOUNTCTL_REMOVE_VFS_JOURNAL 2
49 #define MOUNTCTL_RESYNC_VFS_JOURNAL 3
50 #define MOUNTCTL_JOURNAL_VFS_STATUS 4
52 #define MOUNTCTL_INSTALL_BLK_JOURNAL 8
53 #define MOUNTCTL_REMOVE_BLK_JOURNAL 9
54 #define MOUNTCTL_RESYNC_BLK_JOURNAL 10
55 #define MOUNTCTL_JOURNAL_BLK_STATUS 11
57 struct mountctl_install_journal {
59 int flags; /* journaling flags */
61 int64_t membufsize; /* backing store */
62 int64_t swapbufsize; /* backing store */
63 int64_t transid; /* starting with specified transaction id */
65 int stallwarn; /* stall warning (seconds) */
66 int stallerror; /* stall error (seconds) */
71 #define MC_JOURNAL_REVERSABLE 0x00000001 /* reversable log */
72 #define MC_JOURNAL_BINARY 0x00000002 /* use binary format */
73 #define MC_JOURNAL_ACTIVE 0x00000004 /* journal is active */
74 #define MC_JOURNAL_STREAM_TWO_WAY 0x00000008 /* trans id ack */
75 #define MC_JOURNAL_STOP_REQ 0x00000010 /* stop request pend */
76 #define MC_JOURNAL_STOP_IMM 0x00000020 /* do not flush */
77 #define MC_JOURNAL_WWAIT 0x00000040 /* write stall */
78 #define MC_JOURNAL_MBSIZE_PROVIDED 0x00000200 /* data space */
79 #define MC_JOURNAL_SWSIZE_PROVIDED 0x00000400 /* data space */
80 #define MC_JOURNAL_TRANSID_PROVIDED 0x00000800 /* restart transid */
81 #define MC_JOURNAL_STALLWARN_PROVIDED 0x00001000 /* restart transid */
82 #define MC_JOURNAL_STALLERROR_PROVIDED 0x00002000 /* restart transid */
84 struct mountctl_remove_journal {
89 #define MC_JOURNAL_REMOVE_TRASH 0x00000001 /* data -> trash */
90 #define MC_JOURNAL_REMOVE_ASSYNC 0x00000002 /* asynchronous op */
92 struct mountctl_journal_status {
100 int64_t swapbufqueued;
101 int64_t transidstart;
102 int64_t transidcurrent;
103 int64_t transidqueued;
104 int64_t transidacked;
107 struct timeval lastack;
110 #define MC_JOURNAL_STATUS_NEXT 0x80000000 /* find next id */
112 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
115 * Support structures for the generic journaling structure
117 struct journal_memfifo {
118 int size; /* size (power of two) */
119 int mask; /* index mask (size - 1) */
120 int rindex; /* stream reader index */
121 int xindex; /* last acked / reader restart */
122 int windex; /* stream writer index */
123 char *membase; /* memory buffer representing the FIFO */
127 * Generic journaling structure attached to a mount point.
130 TAILQ_ENTRY(journal) jentry;
133 int flags; /* journaling flags */
135 struct journal_memfifo fifo;
136 struct thread thread;