没有合适的资源?快使用搜索试试~ 我知道了~
ntfs-3g移植到android4.0.3.pdf
4星 · 超过85%的资源 需积分: 33 62 下载量 53 浏览量
2012-01-16
14:18:57
上传
评论 2
收藏 66KB PDF 举报
温馨提示
试读
12页
该pdf是自己总结的移植ntfs-3g的步骤,也参考了别人的东西,需要的下载
资源推荐
资源详情
资源评论
ntfs-3g 移植到 android4.0.3 方法总结
有别于 Linux 核心里所包含的 NTFS 驱动,NTFS-3G 支持大部分的写入操作:在 NTFS 扇区上
创建任意大小的文件、修改、更名、移动和删除,除了压缩或加密文件以外。实测表明还可支持访问控
制清单(access control lists)和权限的修改。NTFS 扇区使用 用户空间文件系统
(Filesystem in Userspace,FUSE)用户空间(user space)文件系统框架完成挂载。
linux 内核自身的 ntfs 驱动是只读的驱动,ntfs-3g 很好的支持了 ntfs 格式文件系统的读写操作,
这也是移植 ntfs-3g 的主要原因。由于 android 提供的 libc 库有些变动,所以在移植的过程指中需
要修改 ntfs-3g 部分源码,下面就简单介绍具体的移植过程:
1.到官网下载最新版本的 ntfs-3g,我下载的是 2011.04.12 这个版本。下载的地址:
http://www.tuxera.com/community/ntfs-3g-download/,解压缩,进入解压缩后的目录,
运行 ./configure 文件, 之后会在当前目录下生成一个 “config.h”的文件,这个文件定义了好多
的宏,打开该文件,注释以下内容:
/* Define to 1 if you have the `setxattr' function. */
//#define HAVE_SETXATTR 1
/* Define to 1 if `st_atim' is member of `struct stat'. */
// #define HAVE_STRUCT_STAT_ST_ATIM 1
/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */
// #define HAVE_UTIME_NULL 1
/#define HAVE_ENDIAN_H 1
//#define HAVE_STRUCT_STAT_ST_ATIM 1
//#define HAVE_UTIMENSAT 1
添加
#define MOUNTED "/etc/mtab"
#define _PATH_MOUNTED "/etc/mtab"
2. include/ntfs-3g/ntfstime.h 文件
删除重复定义
struct timespec{
time_t tv_sec;
long tv_nsec;
}
3.修改 include/fuse-lite/fuse.h
#if HAVE_SYS_STATVFS_H
// #include <sys/statvfs.h>
#include <sys/statfs.h>
#endif
找到(大概在 578 行左右 ) int fuse_fs_statfs(struct fuse_fs *fs, const char *path,
struct statvfs *buf);
修改为
#if HAVE_SYS_STATVFS_H
int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statfs *buf);
#endif
即将 struct statvfs buf 修改为 struct statfs *buf 并且添加
#if HAVE_SYS_STATVFS_H
#endif
修改这个的原因是因为在 config.h 中定义一个宏
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#define HAVE_SYS_STATVFS_H 1
但是在 android 里面没有 sys/statvf.h 这个头文件,只有 sys/statfs .h
大概 190 行左右
#if HAVE_SYS_STATVFS_H
// int (*statfs) (const char *, struct statvfs *);
int (*statfs) (const char *, struct statfs *);
#endif
libfusu-lite/fuse.c
大概在 680 行左右 ,将 fuse_fs_statfs 函数修改如下, :
#if HAVE_SYS_STATVFS_H
int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statfs *buf)
{
fuse_get_context()->private_data = fs->user_data;
if (fs->op.statfs)
return fs->op.statfs(path, buf);
else {
buf->f_namelen = 255;
buf->f_bsize = 512;
return 0;
}
}
#endif
大概 1975 行左右
static void fuse_lib_statfs(fuse_req_t req, fuse_ino_t ino)
{
struct fuse *f = req_fuse_prepare(req);
#if HAVE_SYS_STATVFS_H
struct statfs buf;
char *path;
int err;
memset(&buf, 0, sizeof(buf));
pthread_rwlock_rdlock(&f->tree_lock);
if (!ino) {
err = -ENOMEM;
path = strdup("/");
} else {
err = -ENOENT;
path = get_path(f, ino);
}
if (path) {
struct fuse_intr_data d;
fuse_prepare_interrupt(f, req, &d);
err = fuse_fs_statfs(f->fs, path, &buf);
fuse_finish_interrupt(f, req, &d);
free(path);
}
pthread_rwlock_unlock(&f->tree_lock);
if (!err)
fuse_reply_statfs(req, &buf);
else
reply_err(req, err);
#endif
}
3.include/fusu_lowlevel.h
#if HAVE_SYS_STATVFS_H
// #include <sys/statvfs.h>
#include <sys/statfs.h>
#endif
剩余11页未读,继续阅读
坠尘
- 粉丝: 16
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页