It is legal to create a image name like "foo@s1" by the rbd-fuse method.However the "foo@s1" type image name is not accepted for it may be wrongly treated as the snap name.
Signed-off-by: Yongqiang He <he.yongqiang@h3c.com>
add validation for destination image name to
avoid image name contains invalid characters, such as "/" and "@".
Signed-off-by: Xiangwei Wu wuxiangwei@h3c.com
c++11 adds user-defined literals through type suffixes. for example,
"foo"s is a literal of type std::basic_string. this means that any
non-whitespace characters following a string literal will be interpreted
as a suffix. this causes issues with string concatenation done by the
preprocessor, which can only be resolved by adding whitespace
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Close all open images and librados state. This cleans up watches so we
don't need to wait for them to timeout in tests.
rbd-fuse is still a rough prototype, but this makes it slightly more
usable for testing.
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
Init 'rbd' in open_rbd_image() with NULL and add a check for
'rbd' before dereference it to fix:
rbd_fuse/rbd-fuse.c:182:29: warning: variable 'rbd' may be uninitialized
when used here [-Wconditional-uninitialized]
int ret = rbd_open(ioctx, rbd->image_name, &(rbd->image), NULL);
^~~
rbd_fuse/rbd-fuse.c:151:27: note: initialize the variable 'rbd' to silence
this warning
struct rbd_openimage *rbd;
^
= NULL
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
the mount directory. The purpose of this is to allow a single RBD to be "mounted" in userspace without opening (and locking)
the other RBDs in the pool.
This is accomplished by performing a case-sensitive string compare in enumerate_images() when an image name is
specified on the command line. If no image name is specified, all images appear in the mount directory. If a non-existent
image name is specified, the mount directory is empty.
Signed-off-by: Stephen F Taylor <steveftaylor@gmail.com>
rbd_fuse/rbd-fuse.c: In function 'enumerate_images':
rbd_fuse/rbd-fuse.c:113:2: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Sage Weil <sage@inktank.com>
Image names buffer is fixed at 1024. This turns out to be not enough:
there are at least two "rbd-fuse rbd_list: error %d Numerical result
out of range" reports on the ML. Fix it by calling rbd_list() twice to
first get the expected buffer size. Also, get rid of the memory leak
and tweak the error message while at it.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
When compiling, it met this error:
>In file included from /usr/local/include/fuse/fuse.h:19:0,
> from client/fuse_ll.cc:17:
>/usr/local/include/fuse/fuse_common.h:474:4: error: #error only API
>version 30 or greater is supported
Update FUSE_USE_VERSION from 26 to 30.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
- In "includes", inttypes.h was cluttering the system's one. This caused
random build errors on some systems/in some conditions. Renaming it.
- Add emergency defs of PRI*64 headers when int_types.h does not define
them (which, unfortunately, can happen on some systems).
Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>
Remove uninitialized usage of 'int i' as i++ from 'for' loop.
The variale 'i' is never used in this loop and initialized
before the next use with 0.
Related warning from clang++:
rbd_fuse/rbd-fuse.c:141:36: warning: variable 'i' is uninitialized
when used here [-Wuninitialized]
for (im = rbd_images; im != NULL; i++, im = im->next) {
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix printf format for off_t and size_t to print the same on 32 and 64bit
systems. Use PRI* macros from inttypes.h.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix usage of conn->want and FUSE_CAP_BIG_WRITES. Both need libfuse
version >= 2.8. Encapsulate the related code line into a check for
the needed FUSE_VERSION as already done in ceph-fuse in some cases.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Currently written in C on FUSE hi-level interfaces, so error reporting
could be better. No serious work done for performance. But it's
usable as it stands.
Specify -c <conf> and a mountpoint, and images show up as files in
that mountpoint. You can create new images; they'll be created
with attributes stored in xattrs:
user.rbdfuse.imagesize: default 1GB
user.rbdfuse.imageorder: default 22
user.rbdfuse.imagefeatures: default 1 (layering)
Images may be truncated or extended by rewriting. Currently
once an image is opened, it's not closed, so it can't be deleted
or changed outside of the fuse path.
Signed-off-by: Dan Mick <dan.mick@inktank.com>