2 * Copyright (c) 2008 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/vfs/hammer/hammer_ioctl.h,v 1.2 2008/02/05 07:58:43 dillon Exp $
37 * HAMMER ioctl's. This file can be #included from userland
40 #ifndef VFS_HAMMER_IOCTL_H_
41 #define VFS_HAMMER_IOCTL_H_
43 #include <sys/types.h>
44 #include <sys/ioccom.h>
45 #include "hammer_disk.h"
50 * beg/end TID ranges in the element array must be sorted in descending
51 * order, with the most recent (highest) range at elms[0].
53 struct hammer_ioc_prune_elm {
54 hammer_tid_t beg_tid; /* starting tid */
55 hammer_tid_t end_tid; /* ending tid (non inclusive) */
56 hammer_tid_t mod_tid; /* modulo */
59 #define HAMMER_MAX_PRUNE_ELMS 64
61 struct hammer_ioc_prune {
65 int64_t cur_obj_id; /* initialize to end_obj_id */
66 int64_t cur_key; /* initialize to HAMMER_MAX_KEY */
67 int64_t end_obj_id; /* (range-exclusive) */
68 int64_t stat_scanrecords;/* number of records scanned */
69 int64_t stat_rawrecords; /* number of raw records pruned */
70 int64_t stat_dirrecords; /* number of dir records pruned */
71 int64_t stat_bytes; /* number of data bytes pruned */
72 int64_t stat_realignments; /* number of raw records realigned */
73 int64_t reserved02[7];
74 struct hammer_ioc_prune_elm elms[HAMMER_MAX_PRUNE_ELMS];
78 * HAMMERIOC_GETHISTORY
80 * Retrieve an array of ordered transaction ids >= beg and < end indicating
81 * all changes made to the specified object's inode up to the
84 * If ATKEY is set the key field indicates a particular key within the
85 * inode to retrieve the history for.
87 * On return count is set to the number of elements returned, nxt_tid is
88 * set to the tid the caller should store in beg_tid to continue the
89 * iteration, and nxt_key is set to the nearest key boundary > key
90 * indicating the range key - nxt_key (nxt_key non-inclusive) the tid
91 * array represents. Also obj_id is set to the object's inode number.
93 * nxt_key can be used to iterate the contents of a single file but should
94 * not be stored in key until all modifications at key have been retrieved.
95 * To work properly nxt_key should be initialized to HAMMER_MAX_KEY.
96 * Successive ioctl() calls will reduce nxt_key as appropriate so at the
97 * end of your iterating for 'key', key to nxt_key will represent the
98 * shortest range of keys that all returned TIDs apply to.
101 #define HAMMER_MAX_HISTORY_ELMS 64
103 struct hammer_ioc_history {
105 hammer_tid_t beg_tid;
106 hammer_tid_t nxt_tid;
107 hammer_tid_t end_tid;
112 hammer_tid_t tid_ary[HAMMER_MAX_HISTORY_ELMS];
115 #define HAMMER_IOC_HISTORY_ATKEY 0x0001
116 #define HAMMER_IOC_HISTORY_NEXT_TID 0x0002 /* iterate via nxt_tid */
117 #define HAMMER_IOC_HISTORY_NEXT_KEY 0x0004 /* iterate via nxt_key */
118 #define HAMMER_IOC_HISTORY_EOF 0x0008 /* no more keys */
119 #define HAMMER_IOC_HISTORY_UNSYNCED 0x0010 /* unsynced info in inode */
121 #define HAMMERIOC_PRUNE _IOWR('h',1,struct hammer_ioc_prune)
122 #define HAMMERIOC_GETHISTORY _IOWR('h',2,struct hammer_ioc_history)