hammer2 - Flesh out span code, API cleanups
[dragonfly.git] / sys / vfs / hammer2 / hammer2_ioctl.h
CommitLineData
2910a90c
MD
1/*
2 * Copyright (c) 2011-2012 The DragonFly Project. All rights reserved.
3 *
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@dragonflybsd.org>
6 * by Venkatesh Srinivas <vsrinivas@dragonflybsd.org>
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * 3. Neither the name of The DragonFly Project nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific, prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35#ifndef VFS_HAMMER2_IOCTL_H_
36#define VFS_HAMMER2_IOCTL_H_
37
38#ifndef _SYS_IOCCOM_H_
39#include <sys/ioccom.h>
40#endif
41#ifndef _VFS_HAMMER2_DISK_H_
42#include "hammer2_disk.h"
43#endif
44#ifndef _VFS_HAMMER2_MOUNT_H_
45#include "hammer2_mount.h"
46#endif
47
48/*
49 * get_version
50 */
51struct hammer2_ioc_version {
52 int version;
53 char reserved[256 - 4];
54};
55
56typedef struct hammer2_ioc_version hammer2_ioc_version_t;
57
58/*
59 * Ioctls to manage the volume->copyinfo[] array and to associate or
60 * disassociate sockets
61 */
62struct hammer2_ioc_remote {
63 int copyid;
64 int nextid; /* for iteration (get only) */
65 int fd; /* socket descriptor if applicable */
66 int reserved03;
67 int reserved04[8];
68 hammer2_copy_data_t copy1; /* copy spec */
69 hammer2_copy_data_t copy2; /* copy spec (rename ops only) */
70};
71
72typedef struct hammer2_ioc_remote hammer2_ioc_remote_t;
73
ae183399
MD
74/*
75 * Ioctls to manage PFSs
76 *
8c280d5d 77 * PFSs can be clustered by matching their pfs_clid, and the PFSs making up
ae183399 78 * a cluster can be uniquely identified by combining the vol_id with
8c280d5d 79 * the pfs_clid.
ae183399
MD
80 */
81struct hammer2_ioc_pfs {
82 hammer2_key_t name_key; /* super-root directory scan */
83 hammer2_key_t name_next; /* (GET only) */
84 uint8_t pfs_type; /* e.g. MASTER, SLAVE, ... */
85 uint8_t reserved0011;
86 uint8_t reserved0012;
87 uint8_t reserved0013;
88 uint32_t reserved0014;
89 uint64_t reserved0018;
90 uuid_t pfs_fsid; /* identifies PFS instance */
8c280d5d 91 uuid_t pfs_clid; /* identifies PFS cluster */
ae183399
MD
92 char name[NAME_MAX+1]; /* device@name mtpt */
93};
94
95typedef struct hammer2_ioc_pfs hammer2_ioc_pfs_t;
96
344d4f82
MD
97/*
98 * Ioctls to manage inodes
99 */
100struct hammer2_ioc_inode {
101 uint32_t flags;
26b047fa 102 void *kdata;
344d4f82
MD
103 hammer2_inode_data_t ip_data;
104};
105
106typedef struct hammer2_ioc_inode hammer2_ioc_inode_t;
107
108#define HAMMER2IOC_INODE_FLAG_IQUOTA 0x00000001
109#define HAMMER2IOC_INODE_FLAG_DQUOTA 0x00000002
110#define HAMMER2IOC_INODE_FLAG_COPIES 0x00000004
111
112/*
113 * Ioctl list
114 */
115
ae183399
MD
116#define HAMMER2IOC_VERSION_GET _IOWR('h', 64, struct hammer2_ioc_version)
117
118#define HAMMER2IOC_REMOTE_GET _IOWR('h', 68, struct hammer2_ioc_remote)
119#define HAMMER2IOC_REMOTE_ADD _IOWR('h', 69, struct hammer2_ioc_remote)
120#define HAMMER2IOC_REMOTE_DEL _IOWR('h', 70, struct hammer2_ioc_remote)
121#define HAMMER2IOC_REMOTE_REP _IOWR('h', 71, struct hammer2_ioc_remote)
2910a90c 122
ae183399
MD
123#define HAMMER2IOC_SOCKET_GET _IOWR('h', 76, struct hammer2_ioc_remote)
124#define HAMMER2IOC_SOCKET_SET _IOWR('h', 77, struct hammer2_ioc_remote)
2910a90c 125
ae183399
MD
126#define HAMMER2IOC_PFS_GET _IOWR('h', 80, struct hammer2_ioc_pfs)
127#define HAMMER2IOC_PFS_CREATE _IOWR('h', 81, struct hammer2_ioc_pfs)
128#define HAMMER2IOC_PFS_DELETE _IOWR('h', 82, struct hammer2_ioc_pfs)
2910a90c 129
344d4f82
MD
130#define HAMMER2IOC_INODE_GET _IOWR('h', 86, struct hammer2_ioc_inode)
131#define HAMMER2IOC_INODE_SET _IOWR('h', 87, struct hammer2_ioc_inode)
132
2910a90c 133#endif