summaryrefslogtreecommitdiffstats
path: root/src/librbd/CMakeLists.txt
blob: a41d85d04daa7c6c242976b5e36756efb2920593 (plain)
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
set(librbd_types_srcs
  journal/Types.cc
  mirroring_watcher/Types.cc
  trash_watcher/Types.cc
  watcher/Types.cc
  WatchNotifyTypes.cc)

if(WITH_RBD_RWL OR WITH_RBD_SSD_CACHE)
 list(APPEND librbd_types_srcs cache/pwl/Types.cc)
endif()

add_library(rbd_types STATIC
  ${librbd_types_srcs})

if (WITH_RBD_RWL)
  target_link_libraries(rbd_types
    PUBLIC pmem::pmemobj)
endif()

set(librbd_internal_srcs
  AsioEngine.cc
  AsyncObjectThrottle.cc
  AsyncRequest.cc
  ConfigWatcher.cc
  DeepCopyRequest.cc
  ExclusiveLock.cc
  ImageCtx.cc
  ImageState.cc
  ImageWatcher.cc
  internal.cc
  Journal.cc
  LibrbdAdminSocketHook.cc
  ManagedLock.cc
  MirroringWatcher.cc
  ObjectMap.cc
  Operations.cc
  PluginRegistry.cc
  TrashWatcher.cc
  Utils.cc
  Watcher.cc
  api/Config.cc
  api/DiffIterate.cc
  api/Group.cc
  api/Image.cc
  api/Io.cc
  api/Migration.cc
  api/Mirror.cc
  api/Namespace.cc
  api/Pool.cc
  api/PoolMetadata.cc
  api/Snapshot.cc
  api/Trash.cc
  api/Utils.cc
  asio/ContextWQ.cc
  cache/ImageWriteback.cc
  cache/ObjectCacherObjectDispatch.cc
  cache/ObjectCacherWriteback.cc
  cache/WriteAroundObjectDispatch.cc
  crypto/BlockCrypto.cc
  crypto/CryptoContextPool.cc
  crypto/CryptoImageDispatch.cc
  crypto/CryptoObjectDispatch.cc
  crypto/FormatRequest.cc
  crypto/LoadRequest.cc
  crypto/ShutDownCryptoRequest.cc
  crypto/Utils.cc
  crypto/openssl/DataCryptor.cc
  deep_copy/ImageCopyRequest.cc
  deep_copy/MetadataCopyRequest.cc
  deep_copy/ObjectCopyRequest.cc
  deep_copy/SetHeadRequest.cc
  deep_copy/SnapshotCopyRequest.cc
  deep_copy/SnapshotCreateRequest.cc
  deep_copy/Utils.cc
  exclusive_lock/AutomaticPolicy.cc
  exclusive_lock/ImageDispatch.cc
  exclusive_lock/PreAcquireRequest.cc
  exclusive_lock/PostAcquireRequest.cc
  exclusive_lock/PreReleaseRequest.cc
  exclusive_lock/StandardPolicy.cc
  image/AttachChildRequest.cc
  image/AttachParentRequest.cc
  image/CloneRequest.cc
  image/CloseRequest.cc
  image/CreateRequest.cc
  image/DetachChildRequest.cc
  image/DetachParentRequest.cc
  image/GetMetadataRequest.cc
  image/ListWatchersRequest.cc
  image/OpenRequest.cc
  image/PreRemoveRequest.cc
  image/RefreshParentRequest.cc
  image/RefreshRequest.cc
  image/RemoveRequest.cc
  image/SetFlagsRequest.cc
  image/SetSnapRequest.cc
  image/ValidatePoolRequest.cc
  image_watcher/NotifyLockOwner.cc
  io/AioCompletion.cc
  io/AsyncOperation.cc
  io/CopyupRequest.cc
  io/FlushTracker.cc
  io/ImageDispatch.cc
  io/ImageDispatchSpec.cc
  io/ImageDispatcher.cc
  io/ImageRequest.cc
  io/ObjectDispatch.cc
  io/ObjectDispatchSpec.cc
  io/ObjectDispatcher.cc
  io/ObjectRequest.cc
  io/QosImageDispatch.cc
  io/QueueImageDispatch.cc
  io/ReadResult.cc
  io/RefreshImageDispatch.cc
  io/SimpleSchedulerObjectDispatch.cc
  io/Types.cc
  io/Utils.cc
  io/WriteBlockImageDispatch.cc
  journal/CreateRequest.cc
  journal/DemoteRequest.cc
  journal/ObjectDispatch.cc
  journal/OpenRequest.cc
  journal/PromoteRequest.cc
  journal/RemoveRequest.cc
  journal/Replay.cc
  journal/ResetRequest.cc
  journal/StandardPolicy.cc
  journal/Utils.cc
  managed_lock/AcquireRequest.cc
  managed_lock/BreakRequest.cc
  managed_lock/GetLockerRequest.cc
  managed_lock/ReacquireRequest.cc
  managed_lock/ReleaseRequest.cc
  managed_lock/Utils.cc
  migration/FileStream.cc
  migration/HttpClient.cc
  migration/HttpStream.cc
  migration/ImageDispatch.cc
  migration/NativeFormat.cc
  migration/OpenSourceImageRequest.cc
  migration/QCOWFormat.cc
  migration/RawFormat.cc
  migration/RawSnapshot.cc
  migration/S3Stream.cc
  migration/SourceSpecBuilder.cc
  migration/Utils.cc
  mirror/DemoteRequest.cc
  mirror/DisableRequest.cc
  mirror/EnableRequest.cc
  mirror/GetInfoRequest.cc
  mirror/GetStatusRequest.cc
  mirror/GetUuidRequest.cc
  mirror/ImageRemoveRequest.cc
  mirror/ImageStateUpdateRequest.cc
  mirror/PromoteRequest.cc
  mirror/snapshot/CreateNonPrimaryRequest.cc
  mirror/snapshot/CreatePrimaryRequest.cc
  mirror/snapshot/DemoteRequest.cc
  mirror/snapshot/GetImageStateRequest.cc
  mirror/snapshot/ImageMeta.cc
  mirror/snapshot/PromoteRequest.cc
  mirror/snapshot/RemoveImageStateRequest.cc
  mirror/snapshot/SetImageStateRequest.cc
  mirror/snapshot/Types.cc
  mirror/snapshot/UnlinkPeerRequest.cc
  mirror/snapshot/Utils.cc
  mirror/snapshot/WriteImageStateRequest.cc
  object_map/CreateRequest.cc
  object_map/DiffRequest.cc
  object_map/InvalidateRequest.cc
  object_map/LockRequest.cc
  object_map/RefreshRequest.cc
  object_map/RemoveRequest.cc
  object_map/Request.cc
  object_map/ResizeRequest.cc
  object_map/SnapshotCreateRequest.cc
  object_map/SnapshotRemoveRequest.cc
  object_map/SnapshotRollbackRequest.cc
  object_map/UnlockRequest.cc
  object_map/UpdateRequest.cc
  operation/DisableFeaturesRequest.cc
  operation/EnableFeaturesRequest.cc
  operation/FlattenRequest.cc
  operation/MetadataRemoveRequest.cc
  operation/MetadataSetRequest.cc
  operation/MigrateRequest.cc
  operation/ObjectMapIterate.cc
  operation/RebuildObjectMapRequest.cc
  operation/RenameRequest.cc
  operation/Request.cc
  operation/ResizeRequest.cc
  operation/SnapshotCreateRequest.cc
  operation/SnapshotProtectRequest.cc
  operation/SnapshotRemoveRequest.cc
  operation/SnapshotRenameRequest.cc
  operation/SnapshotRollbackRequest.cc
  operation/SnapshotUnprotectRequest.cc
  operation/SnapshotLimitRequest.cc
  operation/SparsifyRequest.cc
  operation/TrimRequest.cc
  plugin/Api.cc
  trash/MoveRequest.cc
  trash/RemoveRequest.cc
  watcher/Notifier.cc
  watcher/RewatchRequest.cc
  ${CMAKE_SOURCE_DIR}/src/common/ContextCompletion.cc)

if(WITH_EVENTTRACE)
  list(APPEND librbd_internal_srcs ../common/EventTrace.cc)
endif()

if(LINUX AND HAVE_LIBCRYPTSETUP)
  list(APPEND librbd_internal_srcs
          crypto/luks/EncryptionFormat.cc
          crypto/luks/Header.cc
          crypto/luks/FormatRequest.cc
          crypto/luks/LoadRequest.cc)
endif()

add_library(rbd_api STATIC librbd.cc)
add_library(rbd_internal STATIC
  ${librbd_internal_srcs}
  $<TARGET_OBJECTS:rados_snap_set_diff_obj>)
if(WITH_LTTNG)
  # librbd.cc includes tracing/librbd.h
  add_dependencies(rbd_api librbd-tp)
  # io/AioCompletion.cc includes tracing/librbd.h
  add_dependencies(rbd_internal librbd-tp)
endif()
if(WITH_EVENTTRACE)
  add_dependencies(rbd_internal eventtrace_tp)
endif()
target_link_libraries(rbd_internal PRIVATE
  osdc rbd_types
  OpenSSL::SSL)
target_include_directories(rbd_internal PRIVATE ${OPENSSL_INCLUDE_DIR})
if(LINUX AND HAVE_LIBCRYPTSETUP)
  target_include_directories(rbd_internal PRIVATE ${LIBCRYPTSETUP_INCLUDE_DIR})
  target_link_libraries(rbd_internal PRIVATE ${LIBCRYPTSETUP_LIBRARIES})
endif()

add_custom_target(librbd_plugins)
set(librbd_plugins_dir ${CEPH_INSTALL_PKGLIBDIR}/librbd)

set(rbd_plugin_parent_cache_srcs
  cache/ParentCacheObjectDispatch.cc
  plugin/ParentCache.cc)
add_library(librbd_plugin_parent_cache SHARED
  ${rbd_plugin_parent_cache_srcs})
target_link_libraries(librbd_plugin_parent_cache PRIVATE
  ceph_immutable_object_cache_lib ceph-common librbd
  libneorados
  librados)
set_target_properties(librbd_plugin_parent_cache PROPERTIES
  OUTPUT_NAME ceph_librbd_parent_cache
  VERSION 1.0.0
  SOVERSION 1)
install(TARGETS librbd_plugin_parent_cache DESTINATION ${librbd_plugins_dir})
add_dependencies(librbd_plugins librbd_plugin_parent_cache)

if(WITH_RBD_RWL OR WITH_RBD_SSD_CACHE)
  set(rbd_plugin_pwl_srcs
    cache/WriteLogImageDispatch.cc
    cache/pwl/AbstractWriteLog.cc
    cache/pwl/DiscardRequest.cc
    cache/pwl/ImageCacheState.cc
    cache/pwl/InitRequest.cc
    cache/pwl/LogEntry.cc
    cache/pwl/LogMap.cc
    cache/pwl/LogOperation.cc
    cache/pwl/Request.cc
    cache/pwl/ShutdownRequest.cc
    cache/pwl/SyncPoint.cc
    cache/pwl/Types.cc
    plugin/WriteLogImageCache.cc)

    if(WITH_RBD_SSD_CACHE)
      set(rbd_plugin_pwl_srcs
        ${rbd_plugin_pwl_srcs}
        cache/pwl/ssd/LogEntry.cc
        cache/pwl/ssd/LogOperation.cc
        cache/pwl/ssd/ReadRequest.cc
        cache/pwl/ssd/Request.cc
        cache/pwl/ssd/WriteLog.cc)
    endif()
    if(WITH_RBD_RWL)
      set(rbd_plugin_pwl_srcs
        ${rbd_plugin_pwl_srcs}
        cache/pwl/rwl/WriteLog.cc
        cache/pwl/rwl/LogEntry.cc
        cache/pwl/rwl/LogOperation.cc
        cache/pwl/rwl/ReadRequest.cc
        cache/pwl/rwl/Request.cc)
    endif()

  add_library(librbd_plugin_pwl_cache SHARED
    ${rbd_plugin_pwl_srcs})
  target_link_libraries(librbd_plugin_pwl_cache PRIVATE
    blk
    ceph-common
    cls_rbd_client
    libneorados
    librados
    StdFilesystem::filesystem)

  if(WITH_RBD_RWL)
    target_link_libraries(librbd_plugin_pwl_cache
      PUBLIC pmem::pmemobj
      PRIVATE pmem::pmem)
  endif()

  set_target_properties(librbd_plugin_pwl_cache PROPERTIES
    OUTPUT_NAME ceph_librbd_pwl_cache
    VERSION 1.0.0
    SOVERSION 1)
  install(TARGETS librbd_plugin_pwl_cache DESTINATION ${librbd_plugins_dir})
  add_dependencies(librbd_plugins librbd_plugin_pwl_cache)
endif()

add_library(librbd ${CEPH_SHARED}
  librbd.cc)
if(WITH_LTTNG)
  add_dependencies(librbd librbd-tp)
endif()

target_link_libraries(librbd PRIVATE
  rbd_internal
  rbd_types
  journal
  cls_rbd_client
  cls_lock_client
  cls_journal_client
  libneorados
  librados
  ceph-common
  pthread
  ${CMAKE_DL_LIBS}
  ${EXTRALIBS} ${GSSAPI_LIBRARIES})
if(HAVE_UDEV)
  target_link_libraries(librbd PRIVATE
    udev)
endif()
if(ENABLE_SHARED)
  set_target_properties(librbd PROPERTIES
    OUTPUT_NAME rbd
    VERSION 1.16.0
    SOVERSION 1
    CXX_VISIBILITY_PRESET hidden
    VISIBILITY_INLINES_HIDDEN ON)
    if(NOT APPLE AND NOT WIN32)
      set_property(TARGET librbd APPEND_STRING PROPERTY
        LINK_FLAGS " -Wl,--exclude-libs,ALL")
    endif()
endif(ENABLE_SHARED)
install(TARGETS librbd DESTINATION ${CMAKE_INSTALL_LIBDIR})