remount issue on android 7.0
2024-10-10 21:08:18
http://blog.chinaunix.net/uid-23141914-id-5754416.html
最近在新版本的android 7.0上,发现filesystem的remount老是报“ Device or resource busy”的错误。
最终发现,android 7.0上,从原来的toolbox切换到toybox。
- :/ $ ls -al
/system/bin/mount - lrwxr-xr-x 1 root shell 6 2016-09-02 16:23 /system/bin/mount
->
toybox
然后仔细查看了一下toybox中关于mount的相关代码,果然是一个坑。
- // For remount
we need _last_ match (in case of
overmounts), so traverse - //
in reverse order. (Yes I'm using remount as a boolean for a bit here, - //
the double cast is to get gcc
to shut up about it.) - remount = (void *)(long)comma_scan(opts, "remount",
1); - if (((toys.optflags
& FLAG_a) && !access("/proc/mounts", R_OK)) || remount)
{ - mm = dlist_terminate(mtl = mtl2
= xgetmountlist(0)); - if (remount)
remount = mm; - }
关键就是这个comma_scan的最后一个参数clean
- // check all instances of opt and "no"opt
in optlist, return true
if opt - //
found and last instance wasn't no. If clean,
remove each instance from list. - int comma_scan(char *optlist, char
*opt,
int clean) - {
- int optlen = strlen(opt), len, no, got
= 0; - if (optlist)
for (;;) { - char *s = comma_iterate(&optlist,
&len); - if (!s) break;
- no = 2*(*s == 'n' && s[1] == 'o');
- if (optlen == len-no && !strncmp(opt, s+no,
optlen))
{ - got = !no;
- if (clean &&
optlist) memmove(s,
optlist, strlen(optlist)+1); - }
- }
- return got;
- }
如果remount不是-o的最后一个参数(_last_
match ),那么就会被清除掉。最终调用syscall mount的时候,这个remount的flag就没了。
把命令重新改为 mount
-t vfat -o rw,remount /firmware 就好了。
关于remount的说明在help里面根本没有,真是坑!
最新文章
- jquery.fn.extend与jquery.extend--(初体验二)
- 【java回调】java两个类之间的回调函数传递
- Core文件作用、设置及用法
- javascript作用域链学习笔记
- 连贯接口(fluent interface)的Java实现及应用。
- Redis/SSDB+Twemproxy的配置与使用(Mac/Linux平台)
- c#中操作word文档-一、模板方式写入
- [转]HTTPS那些事(一)HTTPS原理
- 远程登陆MS azure Linux 虚拟机
- Python核心编程2第六章课后练习
- DB2 VC++ 中连接字符串
- jqGrid使用整理
- hive java编写udf函数
- 2018 年终总结 &; 2019 年度计划
- python3写入文件时编码问题报错
- 深入迁出mybatis系列
- .NET 中字符文本中的字符太多 错误处理
- 实验Complex
- Jenkins发布PHP代码
- github 管理图示