mount_server: Connect on-demand to app_server.
This is similar to with the registrar and debug_server, both of which are started before app_server, already do. In the case where we cannot connect to app_server for _SuggestMountFlags, we default to read-only. (This should however never happen, at present.)
This commit is contained in:
@@ -350,7 +350,7 @@ ArchiveVisitor::Visit(BPartition* partition, int32 level)
|
|||||||
|
|
||||||
AutoMounter::AutoMounter()
|
AutoMounter::AutoMounter()
|
||||||
:
|
:
|
||||||
BServer(kMountServerSignature, true, NULL),
|
BServer(kMountServerSignature, false, NULL),
|
||||||
fNormalMode(kRestorePreviousVolumes),
|
fNormalMode(kRestorePreviousVolumes),
|
||||||
fRemovableMode(kAllVolumes),
|
fRemovableMode(kAllVolumes),
|
||||||
fEjectWhenUnmounting(true)
|
fEjectWhenUnmounting(true)
|
||||||
@@ -597,7 +597,7 @@ AutoMounter::_MountVolume(const BMessage* message)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
status_t status = partition->Mount(NULL, mountFlags);
|
status_t status = partition->Mount(NULL, mountFlags);
|
||||||
if (status < B_OK) {
|
if (status < B_OK && InitGUIContext() == B_OK) {
|
||||||
char text[512];
|
char text[512];
|
||||||
snprintf(text, sizeof(text),
|
snprintf(text, sizeof(text),
|
||||||
B_TRANSLATE("Error mounting volume:\n\n%s"), strerror(status));
|
B_TRANSLATE("Error mounting volume:\n\n%s"), strerror(status));
|
||||||
@@ -612,6 +612,9 @@ AutoMounter::_MountVolume(const BMessage* message)
|
|||||||
bool
|
bool
|
||||||
AutoMounter::_SuggestForceUnmount(const char* name, status_t error)
|
AutoMounter::_SuggestForceUnmount(const char* name, status_t error)
|
||||||
{
|
{
|
||||||
|
if (InitGUIContext() != B_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
char text[1024];
|
char text[1024];
|
||||||
snprintf(text, sizeof(text),
|
snprintf(text, sizeof(text),
|
||||||
B_TRANSLATE("Could not unmount disk \"%s\":\n\t%s\n\n"
|
B_TRANSLATE("Could not unmount disk \"%s\":\n\t%s\n\n"
|
||||||
@@ -633,6 +636,9 @@ AutoMounter::_SuggestForceUnmount(const char* name, status_t error)
|
|||||||
void
|
void
|
||||||
AutoMounter::_ReportUnmountError(const char* name, status_t error)
|
AutoMounter::_ReportUnmountError(const char* name, status_t error)
|
||||||
{
|
{
|
||||||
|
if (InitGUIContext() != B_OK)
|
||||||
|
return;
|
||||||
|
|
||||||
char text[512];
|
char text[512];
|
||||||
snprintf(text, sizeof(text), B_TRANSLATE("Could not unmount disk "
|
snprintf(text, sizeof(text), B_TRANSLATE("Could not unmount disk "
|
||||||
"\"%s\":\n\t%s"), name, strerror(error));
|
"\"%s\":\n\t%s"), name, strerror(error));
|
||||||
@@ -969,6 +975,12 @@ AutoMounter::_SuggestMountFlags(const BPartition* partition, uint32* _flags)
|
|||||||
if (partition->IsReadOnly())
|
if (partition->IsReadOnly())
|
||||||
askReadOnly = false;
|
askReadOnly = false;
|
||||||
|
|
||||||
|
if (askReadOnly && ((BServer*)be_app)->InitGUIContext() != B_OK) {
|
||||||
|
// Mount read-only, just to be safe.
|
||||||
|
mountFlags |= B_MOUNT_READ_ONLY;
|
||||||
|
askReadOnly = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (askReadOnly) {
|
if (askReadOnly) {
|
||||||
// Suggest to the user to mount read-only until Haiku is more mature.
|
// Suggest to the user to mount read-only until Haiku is more mature.
|
||||||
BString string;
|
BString string;
|
||||||
|
|||||||
Reference in New Issue
Block a user