]> git.proxmox.com Git - ceph.git/blob - ceph/src/os/FuseStore.h
import 15.2.9
[ceph.git] / ceph / src / os / FuseStore.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_OS_FUSESTORE_H
5 #define CEPH_OS_FUSESTORE_H
6
7 #include <string>
8 #include <map>
9 #include <mutex>
10 #include <functional>
11
12 #include "common/Thread.h"
13 #include "include/buffer.h"
14
15 class ObjectStore;
16
17 class FuseStore {
18 public:
19 ObjectStore *store;
20 std::string mount_point;
21 struct fs_info *info;
22 std::mutex lock;
23
24 struct OpenFile {
25 std::string path;
26 bufferlist bl;
27 bool dirty = false;
28 int ref = 0;
29 };
30 std::map<std::string,OpenFile*> open_files;
31
32 int open_file(std::string p, struct fuse_file_info *fi,
33 std::function<int(bufferlist *bl)> f);
34
35 class FuseThread : public Thread {
36 FuseStore *fs;
37 public:
38 explicit FuseThread(FuseStore *f) : fs(f) {}
39 void *entry() override {
40 fs->loop();
41 return NULL;
42 }
43 } fuse_thread;
44
45 FuseStore(ObjectStore *s, std::string p);
46 ~FuseStore();
47
48 int main();
49 int start();
50 int loop();
51 int stop();
52 };
53
54 #endif