Ai
4 Star 1 Fork 0

Gitee 极速下载/bareos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/bareos/bareos
克隆/下载
README.storagebackend 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
Philipp Storz 提交于 2018-04-12 19:07 +08:00 . moved content of base directory to core/
Adding additional storage backends:
- Creating a new backend:
- Create a new derived class of DEVICE e.g.
class whatever_device: public DEVICE {
private:
POOLMEM *m_virtual_filename;
boffset_t m_offset;
public:
whatever_device();
~whatever_device();
/*
* Interface from DEVICE
*/
int d_close(int);
int d_open(const char *pathname, int flags, int mode);
int d_ioctl(int fd, ioctl_req_t request, char *mt = NULL);
boffset_t d_lseek(DCR *dcr, boffset_t offset, int whence);
ssize_t d_read(int fd, void *buffer, size_t count);
ssize_t d_write(int fd, const void *buffer, size_t count);
bool d_truncate(DCR *dcr);
};
In file src/stored/backends/whatever_device.h
- Create a new class implementing the pure virtual methods.
In file src/stored/backends/whatever_device.c
There are plenty of examples.
- Add build rules to src/stored/backends/Makefile.in
- Add new backend to AVAILABLE_DEVICE_API_SRCS in src/stored/Makefile.in for non dynamic loading.
- Glue code for loading and using the new backend
- Add new enum value to Device types enum in src/stored/dev.h
- Add new enum value to is_file() method of DEVICE class.
- Add new enum mapping to dev_types array in src/stored/stored_conf.c
- For static allocation of new backend add code to m_init_dev() in src/stored/dev.c
(In switch (device->dev_type) which dispatches based on device type)
- Add mapping for dynamic loading of backend to src/stored/sd_backends.h
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/bareos.git
git@gitee.com:mirrors/bareos.git
mirrors
bareos
bareos
master

搜索帮助