* "mountvolume" now can also mount by device path.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32128 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-08-05 11:09:59 +00:00
parent d6629c3102
commit ccee2a8b35
+20 -11
View File
@@ -368,16 +368,25 @@ main(int argc, char** argv)
if (entry.GetPath(&path) != B_OK)
continue;
// a file with this name exists, so try to mount it
partition_id id = roster.RegisterFileDevice(path.Path());
if (id < B_OK)
continue;
partition_id id = -1;
BDiskDevice device;
BPartition* partition;
if (roster.GetPartitionWithID(id, &device, &partition) != B_OK) {
roster.UnregisterFileDevice(id);
continue;
if (!strncmp(path.Path(), "/dev/", 5)) {
// seems to be a device path
if (roster.GetPartitionForPath(path.Path(), &device, &partition)
!= B_OK)
continue;
} else {
// a file with this name exists, so try to mount it
id = roster.RegisterFileDevice(path.Path());
if (id < 0)
continue;
if (roster.GetPartitionWithID(id, &device, &partition) != B_OK) {
roster.UnregisterFileDevice(id);
continue;
}
}
status_t status = partition->Mount(NULL,
@@ -386,14 +395,14 @@ main(int argc, char** argv)
if (status >= B_OK) {
BPath mountPoint;
partition->GetMountPoint(&mountPoint);
printf("Image \"%s\" mounted successfully at \"%s\".\n", name,
mountPoint.Path());
printf("%s \"%s\" mounted successfully at \"%s\".\n",
id < 0 ? "Device" : "Image", name, mountPoint.Path());
}
}
if (status >= B_OK) {
// remove from list
mountVisitor.toMount.erase(name);
} else
} else if (id >= 0)
roster.UnregisterFileDevice(id);
}