该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

共享PC机上Windows的文件系统好几天前就做到了,但一直无法实现挂载到安卓。找了各种各样的方法,试验过几个软件都无法做到。有些问题也得不到解释,比如:

执行了Adb Shell的Cat /proc/filesystems后,看到的明明是不支持cifs,可在cifsManager中cifs模块安装成功。我/system/lib/modules下明明没有cifs.ko啊。

挂载共享的Windows文件夹时显示执行成功,目录中却是空。切出去再回来,又变回未挂载状态了。从国外找了个贴子命令好长,mount -o noperm,username=XXX password=??? ......此处省略XX字。执行,提示我字符串太长,NND。国外的回贴明明说这个执行成功了,而前期的现象和我的一样!

今天早上又找到个贴,有点长,貌似有深度,先贴上来慢慢翻译,有兴趣的机油们围观一下吧

Fix for empty app-mounted directories (CifsManager, etc.) in Android 4.2

Android 4.2 breaks Dalvik-apps that mount file systems to be shared with other apps. This includes CifsManager, Mount Manager, essentially anything that mounts cifs shares, FUSE file sytems, etc. The symptom is that the mounted contents appear fine to app that peforms the mount operation (assuming the app itself provides the ability to browse the contents), but every other app only sees an empty directory at the mount point.

It turns out that this problem is a side-effect of the approach used to implement multi-user storage in Android 4.2. I've explained the problem in detail in the commit log for a Gerrit issue we're reviewing for CyanogenMod 10.1 that addresses the problem:

Quote:

Originally Posted by Zygote patch commit message Zygote: Restrict slave mountspace so Dalvik apps can mount system-wide volumesAndroid 4.2 implements multi-user storage using per-process mount namespaces. Originally, everything under "/" (the entire filesystem hierarchy) is marked as a recursive-slave mountspace for all zygote instances. This is done so that user-storage sandbox mounts under /storage/emulated are hidden from other apps and users.Unfortunately this means that any Dalvik app (actually, any program whose clone/fork ancestry includes a Dalvik zygote, which is everything except services spawned directly from init) cannot mount system-wide volumes. Thus, apps like CifsManager are effectively broken in Android 4.2, since its cifs mounts are only visible to the CifsManager app itself. All other apps see empty mountpoints instead of the mounted volume. Furthermore, Linux provides no provision for a process to "escape" a recursive-slave mountspace in versions prior to Linux 3.8 (setns syscall).Here, we restrict the slave mountspace to /storage (and, due to a possible kernel bug, /mnt/shell/emulated) so that Dalvik apps can mount system-wide volumes elsewhere (with appropriate permission, as in earlier versions of Android), while retaining full multi-user storage compatibility.This change requires that a tmpfs volume is mounted as /storage in init.rc. If this volume is unavailable, then Zygote falls back to the previous behavior of marking the entire filesystem hierarchy as slave. It also implicitly requires that EMULATED_STORAGE_TARGET is path-prefixed by (part of the subhierarchy of) ANDROID_STORAGE, which is the typical case.

Ideally, any 4.2 ROM can provide support for CifsManager by applying a change to Dalvik, and a second change to the boot ramdisk's init.rc:

Dalvik change: Zygote: Restrict slave mountspace so Dalvik apps can mount system-wide volumes

init.rc change: init.rc: Create /storage mountpoint so Dalvik can mark as slave in zygotes

Alternatively, ROMs that can't/prefer not to use a source-build Dalvik (libdvm), I've also provided a kernel patch that implements a similar workaround within the kernel. It also requires the above init.rc modification:

Kernel commit: Restrict slave mountspace so Dalvik apps can mount system-wide volumes

init.rc change: init.rc: Create /storage mountpoint so Dalvik can mark as slave in zygotes

With either of the above two fixes, CifsManager et al. should work when using a mountpoint outside /storage (and /mnt/shell/emulated). I'd recommend using "/mnt/cifs" or something similar. Attempting to mount inside /storage retains the previous behavior where the mount can not be seen by other apps.

Note that ROMs only need one of the above two fixes, although they are compatible with each other and will function correctly if both are present. The Dalvik approach is preferred over the kernel workaround where feasible. Attached are the three patches referenced in the issues/commits. Attached Files

dalvik.diff - [Click for QR Code] (5.9 KB, 722 views)

initrc.diff - [Click for QR Code] (1.1 KB, 415 views)

kernel.diff - [Click for QR Code] (5.3 KB, 349 views)

android cifs管理,【01-12讨论】安卓关于cifs的问题相关推荐

  1. Android内存管理机制

    好文摘录 原作: https://www.cnblogs.com/nathan909/p/5372981.html 1.基于Linux内存管理 Android系统是基于Linux 2.6内核开发的开源 ...

  2. Android窗口管理服务WindowManagerService切换Activity窗口(App Transition)的过程分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8596449 在Android系统中,同一时刻只 ...

  3. Android APP 快速开发教程(安卓)

    Android APP 快速开发教程(安卓) 前言 本篇博客从开发的角度来介绍如何开发一个Android App,需要说明一点是,这里只是提供一个如何开发一个app的思路,并不会介绍很多技术上的细节, ...

  4. Android日程管理软件开发

    安卓日程管理 1.    程序图标 2.    点击图标,进入如下界面: 这个界面会有缓冲效果,然后进入程序的主界面. 3.程序主界面: 手指在屏幕上左右滑动可以对日期进行切换,切换的时候画面有过渡效 ...

  5. 安卓通讯录管理软件_细说|安卓系统50个你不知道的使用窍门!每个都值得你去收藏!...

    世界那么大,谢谢你来看我!! 今天给大家介绍下安卓系统的安卓手机的使用技巧方法,以时下最为普遍最主流的Android 2.3系统为例,不过大部分使用技巧在其他版本的安卓系统上同样适用. 1.使用And ...

  6. android studio 课程表,基于课程表的安卓Android手机控制APP设计(AndroidStudio,SQLite)(含录像)...

    基于课程表的安卓Android手机控制APP设计(AndroidStudio,SQLite)(含录像)(毕业论文12000字,程序代码) 摘 要 随着IT技术的发展,以前老套的课程表内容查询管理方式已 ...

  7. Android内存管理机制官方详解文档

    很早之前写过一篇<Android内存管理机制详解>点击量已7万+,现把Google官方文档整理输出一下,供各位参考. 一.内存管理概览 Android 运行时 (ART) 和 Dalvik ...

  8. android 内存管理

    文章目录 android 内存管理 其他参考 内存相关测评参考 进程间的内存分配 内存类型 内存页面 Attention! 内存不足管理 内核交换守护进程(Kswapd) 请求分页(Kswapd) 更 ...

  9. Android窗口管理服务WindowManagerService计算窗口Z轴位置的过程分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8570428 通过前面几篇文章的学习,我们知道了 ...

最新文章

  1. 源码包部署tomcat
  2. CCAI 2017 | 德国DFKI科技总监Hans Uszkoreit:如何用机器学习和知识图谱来实现商业智能化? 原2017.07.25AI科技大本营 文/CSDN大琦 7 月22 - 2
  3. 公众号推荐:Python入门、统计学、推荐系统、机器学习、深度学习、数据分析...
  4. (转)git常用命令
  5. Spring在web中的使用
  6. stm32mp1安装linux系统,stm32mp1linux开发环境搭建(cortex a7)
  7. 实时事件日志记录和聚合的平台——Sentry
  8. linux下tomcat部署java web项目_求助帖 linux服务器 tomcat部署javaweb项目问题
  9. K-Means聚类算法的原理及实现
  10. Java super与this
  11. 8051RTX编程一例
  12. ModifyStyle()调用不起作用
  13. comsol显示电场计算结果_comsol电磁场仿真案例
  14. Android之单元测试
  15. OpenCV笔记11:利用HSV颜色空间进行目标检测和目标跟踪
  16. stm32的timer-trgo + DMA + DAC 播放WAV格式音乐
  17. 零基础学Python学习笔记
  18. python基线计算法_从头开始:用Python实现基线机器学习算法
  19. zookeeper集群模式(十)zookeeper的lead流程
  20. 局部搜索:禁忌搜索(Tabu Search)解决TSP问题的python案例

热门文章

  1. ORACLE分页及lt 和gt的区别
  2. codemirror 光标定位_在线代码编辑器 CODEMIRROR 配置说明
  3. 写一个人社工作年终总结
  4. iOS 程序猿们要知道的一些 HTTPS 的事情...
  5. 【OpenGL进阶】05.绘制3D模型
  6. 全排列(dfs、小白、详细解释)
  7. 消防工程师的前景怎么样
  8. 使用Swin-Transformer进行CIFAR10数据集的训练
  9. app测试必掌握的核心测试:UI、功能测试
  10. C# AttributeUsage的使用浅析