sys/vfs/hammer2/hammer2_ioctl.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | /* * Copyright (c) 2011-2020 The DragonFly Project. All rights reserved. * * This code is derived from software contributed to The DragonFly Project * by Matthew Dillon <dillon@dragonflybsd.org> * by Venkatesh Srinivas <vsrinivas@dragonflybsd.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name of The DragonFly Project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific, prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _VFS_HAMMER2_IOCTL_H_ #define _VFS_HAMMER2_IOCTL_H_ #include <sys/param.h> #include <sys/syslimits.h> #ifndef _SYS_IOCCOM_H_ #include <sys/ioccom.h> #endif #ifndef _VFS_HAMMER2_DISK_H_ #include "hammer2_disk.h" #endif #ifndef _VFS_HAMMER2_MOUNT_H_ #include "hammer2_mount.h" #endif /* * get_version */ struct hammer2_ioc_version { int version; char reserved[256 - 4]; }; typedef struct hammer2_ioc_version hammer2_ioc_version_t; struct hammer2_ioc_recluster { int fd; char reserved[256 - 4]; }; typedef struct hammer2_ioc_recluster hammer2_ioc_recluster_t; /* * Ioctls to manage the volume->copyinfo[] array and to associate or * disassociate sockets */ struct hammer2_ioc_remote { int copyid; int nextid; /* for iteration (get only) */ int fd; /* socket descriptor if applicable */ int reserved03; int reserved04[8]; hammer2_volconf_t copy1; /* copy spec */ hammer2_volconf_t copy2; /* copy spec (rename ops only) */ }; typedef struct hammer2_ioc_remote hammer2_ioc_remote_t; /* * Ioctls to manage PFSs * * PFSs can be clustered by matching their pfs_clid, and the PFSs making up * a cluster can be uniquely identified by combining the vol_id with * the pfs_clid. */ struct hammer2_ioc_pfs { hammer2_key_t name_key; /* super-root directory scan */ hammer2_key_t name_next; /* (GET only) */ uint8_t pfs_type; /* e.g. MASTER, SLAVE, ... */ uint8_t pfs_subtype; /* e.g. SNAPSHOT */ uint8_t reserved0012; uint8_t reserved0013; uint32_t pfs_flags; uint64_t reserved0018; uuid_t pfs_fsid; /* identifies PFS instance */ uuid_t pfs_clid; /* identifies PFS cluster */ char name[NAME_MAX+1]; /* PFS label */ }; typedef struct hammer2_ioc_pfs hammer2_ioc_pfs_t; #define HAMMER2_PFSFLAGS_NOSYNC 0x00000001 /* * Ioctls to manage inodes */ struct hammer2_ioc_inode { uint32_t flags; void *unused; hammer2_key_t data_count; hammer2_key_t inode_count; hammer2_inode_data_t ip_data; }; typedef struct hammer2_ioc_inode hammer2_ioc_inode_t; #define HAMMER2IOC_INODE_FLAG_IQUOTA 0x00000001 #define HAMMER2IOC_INODE_FLAG_DQUOTA 0x00000002 #define HAMMER2IOC_INODE_FLAG_COPIES 0x00000004 #define HAMMER2IOC_INODE_FLAG_CHECK 0x00000008 #define HAMMER2IOC_INODE_FLAG_COMP 0x00000010 /* * Ioctl for bulkfree scan */ struct hammer2_ioc_bulkfree { hammer2_off_t sbase; /* starting storage offset */ hammer2_off_t sstop; /* (set on return) */ size_t size; /* swapable kernel memory to use */ hammer2_off_t count_allocated; /* alloc fixups this run */ hammer2_off_t count_freed; /* bytes freed this run */ hammer2_off_t total_fragmented; /* merged result */ hammer2_off_t total_allocated; /* merged result */ hammer2_off_t total_scanned; /* bytes of storage */ }; typedef struct hammer2_ioc_bulkfree hammer2_ioc_bulkfree_t; /* * Unconditionally delete a hammer2 directory entry or inode number */ struct hammer2_ioc_destroy { enum { HAMMER2_DELETE_NOP, HAMMER2_DELETE_FILE, HAMMER2_DELETE_INUM } cmd; char path[HAMMER2_INODE_MAXNAME]; hammer2_key_t inum; }; typedef struct hammer2_ioc_destroy hammer2_ioc_destroy_t; /* * Grow the filesystem. If size is set to 0 H2 will auto-size to the * partition it is in. The caller can resize the partition, then issue * the ioctl. */ struct hammer2_ioc_growfs { hammer2_off_t size; int modified; int unused01; int unusedary[14]; }; typedef struct hammer2_ioc_growfs hammer2_ioc_growfs_t; /* * Ioctls to manage volumes */ struct hammer2_ioc_volume { char path[MAXPATHLEN]; int id; hammer2_off_t offset; hammer2_off_t size; }; typedef struct hammer2_ioc_volume hammer2_ioc_volume_t; struct hammer2_ioc_volume_list { hammer2_ioc_volume_t *volumes; int nvolumes; int version; char pfs_name[HAMMER2_INODE_MAXNAME]; }; typedef struct hammer2_ioc_volume_list hammer2_ioc_volume_list_t; /* * Ioctl list */ #define HAMMER2IOC_VERSION_GET _IOWR('h', 64, struct hammer2_ioc_version) #define HAMMER2IOC_RECLUSTER _IOWR('h', 65, struct hammer2_ioc_recluster) #define HAMMER2IOC_REMOTE_SCAN _IOWR('h', 68, struct hammer2_ioc_remote) #define HAMMER2IOC_REMOTE_ADD _IOWR('h', 69, struct hammer2_ioc_remote) #define HAMMER2IOC_REMOTE_DEL _IOWR('h', 70, struct hammer2_ioc_remote) #define HAMMER2IOC_REMOTE_REP _IOWR('h', 71, struct hammer2_ioc_remote) #define HAMMER2IOC_SOCKET_GET _IOWR('h', 76, struct hammer2_ioc_remote) #define HAMMER2IOC_SOCKET_SET _IOWR('h', 77, struct hammer2_ioc_remote) #define HAMMER2IOC_PFS_GET _IOWR('h', 80, struct hammer2_ioc_pfs) #define HAMMER2IOC_PFS_CREATE _IOWR('h', 81, struct hammer2_ioc_pfs) #define HAMMER2IOC_PFS_DELETE _IOWR('h', 82, struct hammer2_ioc_pfs) #define HAMMER2IOC_PFS_LOOKUP _IOWR('h', 83, struct hammer2_ioc_pfs) #define HAMMER2IOC_PFS_SNAPSHOT _IOWR('h', 84, struct hammer2_ioc_pfs) #define HAMMER2IOC_INODE_GET _IOWR('h', 86, struct hammer2_ioc_inode) #define HAMMER2IOC_INODE_SET _IOWR('h', 87, struct hammer2_ioc_inode) /* * 88, 89, 90 - old copmression ioctls, now reserved * * 94 - note that this deletes a directory entry or inode number * unconditionally. */ #define HAMMER2IOC_DEBUG_DUMP _IOWR('h', 91, int) #define HAMMER2IOC_BULKFREE_SCAN _IOWR('h', 92, struct hammer2_ioc_bulkfree) #define HAMMER2IOC_BULKFREE_ASYNC _IOWR('h', 93, struct hammer2_ioc_bulkfree) #define HAMMER2IOC_DESTROY _IOWR('h', 94, struct hammer2_ioc_destroy) #define HAMMER2IOC_EMERG_MODE _IOWR('h', 95, int) #define HAMMER2IOC_GROWFS _IOWR('h', 96, struct hammer2_ioc_growfs) #define HAMMER2IOC_VOLUME_LIST _IOWR('h', 97, struct hammer2_ioc_volume_list) #endif /* !_VFS_HAMMER2_IOCTL_H_ */ |