adbncfs  0.9.1
main.cpp
Go to the documentation of this file.
1 /*
2  * $Id: main.cpp 2 2015-12-03 19:46:25Z wejaeger $
3  *
4  * File: main.cpp
5  * Author: Werner Jaeger
6  *
7  * Created on November 17, 2015, 12:14 PM
8  *
9  * Copyright 2015 Werner Jaeger.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 #include "adbncfs.h"
25 
29 static struct fuse_operations adbfs_oper;
30 
31 /*
32  *
33  */
34 int main(const int argc, char** const argv)
35 {
36  int iRes(initAdbncFs(argc, argv));
37 
38  if (iRes == 0)
39  {
40  ::memset(&adbfs_oper, 0, sizeof(adbfs_oper));
41  adbfs_oper.statfs= adbnc_statfs;
42  adbfs_oper.opendir= adbnc_opendir;
43  adbfs_oper.readdir= adbnc_readdir;
44  adbfs_oper.releasedir= adbnc_releasedir;
45  adbfs_oper.getattr= adbnc_getattr;
46  adbfs_oper.access= adbnc_access;
47  adbfs_oper.open= adbnc_open;
48  adbfs_oper.flush = adbnc_flush;
49  adbfs_oper.fsync = adbnc_fsync;
50  adbfs_oper.release = adbnc_release;
51  adbfs_oper.read= adbnc_read;
52  adbfs_oper.write = adbnc_write;
53  adbfs_oper.utimens = adbnc_utimens;
54  adbfs_oper.truncate = adbnc_truncate;
55  adbfs_oper.mknod = adbnc_mknod;
56  adbfs_oper.mkdir = adbnc_mkdir;
57  adbfs_oper.rename = adbnc_rename;
58  adbfs_oper.rmdir = adbnc_rmdir;
59  adbfs_oper.unlink = adbnc_unlink;
60  adbfs_oper.readlink = adbnc_readlink;
61  adbfs_oper.init = adbnc_init;
62  adbfs_oper.destroy = adbnc_destroy;
63  iRes = fuse_main(argc, argv, &adbfs_oper, NULL);
64  }
65 
66  if (iRes)
67  adbnc_destroy(NULL);
68 
69  return(iRes);
70 }
71 
void adbnc_destroy(void *private_data)
FUSE callback function, called when the file system exits.
Definition: adbncfs.cpp:1003
int initAdbncFs(const int argc, char **const argv)
Initialize the file system application.
Definition: adbncfs.cpp:906
int adbnc_mkdir(const char *pcPath, mode_t mode)
Definition: adbncfs.cpp:1710
static struct fuse_operations adbfs_oper
Main struct for FUSE interface.
Definition: main.cpp:29
int adbnc_readdir(const char *pcPath, void *vpBuf, fuse_fill_dir_t filler, off_t iOffset, struct fuse_file_info *pFi)
FUSE callback to retrieve directory entries.
Definition: adbncfs.cpp:1311
int adbnc_readlink(const char *pcPath, char *pcBuf, size_t iSize)
FUSE callback function to resolve a link.
Definition: adbncfs.cpp:1400
int adbnc_statfs(const char *pcPath, struct statvfs *pFst)
FUSE callback function to retrieve statistics about the file system.
Definition: adbncfs.cpp:1041
int adbnc_releasedir(const char *pcPath, struct fuse_file_info *pFi)
FUSE callback to release given directory.
Definition: adbncfs.cpp:1366
int adbnc_access(const char *pcPath, int iMask)
FUSE callback to check whether file pcPath can be accessed.
Definition: adbncfs.cpp:1474
int main(const int argc, char **const argv)
Definition: main.cpp:34
int adbnc_getattr(const char *pcPath, struct stat *pStatBuf)
FUSE callback function to retrieve file attributes.
Definition: adbncfs.cpp:1143
int adbnc_write(const char *pcPath, const char *pcBuf, size_t iSize, off_t iOffset, struct fuse_file_info *pFi)
Definition: adbncfs.cpp:1637
int adbnc_release(const char *pcPath, struct fuse_file_info *pFi)
FUSE callback called when FUSE is completely done with a file.
Definition: adbncfs.cpp:1598
int adbnc_unlink(const char *pcPath)
FUSE callback function to remove (delete) the given file, symbolic link, hard link, or special node.
Definition: adbncfs.cpp:1781
int adbnc_utimens(const char *pcPath, const struct timespec ts[2])
Definition: adbncfs.cpp:1648
int adbnc_rmdir(const char *pcPath)
Definition: adbncfs.cpp:1754
int adbnc_fsync(const char *pcPath, int iIsdatasync, struct fuse_file_info *pFi)
Definition: adbncfs.cpp:1566
void * adbnc_init(struct fuse_conn_info *pConn)
FUSE callback function to initialize the file system.
Definition: adbncfs.cpp:975
int adbnc_open(const char *pcPath, struct fuse_file_info *pFi)
FUSE callback to open a file.
Definition: adbncfs.cpp:1220
int adbnc_read(const char *pcPath, char *pcBuf, size_t iSize, off_t iOffset, struct fuse_file_info *pFi)
FUSE callback to read iSize bytes from the given file into the buffer pcBuf, beginning at iOffset byt...
Definition: adbncfs.cpp:1619
int adbnc_truncate(const char *pcPath, off_t iSize)
Definition: adbncfs.cpp:1663
int adbnc_rename(const char *pcFrom, const char *pcTo)
Definition: adbncfs.cpp:1725
int adbnc_flush(const char *pcPath, struct fuse_file_info *pFi)
FUSE callback function called on each close so that the file system has a chance to report delayed er...
Definition: adbncfs.cpp:1541
int adbnc_mknod(const char *pcPath, mode_t mode, dev_t rdev)
Definition: adbncfs.cpp:1687
int adbnc_opendir(const char *pcPath, struct fuse_file_info *pFi)
FUSE callback to open a directory for reading.
Definition: adbncfs.cpp:1263