StuBS
util.cc File Reference
#include "fs/tool/util.h"
#include <algorithm>
#include <utility>
#include <iterator>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cerrno>
#include "fs/tool/fs_image.h"
#include "fs/tool/fs_host.h"
#include "fs/tool/imagefile.h"
Include dependency graph for util.cc:

Macros

#define count(X)   (sizeof(X)/sizeof(X[0]))
 
#define PATH_MAX   4096
 

Functions

static std::string combinepath (const std::string &dir, const std::string &name)
 
bool imageload (std::string path)
 
bool imagesync ()
 
bool imageclose ()
 
std::string imagename ()
 
std::string basename (std::string const &path)
 
std::string dirname (std::string const &path)
 
std::string join (const std::vector< std::string > &vec, const char *delim)
 
bool checkError (FileSystemInterface *const fs, int e)
 
bool printError (int e)
 
std::string getcwd (FileSystemInterface *const fs)
 
std::string readlink (FileSystemInterface *const fs, std::string symlink)
 
static bool recursive (FileSystemInterface *const fs, const std::string &path, FileSystemInterface::FileType type, const std::function< bool(const std::string &, const FileSystemInterface::FileType &)> callback)
 
bool recursive (FileSystemInterface *const fs, const std::string &path, const std::function< bool(const std::string &, const FileSystemInterface::FileType &)> callback)
 
std::string filesize (unsigned long size, bool showBytes)
 
static bool listFile (FileSystemInterface *const fs, const std::string &path, const std::string &name, unsigned recursive)
 
static bool listDir (FileSystemInterface *const fs, const std::string &path, unsigned recursive)
 
bool list (FileSystemInterface *const fs, const std::string &path, bool recursive)
 
bool stat (FileSystemInterface *const fs, const std::string &path)
 
bool cat (FileSystemInterface *const fs, const std::string &path)
 
bool transfer (FileSystemInterface *const source, FileSystemInterface *const target, const std::string &path_source, std::string path_target, bool targetAsDir)
 

Constants

FileSystemImage image
 
FileSystemHost host
 
static ImageFile file
 

Macro Definition Documentation

◆ count

#define count (   X)    (sizeof(X)/sizeof(X[0]))

◆ PATH_MAX

#define PATH_MAX   4096

Function Documentation

◆ combinepath()

static std::string combinepath ( const std::string &  dir,
const std::string &  name 
)
static

◆ imageload()

bool imageload ( std::string  path)

◆ imagesync()

bool imagesync ( )

◆ imageclose()

bool imageclose ( )

◆ imagename()

std::string imagename ( )

◆ basename()

std::string basename ( std::string const &  path)

◆ dirname()

std::string dirname ( std::string const &  path)

◆ join()

std::string join ( const std::vector< std::string > &  vec,
const char *  delim 
)

◆ checkError()

bool checkError ( FileSystemInterface *const  fs,
int  e 
)

◆ printError()

bool printError ( int  e)

◆ getcwd()

std::string getcwd ( FileSystemInterface *const  fs)

◆ readlink()

std::string readlink ( FileSystemInterface *const  fs,
std::string  symlink 
)

◆ recursive() [1/2]

static bool recursive ( FileSystemInterface *const  fs,
const std::string &  path,
FileSystemInterface::FileType  type,
const std::function< bool(const std::string &, const FileSystemInterface::FileType &)>  callback 
)
static

◆ recursive() [2/2]

bool recursive ( FileSystemInterface *const  fs,
const std::string &  path,
const std::function< bool(const std::string &, const FileSystemInterface::FileType &)>  callback 
)

◆ filesize()

std::string filesize ( unsigned long  size,
bool  showBytes 
)

◆ listFile()

static bool listFile ( FileSystemInterface *const  fs,
const std::string &  path,
const std::string &  name,
unsigned  recursive 
)
static

◆ listDir()

static bool listDir ( FileSystemInterface *const  fs,
const std::string &  path,
unsigned  recursive 
)
static

◆ list()

bool list ( FileSystemInterface *const  fs,
const std::string &  path,
bool  recursive 
)

◆ stat()

bool stat ( FileSystemInterface *const  fs,
const std::string &  path 
)

◆ cat()

bool cat ( FileSystemInterface *const  fs,
const std::string &  path 
)

◆ transfer()

bool transfer ( FileSystemInterface *const  source,
FileSystemInterface *const  target,
const std::string &  path_source,
std::string  path_target,
bool  targetAsDir 
)

Variable Documentation

◆ image

FileSystemImage image
extern

◆ host

FileSystemHost host
extern

◆ file

ImageFile file
static