patch-2.1.132 linux/fs/umsdos/mangle.c

Next file: linux/fs/umsdos/namei.c
Previous file: linux/fs/umsdos/check.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.131/linux/fs/umsdos/mangle.c linux/fs/umsdos/mangle.c
@@ -69,14 +69,8 @@
 		 * ever think of using such a name in real life. This is not
 		 * fool proof. I don't think there is a total solution to this.
 		 */
-		union {
-			int entry_num;
-			struct {
-				unsigned num1:5, num2:5, num3:5;
-			} num;
-		} u;
+		int entry_num;
 		char *pt = info->fake.fname + info->fake.len;
-
 		/* lookup for encoding the last character of the extension 
 		 * It contains valid character after the ugly one to make sure 
 		 * even if someone overflows the 32 * 32 * 9 limit, it still 
@@ -93,17 +87,17 @@
 		};
 
 #define lookup12 (lookup3+9)
-		u.entry_num = info->f_pos / UMSDOS_REC_SIZE;
-		if (u.entry_num > (9 * 32 * 32)) {
+		entry_num = info->f_pos / UMSDOS_REC_SIZE;
+		if (entry_num > (9* 32 * 32)){
 			printk (KERN_WARNING "UMSDOS: more than 9216 files in a directory.\n"
 				"This may break the mangling strategy.\n"
 				"Not a killer problem. See doc.\n");
 		}
 		*pt++ = '.';
-		*pt++ = lookup3[u.num.num3];
-		*pt++ = lookup12[u.num.num2];
-		*pt++ = lookup12[u.num.num1];
-		*pt = '\0';	/* help doing printk */
+		*pt++ = lookup3 [(entry_num >> 10) & 31];
+		*pt++ = lookup12[(entry_num >> 5) & 31];
+		*pt++ = lookup12[entry_num & 31];
+		*pt = '\0';		/* help doing printk */	
 		info->fake.len += 4;
 		info->msdos_reject = 0;		/* Avoid mangling twice */
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov