adbncfs
0.9.1
|
#include <fuse.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <string>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <map>
Go to the source code of this file.
Macros | |
#define | FUSE_USE_VERSION 26 |
Functions | |
int | adbnc_statfs (const char *pcPath, struct statvfs *pFst) |
FUSE callback function to retrieve statistics about the file system. More... | |
int | adbnc_getattr (const char *pcPath, struct stat *oStatBuf) |
FUSE callback function to retrieve file attributes. More... | |
int | adbnc_open (const char *pcPath, struct fuse_file_info *pFi) |
FUSE callback to open a file. More... | |
int | adbnc_opendir (const char *pcPath, struct fuse_file_info *pFi) |
FUSE callback to open a directory for reading. More... | |
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. More... | |
int | adbnc_releasedir (const char *pcPath, struct fuse_file_info *pFi) |
FUSE callback to release given directory. More... | |
int | adbnc_readlink (const char *pcPath, char *pcBuf, size_t iSize) |
FUSE callback function to resolve a link. More... | |
int | adbnc_access (const char *pcPath, int iMask) |
FUSE callback to check whether file pcPath can be accessed. More... | |
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 errors. More... | |
int | adbnc_release (const char *pcPath, struct fuse_file_info *pFi) |
FUSE callback called when FUSE is completely done with a file. More... | |
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 bytes into the file. More... | |
int | adbnc_write (const char *pcPath, const char *pcBuf, size_t iSize, off_t iOffset, struct fuse_file_info *pFi) |
int | adbnc_utimens (const char *pcPath, const struct timespec ts[2]) |
int | adbnc_truncate (const char *pcPath, off_t iSize) |
int | adbnc_mknod (const char *pcPath, mode_t mode, dev_t rdev) |
int | adbnc_mkdir (const char *pcPath, mode_t mode) |
int | adbnc_rename (const char *pcFrom, const char *pcTo) |
int | adbnc_rmdir (const char *pcPath) |
int | adbnc_unlink (const char *pcPath) |
FUSE callback function to remove (delete) the given file, symbolic link, hard link, or special node. More... | |
int | adbnc_fsync (const char *pcPath, int iIsdatasync, struct fuse_file_info *pFi) |
void * | adbnc_init (struct fuse_conn_info *pConn) |
FUSE callback function to initialize the file system. More... | |
void | adbnc_destroy (void *private_data) |
FUSE callback function, called when the file system exits. More... | |
int | initAdbncFs (const int argc, char **const argv) |
Initialize the file system application. More... | |
int adbnc_access | ( | const char * | pcPath, |
int | iMask | ||
) |
FUSE callback to check whether file pcPath can be accessed.
No need to follow links, pcPath never points to a link.
pcPath | pathname for that access is tested. |
iMask | specifies the accessibility check(s) to be performed, and is either the value F_OK, or a mask consisting of the bitwise OR of one or more of R_OK, W_OK, and X_OK. F_OK tests for the existence of the file. R_OK, W_OK, and X_OK test whether the file exists and grants read, write, and execute permissions, respectively. |
Definition at line 1474 of file adbncfs.cpp.
void adbnc_destroy | ( | void * | private_data | ) |
FUSE callback function, called when the file system exits.
private_data | comes from the return value of adbnc_init(). |
Definition at line 1003 of file adbncfs.cpp.
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 errors.
Important: I noticed flush calls for already closed files which causes fsync() to return a EBADF, we'll ignore this error.
pcPath | path to the file to be flushed. |
pFi | pFi-fd the file descriptor of the file to flush. |
Definition at line 1541 of file adbncfs.cpp.
int adbnc_fsync | ( | const char * | pcPath, |
int | iIsdatasync, | ||
struct fuse_file_info * | pFi | ||
) |
Definition at line 1566 of file adbncfs.cpp.
int adbnc_getattr | ( | const char * | pcPath, |
struct stat * | pStatBuf | ||
) |
FUSE callback function to retrieve file attributes.
For the given pathname, the elements of the "stat" structure are filled.
pcPath | |
pStatBuf | is described in detail in the stat(2) manual page. |
Definition at line 1143 of file adbncfs.cpp.
void* adbnc_init | ( | struct fuse_conn_info * | pConn | ) |
FUSE callback function to initialize the file system.
One-time setup of ncCmdMutex, openMutex, inReleaseDirMutex and inReleaseDirCond.
pConn | gives information about what features are supported by FUSE. |
Definition at line 975 of file adbncfs.cpp.
int adbnc_mkdir | ( | const char * | pcPath, |
mode_t | mode | ||
) |
Definition at line 1710 of file adbncfs.cpp.
int adbnc_mknod | ( | const char * | pcPath, |
mode_t | mode, | ||
dev_t | rdev | ||
) |
Definition at line 1687 of file adbncfs.cpp.
int adbnc_open | ( | const char * | pcPath, |
struct fuse_file_info * | pFi | ||
) |
FUSE callback to open a file.
Calls adbncPull() to copy the file from the android device to local host and opens the file on local host. The file handle obtained from local open is set to pFi->fh;
pcPath | path to the filename to open. |
pFi | pFi->fh receives the file handle if file could be opened successfully otherwise it is set to -1. |
Definition at line 1220 of file adbncfs.cpp.
int adbnc_opendir | ( | const char * | pcPath, |
struct fuse_file_info * | pFi | ||
) |
FUSE callback to open a directory for reading.
Stores directory content retrieved from android device in openDirs map for retrieval in adbnc_readdir().
pcPath | pathname of the directory to open. |
pFi | not used here. |
Definition at line 1263 of file adbncfs.cpp.
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 bytes into the file.
pcPath | path of the filename to read from. |
pcBuf | receives the read bytes. |
iSize | number of bytes to read. |
iOffset | start reading at this offset. |
pFi | pFi->fh the file handle of the file to read from. as provided by adbnc_open(). |
Definition at line 1619 of file adbncfs.cpp.
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.
openDirs, filled by adbnc_opendir(), is supposed to hold the directory listing.
pcPath | pathname of the directory get the listing from. |
vpBuf | buffer where result is returned. |
filler | FUSE provided helper function for putting directory entries into the result buffer. |
iOffset | start reading form this directory entry. |
pFi | not used here. |
Definition at line 1311 of file adbncfs.cpp.
int adbnc_readlink | ( | const char * | pcPath, |
char * | pcBuf, | ||
size_t | iSize | ||
) |
FUSE callback function to resolve a link.
If path is a symbolic link, fills pcBuf with its target, up to iSize.
pcPath | pathname of the link. |
pcBuf | receives the target name of the link. |
iSize | size of pcBuf. |
Definition at line 1400 of file adbncfs.cpp.
int adbnc_release | ( | const char * | pcPath, |
struct fuse_file_info * | pFi | ||
) |
FUSE callback called when FUSE is completely done with a file.
Closes the file handle.
pcPath | path of the filename close. |
pFi | pFi->fh the file handle of the file to close as provided by adbnc_open(). |
Definition at line 1598 of file adbncfs.cpp.
int adbnc_releasedir | ( | const char * | pcPath, |
struct fuse_file_info * | pFi | ||
) |
FUSE callback to release given directory.
Erases the directory listing entry in openDirs.
pcPath | pathname to the directory to release. |
pFi | not used here. |
Definition at line 1366 of file adbncfs.cpp.
int adbnc_rename | ( | const char * | pcFrom, |
const char * | pcTo | ||
) |
Definition at line 1725 of file adbncfs.cpp.
int adbnc_rmdir | ( | const char * | pcPath | ) |
Definition at line 1754 of file adbncfs.cpp.
int adbnc_statfs | ( | const char * | pcPath, |
struct statvfs * | pFst | ||
) |
FUSE callback function to retrieve statistics about the file system.
this is how programs like df determine the free space.
pcPath | statistic is retrieved for the file system containing this path. |
pFst | See statvfs(2) for a description of the structure contents. |
Definition at line 1041 of file adbncfs.cpp.
int adbnc_truncate | ( | const char * | pcPath, |
off_t | iSize | ||
) |
Definition at line 1663 of file adbncfs.cpp.
int adbnc_unlink | ( | const char * | pcPath | ) |
FUSE callback function to remove (delete) the given file, symbolic link, hard link, or special node.
Note that if you support hard links, unlink only deletes the data when the last hard link is removed. See unlink(2) for details.
pcPath | oath to filename to unlink. |
Definition at line 1781 of file adbncfs.cpp.
int adbnc_utimens | ( | const char * | pcPath, |
const struct timespec | ts[2] | ||
) |
Definition at line 1648 of file adbncfs.cpp.
int adbnc_write | ( | const char * | pcPath, |
const char * | pcBuf, | ||
size_t | iSize, | ||
off_t | iOffset, | ||
struct fuse_file_info * | pFi | ||
) |
Definition at line 1637 of file adbncfs.cpp.
int initAdbncFs | ( | const int | argc, |
char **const | argv | ||
) |
Initialize the file system application.
Definition at line 906 of file adbncfs.cpp.