2 Copyright (C) 2010 Proxmox Server Solutions GmbH
4 This software is written by Proxmox Server Solutions GmbH <support@proxmox.com>
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Affero General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Affero General Public License for more details.
16 You should have received a copy of the GNU Affero General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 Author: Dietmar Maurer <dietmar@proxmox.com>
23 #ifndef _PVE_CFS_PLUG_H_
24 #define _PVE_CFS_PLUG_H_
26 #define FUSE_USE_VERSION 26
30 #include <sys/types.h>
34 #define PARAM_CHECK_ERRNO -EREMOTEIO
36 typedef struct cfs_plug cfs_plug_t
;
38 struct cfs_operations
{
39 int (*getattr
) (cfs_plug_t
*, const char *, struct stat
*);
40 int (*readlink
) (cfs_plug_t
*, const char *, char *, size_t);
41 int (*mkdir
) (cfs_plug_t
*, const char *, mode_t
);
42 int (*unlink
) (cfs_plug_t
*, const char *);
43 int (*rmdir
) (cfs_plug_t
*, const char *);
44 int (*rename
) (cfs_plug_t
*, const char *, const char *);
45 int (*truncate
) (cfs_plug_t
*, const char *, off_t
);
46 int (*open
) (cfs_plug_t
*, const char *, struct fuse_file_info
*);
47 int (*read
) (cfs_plug_t
*, const char *, char *, size_t, off_t
,
48 struct fuse_file_info
*);
49 int (*write
) (cfs_plug_t
*, const char *, const char *, size_t, off_t
,
50 struct fuse_file_info
*);
51 int (*readdir
) (cfs_plug_t
*, const char *, void *, fuse_fill_dir_t
, off_t
,
52 struct fuse_file_info
*);
53 int (*create
) (cfs_plug_t
*, const char *, mode_t
, struct fuse_file_info
*);
54 int (*utimens
) (cfs_plug_t
*, const char *, const struct timespec tv
[2]);
55 int (*statfs
) (cfs_plug_t
*, const char *, struct statvfs
*);
59 struct cfs_operations
*ops
;
60 cfs_plug_t
*(*lookup_plug
)(cfs_plug_t
*plug
, char **path
);
61 void (*destroy_plug
) (cfs_plug_t
*plug
);
62 void (*start_workers
) (cfs_plug_t
*plug
);
63 void (*stop_workers
) (cfs_plug_t
*plug
);
79 typedef char *(*cfs_plug_func_udpate_data_fn_t
)(cfs_plug_t
*plug
);
80 typedef int (*cfs_plug_func_write_data_fn_t
)(
90 cfs_plug_func_udpate_data_fn_t update_callback
;
91 cfs_plug_func_write_data_fn_t write_callback
;
94 cfs_plug_base_t
*cfs_plug_base_new(const char *name
, cfs_plug_t
*base
);
95 void cfs_plug_base_insert(cfs_plug_base_t
*base
, cfs_plug_t
*sub
);
97 cfs_plug_link_t
*cfs_plug_link_new(const char *name
, const char *symlink
);
98 cfs_plug_func_t
*cfs_plug_func_new(
101 cfs_plug_func_udpate_data_fn_t update_callback
,
102 cfs_plug_func_write_data_fn_t write_callback
);
105 #endif /* _PVE_CFS_PLUG_H_ */