Remount Issue on Android 7.0

Source: Internet
Author: User

Http://blog.chinaunix.net/uid-23141914-id-5754416.html

Recently on the new version of Android 7.0, it was found that filesystem's remount always reported "Device or resource Busy" errors.
Finally found on Android 7.0, switch from original toolbox to Toybox.

    1. :/$ ls-al/system/bin/mount
    2. Lrwxr-xr-x 1 root Shell 6 2016-09-02 16:23/system/bin/mount-Toybox

And then look closely at the relevant code for mount in Toybox, which is a pit.

    1. For remount we need _last_ match (in case of overmounts), so traverse
    2. In reverse order. (Yes I ' m using Remount as a Boolean for a bit here,
    3. The double cast is to get GCC to shut up about it.)
    4. Remount = (void *) (long) Comma_scan (opts, "remount", 1);
    5. if ((Toys.optflags & flag_a) &&!access ("/proc/mounts", R_OK)) | | remount) {
    6. MM = dlist_terminate (MTL = MTL2 = xgetmountlist (0));
    7. if (remount) remount = mm;
    8. }

The key is the last parameter of the Comma_scan clean

  1. Check all instances of opt and "no" opt in optlist, return true if opt
  2. Found and last instance wasn ' t. If clean, remove the from list for each instance.
  3. int Comma_scan (char *optlist, char *opt, int clean)
  4. {
  5. int optlen = strlen (opt), Len, no, got = 0;
  6. if (optlist) for (;;) {
  7. Char *s = comma_iterate (&optlist, &len);
  8. if (!s) break;
  9. No = (*s = = ' n ' && s[1] = = ' O ');
  10. if (Optlen = = Len-no &&!strncmp (opt, s+no, Optlen)) {
  11. got =!no;
  12. if (clean && optlist) memmove (S, Optlist, strlen (optlist) +1);
  13. }
  14. }
  15. return got;
  16. }

If Remount is not the last parameter of-O (_last_ match), then it will be erased. When the final call Syscall mount, the REMOUNT flag is gone.
It would be nice to change the order to mount-t Vfat-o Rw,remount/firmware.
The description of remount is not at all in Help, it's a pit!

Remount Issue on Android 7.0

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.