Log mount/unmount errors to UI
Bug: 18092022 Change-Id: I6c42038ebeb1cfc1e7ca0d3e12310fdce1b990b0
This commit is contained in:
parent
688024169d
commit
5ddf4293df
1 changed files with 9 additions and 5 deletions
|
@ -151,13 +151,13 @@ Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
|
||||||
const MtdPartition* mtd;
|
const MtdPartition* mtd;
|
||||||
mtd = mtd_find_partition_by_name(location);
|
mtd = mtd_find_partition_by_name(location);
|
||||||
if (mtd == NULL) {
|
if (mtd == NULL) {
|
||||||
printf("%s: no mtd partition named \"%s\"",
|
uiPrintf(state, "%s: no mtd partition named \"%s\"",
|
||||||
name, location);
|
name, location);
|
||||||
result = strdup("");
|
result = strdup("");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (mtd_mount_partition(mtd, mount_point, fs_type, 0 /* rw */) != 0) {
|
if (mtd_mount_partition(mtd, mount_point, fs_type, 0 /* rw */) != 0) {
|
||||||
printf("mtd mount of %s failed: %s\n",
|
uiPrintf(state, "mtd mount of %s failed: %s\n",
|
||||||
location, strerror(errno));
|
location, strerror(errno));
|
||||||
result = strdup("");
|
result = strdup("");
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -167,7 +167,7 @@ Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
|
||||||
if (mount(location, mount_point, fs_type,
|
if (mount(location, mount_point, fs_type,
|
||||||
MS_NOATIME | MS_NODEV | MS_NODIRATIME,
|
MS_NOATIME | MS_NODEV | MS_NODIRATIME,
|
||||||
has_mount_options ? mount_options : "") < 0) {
|
has_mount_options ? mount_options : "") < 0) {
|
||||||
printf("%s: failed to mount %s at %s: %s\n",
|
uiPrintf(state, "%s: failed to mount %s at %s: %s\n",
|
||||||
name, location, mount_point, strerror(errno));
|
name, location, mount_point, strerror(errno));
|
||||||
result = strdup("");
|
result = strdup("");
|
||||||
} else {
|
} else {
|
||||||
|
@ -231,10 +231,14 @@ Value* UnmountFn(const char* name, State* state, int argc, Expr* argv[]) {
|
||||||
scan_mounted_volumes();
|
scan_mounted_volumes();
|
||||||
const MountedVolume* vol = find_mounted_volume_by_mount_point(mount_point);
|
const MountedVolume* vol = find_mounted_volume_by_mount_point(mount_point);
|
||||||
if (vol == NULL) {
|
if (vol == NULL) {
|
||||||
printf("unmount of %s failed; no such volume\n", mount_point);
|
uiPrintf(state, "unmount of %s failed; no such volume\n", mount_point);
|
||||||
result = strdup("");
|
result = strdup("");
|
||||||
} else {
|
} else {
|
||||||
unmount_mounted_volume(vol);
|
int ret = unmount_mounted_volume(vol);
|
||||||
|
if (ret != 0) {
|
||||||
|
uiPrintf(state, "unmount of %s failed (%d): %s\n",
|
||||||
|
mount_point, ret, strerror(errno));
|
||||||
|
}
|
||||||
result = mount_point;
|
result = mount_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue