本文整理汇总了C++中VolumeManager类的典型用法代码示例。如果您正苦于以下问题:C++ VolumeManager类的具体用法?C++ VolumeManager怎么用?C++ VolumeManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VolumeManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main() {
VolumeManager *vm;
CommandListener *cl;
NetlinkManager *nm;
SLOGI("Vold 2.1 (the revenge) firing up");
mkdir("/dev/block/vold", 0755);
/* Create our singleton managers */
if (!(vm = VolumeManager::Instance())) {
SLOGE("Unable to create VolumeManager");
exit(1);
};
if (!(nm = NetlinkManager::Instance())) {
SLOGE("Unable to create NetlinkManager");
exit(1);
};
cl = new CommandListener();
vm->setBroadcaster((SocketListener *) cl);
nm->setBroadcaster((SocketListener *) cl);
if (vm->start()) {
SLOGE("Unable to start VolumeManager (%s)", strerror(errno));
exit(1);
}
if (process_config(vm)) {
SLOGE("Error reading configuration (%s)... continuing anyways", strerror(errno));
}
if (nm->start()) {
SLOGE("Unable to start NetlinkManager (%s)", strerror(errno));
exit(1);
}
coldboot("/sys/block");
// coldboot("/sys/class/switch");
/*
* Now that we're up, we can respond to commands
*/
if (cl->startListener()) {
SLOGE("Unable to start CommandListener (%s)", strerror(errno));
exit(1);
}
// Eventually we'll become the monitoring thread
while(1) {
sleep(1000);
}
SLOGI("Vold exiting");
exit(0);
}
开发者ID:CharlieWood,项目名称:android_platform_system_vold,代码行数:59,代码来源:main.cpp
示例2: dumpArgs
int CommandListener::ObbCmd::runCommand(SocketClient *cli,
int argc, char **argv) {
if (argc < 2) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing Argument", false);
return 0;
}
VolumeManager *vm = VolumeManager::Instance();
int rc = 0;
if (!strcmp(argv[1], "list")) {
dumpArgs(argc, argv, -1);
rc = vm->listMountedObbs(cli);
} else if (!strcmp(argv[1], "mount")) {
dumpArgs(argc, argv, 3);
if (argc != 5) {
cli->sendMsg(ResponseCode::CommandSyntaxError,
"Usage: obb mount <filename> <key> <ownerUid>", false);
return 0;
}
rc = vm->mountObb(argv[2], argv[3], atoi(argv[4]));
} else if (!strcmp(argv[1], "unmount")) {
dumpArgs(argc, argv, -1);
if (argc < 3) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: obb unmount <source file> [force]", false);
return 0;
}
bool force = false;
if (argc > 3 && !strcmp(argv[3], "force")) {
force = true;
}
rc = vm->unmountObb(argv[2], force);
} else if (!strcmp(argv[1], "path")) {
dumpArgs(argc, argv, -1);
if (argc != 3) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: obb path <source file>", false);
return 0;
}
char path[255];
if (!(rc = vm->getObbMountPath(argv[2], path, sizeof(path)))) {
cli->sendMsg(ResponseCode::AsecPathResult, path, false);
return 0;
}
} else {
dumpArgs(argc, argv, -1);
cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown obb cmd", false);
}
if (!rc) {
cli->sendMsg(ResponseCode::CommandOkay, "obb operation succeeded", false);
} else {
rc = ResponseCode::convertFromErrno();
cli->sendMsg(rc, "obb operation failed", true);
}
return 0;
}
开发者ID:SebastianHobearth,项目名称:Android,代码行数:59,代码来源:CommandListener.cpp
示例3: vold_unmountAllAsecs
extern "C" int vold_unmountAllAsecs(void) {
int rc;
VolumeManager *vm = VolumeManager::Instance();
rc = vm->unmountAllAsecsInDir(Volume::SEC_ASECDIR_EXT);
if (vm->unmountAllAsecsInDir(Volume::SEC_ASECDIR_INT)) {
rc = -1;
}
return rc;
}
开发者ID:optimumpr,项目名称:android_system_vold,代码行数:10,代码来源:VolumeManager.cpp
示例4: mFlags
TrimTask::TrimTask(int flags) : mFlags(flags) {
// Collect both fstab and vold volumes
addFromFstab();
VolumeManager* vm = VolumeManager::Instance();
std::list<std::string> privateIds;
vm->listVolumes(VolumeBase::Type::kPrivate, privateIds);
for (const auto& id : privateIds) {
auto vol = vm->findVolume(id);
if (vol != nullptr && vol->getState() == VolumeBase::State::kMounted) {
mPaths.push_back(vol->getPath());
}
}
}
开发者ID:rockchip-toybrick,项目名称:system-vold,代码行数:14,代码来源:TrimTask.cpp
示例5: netfs_free_query_cookie
// netfs_free_query_cookie
static
int
netfs_free_query_cookie(void *ns, void *node, void *cookie)
{
VolumeManager* volumeManager = (VolumeManager*)ns;
QueryIterator* iterator = (QueryIterator*)cookie;
PRINT("netfs_free_query_cookie(%p, %p)\n", ns, cookie);
status_t error = B_OK;
volumeManager->GetQueryManager()->PutIterator(iterator);
PRINT("netfs_free_query_cookie() done: (%" B_PRIx32 ")\n", error);
return error;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:16,代码来源:netfs.cpp
示例6:
// GetNode
Node*
ClientVolume::GetNode(dev_t volumeID, ino_t nodeID)
{
VolumeManager* volumeManager = VolumeManager::GetDefault();
// get the node
Node* node = volumeManager->GetNode(volumeID, nodeID);
if (!node)
return NULL;
// check, if the node is contained by the root dir of the client volume
if (volumeManager->DirectoryContains(GetRootDirectory(), node, true))
return node;
return NULL;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:17,代码来源:ClientVolume.cpp
示例7: GetDirectory
// GetDirectory
Directory*
ClientVolume::GetDirectory(dev_t volumeID, ino_t nodeID)
{
VolumeManager* volumeManager = VolumeManager::GetDefault();
// get the directory
Directory* dir = GetDirectory(volumeID, nodeID);
if (!dir)
return NULL;
// check, if the dir is contained by the root dir of the client volume
if (volumeManager->DirectoryContains(GetRootDirectory(), dir, true))
return dir;
return NULL;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:17,代码来源:ClientVolume.cpp
示例8: netfs_write_fs_stat
// netfs_write_fs_stat
static
int
netfs_write_fs_stat(void *ns, struct fs_info *info, long mask)
{
VolumeManager* volumeManager = (VolumeManager*)ns;
Volume* volume = volumeManager->GetRootVolume();
VolumePutter _(volume);
PRINT("netfs_write_fs_stat(%p, %p, %ld)\n", ns, info, mask);
status_t error = B_BAD_VALUE;
if (volume)
error = volume->WriteFSStat(info, mask);
PRINT("netfs_write_fs_stat() done: %" B_PRIx32 " \n", error);
return error;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:19,代码来源:netfs.cpp
示例9: onEvent
void NetlinkHandler::onEvent(NetlinkEvent *evt) {
VolumeManager *vm = VolumeManager::Instance();
const char *subsys = evt->getSubsystem();
if (!subsys) {
SLOGW("No subsystem found in netlink event");
return;
}
if (!strcmp(subsys, "block")) {
vm->handleBlockEvent(evt);
}
#if defined(BOARD_USES_HDMI) || defined(S5P_BOARD_USES_HDMI)
else if ((!strcmp(subsys, "misc")) || (!strcmp(subsys, "video4linux"))) {
vm->handleMiscEvent(evt);
}
#endif
}
开发者ID:adeelmunir,项目名称:x210_ics_rtm_v13,代码行数:18,代码来源:NetlinkHandler.cpp
示例10: netfs_read_vnode
// netfs_read_vnode
static
int
netfs_read_vnode(void *ns, vnode_id vnid, char reenter, void **node)
{
VolumeManager* volumeManager = (VolumeManager*)ns;
Volume* volume = volumeManager->GetVolume(vnid);
VolumePutter _(volume);
PRINT(("netfs_read_vnode(%p, %Ld, %d, %p)\n", ns, vnid, reenter, node));
status_t error = B_BAD_VALUE;
if (volume)
error = volume->ReadVNode(vnid, reenter, (Node**)node);
PRINT(("netfs_read_vnode() done: (%lx, %p)\n", error, *node));
return error;
}
开发者ID:luciang,项目名称:haiku,代码行数:19,代码来源:netfs.cpp
示例11: netfs_read_fs_stat
// netfs_read_fs_stat
static
int
netfs_read_fs_stat(void *ns, struct fs_info *info)
{
VolumeManager* volumeManager = (VolumeManager*)ns;
Volume* volume = volumeManager->GetRootVolume();
VolumePutter _(volume);
PRINT(("netfs_read_fs_stat(%p, %p)\n", ns, info));
status_t error = B_BAD_VALUE;
if (volume)
error = volume->ReadFSStat(info);
PRINT(("netfs_read_fs_stat() done: %lx \n", error));
return error;
}
开发者ID:luciang,项目名称:haiku,代码行数:19,代码来源:netfs.cpp
示例12: netfs_sync
// netfs_sync
static
int
netfs_sync(void *ns)
{
VolumeManager* volumeManager = (VolumeManager*)ns;
Volume* volume = volumeManager->GetRootVolume();
VolumePutter _(volume);
PRINT("netfs_sync(%p)\n", ns);
status_t error = B_BAD_VALUE;
if (volume)
error = volume->Sync();
PRINT("netfs_sync() done: %" B_PRIx32 " \n", error);
return error;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:19,代码来源:netfs.cpp
示例13: securityContextDeleter
// Mount
status_t
ClientVolume::Mount(UserSecurityContext* securityContext, Share* share)
{
if (!securityContext || !share)
return B_BAD_VALUE;
ObjectDeleter<UserSecurityContext> securityContextDeleter(securityContext);
if (IsMounted())
return B_BAD_VALUE;
fSecurityContext = securityContext;
securityContextDeleter.Detach();
fShare = share;
fShare->AcquireReference();
dev_t volumeID = share->GetVolumeID();
ino_t nodeID = share->GetNodeID();
// into root node ref
fRootNodeRef.device = volumeID;
fRootNodeRef.node = nodeID;
// get the share permissions
fSharePermissions = securityContext->GetNodePermissions(volumeID, nodeID);
// get the root directory
VolumeManager* volumeManager = VolumeManager::GetDefault();
Directory* rootDir;
status_t error = volumeManager->LoadDirectory(volumeID, nodeID, &rootDir);
if (error != B_OK)
return error;
// register with the volume manager
error = volumeManager->AddClientVolume(this);
if (error != B_OK) {
Unmount();
return error;
}
fMounted = true;
// notify the statistics manager
StatisticsManager::GetDefault()->ShareMounted(fShare,
fSecurityContext->GetUser());
return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:45,代码来源:ClientVolume.cpp
示例14: onEvent
void NetlinkHandler::onEvent(NetlinkEvent *evt) {
VolumeManager *vm = VolumeManager::Instance();
const char *subsys = evt->getSubsystem();
if (!subsys) {
SLOGW("No subsystem found in netlink event");
return;
}
if (!strcmp(subsys, "block")) {
vm->handleBlockEvent(evt);
} else if (!strcmp(subsys, "switch")) {
vm->handleSwitchEvent(evt);
} else if (!strcmp(subsys, "usb_composite")) {
vm->handleUsbCompositeEvent(evt);
} else if (!strcmp(subsys, "battery")) {
} else if (!strcmp(subsys, "power_supply")) {
}
}
开发者ID:CharlieWood,项目名称:android_platform_system_vold,代码行数:19,代码来源:NetlinkHandler.cpp
示例15: netfs_unmount
// netfs_unmount
static
int
netfs_unmount(void *ns)
{
VolumeManager* volumeManager = (VolumeManager*)ns;
PRINT("netfs_unmount()\n");
volumeManager->UnmountRootVolume();
delete volumeManager;
#ifdef DEBUG_OBJECT_TRACKING
ObjectTracker::ExitDefault();
#endif
PRINT("netfs_unmount() done\n");
exit_debugging();
return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:21,代码来源:netfs.cpp
示例16: netfs_open_query
// netfs_open_query
static
int
netfs_open_query(void *ns, const char *queryString, ulong flags,
port_id port, long token, void **cookie)
{
VolumeManager* volumeManager = (VolumeManager*)ns;
Volume* volume = volumeManager->GetRootVolume();
VolumePutter _(volume);
PRINT("netfs_open_query(%p, `%s', %lu, %" B_PRId32 ", %ld, %p)\n", ns,
queryString, flags, port, token, cookie);
status_t error = B_BAD_VALUE;
if (volume) {
error = volume->OpenQuery(queryString, flags, port, token,
(QueryIterator**)cookie);
}
PRINT("netfs_open_query() done: (%" B_PRIx32 ", %p)\n", error, *cookie);
return error;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:22,代码来源:netfs.cpp
示例17: netfs_read_query
// netfs_read_query
static
int
netfs_read_query(void *ns, void *cookie, long *count,
struct dirent *buffer, size_t bufferSize)
{
VolumeManager* volumeManager = (VolumeManager*)ns;
Volume* volume = volumeManager->GetRootVolume();
QueryIterator* iterator = (QueryIterator*)cookie;
VolumePutter _(volume);
PRINT(("netfs_read_query(%p, %p, %ld, %p, %lu)\n", ns, cookie,
*count, buffer, bufferSize));
status_t error = B_BAD_VALUE;
if (volume) {
error = volume->ReadQuery(iterator, buffer, bufferSize,
*count, count);
}
PRINT(("netfs_read_query() done: (%lx, %ld)\n", error, *count));
return error;
}
开发者ID:luciang,项目名称:haiku,代码行数:23,代码来源:netfs.cpp
示例18: netfs_mount
// netfs_mount
static
int
netfs_mount(nspace_id nsid, const char *device, ulong flags,
void *parameters, size_t len, void **data, vnode_id *rootID)
{
status_t error = B_OK;
init_debugging();
#ifdef DEBUG_OBJECT_TRACKING
ObjectTracker::InitDefault();
#endif
// create and init the volume manager
VolumeManager* volumeManager = new(std::nothrow) VolumeManager(nsid, flags);
Volume* rootVolume = NULL;
if (volumeManager) {
error = volumeManager->MountRootVolume(device,
(const char*)parameters, len, &rootVolume);
if (error != B_OK) {
delete volumeManager;
volumeManager = NULL;
}
} else
error = B_NO_MEMORY;
VolumePutter _(rootVolume);
// set results
if (error == B_OK) {
*data = volumeManager;
*rootID = rootVolume->GetRootID();
} else {
#ifdef DEBUG_OBJECT_TRACKING
ObjectTracker::ExitDefault();
#endif
exit_debugging();
}
return error;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:39,代码来源:netfs.cpp
示例19: dumpArgs
int CommandListener::AsecCmd::runCommand(SocketClient *cli,
int argc, char **argv) {
if (argc < 2) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing Argument", false);
return 0;
}
VolumeManager *vm = VolumeManager::Instance();
int rc = 0;
if (!strcmp(argv[1], "list")) {
dumpArgs(argc, argv, -1);
listAsecsInDirectory(cli, Volume::SEC_ASECDIR_EXT);
listAsecsInDirectory(cli, Volume::SEC_ASECDIR_INT);
} else if (!strcmp(argv[1], "create")) {
dumpArgs(argc, argv, 5);
if (argc != 8) {
cli->sendMsg(ResponseCode::CommandSyntaxError,
"Usage: asec create <container-id> <size_mb> <fstype> <key> <ownerUid> "
"<isExternal>", false);
return 0;
}
unsigned int numSectors = (atoi(argv[3]) * (1024 * 1024)) / 512;
const bool isExternal = (atoi(argv[7]) == 1);
rc = vm->createAsec(argv[2], numSectors, argv[4], argv[5], atoi(argv[6]), isExternal);
} else if (!strcmp(argv[1], "finalize")) {
dumpArgs(argc, argv, -1);
if (argc != 3) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: asec finalize <container-id>", false);
return 0;
}
rc = vm->finalizeAsec(argv[2]);
} else if (!strcmp(argv[1], "fixperms")) {
dumpArgs(argc, argv, -1);
if (argc != 5) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: asec fixperms <container-id> <gid> <filename>", false);
return 0;
}
char *endptr;
gid_t gid = (gid_t) strtoul(argv[3], &endptr, 10);
if (*endptr != '\0') {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: asec fixperms <container-id> <gid> <filename>", false);
return 0;
}
rc = vm->fixupAsecPermissions(argv[2], gid, argv[4]);
} else if (!strcmp(argv[1], "destroy")) {
dumpArgs(argc, argv, -1);
if (argc < 3) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: asec destroy <container-id> [force]", false);
return 0;
}
bool force = false;
if (argc > 3 && !strcmp(argv[3], "force")) {
force = true;
}
rc = vm->destroyAsec(argv[2], force);
} else if (!strcmp(argv[1], "mount")) {
dumpArgs(argc, argv, 3);
if (argc != 5) {
cli->sendMsg(ResponseCode::CommandSyntaxError,
"Usage: asec mount <namespace-id> <key> <ownerUid>", false);
return 0;
}
rc = vm->mountAsec(argv[2], argv[3], atoi(argv[4]));
} else if (!strcmp(argv[1], "unmount")) {
dumpArgs(argc, argv, -1);
if (argc < 3) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: asec unmount <container-id> [force]", false);
return 0;
}
bool force = false;
if (argc > 3 && !strcmp(argv[3], "force")) {
force = true;
}
rc = vm->unmountAsec(argv[2], force);
} else if (!strcmp(argv[1], "rename")) {
dumpArgs(argc, argv, -1);
if (argc != 4) {
cli->sendMsg(ResponseCode::CommandSyntaxError,
"Usage: asec rename <old_id> <new_id>", false);
return 0;
}
rc = vm->renameAsec(argv[2], argv[3]);
} else if (!strcmp(argv[1], "path")) {
dumpArgs(argc, argv, -1);
if (argc != 3) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: asec path <container-id>", false);
return 0;
}
char path[255];
if (!(rc = vm->getAsecMountPath(argv[2], path, sizeof(path)))) {
cli->sendMsg(ResponseCode::AsecPathResult, path, false);
return 0;
}
} else if (!strcmp(argv[1], "fspath")) {
//.........这里部分代码省略.........
开发者ID:AndroidXperia,项目名称:android_system_vold,代码行数:101,代码来源:CommandListener.cpp
示例20: vold_getDirectVolumeList
extern "C" int vold_getDirectVolumeList(struct volume_info *vol_list) {
VolumeManager *vm = VolumeManager::Instance();
return vm->getDirectVolumeList(vol_list);
}
开发者ID:optimumpr,项目名称:android_system_vold,代码行数:4,代码来源:VolumeManager.cpp
注:本文中的VolumeManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论