1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
5 * Copyright (C) 2001 Tacit Networks, Inc.
7 * This file is part of InterMezzo, http://www.inter-mezzo.org.
9 * InterMezzo is free software; you can redistribute it and/or
10 * modify it under the terms of version 2 of the GNU General Public
11 * License as published by the Free Software Foundation.
13 * InterMezzo is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with InterMezzo; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef __INTERMEZZO_IDL_H__
24 #define __INTERMEZZO_IDL_H__
26 #include <linux/ioctl.h>
27 #include <linux/types.h>
29 /* this file contains all data structures used in InterMezzo's interfaces:
38 #define INTERMEZZO_MINOR 248
41 #define IZO_UPC_VERSION 0x00010002
42 #define IZO_UPC_PERMIT 1
43 #define IZO_UPC_CONNECT 2
44 #define IZO_UPC_GO_FETCH_KML 3
45 #define IZO_UPC_OPEN 4
46 #define IZO_UPC_REVOKE_PERMIT 5
48 #define IZO_UPC_BACKFETCH 7
49 #define IZO_UPC_KML_TRUNC 8
50 #define IZO_UPC_SET_KMLSIZE 9
51 #define IZO_UPC_BRANCH_UNDO 10
52 #define IZO_UPC_BRANCH_REDO 11
53 #define IZO_UPC_GET_FILEID 12
54 #define IZO_UPC_CLIENT_MAKE_BRANCH 13
55 #define IZO_UPC_SERVER_MAKE_BRANCH 14
56 #define IZO_UPC_REPSTATUS 15
58 #define IZO_UPC_LARGEST_OPCODE 15
60 struct izo_upcall_hdr {
78 /* This structure _must_ sit at the beginning of the buffer */
79 struct izo_upcall_resp {
88 #define IZO_IOCTL_VERSION 0x00010003
90 /* maximum size supported for ioc_pbuf1 */
91 #define KML_MAX_BUF (64*1024)
93 struct izo_ioctl_hdr {
98 struct izo_ioctl_data {
107 __u64 ioc_generation;
117 __u32 ioc_inllen1; /* path */
119 __u32 ioc_inllen2; /* fileset */
122 __u32 ioc_plen1; /* buffers in user space (KML) */
124 __u32 ioc_plen2; /* buffers in user space (KML) */
130 #define IZO_IOC_DEVICE _IOW ('p',0x50, void *)
131 #define IZO_IOC_REINTKML _IOW ('p',0x51, void *)
132 #define IZO_IOC_GET_RCVD _IOW ('p',0x52, void *)
133 #define IZO_IOC_SET_IOCTL_UID _IOW ('p',0x53, void *)
134 #define IZO_IOC_GET_KML_SIZE _IOW ('p',0x54, void *)
135 #define IZO_IOC_PURGE_FILE_DATA _IOW ('p',0x55, void *)
136 #define IZO_IOC_CONNECT _IOW ('p',0x56, void *)
137 #define IZO_IOC_GO_FETCH_KML _IOW ('p',0x57, void *)
138 #define IZO_IOC_MARK _IOW ('p',0x58, void *)
139 #define IZO_IOC_CLEAR_FSET _IOW ('p',0x59, void *)
140 #define IZO_IOC_CLEAR_ALL_FSETS _IOW ('p',0x60, void *)
141 #define IZO_IOC_SET_FSET _IOW ('p',0x61, void *)
142 #define IZO_IOC_REVOKE_PERMIT _IOW ('p',0x62, void *)
143 #define IZO_IOC_SET_KMLSIZE _IOW ('p',0x63, void *)
144 #define IZO_IOC_CLIENT_MAKE_BRANCH _IOW ('p',0x64, void *)
145 #define IZO_IOC_SERVER_MAKE_BRANCH _IOW ('p',0x65, void *)
146 #define IZO_IOC_BRANCH_UNDO _IOW ('p',0x66, void *)
147 #define IZO_IOC_BRANCH_REDO _IOW ('p',0x67, void *)
148 #define IZO_IOC_SET_PID _IOW ('p',0x68, void *)
149 #define IZO_IOC_SET_CHANNEL _IOW ('p',0x69, void *)
150 #define IZO_IOC_GET_CHANNEL _IOW ('p',0x70, void *)
151 #define IZO_IOC_GET_FILEID _IOW ('p',0x71, void *)
152 #define IZO_IOC_ADJUST_LML _IOW ('p',0x72, void *)
153 #define IZO_IOC_SET_FILEID _IOW ('p',0x73, void *)
154 #define IZO_IOC_REPSTATUS _IOW ('p',0x74, void *)
156 /* marking flags for fsets */
157 #define FSET_CLIENT_RO 0x00000001
158 #define FSET_LENTO_RO 0x00000002
159 #define FSET_HASPERMIT 0x00000004 /* we have a permit to WB */
160 #define FSET_INSYNC 0x00000008 /* this fileset is in sync */
161 #define FSET_PERMIT_WAITING 0x00000010 /* Lento is waiting for permit */
162 #define FSET_STEAL_PERMIT 0x00000020 /* take permit if Lento is dead */
163 #define FSET_JCLOSE_ON_WRITE 0x00000040 /* Journal closes on writes */
164 #define FSET_DATA_ON_DEMAND 0x00000080 /* update data on file_open() */
165 #define FSET_PERMIT_EXCLUSIVE 0x00000100 /* only one permitholder allowed */
166 #define FSET_HAS_BRANCHES 0x00000200 /* this fileset contains branches */
167 #define FSET_IS_BRANCH 0x00000400 /* this fileset is a branch */
168 #define FSET_FLAT_BRANCH 0x00000800 /* this fileset is ROOT with branches */
170 /* what to mark indicator (ioctl parameter) */
171 #define MARK_DENTRY 101
172 #define MARK_FSET 102
173 #define MARK_CACHE 103
174 #define MARK_GETFL 104
178 #define KML_MAJOR_VERSION 0x00010000
179 #define KML_MINOR_VERSION 0x00000002
180 #define KML_OPCODE_NOOP 0
181 #define KML_OPCODE_CREATE 1
182 #define KML_OPCODE_MKDIR 2
183 #define KML_OPCODE_UNLINK 3
184 #define KML_OPCODE_RMDIR 4
185 #define KML_OPCODE_CLOSE 5
186 #define KML_OPCODE_SYMLINK 6
187 #define KML_OPCODE_RENAME 7
188 #define KML_OPCODE_SETATTR 8
189 #define KML_OPCODE_LINK 9
190 #define KML_OPCODE_OPEN 10
191 #define KML_OPCODE_MKNOD 11
192 #define KML_OPCODE_WRITE 12
193 #define KML_OPCODE_RELEASE 13
194 #define KML_OPCODE_TRUNC 14
195 #define KML_OPCODE_SETEXTATTR 15
196 #define KML_OPCODE_DELEXTATTR 16
197 #define KML_OPCODE_KML_TRUNC 17
198 #define KML_OPCODE_GET_FILEID 18
199 #define KML_OPCODE_NUM 19
201 struct presto_version {
209 struct kml_prefix_hdr {
221 struct kml_prefix_hdr *hdr;
234 struct kml_prefix prefix;
242 struct presto_version *old_objectv;
243 struct presto_version *new_objectv;
244 struct presto_version *old_parentv;
245 struct presto_version *new_parentv;
246 struct presto_version *old_targetv;
247 struct presto_version *new_targetv;
269 struct kml_suffix *suffix;
275 /* izo_rcvd_rec fills the .intermezzo/fset/last_rcvd file and provides data about
276 * our view of reintegration offsets for a given peer.
278 * The only exception is the last_rcvd record which has a UUID consisting of all
279 * zeroes; this record's lr_local_offset field is the logical byte offset of our
280 * KML, which is updated when KML truncation takes place. All other fields are
283 /* XXX - document how clean shutdowns are recorded */
285 struct izo_rcvd_rec {
286 __u8 lr_uuid[16]; /* which peer? */
287 __u64 lr_remote_recno; /* last confirmed remote recno */
288 __u64 lr_remote_offset; /* last confirmed remote offset */
289 __u64 lr_local_recno; /* last locally reinted recno */
290 __u64 lr_local_offset; /* last locally reinted offset */
291 __u64 lr_last_ctime; /* the largest ctime that has reintegrated */
294 /* Cache purge database
296 * Each DB entry is this structure followed by the path name, no trailing NUL. */
297 struct izo_purge_entry {