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