1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * scalable distributed file system
6 * Copyright (C) Jeff Layton <jlayton@redhat.com>
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.
14 #ifndef CEPH_CEPH_LL_CLIENT_H
15 #define CEPH_CEPH_LL_CLIENT_H
19 #include "include/win32/fs_compat.h"
29 typedef struct vinodeno_t vinodeno
;
31 #else /* __cplusplus */
35 typedef struct inodeno_t
{
39 typedef struct _snapid_t
{
43 typedef struct vinodeno_t
{
48 #endif /* __cplusplus */
51 * Heavily borrowed from David Howells' draft statx patchset.
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.
69 struct timespec stx_atime
;
70 struct timespec stx_ctime
;
71 struct timespec stx_mtime
;
72 struct timespec stx_btime
;
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 */
93 * Compatibility macros until these defines make their way into glibc
95 #ifndef AT_NO_ATTR_SYNC
96 #define AT_NO_ATTR_SYNC 0x4000 /* Don't sync attributes with the server */
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.
103 #define CEPH_REQ_FLAG_MASK (AT_SYMLINK_NOFOLLOW|AT_NO_ATTR_SYNC)
105 /* fallocate mode flags */
106 #ifndef FALLOC_FL_KEEP_SIZE
107 #define FALLOC_FL_KEEP_SIZE 0x01
109 #ifndef FALLOC_FL_PUNCH_HOLE
110 #define FALLOC_FL_PUNCH_HOLE 0x02
113 /** ceph_deleg_cb_t: Delegation recalls
115 * Called when there is an outstanding Delegation and there is conflicting
116 * access, either locally or via cap activity.
117 * @fh: open filehandle
118 * @priv: private info registered when delegation was acquired
120 typedef void (*ceph_deleg_cb_t
)(Fh
*fh
, void *priv
);
123 * client_ino_callback_t: Inode data/metadata invalidation
125 * Called when the client wants to invalidate the cached data for a range
127 * @handle: client callback handle
128 * @ino: vino of inode to be invalidated
129 * @off: starting offset of content to be invalidated
130 * @len: length of region to invalidate
132 typedef void (*client_ino_callback_t
)(void *handle
, vinodeno_t ino
,
133 int64_t off
, int64_t len
);
136 * client_dentry_callback_t: Dentry invalidation
138 * Called when the client wants to purge a dentry from its cache.
139 * @handle: client callback handle
140 * @dirino: vino of directory that contains dentry to be invalidate
141 * @ino: vino of inode attached to dentry to be invalidated
142 * @name: name of dentry to be invalidated
143 * @len: length of @name
145 typedef void (*client_dentry_callback_t
)(void *handle
, vinodeno_t dirino
,
146 vinodeno_t ino
, const char *name
,
150 * client_remount_callback_t: Remount entire fs
152 * Called when the client needs to purge the dentry cache and the application
153 * doesn't have a way to purge an individual dentry. Mostly used for ceph-fuse
155 * @handle: client callback handle
158 typedef int (*client_remount_callback_t
)(void *handle
);
161 * client_switch_interrupt_callback_t: Lock request interrupted
163 * Called before file lock request to set the interrupt handler while waiting
164 * After the wait, called with "data" set to NULL pointer.
165 * @handle: client callback handle
166 * @data: opaque data passed to interrupt before call, NULL pointer after.
168 typedef void (*client_switch_interrupt_callback_t
)(void *handle
, void *data
);
171 * client_umask_callback_t: Fetch umask of actor
173 * Called when the client needs the umask of the requestor.
174 * @handle: client callback handle
176 typedef mode_t (*client_umask_callback_t
)(void *handle
);
179 * client_ino_release_t: Request that application release Inode references
181 * Called when the MDS wants to trim caps and Inode records.
182 * @handle: client callback handle
183 * @ino: vino of Inode being released
185 typedef void (*client_ino_release_t
)(void *handle
, vinodeno_t ino
);
188 * The handle is an opaque value that gets passed to some callbacks. Any fields
189 * set to NULL will be left alone. There is no way to unregister callbacks.
191 struct ceph_client_callback_args
{
193 client_ino_callback_t ino_cb
;
194 client_dentry_callback_t dentry_cb
;
195 client_switch_interrupt_callback_t switch_intr_cb
;
196 client_remount_callback_t remount_cb
;
197 client_umask_callback_t umask_cb
;
198 client_ino_release_t ino_release_cb
;
205 #endif /* CEPH_STATX_H */