[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FDclone-users:00766] Re: ext3 の index_dir Re: 質問: Linux の sd* デバイス上での WRITE_DIR



 しらいです。

In Message-Id <20080404053756.GD20944@trix.islocal>
        Takeshi Hamasaki <hma@syd.odn.ne.jp>さんwrites:
> 濱崎です。

> ext3 の feature に index_dir 属性が付いている場合、
> ディレクトリ内のファイルの並べ替えをして WRITE_DIR しても順番の変更が
> 反映されないことがわかりました。この属性を外すと、反映されるようになります。

 なるほど。でも「index_dir」という属性は見当たらないのです
が、これは「dir_index」の間違いではありませんか?それなら見
当がつくのですが。
 もしそうでないとすると、tune2fs(8) の裏技的な設定というこ
とになるので、「詳しくは man page 見てね」と言えなくなって厄
介ですね。


> FDclone での対処については、TECKNOW ファイルに記述を追加していただければ
> と思います。下に追記の文案を付けます。

 そうですね。ext2/ext3 を書込み不能扱いにしてしまうという対
応の方が安全ではあるのですが、それだとメリットを得る人よりデ
メリットを被る人の方が多くなりそうですし。
 文面についてはこちらで適当に考えておきます。


> vfat については、まだ手つかずです。
> 試すのが来週後半になってしまうかもしれません。
> 他の方が試してくださるなら、もちろん報告大歓迎です。

 HDD 上に FAT partition を追加で用意するのは容易ではないの
で USB storage で試してみました。色々やってみたところ、どう
やら原因らしきものが見えて来たようです。
 主な原因としては、FAT file system は case insensitive なの
と、後は 255 文字という比較的短い file name 長上限でしょうか。
以下の patch を試してみて下さい。

---- Cut Here ----
diff -u ../old/FD-2.09h/file.c ./file.c
--- ../old/FD-2.09h/file.c	Sat Mar 15 00:00:00 2008
+++ ./file.c	Sun Apr  6 02:53:14 2008
@@ -1517,15 +1517,17 @@
 {
 	if (!dos) {
 		size -= dirsize;
-		return((size & ~(boundary - 1)) - 1 - ofs);
+		size = (size & ~(boundary - 1)) - 1 - ofs;
+		if (size > MAXNAMLEN) size = MAXNAMLEN;
 	}
-
-	if (size > DOSDIRENT) {
+	else if (size <= DOSDIRENT) size = DOSBODYLEN;
+	else {
 		size -= DOSDIRENT;
-		return((size / DOSDIRENT) * LFNENTSIZ - 1);
+		size = (size / DOSDIRENT) * LFNENTSIZ - 1;
+		if (size > DOSMAXNAMLEN) size = DOSMAXNAMLEN;
 	}
 
-	return(DOSBODYLEN);
+	return(size);
 }
 
 static int NEAR saferename(from, to)
@@ -1535,7 +1537,7 @@
 	char fpath[MAXPATHLEN], tpath[MAXPATHLEN];
 #endif
 
-	if (!strpathcmp(from, to)) return(0);
+	if (!strpathcmp2(from, to)) return(0);
 #ifdef	_USEDOSEMU
 	from = nodospath(fpath, from);
 	to = nodospath(tpath, to);
@@ -1682,6 +1684,9 @@
 	char **tmpfiles;
 	int n, tmpno, block, ptr, totalptr, headbyte;
 #endif
+#ifndef	PATHNOCASE
+	int duppathignorecase;
+#endif
 	DIR *dirp;
 	struct dirent *dp;
 	int dos, boundary, dirsize, namofs;
@@ -1770,12 +1775,19 @@
 		return;
 	}
 
+#ifndef	PATHNOCASE
+	duppathignorecase = pathignorecase;
+	pathignorecase = (dos) ? 1 : 0;
+#endif
 	noconv++;
 	size = realdirsiz(fnamelist[top], dos, boundary, dirsize, namofs);
 	len = getnamlen(size, dos, boundary, dirsize, namofs);
 	if (!(tmpdir = maketmpfile(len, dos, NULL, NULL))) {
 		warning(0, NOWRT_K);
 		freevar(fnamelist);
+#ifndef	PATHNOCASE
+		pathignorecase = duppathignorecase;
+#endif
 		noconv--;
 		return;
 	}
@@ -1788,6 +1800,9 @@
 
 	if (!(dirp = Xopendir(curpath))) {
 		freevar(fnamelist);
+#ifndef	PATHNOCASE
+		pathignorecase = duppathignorecase;
+#endif
 		noconv--;
 		lostcwd(path);
 		return;
@@ -1795,7 +1810,7 @@
 	i = ent = 0;
 	while ((dp = Xreaddir(dirp))) {
 		if (isdotdir(dp -> d_name)) continue;
-		else if (!strpathcmp(dp -> d_name, tmpdir)) {
+		else if (!strpathcmp2(dp -> d_name, tmpdir)) {
 #if	MSDOS
 			if (!(dp -> d_alias[0])) len = DOSBODYLEN;
 #else	/* !MSDOS */
@@ -1813,6 +1828,9 @@
 				warning(-1, dp -> d_name);
 				restorefile(tmpdir, path, fnamp);
 				freevar(fnamelist);
+#ifndef	PATHNOCASE
+				pathignorecase = duppathignorecase;
+#endif
 				noconv--;
 				return;
 			}
@@ -1826,6 +1844,9 @@
 			warning(-1, tmpdir);
 			restorefile(tmpdir, path, fnamp);
 			freevar(fnamelist);
+#ifndef	PATHNOCASE
+			pathignorecase = duppathignorecase;
+#endif
 			noconv--;
 			return;
 		}
@@ -1840,6 +1861,9 @@
 		warning(-1, curpath);
 		restorefile(tmpdir, path, fnamp);
 		freevar(fnamelist);
+#ifndef	PATHNOCASE
+		pathignorecase = duppathignorecase;
+#endif
 		noconv--;
 		return;
 	}
@@ -1918,6 +1942,9 @@
 	restorefile(tmpdir, path, fnamp);
 
 	freevar(fnamelist);
+#ifndef	PATHNOCASE
+	pathignorecase = duppathignorecase;
+#endif
 	noconv--;
 }
 #endif	/* !_NOWRITEFS */
---- Cut Here ----

                                               しらい たかし