]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rbd_fuse/rbd-fuse.cc
update sources to v12.1.3
[ceph.git] / ceph / src / rbd_fuse / rbd-fuse.cc
index c55f513f3c46a10140f538d2a7cd8f5f8a280984..6295097ca7fce5a868943137b012886067960e9c 100644 (file)
@@ -19,6 +19,7 @@
 #include <getopt.h>
 #include <assert.h>
 #include <string>
+#include <mutex>
 
 #if defined(__FreeBSD__)
 #include <sys/param.h>
@@ -26,7 +27,6 @@
 
 #include "include/compat.h"
 #include "include/rbd/librbd.h"
-#include "common/Mutex.h"
 
 static int gotrados = 0;
 char *pool_name;
@@ -34,7 +34,7 @@ char *mount_image_name;
 rados_t cluster;
 rados_ioctx_t ioctx;
 
-Mutex readdir_lock("read_dir");
+std::mutex readdir_lock;
 
 struct rbd_stat {
        u_char valid;
@@ -213,11 +213,11 @@ iter_images(void *cookie,
 {
        struct rbd_image *im;
 
-       readdir_lock.Lock();
-       
+       readdir_lock.lock();
+
        for (im = rbd_image_data.images; im != NULL; im = im->next)
                iter(cookie, im->image_name);
-       readdir_lock.Unlock();
+       readdir_lock.unlock();
 }
 
 static void count_images_cb(void *cookie, const char *image)
@@ -229,9 +229,9 @@ static int count_images(void)
 {
        unsigned int count = 0;
 
-       readdir_lock.Lock();
+       readdir_lock.lock();
        enumerate_images(&rbd_image_data);
-       readdir_lock.Unlock();
+       readdir_lock.unlock();
 
        iter_images(&count, count_images_cb);
        return count;
@@ -270,9 +270,9 @@ static int rbdfs_getattr(const char *path, struct stat *stbuf)
        }
 
        if (!in_opendir) {
-               readdir_lock.Lock();
+               readdir_lock.lock();
                enumerate_images(&rbd_image_data);
-               readdir_lock.Unlock();
+               readdir_lock.unlock();
        }
        fd = open_rbd_image(path + 1);
        if (fd < 0)
@@ -304,9 +304,9 @@ static int rbdfs_open(const char *path, struct fuse_file_info *fi)
        if (path[0] == 0)
                return -ENOENT;
 
-       readdir_lock.Lock();
+       readdir_lock.lock();
        enumerate_images(&rbd_image_data);
-       readdir_lock.Unlock();
+       readdir_lock.unlock();
        fd = open_rbd_image(path + 1);
        if (fd < 0)
                return -ENOENT;
@@ -402,9 +402,9 @@ static int rbdfs_statfs(const char *path, struct statvfs *buf)
 
        num[0] = 1;
        num[1] = 0;
-       readdir_lock.Lock();
+       readdir_lock.lock();
        enumerate_images(&rbd_image_data);
-       readdir_lock.Unlock();
+       readdir_lock.unlock();
        iter_images(num, rbdfs_statfs_image_cb);
 
 #define        RBDFS_BSIZE     4096
@@ -435,10 +435,10 @@ static int rbdfs_fsync(const char *path, int datasync,
 static int rbdfs_opendir(const char *path, struct fuse_file_info *fi)
 {
        // only one directory, so global "in_opendir" flag should be fine
-       readdir_lock.Lock();
+       readdir_lock.lock();
        in_opendir++;
        enumerate_images(&rbd_image_data);
-       readdir_lock.Unlock();
+       readdir_lock.unlock();
        return 0;
 }
 
@@ -476,9 +476,9 @@ static int rbdfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
 static int rbdfs_releasedir(const char *path, struct fuse_file_info *fi)
 {
        // see opendir comments
-       readdir_lock.Lock();
+       readdir_lock.lock();
        in_opendir--;
-       readdir_lock.Unlock();
+       readdir_lock.unlock();
        return 0;
 }