]> git.proxmox.com Git - ceph.git/blob - ceph/src/include/cephfs/ceph_ll_client.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / include / cephfs / ceph_ll_client.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * scalable distributed file system
5 *
6 * Copyright (C) Jeff Layton <jlayton@redhat.com>
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 */
13
14 #ifndef CEPH_CEPH_LL_CLIENT_H
15 #define CEPH_CEPH_LL_CLIENT_H
16 #include <stdint.h>
17
18 #ifdef _WIN32
19 #include "include/win32/fs_compat.h"
20 #endif
21
22 #ifdef __cplusplus
23 extern "C" {
24
25 class Fh;
26
27 struct inodeno_t;
28 struct vinodeno_t;
29 typedef struct vinodeno_t vinodeno;
30
31 #else /* __cplusplus */
32
33 typedef struct Fh Fh;
34
35 typedef struct inodeno_t {
36 uint64_t val;
37 } inodeno_t;
38
39 typedef struct _snapid_t {
40 uint64_t val;
41 } snapid_t;
42
43 typedef struct vinodeno_t {
44 inodeno_t ino;
45 snapid_t snapid;
46 } vinodeno_t;
47
48 #endif /* __cplusplus */
49
50 /*
51 * Heavily borrowed from David Howells' draft statx patchset.
52 *
53 * Since the xstat patches are still a work in progress, we borrow its data
54 * structures and #defines to implement ceph_getattrx. Once the xstat stuff
55 * has been merged we should drop this and switch over to using that instead.
56 */
57 struct ceph_statx {
58 uint32_t stx_mask;
59 uint32_t stx_blksize;
60 uint32_t stx_nlink;
61 uint32_t stx_uid;
62 uint32_t stx_gid;
63 uint16_t stx_mode;
64 uint64_t stx_ino;
65 uint64_t stx_size;
66 uint64_t stx_blocks;
67 dev_t stx_dev;
68 dev_t stx_rdev;
69 struct timespec stx_atime;
70 struct timespec stx_ctime;
71 struct timespec stx_mtime;
72 struct timespec stx_btime;
73 uint64_t stx_version;
74 };
75
76 #define CEPH_STATX_MODE 0x00000001U /* Want/got stx_mode */
77 #define CEPH_STATX_NLINK 0x00000002U /* Want/got stx_nlink */
78 #define CEPH_STATX_UID 0x00000004U /* Want/got stx_uid */
79 #define CEPH_STATX_GID 0x00000008U /* Want/got stx_gid */
80 #define CEPH_STATX_RDEV 0x00000010U /* Want/got stx_rdev */
81 #define CEPH_STATX_ATIME 0x00000020U /* Want/got stx_atime */
82 #define CEPH_STATX_MTIME 0x00000040U /* Want/got stx_mtime */
83 #define CEPH_STATX_CTIME 0x00000080U /* Want/got stx_ctime */
84 #define CEPH_STATX_INO 0x00000100U /* Want/got stx_ino */
85 #define CEPH_STATX_SIZE 0x00000200U /* Want/got stx_size */
86 #define CEPH_STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */
87 #define CEPH_STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */
88 #define CEPH_STATX_BTIME 0x00000800U /* Want/got stx_btime */
89 #define CEPH_STATX_VERSION 0x00001000U /* Want/got stx_version */
90 #define CEPH_STATX_ALL_STATS 0x00001fffU /* All supported stats */
91
92 /*
93 * Compatibility macros until these defines make their way into glibc
94 */
95 #ifndef AT_NO_ATTR_SYNC
96 #define AT_NO_ATTR_SYNC 0x4000 /* Don't sync attributes with the server */
97 #endif
98
99 /*
100 * The statx interfaces only allow these flags. In order to allow us to add
101 * others in the future, we disallow setting any that aren't recognized.
102 */
103 #define CEPH_REQ_FLAG_MASK (AT_SYMLINK_NOFOLLOW|AT_NO_ATTR_SYNC)
104
105 /* delegation recalls */
106 typedef void (*ceph_deleg_cb_t)(Fh *fh, void *priv);
107
108 /* inode data/metadata invalidation */
109 typedef void (*client_ino_callback_t)(void *handle, vinodeno_t ino,
110 int64_t off, int64_t len);
111
112 /* dentry invalidation */
113 typedef void (*client_dentry_callback_t)(void *handle, vinodeno_t dirino,
114 vinodeno_t ino, const char *name,
115 size_t len);
116
117 /* remount entire fs */
118 typedef int (*client_remount_callback_t)(void *handle);
119
120 /* lock request interrupted */
121 typedef void (*client_switch_interrupt_callback_t)(void *handle, void *data);
122
123 /* fetch umask of actor */
124 typedef mode_t (*client_umask_callback_t)(void *handle);
125
126 /* request that application release Inode references */
127 typedef void (*client_ino_release_t)(void *handle, vinodeno_t ino);
128
129 /*
130 * The handle is an opaque value that gets passed to some callbacks. Any fields
131 * set to NULL will be left alone. There is no way to unregister callbacks.
132 */
133 struct ceph_client_callback_args {
134 void *handle;
135 client_ino_callback_t ino_cb;
136 client_dentry_callback_t dentry_cb;
137 client_switch_interrupt_callback_t switch_intr_cb;
138 client_remount_callback_t remount_cb;
139 client_umask_callback_t umask_cb;
140 client_ino_release_t ino_release_cb;
141 };
142
143 #ifdef __cplusplus
144 }
145 #endif
146
147 #endif /* CEPH_STATX_H */
148