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

最近在新版本的android 7.0上,发现filesystem的remount老是报“ Device or resource busy”的错误。
最终发现,android 7.0上,从原来的toolbox切换到toybox。

  1. :/ $ ls -al
    /system/bin/mount
  2. lrwxr-xr-x 1 root shell 6 2016-09-02 16:23 /system/bin/mount
    ->
    toybox

然后仔细查看了一下toybox中关于mount的相关代码,果然是一个坑。

  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. }

关键就是这个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 no. If clean,
    remove each instance from list.
  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 = 2*(*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. }

如果remount不是-o的最后一个参数(_last_
match ),那么就会被清除掉。最终调用syscall mount的时候,这个remount的flag就没了。
把命令重新改为 mount
-t vfat -o rw,remount /firmware 就好了。
关于remount的说明在help里面根本没有,真是坑!

最新文章

  1. jquery.fn.extend与jquery.extend--(初体验二)
  2. 【java回调】java两个类之间的回调函数传递
  3. Core文件作用、设置及用法
  4. javascript作用域链学习笔记
  5. 连贯接口(fluent interface)的Java实现及应用。
  6. Redis/SSDB+Twemproxy的配置与使用(Mac/Linux平台)
  7. c#中操作word文档-一、模板方式写入
  8. [转]HTTPS那些事(一)HTTPS原理
  9. 远程登陆MS azure Linux 虚拟机
  10. Python核心编程2第六章课后练习
  11. DB2 VC++ 中连接字符串
  12. jqGrid使用整理
  13. hive java编写udf函数
  14. 2018 年终总结 & 2019 年度计划
  15. python3写入文件时编码问题报错
  16. 深入迁出mybatis系列
  17. .NET 中字符文本中的字符太多 错误处理
  18. 实验Complex
  19. Jenkins发布PHP代码
  20. github 管理图示

热门文章

  1. AndroidStudio遇到过的问题
  2. thinkjs——art-template模板用法
  3. 【GIT】Git Flow最佳实践
  4. Day05_C操作符及二进制补码计算
  5. java基础---->Java中枚举的使用(一)
  6. 开源的PaaS方案:在OpenStack上部署CloudFoundry (五)常见问题
  7. HTML - 分页效果布局
  8. LeetCode——Balanced Binary Tree
  9. Fragments (官方文档中文版)
  10. 2015.10.9js(页面坐标)