| 1 |
Abstract |
| 2 |
======== |
| 3 |
|
| 4 |
This is a filesystem client use the FUSE(Filesystem in |
| 5 |
USErspace) interface to convert file name from one charset |
| 6 |
to another. |
| 7 |
|
| 8 |
|
| 9 |
Motivation |
| 10 |
========== |
| 11 |
|
| 12 |
Convmv(http://osx.freshmeat.net/projects/convmv/)is a |
| 13 |
utility to converts filenames (not file content), |
| 14 |
directories, and even whole filesystems to a different |
| 15 |
encoding. Inspired by this tool, born was the convmvfs which |
| 16 |
mirror a whole filesystem tree from one charset to another. |
| 17 |
|
| 18 |
For example, in China there's a National Standard called |
| 19 |
GB2312 which defined a charset to present most of the |
| 20 |
Chinese character. And many ftp client used in China only |
| 21 |
accept and show filename in GB2312. But in *nix world i18n |
| 22 |
is more acceptable than l10n so many *nix server use UTF-8. |
| 23 |
For example, there's a linux hosted box run a ftp server app |
| 24 |
on it. The ftp server export /ftp/pub to anonymous access in |
| 25 |
which all filenames are in UTF-8 charset. Now we can make a |
| 26 |
directory called /ftp/pub_gb2312 and use our convmvfs tool to |
| 27 |
mount a special fuse filesystem on /ftp/pub_gb2312, which |
| 28 |
hotly convert the filename in /ftp/pub from UTF-8 to GB2312 |
| 29 |
but leave the contant unchanged. |
| 30 |
|
| 31 |
|
| 32 |
Install |
| 33 |
======= |
| 34 |
|
| 35 |
First you need to download FUSE 2.5 or later from: |
| 36 |
|
| 37 |
http://fuse.sourceforge.net |
| 38 |
|
| 39 |
After installing FUSE, compile convmvfs the usual way: |
| 40 |
|
| 41 |
./configure |
| 42 |
make |
| 43 |
make install (as root) |
| 44 |
|
| 45 |
And you are ready to go.You can now type 'convmvfs --help" to get help |
| 46 |
infomation. |
| 47 |
|
| 48 |
If checking out from CVS for the first time also do |
| 49 |
'autoreconf -iv' before doing './configure'. |
| 50 |
|
| 51 |
|
| 52 |
How to use |
| 53 |
========== |
| 54 |
|
| 55 |
Once convmvfs is installed running it is very simple: |
| 56 |
|
| 57 |
usage: convmvfs mountpoint [options] |
| 58 |
|
| 59 |
general options: |
| 60 |
-o opt,[opt...] mount options |
| 61 |
-h --help print help |
| 62 |
-V --version print version |
| 63 |
|
| 64 |
FUSE options: |
| 65 |
-d -o debug enable debug output (implies -f) |
| 66 |
-f foreground operation |
| 67 |
-s disable multi-threaded operation |
| 68 |
|
| 69 |
-o allow_other allow access to other users |
| 70 |
-o allow_root allow access to root |
| 71 |
-o nonempty allow mounts over non-empty file/dir |
| 72 |
-o default_permissions enable permission checking by kernel |
| 73 |
-o fsname=NAME set filesystem name |
| 74 |
-o large_read issue large read requests (2.4 only) |
| 75 |
-o max_read=N set maximum size of read requests |
| 76 |
|
| 77 |
-o hard_remove immediate removal (don't hide files) |
| 78 |
-o use_ino let filesystem set inode numbers |
| 79 |
-o readdir_ino try to fill in d_ino in readdir |
| 80 |
-o direct_io use direct I/O |
| 81 |
-o kernel_cache cache files in kernel |
| 82 |
-o umask=M set file permissions (octal) |
| 83 |
-o uid=N set file owner |
| 84 |
-o gid=N set file group |
| 85 |
-o entry_timeout=T cache timeout for names (1.0s) |
| 86 |
-o negative_timeout=T cache timeout for deleted names (0.0s) |
| 87 |
-o attr_timeout=T cache timeout for attributes (1.0s) |
| 88 |
|
| 89 |
CONVMVFS options: |
| 90 |
-o srcdir=PATH which directory to convert |
| 91 |
-o icharset=CHARSET charset used in srcdir |
| 92 |
-o ocharset=CHARSET charset used in mounted filesystem |
| 93 |
|
| 94 |
Note: |
| 95 |
* If you use normal user to mount file system be sure to have |
| 96 |
r/w permision to /dev/fuse. |
| 97 |
|
| 98 |
* use `iconv --list` to see which charsets are supported. |
| 99 |
|
| 100 |
* to allow other user to access the mount point use allow_other option |
| 101 |
|
| 102 |
* IMPORTANT: if mount point and srcdir was the same dir, readdir oper |
| 103 |
would enter dead loop. BE SURE TO AVOID THIS SITUATION! |
| 104 |
|
| 105 |
Sample use: |
| 106 |
* to mount |
| 107 |
$convmvfs /ftp/pub_gbk -o srcdir=/ftp/pub, icharset=utf8,ocharset=gbk |
| 108 |
|
| 109 |
* to umount |
| 110 |
$fusermount -u /ftp/pub_gbk |