LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2348|回复: 10

fuse-convmvfs项目

[复制链接]
发表于 2006-4-19 10:31:49 | 显示全部楼层 |阅读模式
Abstract
========


This is a filesystem client use the FUSE(Filesystem in
USErspace) interface to convert file name from one charset
to another.


Motivation
==========


Convmv(http://osx.freshmeat.net/projects/convmv/)is a
utility to converts filenames (not file content),
directories, and even whole filesystems to a different
encoding. Inspired by this tool, born was the convmvfs which
mirror a whole filesystem tree from one charset to another.

For example, in China there's a National Standard called
GB2312 which defined a charset to present most of the
Chinese character. And many ftp client used in China only
accept and show filename in GB2312. But in *nix world i18n
is more acceptable than l10n so many *nix server use UTF-8.
For example, there's a linux hosted box run a ftp server app
on it. The ftp server export /ftp/pub to anonymous access in
which all filenames are in UTF-8 charset. Now we can make a
directory called /ftp/pub_gb2312 and use our convmvfs tool to
mount a special fuse filesystem on /ftp/pub_gb2312, which
hotly convert the filename in /ftp/pub from UTF-8 to GB2312
but leave the contant unchanged.


Install
=======


First you need to download FUSE 2.5 or later from:

  http://fuse.sourceforge.net

After installing FUSE, compile convmvfs the usual way:

  ./configure
  make
  make install (as root)

And you are ready to go.

If checking out from CVS for the first time also do
'autoreconf -iv' before doing './configure'.


How to use
==========


Once convmvfs is installed running it is very simple:

usage: convmvfs mountpoint [options]

general options:
    -o opt,[opt...]        mount options
    -h   --help            print help
    -V   --version         print version

FUSE options:
    -d   -o debug          enable debug output (implies -f)
    -f                     foreground operation
    -s                     disable multi-threaded operation

    -o allow_other         allow access to other users
    -o allow_root          allow access to root
    -o nonempty            allow mounts over non-empty file/dir
    -o default_permissions enable permission checking by kernel
    -o fsname=NAME         set filesystem name
    -o large_read          issue large read requests (2.4 only)
    -o max_read=N          set maximum size of read requests

    -o hard_remove         immediate removal (don't hide files)
    -o use_ino             let filesystem set inode numbers
    -o readdir_ino         try to fill in d_ino in readdir
    -o direct_io           use direct I/O
    -o kernel_cache        cache files in kernel
    -o umask=M             set file permissions (octal)
    -o uid=N               set file owner
    -o gid=N               set file group
    -o entry_timeout=T     cache timeout for names (1.0s)
    -o negative_timeout=T  cache timeout for deleted names (0.0s)
    -o attr_timeout=T      cache timeout for attributes (1.0s)

CONVMVFS options:
    -o srcdir=PATH         which directory to convert
    -o icharset=CHARSET    charset used in srcdir
    -o ocharset=CHARSET    charset used in mounted filesystem

Note:
* If you use normal user to mount file system be sure to have
r/w permision to /dev/fuse.

* use iconv --list to see which charsets are supported.

* to allow other user to access the mount point use allow_other option

Sample use:

* to mount
$convmvfs /ftp/pub_gbk -o srcdir=/ftp/pub, \
         icharset=utf8,ocharset=gbk

* to umount
$fusermount -u /ftp/pub_gbk


cvsweb界面查看:
http://gro.clinux.org/scm/cvsweb ... vfs/?cvsroot=fedora

现在还只实现了部分文件系统操作,谁有兴趣加入?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2006-4-19 13:01:51 | 显示全部楼层
这个东西挺有意思的,嘿嘿~!
看看先……
回复 支持 反对

使用道具 举报

发表于 2006-4-20 08:44:13 | 显示全部楼层
先看看。呵呵
能用中文说说是做什么的。。。。。。。。。。。
回复 支持 反对

使用道具 举报

发表于 2006-4-20 16:48:33 | 显示全部楼层
不错不错
Keep going on
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-27 17:56:22 | 显示全部楼层
0.1版发布,附件提供下载,其他下载地址:
http://www.linuxforum.net/forum/ ... convmvfs-0.1.tar.gz
http://bbs.chinaunix.net/attachment.php?aid=137929

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2006-5-14 18:42:37 | 显示全部楼层
这个不错呀,不同编码的文件用不同的目录来保存,这样用上面这位大哥的东西来mount下一下就搞定!!
了不起的工作呀!!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-14 18:53:20 | 显示全部楼层
谢谢,前天终于在sourceforge上注册通过了:
http://sourceforge.net/projects/fuse-convmvfs/

不是很复杂的东西,现在只实现了读操作,希望有谁感兴趣把所有功能都继续做完。
回复 支持 反对

使用道具 举报

发表于 2006-5-15 09:44:30 | 显示全部楼层
呵呵, 做这个活的还不少, 我前段时间写了简陋的shell脚本转换文件名编码, 刚写完就发现
有convmv的包了, 写这个东西是因为碰到gFTP的乱码问题, 又不想打非官方补丁, 怕升级
时麻烦. 这些天在写一个PRE_LOAD的小动态库, 把常用的跟文件名有关的系统调用包装了
一下, 大概有十来个函数, 几十行代码, 哼哧哼哧的一边查文档一边写,  已经测试过open()
了.
回复 支持 反对

使用道具 举报

发表于 2006-5-15 09:54:48 | 显示全部楼层
看了一下代码, 你那个conv_t的全局变量没有加锁, 不是线程安全的, 另外, 文件名缓冲区用了
自定义宏OUTINBUFLEN为255, 这个已经有标准宏定义了, 似乎一个是FILE_MAX, 255吧,
另一个是PATH_MAX, 4096, 在linux/limits.h中, 我用的后者, 加上环境变量可以减小这个值.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-15 10:02:03 | 显示全部楼层
iconv_t只在进程启动时修改一次,没有线程安全问题吧。FUSE的每个mount都对应一个进程的,所以是独立的。

那就用PATH_MAX吧。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表