adbncfs  0.9.1
Macros | Functions
adbncfs.h File Reference
#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>
Include dependency graph for adbncfs.h:
This graph shows which files directly or indirectly include this file:

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...
 

Macro Definition Documentation

#define FUSE_USE_VERSION   26

Definition at line 28 of file adbncfs.h.

Function Documentation

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.

Parameters
pcPathpathname for that access is tested.
iMaskspecifies 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.
Returns
it returns -ENOENT if the path doesn't exist, -EACCESS if the requested permission isn't available, or 0 for success.

Definition at line 1474 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void adbnc_destroy ( void *  private_data)

FUSE callback function, called when the file system exits.

Parameters
private_datacomes from the return value of adbnc_init().

Definition at line 1003 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pcPathpath to the file to be flushed.
pFipFi-fd the file descriptor of the file to flush.
Returns
0 if success -errno otherwise but never EBADF.

Definition at line 1541 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int adbnc_fsync ( const char *  pcPath,
int  iIsdatasync,
struct fuse_file_info *  pFi 
)

Definition at line 1566 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pcPath
pStatBufis described in detail in the stat(2) manual page.
Returns

Definition at line 1143 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pConngives information about what features are supported by FUSE.
Returns
NULL.

Definition at line 975 of file adbncfs.cpp.

Here is the caller graph for this function:

int adbnc_mkdir ( const char *  pcPath,
mode_t  mode 
)

Definition at line 1710 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int adbnc_mknod ( const char *  pcPath,
mode_t  mode,
dev_t  rdev 
)

Definition at line 1687 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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;

Parameters
pcPathpath to the filename to open.
pFipFi->fh receives the file handle if file could be opened successfully otherwise it is set to -1.
Returns
-errno in case of an error, zero otherwise.

Definition at line 1220 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Parameters
pcPathpathname of the directory to open.
pFinot used here.
Returns
-EIO if failed to retrieve directory from android device, zero otherwise.

Definition at line 1263 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pcPathpath of the filename to read from.
pcBufreceives the read bytes.
iSizenumber of bytes to read.
iOffsetstart reading at this offset.
pFipFi->fh the file handle of the file to read from. as provided by adbnc_open().
Returns
Returns the number of bytes transferred or -errno in case of an error.

Definition at line 1619 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pcPathpathname of the directory get the listing from.
vpBufbuffer where result is returned.
fillerFUSE provided helper function for putting directory entries into the result buffer.
iOffsetstart reading form this directory entry.
pFinot used here.
Returns
-EBADF if directory listing was not found in openDirs, zero otherwise.

Definition at line 1311 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pcPathpathname of the link.
pcBufreceives the target name of the link.
iSizesize of pcBuf.
Returns
-ENOENT if pathname does not exist on android device, -ENOSYS if provided pcBuf is to small for the target name, zero otherwise.

Definition at line 1400 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pcPathpath of the filename close.
pFipFi->fh the file handle of the file to close as provided by adbnc_open().
Returns
0 if successfully closed, -EBADF if file handle is invalid or -errno i case of an close error.

Definition at line 1598 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int adbnc_releasedir ( const char *  pcPath,
struct fuse_file_info *  pFi 
)

FUSE callback to release given directory.

Erases the directory listing entry in openDirs.

Parameters
pcPathpathname to the directory to release.
pFinot used here.
Returns
always zero;

Definition at line 1366 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int adbnc_rename ( const char *  pcFrom,
const char *  pcTo 
)

Definition at line 1725 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int adbnc_rmdir ( const char *  pcPath)

Definition at line 1754 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pcPathstatistic is retrieved for the file system containing this path.
pFstSee statvfs(2) for a description of the structure contents.
Returns
zero on success, non zero otherwise.

Definition at line 1041 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int adbnc_truncate ( const char *  pcPath,
off_t  iSize 
)

Definition at line 1663 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pcPathoath to filename to unlink.
Returns
0 if success, -errno otherwise.

Definition at line 1781 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int adbnc_utimens ( const char *  pcPath,
const struct timespec  ts[2] 
)

Definition at line 1648 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

int initAdbncFs ( const int  argc,
char **const  argv 
)

Initialize the file system application.

Returns
0 if a device is connected and no other error occurred; a value != 0 otherwise.

Definition at line 906 of file adbncfs.cpp.

Here is the call graph for this function:

Here is the caller graph for this function: