26 #include <sys/statvfs.h>
37 #define DBG(line) if (fDebug) cout << "--*-- " << line << endl
38 #define INF(line) cout << "--*-- " << line << endl
39 #define ERR(line) cerr << "--*-- " << line << endl
53 static const char*
pcDone =
"---eoc---";
63 static const char*
pcSdCardMountEntry =
"sdcardfs on /storage/emulated/legacy type sdcardfs (rw,nosuid,nodev,relatime,uid=1023,gid=1023)";
124 const int iSize(::backtrace(pvArray,
sizeof(*pvArray)));
127 ::fprintf(stderr,
"Error: signal %d:\n", iSig);
128 ::backtrace_symbols_fd(pvArray, iSize, 2);
144 ostringstream strForward;
146 const char*
const argv[] = {
"nc",
"localhost", strForward.str().c_str(), NULL };
148 cout <<
"--*-- " <<
"spawn: ";
149 for (
int i = 0; argv[i]; i++)
171 INF(
"Waiting to terminate netcat...");
189 static void stringReplacer(
string& strSource,
const string& strFind,
const string& strReplace)
191 const int iLen(strFind.length());
193 for (; (j = strSource.find(strFind, j)) != string::npos ;)
195 strSource.replace(j, iLen, strReplace);
196 j += strReplace.length();
213 string strRemotePath(strPath);
215 strLocalPath.append(strRemotePath);
216 return(strLocalPath);
229 static string parent(
const string& strPath)
231 string strParent(strPath);
232 const size_t uiLen(strParent.length());
235 if (uiLen != 1 || strParent[0] !=
'/')
240 if (strParent[uiLen - 1] ==
'/')
241 strParent = strParent.substr(0, uiLen - 1);
243 const std::size_t uiPos(strParent.rfind(
'/'));
244 if (uiPos != string::npos)
245 strParent = strParent.substr(0, uiPos == 0 ? 1 : uiPos);
247 if (strParent == strPath)
271 static vector<string>
tokenize(
const string& strData)
273 vector<string> tokens;
275 const char* pcDelimiters =
" \t";
276 const int iLen(strData.length() + 1);
279 ::strncpy(acTokens, strData.c_str(), iLen);
282 char* pch = ::strtok_r(acTokens, pcDelimiters, &pcSave);
285 tokens.push_back(pch);
286 pch = ::strtok_r(NULL, pcDelimiters, &pcSave);
304 return (::stat(pcName, &buffer) == 0);
318 DBG(
"execCommandViaNetCat: " << strCommand);
322 deque<string> output;
327 if (strTmpString.find(
pcDone) != string::npos)
330 output.push_back(strTmpString);
334 DBG(
"output: " << output.front());
336 DBG(
"output: EMPTY");
362 static deque<string>
execProg(
const char*
const argv[],
const bool fUseStdErr =
false,
int*
const piError = NULL)
367 for (
int i = 0; argv[i]; i++)
376 deque<string> output;
380 Spawn cmd(argv, fUseStdErr,
true);
383 while (!getline(cmd.
inStream(), strTmpString).eof())
387 if (strTmpString.find(
": Permission denied") != string::npos)
394 else if (strTmpString.find(
"does not exist") != string::npos)
403 output.push_back(strTmpString);
407 DBG(
"output: " << output.front());
409 DBG(
"output: EMPTY");
413 int iExitCode(cmd.
wait());
414 if (WIFEXITED(iExitCode))
416 iExitCode = WEXITSTATUS(iExitCode);
417 if (iExitCode == ENOENT)
418 ERR(
"Error: program \"" << argv[0] <<
"\" not found");
421 *piError = iExitCode;
424 catch (
const runtime_error& error)
447 string strActualCommand(strCommand);
448 strActualCommand.insert(0,
"busybox ");
462 static int adbncPushPullCmd(
const bool fPush,
const string& strLocalPath,
const string& strRemotePath)
464 string strCmdPath1(
"'");
465 strCmdPath1.append((fPush ? strLocalPath : strRemotePath));
466 strCmdPath1.append(
"'");
468 string strCmdPath2(
"'");
469 strCmdPath2.append((fPush ? strRemotePath : strLocalPath));
470 strCmdPath2.append(
"'");
474 argv[1] = fPush ?
"push" :
"pull";
475 argv[2] = fPush ? strLocalPath.c_str() : strRemotePath.c_str();
476 argv[3] = fPush ? strRemotePath.c_str() : strLocalPath.c_str();
479 int iRes(
adbnc_access(fPush ?
parent(strRemotePath).c_str() : strRemotePath.c_str(), fPush ? W_OK : R_OK));
512 static int adbncPull(
const string& strRemoteSource,
const string& strLocalDestination)
528 int adbncPush(
const string& strLocalSource,
const string& strRemoteDestination)
542 static int doStat(
const char *pcPath, vector<string>* pOutputTokens = NULL)
544 deque<string> output;
549 string strCommand(
"stat -t '");
550 strCommand.append(pcPath);
551 strCommand.append(
"'");
561 DBG(
"from cache " << output.front());
563 DBG(
"from cache EMPTY");
569 if (output.size() > 1)
571 deque<string>::iterator it(output.begin());
572 while (it != output.end())
573 output.front() += *it++;
578 *pOutputTokens =
tokenize(output.front());
579 if (pOutputTokens->size() < 13)
582 while (pOutputTokens->size() > 15)
583 pOutputTokens->erase(pOutputTokens->begin());
597 ostringstream strCmdStream;
598 strCmdStream <<
"nc -ll -p " <<
iForwardPort <<
" -e /system/xbin/bash";
600 return(strCmdStream.str());
612 const char*
const argv[] = {
"adb",
"shell",
"su",
"-c",
"busybox",
"ps",
"|",
"grep",
androidNetCatStartCommand().c_str(), NULL };
614 deque<string> output(
execProg(argv));
616 while (output.size() > 0)
618 if (output.front().find(
"grep") == string::npos)
620 vector<string> tokens(
tokenize(output.front()));
621 iPid = stoi(tokens[0].c_str());
642 const string strPid(to_string(iPid));
643 const char*
const argv[] = {
"adb",
"shell",
"su",
"-c",
"busybox",
"kill", strPid.c_str(), NULL };
649 INF(
"Netcat successfully stopped on android device");
651 INF(
"Failed to kill NetCat on android device");
665 const char*
const argv[] = {
"adb",
"shell",
"su",
"-c",
"busybox",
"nohup",
androidNetCatStartCommand().c_str(),
"2>/dev/null",
"1>/dev/null",
"&", NULL };
671 INF(
"error: could not start netcat on android device");
673 INF(
"Netcat successfully started on android device");
675 return(iStarted ? 0 : 3);
690 const char*
const argv[] = {
"adb",
"devices", NULL };
691 deque<string> output(
execProg(argv,
false, &iError));
695 if (output.size() > 2)
697 const string strDeviceId(output[output.size() - 2].substr(0, 8));
699 if (strDeviceId !=
"List of ")
701 INF(
"Using android device " << strDeviceId);
725 const char*
const argv[] = {
"adb",
"forward",
"--list", NULL };
726 deque<string> output(
execProg(argv));
728 for(deque<string>::iterator it = output.begin(); it != output.end(); ++it)
730 if((*it).find(strForwardArg) != string::npos)
749 ostringstream strForwardPort;
752 ostringstream strForwardArg;
753 strForwardArg << strForwardPort.str() <<
" " << strForwardPort.str();
757 const char*
const argv[] = {
"adb",
"forward", strForwardPort.str().c_str(), strForwardPort.str().c_str(), NULL };
763 INF(
"Port " << strForwardPort.str() <<
" successfully forwarded to android device");
767 INF(
"Failed to forward Port " << strForwardPort.str() <<
" to android device");
782 ostringstream strForwardPort;
785 ostringstream strForwardArg;
786 strForwardArg << strForwardPort.str() <<
" " << strForwardPort.str();
790 const char*
const argv[] = {
"adb",
"forward",
"--remove", strForwardPort.str().c_str(), NULL };
796 INF(
"Forward port " << strForwardPort.str() <<
" to android device successfully removed");
798 INF(
"Failed to remove forward port " << strForwardPort.str() <<
" from android device");
808 const char*
const argv[] = {
"rm",
"-rf",
strTempDirPath.c_str(), NULL };
823 const char * pcTempDir = ::mkdtemp(&acTempDirTemplate[0]);
831 return(pcTempDir ? 0 : errno);
847 const char*
const argv[] = {
"adb",
"shell",
"busybox id", NULL };
848 deque<string> output(
execProg(argv));
850 int iRes(!(output.size() == 1));
851 if (!iRes && output.front().length() > 5 && output.front()[0] ==
'u')
854 INF(
"Failed to query user info from device");
872 const char*
const argv[] = {
"adb",
"shell",
"busybox mount", NULL };
873 deque<string> output(
execProg(argv));
875 int iRes(!(output.size() > 0));
887 INF(
"Failed to query mount info from device");
910 bool fInitRequired(
true);
913 for (
int i = 1; i < argc; i++)
915 if (::strcmp(argv[i],
"-d") == 0)
918 if (::strcmp(argv[i],
"-h") == 0)
919 fInitRequired =
false;
921 if (::strcmp(argv[i],
"--help") == 0)
922 fInitRequired =
false;
924 if (::strcmp(argv[i],
"-V") == 0)
925 fInitRequired =
false;
927 if (::strcmp(argv[i],
"--version") == 0)
928 fInitRequired =
false;
981 pConn->want |= FUSE_CAP_EXPORT_SUPPORT;
1005 DBG(
"adbnc_destroy()");
1043 DBG(
"adbnc_statfs(" << pcPath <<
")");
1045 ::memset(pFst, 0,
sizeof(
struct statvfs));
1049 if (::strcmp(pcPath,
"/") != 0)
1052 string strCommand(
"df -P -B 4096 '");
1053 strCommand.append(pcPath);
1054 strCommand.append(
"'");
1055 deque<string> output(
adbncShell(strCommand));
1057 iRes = (output.size() > 1 ? 0 : -EIO);
1065 vector<string> tokens(
tokenize(output.front()));
1066 if (tokens.size() >= 6)
1070 pFst->f_bsize = 4096;
1071 pFst->f_blocks = stoul(tokens[1]);
1072 pFst->f_frsize = pFst->f_bsize;
1073 pFst->f_bfree = stoul(tokens[3]);
1074 pFst->f_bavail = pFst->f_bfree;
1076 catch (
const exception& e)
1078 ERR(
"Exception thrown in adbnc_statfs(" << pcPath <<
")" <<
": " << e.what());
1080 for (
int i = 0; i < tokens.size(); i++)
1081 ERR(
"Token[" << i <<
"] :" << tokens[i]);
1091 strCommand.assign(
"df -P -i '");
1092 strCommand.append(pcPath);
1093 strCommand.append(
"'");
1096 iRes = (output.size() > 1 ? 0 : -EIO);
1104 vector<string> tokens(
tokenize(output.front()));
1105 if (tokens.size() >= 6)
1109 pFst->f_files = stoul(tokens[1]);
1110 pFst->f_ffree = stoul(tokens[3]);
1111 pFst->f_favail = pFst->f_ffree;
1113 catch (
const exception& e)
1115 ERR(
"Exception thrown in adbnc_statfs(" << pcPath <<
")" <<
": " << e.what());
1117 for (
int i = 0; i < tokens.size(); i++)
1118 ERR(
"Token[" << i <<
"] :" << tokens[i]);
1126 pFst->f_namemax = 1024;
1145 DBG(
"adbnc_getattr(" << pcPath <<
")");
1148 ::memset(pStatBuf, 0,
sizeof(
struct stat));
1149 vector<string> tokens;
1150 iRes =
doStat(pcPath, &tokens);
1175 pStatBuf->st_ino = stoul(tokens[7].c_str());
1176 const unsigned int uiRawMode(stoul(tokens[3], NULL, 16));
1177 pStatBuf->st_mode = uiRawMode | 0700;
1178 pStatBuf->st_nlink = 1;
1179 pStatBuf->st_uid = stoul(tokens[4].c_str());
1180 pStatBuf->st_gid = stoul(tokens[5].c_str());
1182 const unsigned int uiDeviceId(stoul(tokens[6], NULL, 16));
1183 pStatBuf->st_rdev = uiDeviceId;
1185 pStatBuf->st_size = stoul(tokens[1].c_str());
1186 pStatBuf->st_blksize = stol(tokens[14].c_str());
1187 pStatBuf->st_blocks = stoul(tokens[2].c_str());
1188 pStatBuf->st_atime = stol(tokens[11].c_str());
1189 pStatBuf->st_mtime = stol(tokens[12].c_str());
1190 pStatBuf->st_ctime = stol(tokens[13].c_str());
1192 catch (
const exception& e)
1194 ERR(
"Exception thrown in adbnc_getattr(" << pcPath <<
")" <<
": " << e.what());
1196 for (
int i = 0; i < tokens.size(); i++)
1197 ERR(
"Token[" << i <<
"] :" << tokens[i]);
1226 DBG(
"adbnc_open(" << pcPath <<
")");
1241 pFi->fh = ::open(strLocalPath.c_str(), pFi->flags);
1273 DBG(
"adbnc_opendir(" << pcPath <<
")");
1275 string strCommand(
"ls -1a '");
1276 strCommand.append(pcPath);
1277 strCommand.append(
"'");
1278 deque<string> output(
adbncShell(strCommand));
1280 if (!output.empty())
1282 const map<string, deque<string> >::iterator it(
openDirs.find(pcPath));
1284 openDirs.insert(make_pair(pcPath, output));
1311 int adbnc_readdir(
const char *pcPath,
void *vpBuf, fuse_fill_dir_t filler, off_t iOffset,
struct fuse_file_info *pFi)
1315 DBG(
"adbnc_readdir(" << pcPath <<
")");
1317 const map<string, deque<string> >::const_iterator it(
openDirs.find(pcPath));
1320 int iNumDirectoryEntries(it->second.size());
1321 for (
int i(0); i < iNumDirectoryEntries; i++)
1331 DBG(
"entry: " << it->second[i]);
1333 string strFullEntryPath(pcPath);
1334 if (strFullEntryPath !=
"/")
1335 strFullEntryPath.append(
"/");
1337 strFullEntryPath.append(it->second[i]);
1340 struct stat statBuf;
1345 if (filler(vpBuf, it->second[i].c_str(), &statBuf, i+1))
1374 DBG(
"adbnc_releasedir(" << pcPath <<
")");
1402 DBG(
"adbnc_readlink(" << pcPath <<
")");
1404 deque<string> output;
1409 string strCommand(
"readlink -f '");
1410 strCommand.append(pcPath);
1411 strCommand.append(
"'");
1421 if (!output.empty())
1422 DBG(
"from cache " << output.front());
1424 DBG(
"from cache EMPTY");
1430 string strRes(output.front());
1431 if (strRes[0] ==
'/')
1435 while (pcPath[iPos] !=
'\0')
1437 if (pcPath[iPos++] ==
'/')
1444 string strDotDot(
"..");
1445 strDotDot.append(
"/");
1446 strRes.insert(0, strDotDot);
1451 size_t iMySize(strRes.size());
1452 if (iMySize >= iSize)
1455 ::memcpy(pcBuf, strRes.c_str(), iMySize + 1);
1476 DBG(
"adbnc_access(" << pcPath <<
")");
1479 vector<string> tokens;
1480 int iRes(
doStat(pcPath, &tokens));
1481 if (iRes && iMask == F_OK)
1484 if (!iRes && (iMask != F_OK))
1486 unsigned int uiRawMode(0);
1493 uiRawMode = stoul(tokens[3], NULL, 16);
1494 iUid = stoi(tokens[4].c_str());
1495 iGid = stoi(tokens[5].c_str());
1497 catch (
const exception& e)
1499 ERR(
"Exception thrown in adbnc_access(" << pcPath <<
")" <<
": " << e.what());
1501 for (
int i = 0; i < tokens.size(); i++)
1502 ERR(
"Token[" << i <<
"] :" << tokens[i]);
1518 if (!iRes && (iMask & X_OK))
1545 DBG(
"adbnc_flush(" << pcPath <<
")");
1547 iRes = ::fsync(pFi->fh);
1548 if (!iRes || errno == EBADF)
1551 int iFlags(pFi->flags);
1553 DBG(
"flag is: " << iFlags);
1566 int adbnc_fsync(
const char* pcPath,
int iIsdatasync,
struct fuse_file_info* pFi)
1568 DBG(
"adbnc_fsync(" << pcPath <<
")");
1570 int iRes(::fsync(pFi->fh));
1600 DBG(
"adbnc_release(" << pcPath <<
")");
1619 int adbnc_read(
const char *pcPath,
char *pcBuf,
size_t iSize, off_t iOffset,
struct fuse_file_info *pFi)
1623 DBG(
"adbnc_read(" << pcPath <<
")");
1629 iRes = ::pread(pFi->fh, pcBuf, iSize, iOffset);
1637 int adbnc_write(
const char *pcPath,
const char *pcBuf,
size_t iSize, off_t iOffset,
struct fuse_file_info *pFi)
1639 DBG(
"adbnc_write(" << pcPath <<
")");
1643 int iRes(::pwrite(pFi->fh, pcBuf, iSize, iOffset));
1645 return(iRes == -1 ? -errno : iRes);
1650 DBG(
"adbnc_utimens(" << pcPath <<
")");
1654 string command(
"touch \"");
1655 command.append(pcPath);
1656 command.append(
"\"");
1665 DBG(
"adbnc_truncate(" << pcPath <<
")");
1667 int iRes(
doStat(pcPath));
1672 iRes = ::truncate(strLocalPath.c_str(), iSize);
1675 DBG(
"truncate[path=" << strLocalPath <<
"][size=" << iSize <<
"]");
1689 DBG(
"adbnc_mknod(" << pcPath <<
")");
1693 DBG(
"mknod for " << strLocalPath);
1695 int iRes(::mknod(strLocalPath.c_str(), mode, rdev));
1712 DBG(
"adbnc_mkdir(" << pcPath <<
")");
1715 string strCommand(
"mkdir '");
1716 strCommand.append(pcPath);
1717 strCommand.append(
"'");
1719 DBG(
"Making directory " << pcPath);
1727 DBG(
"adbnc_rename(" << pcFrom <<
", " << pcTo <<
")");
1729 string strCommand(
"mv '");
1730 strCommand.append(pcFrom);
1731 strCommand.append(
"' '");
1732 strCommand.append(pcTo);
1733 strCommand.append(
"'");
1735 DBG(
"Renaming " << pcFrom <<
" to " << pcTo);
1756 DBG(
"adbnc_rmdir(" << pcPath <<
")");
1759 string strCommand(
"rmdir '");
1760 strCommand.append(pcPath);
1761 strCommand.append(
"'");
1763 DBG(
"Removing directory " << pcPath);
1783 DBG(
"adbnc_unlink(" << pcPath <<
")");
1787 string strCommand(
"rm '");
1788 strCommand.append(pcPath);
1789 strCommand.append(
"'");
1791 DBG(
"Deleting " << pcPath);
Keep track of files opened and truncated files.
static Spawn * pNetCat
Pointer to the netcat process initialized in initNetCat()
static vector< string > tokenize(const string &strData)
Splits the given data string into tokens.
static const string androidNetCatStartCommand()
Return the command line used to start netcat process on android device.
static bool fInReleaseDirCond(false)
Waited for condition variable.
static FileStatus fileStatus
void adbnc_destroy(void *private_data)
FUSE callback function, called when the file system exits.
int initAdbncFs(const int argc, char **const argv)
Initialize the file system application.
A class to manage informations obtained from the output of the busybox applet mount command...
static pthread_cond_t inReleaseDirCond
Condition to block adbnc_opendir() until adbnc_releasedir() is finished.
static int isAndroidDeviceConnected()
Tests if any android device is connected to a local host's usb port.
void putStat(const char *pcPath, const deque< string > &statOutput)
Caches the output of doStat().
int adbnc_mkdir(const char *pcPath, mode_t mode)
bool isMountedNoexec(const char *pcPath) const
Test if the given path is located on a mount point that is mounted with the noexec option...
static const char * pcSdCardMountEntry
Big Hack, don't now how to figure out wher sdcard on a phone is mounted.
void putReadLink(const char *pcPath, const deque< string > &readLinkOutput)
Caches the output of adbnc_readlink().
static pthread_mutex_t ncCmdMutex
Mutex to synchronize thread access to execCommandViaNetCat()
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.
static pthread_mutex_t inReleaseDirMutex
Mutex to synchronize thread access to adbnc_opendir() and adbnc_releasedir()
int adbnc_readlink(const char *pcPath, char *pcBuf, size_t iSize)
FUSE callback function to resolve a link.
void pendingOpen(const char *pcPath, const bool fPendingOpen, const bool fForWrite)
Notes that on the given path a read or write operation has been performed.
static bool isAndroidPortForwarded(const string &strForwardArg)
Tests if tcp socket connections from local port to remote port on the android device is in place...
int adbnc_statfs(const char *pcPath, struct statvfs *pFst)
FUSE callback function to retrieve statistics about the file system.
static int doStat(const char *pcPath, vector< string > *pOutputTokens=NULL)
Execute a stat command on android file or directory denoted by pcPath.
static int adbncPushPullCmd(const bool fPush, const string &strLocalPath, const string &strRemotePath)
Execute an adb push or pull command with given paths.
static pthread_mutex_t openMutex
Mutex to synchronize thread access to adbnc_open()
static bool fDebug(false)
Debug mode as set in initAdbncFs()
int wait()
Wait until child process has terminated.
static int queryMountInfo()
Query mount information form android device.
int adbnc_releasedir(const char *pcPath, struct fuse_file_info *pFi)
FUSE callback to release given directory.
static void androidKillNetCat()
Kills the running netcat process on android device.
int adbnc_access(const char *pcPath, int iMask)
FUSE callback to check whether file pcPath can be accessed.
std::istream & inStream()
Access the child process stdout as in stream to read from.
A cache for file attributes and resolved links.
static map< string, deque< string > > openDirs
Map to store directory listing retrieved with adbnc_opendir() from android device.
static void cleanupTempDir(void)
Recursively deletes the temporary directory created in makeTempDir().
static int androidNetcatStarted()
Test if netcat is started on the android device.
int adbnc_getattr(const char *pcPath, struct stat *pStatBuf)
FUSE callback function to retrieve file attributes.
int adbnc_write(const char *pcPath, const char *pcBuf, size_t iSize, off_t iOffset, struct fuse_file_info *pFi)
static void sig11Handler(int iSig)
Segmentation fault handler.
static bool removeAndroidPortForwarding()
Tries to remove android port forwarding.
static Spawn & initNetCat()
Spawns a netcat process on the local host with the local forward port.
int adbnc_release(const char *pcPath, struct fuse_file_info *pFi)
FUSE callback called when FUSE is completely done with a file.
int adbnc_unlink(const char *pcPath)
FUSE callback function to remove (delete) the given file, symbolic link, hard link, or special node.
static int androidStartNetcat()
Starts a netcat process on the android device.
static string makeLocalPath(const string &strPath)
Converts the given android path to a path on the local host.
std::ostream & outStream()
Access the child process stdin as out stream to write to the process.
static const int iForwardPort(4444)
Local and remote adb forward port.
static string strTempDirPath
Path to the temporary directory used by the instance of this application initialized in makeTempDir()...
static void stringReplacer(string &strSource, const string &strFind, const string &strReplace)
Replace all instances of string strFind with string strReplace in the given string strSource...
static bool fileExists(const char *pcName)
Tests whether the file or directory denoted by pcName exists on the local host.
static string parent(const string &strPath)
Returns the parent pathname string of the given strPath.
int adbnc_utimens(const char *pcPath, const struct timespec ts[2])
static deque< string > adbncShell(const string &strCommand)
Execute a shell command on the android device.
bool isMountedRo(const char *pcPath) const
Test if the given path is located on a mount point that is mounted read only.
int access(const int iUid, const int iGid, const unsigned int uiRawMode, const int iMask) const
This is the similar to the access(2) system call.
int adbnc_rmdir(const char *pcPath)
static const char * pcTempDirTemplate
Template used to makeTempDir()
static deque< string > execCommandViaNetCat(const string &strCommand)
Execute the given command string via netcat.
int adbnc_fsync(const char *pcPath, int iIsdatasync, struct fuse_file_info *pFi)
static int setAndroidPortForwarding()
Enable adb port forwarding for our local and remote port.
void * adbnc_init(struct fuse_conn_info *pConn)
FUSE callback function to initialize the file system.
static FileCache fileCache
int adbnc_open(const char *pcPath, struct fuse_file_info *pFi)
FUSE callback to open a file.
void invalidate(const char *pcPath)
Renders the cashed data for the given file as invalid.
const deque< string > * getReadLink(const char *pcPath) const
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...
int adbnc_truncate(const char *pcPath, off_t iSize)
static void destroyNetCat()
Kills the netcat process spawned in initNetCat().
static deque< string > execProg(const char *const argv[], const bool fUseStdErr=false, int *const piError=NULL)
Execute a program.
int adbncPush(const string &strLocalSource, const string &strRemoteDestination)
Copy (using adb push) a file from the local host to the Android device.
static MountInfo * pMountInfo
Pointer to mount info instance initialized in queryMountInfo()
int adbnc_rename(const char *pcFrom, const char *pcTo)
int release(const char *pcPath, const int iFh)
A class to manage informations obtained from the output of the busybox applet id command.
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...
static UserInfo * pUserInfo
Pointer to user info instance initialized in queryUserInfo()
int adbnc_mknod(const char *pcPath, mode_t mode, dev_t rdev)
const deque< string > * getStat(const char *pcPath) const
static const char * pcDone
static int queryUserInfo()
Query user information (uid, gid, groups) form android device.
int flush(const char *pcPath, const string &strFromLocalPath)
int adbnc_opendir(const char *pcPath, struct fuse_file_info *pFi)
FUSE callback to open a directory for reading.
static int adbncPull(const string &strRemoteSource, const string &strLocalDestination)
Copy (using adb pull) a file from the Android device to the local host.
void truncated(const char *pcPath, const bool fTruncated)
static int makeTempDir(void)
Create a temporary directory and stores the path in strTempDirPath variable.