]>
git.proxmox.com Git - ceph.git/blob - ceph/src/include/krbd.h
2 * Ceph - scalable distributed file system
4 * Copyright (C) 2014 Inktank Storage, Inc.
6 * This is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software
9 * Foundation. See file COPYING.
16 #include "rados/librados.h"
19 * Don't wait for udev add uevents in krbd_map() and udev remove
20 * uevents in krbd_unmap*(). Instead, make do with the respective
21 * kernel uevents and return as soon as they are received.
23 * systemd-udevd sends out udev uevents after it finishes processing
24 * the respective kernel uevents, which mostly boils down to executing
25 * all matching udev rules. With this flag set, on return from
26 * krbd_map() systemd-udevd may still be poking at the device: it
27 * may still be open with tools such as blkid and various ioctls to
28 * be run against it, none of the persistent symlinks to the device
29 * node may be there, etc. udev used to be responsible for creating
30 * the device node as well, but that has been handled by devtmpfs in
31 * the kernel for many years now, so the device node (as returned
32 * through @pdevnode) is guaranteed to be there.
34 * If set, krbd_map() and krbd_unmap*() can be invoked from any
35 * network namespace that is owned by the initial user namespace
36 * (which is a formality because things like loading kernel modules
37 * and creating block devices are not namespaced and require global
38 * privileges, i.e. capabilities in the initial user namespace).
39 * Otherwise, krbd_map() and krbd_unmap*() must be invoked from
40 * the initial network namespace.
42 * If set, krbd_unmap*() doesn't attempt to settle the udev queue
43 * before retrying unmap for the last time. Some EBUSY errors due
44 * to systemd-udevd poking at the device at the time krbd_unmap*()
45 * is invoked that are otherwise covered by the retry logic may be
48 #define KRBD_CTX_F_NOUDEV (1U << 0)
56 int krbd_create_from_context(rados_config_t cct
, uint32_t flags
,
57 struct krbd_ctx
**pctx
);
58 void krbd_destroy(struct krbd_ctx
*ctx
);
60 int krbd_map(struct krbd_ctx
*ctx
,
61 const char *pool_name
,
62 const char *nspace_name
,
63 const char *image_name
,
64 const char *snap_name
,
67 int krbd_is_mapped(struct krbd_ctx
*ctx
,
68 const char *pool_name
,
69 const char *nspace_name
,
70 const char *image_name
,
71 const char *snap_name
,
74 int krbd_unmap(struct krbd_ctx
*ctx
, const char *devnode
,
76 int krbd_unmap_by_spec(struct krbd_ctx
*ctx
,
77 const char *pool_name
,
78 const char *nspace_name
,
79 const char *image_name
,
80 const char *snap_name
,
93 int krbd_showmapped(struct krbd_ctx
*ctx
, ceph::Formatter
*f
);
95 #endif /* __cplusplus */
97 #endif /* CEPH_KRBD_H */