-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkiofuseops.h
89 lines (82 loc) · 4.4 KB
/
kiofuseops.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/****************************************************************************
* Copyright (c) 2003-2004 by Alexander Neundorf & Kevin 'ervin' Ottens *
* Copyright (c) 2007-2008 Vlad Codrea *
* Copyright (c) 2015 Thomas Fischer *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License. *
* *
****************************************************************************/
#ifndef KIOFUSE_OPS_H
#define KIOFUSE_OPS_H
#define FUSE_USE_VERSION 26
extern "C" {
#include <fuse.h>
}
#include <QString>
#include <KFileItem>
int kioFuseGetAttr(const char *relPath, struct stat *stbuf);
int kioFuseReadLink(const char *relPath, char *buf, size_t size);
int kioFuseMkNod(const char *relPath, mode_t mode, dev_t /*rdev*/);
int kioFuseMkDir(const char *relPath, mode_t mode);
int kioFuseUnLink(const char *relPath);
int kioFuseRmDir(const char *relPath);
int kioFuseSymLink(const char *from, const char *to);
int kioFuseReName(const char *from, const char *to);
int kioFuseLink(const char *from, const char *to);
int kioFuseChMod(const char *relPath, mode_t mode);
int kioFuseChOwn(const char *path, uid_t uid, gid_t gid);
int kioFuseTruncate(const char *relPath, off_t size);
int kioFuseOpen(const char *relPath, struct fuse_file_info *fi);
int kioFuseRead(const char *relPath, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi);
int kioFuseWrite(const char *relPath, const char *buf, size_t size, off_t offset,
struct fuse_file_info *fi);
/**
* Returns information about filesystem.
* A description of 'struct statvfs' is found in statvfs(2)
* as well as in /usr/include/sys/statvfs.h and
* /usr/include/bits/statvfs.h.
*
* @brief Get file system statistics
* @param path Any file in the filesystem, usually '/'
* @param stbuf Will contain data on filesystem upon successful return
* @return On success, zero is returned
*/
int kioFuseStatFs(const char *path, struct statvfs *stbuf);
//FIXME add kioFuseFlush
int kioFuseRelease(const char* relPath, struct fuse_file_info *fi);
int kioFuseFSync(const char *path, int isdatasync, struct fuse_file_info *fi);
int kioFuseSetXAttr(const char *path, const char *name, const char *value, size_t size, int flags);
int kioFuseGetXAttr(const char *path, const char *name, char *value, size_t size);
int kioFuseListXAttr(const char *path, char *list, size_t size);
int kioFuseRemoveXAttr(const char *path, const char *name);
//FIXME add kioFuseOpenDir
int kioFuseReadDir(const char *relPath, void *buf, fuse_fill_dir_t filler,
off_t /*offset*/, struct fuse_file_info* /*fi*/);
//FIXME add kioFuseReleaseDir
//FIXME add kioFuseFSyncDir
//FIXME add kioFuseInit
//FIXME add kioFuseDestroy
//int kioFuseAccess(const char *relPath, int mask); // TODO when KIO can check permissions
//FIXME add kioFuseCreate
//int kioFuseFTruncate(const char *relPath, off_t size, struct fuse_file_info *fi); // TODO only possible if KIO gets a truncate method
//FIXME add kioFuseFGetAttr
//FIXME add kioFuseLock
int kioFuseUTimeNS(const char *relPath, const struct timespec ts[2]);
// TODO #ifdef HAVE_POSIX_FALLOCATE
int kioFuseFAllocate(const char *path, int mode, off_t offset, off_t length, struct fuse_file_info *fi);
// TODO #endif // HAVE_POSIX_FALLOCATE
void fillStatBufFromFileItem(struct stat *stbuf, KFileItem *item);
void fillLinkBufFromFileItem(char *buf, size_t size, const QString& dest);
QIODevice::OpenMode modeFromPosix(int flags);
#endif /* KIOFUSE_OPS_H */