Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/libntfs
In directory usw-pr-cvs1:/tmp/cvs-serv6688/libntfs
Modified Files:
attrib.c unistr.c
Log Message:
mkntfs delayed. more reverse engineering required to determine exact method of
index entry collation. first few helper functions are already done and entered
into ntfslib in unistr.c
Index: attrib.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/libntfs/attrib.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -U2 -r1.14 -r1.15
--- attrib.c 2001/06/01 02:07:25 1.14
+++ attrib.c 2001/06/09 00:25:55 1.15
@@ -233,8 +233,9 @@
register int rc;
- rc = ntfs_collate_names(upcase, upcase_len,
- name, name_len, (uchar_t*)((char*)a +
- le16_to_cpu(a->name_offset)),
- a->name_length, IGNORE_CASE, 1);
+ rc = ntfs_collate_names(name, name_len,
+ (uchar_t*)((char*)a +
+ le16_to_cpu(a->name_offset)),
+ a->name_length, 1, IGNORE_CASE,
+ upcase, upcase_len);
/*
* If @name collates before a->name, there is no
@@ -246,8 +247,9 @@
if (rc)
continue;
- rc = ntfs_collate_names(upcase, upcase_len,
- name, name_len, (uchar_t*)((char*)a +
- le16_to_cpu(a->name_offset)),
- a->name_length, CASE_SENSITIVE, 1);
+ rc = ntfs_collate_names(name, name_len,
+ (uchar_t*)((char*)a +
+ le16_to_cpu(a->name_offset)),
+ a->name_length, 1, CASE_SENSITIVE,
+ upcase, upcase_len);
if (rc == -1)
return FALSE;
Index: unistr.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/libntfs/unistr.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -U2 -r1.5 -r1.6
--- unistr.c 2001/06/01 02:07:26 1.5
+++ unistr.c 2001/06/09 00:25:55 1.6
@@ -28,4 +28,12 @@
/*
+ * IMPORTANT
+ * =========
+ *
+ * All these routines assume that the Unicode characters are in little endian
+ * encoding inside the strings!!!
+ */
+
+/*
* This is used by the name collation functions to quickly determine what
* characters are (in)valid.
@@ -67,5 +75,5 @@
return FALSE;
if (ic == CASE_SENSITIVE)
- return memcmp(s1, s2, s1_len << 1) ? FALSE: TRUE;
+ return ntfs_wcsncmp(s1, s2, s1_len << 1) ? FALSE: TRUE;
return ntfs_wcsncasecmp(s1, s2, s1_len, upcase, upcase_size) ? FALSE:
TRUE;
@@ -90,8 +98,8 @@
* The following characters are considered invalid: '"', '*', '<', '>' and '?'.
*/
-int ntfs_collate_names(const uchar_t *upcase, const __u32 upcase_len,
- const uchar_t *name1, const __u32 name1_len,
- const uchar_t *name2, const __u32 name2_len,
- const IGNORE_CASE_BOOL ic, const int err_val)
+int ntfs_collate_names(const uchar_t *name1, const __u32 name1_len,
+ const uchar_t *name2, const __u32 name2_len,
+ const int err_val, const IGNORE_CASE_BOOL ic,
+ const uchar_t *upcase, const __u32 upcase_len)
{
__u32 cnt;
@@ -215,4 +223,34 @@
}
return 0;
+}
+
+void ntfs_upcase_name(uchar_t *name, __u32 name_len, const uchar_t *upcase,
+ const __u32 upcase_len)
+{
+ __u32 i;
+ uchar_t u;
+
+ for (i = 0; i < name_len; i++)
+ if ((u = le16_to_cpu(name[i])) < upcase_len)
+ name[i] = upcase[u];
+}
+
+void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr,
+ const uchar_t *upcase, const __u32 upcase_len)
+{
+ ntfs_upcase_name((uchar_t*)&file_name_attr->file_name,
+ file_name_attr->file_name_length, upcase, upcase_len);
+}
+
+int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1,
+ FILE_NAME_ATTR *file_name_attr2,
+ const int err_val, const IGNORE_CASE_BOOL ic,
+ const uchar_t *upcase, const __u32 upcase_len)
+{
+ return ntfs_collate_names((uchar_t*)&file_name_attr1->file_name,
+ file_name_attr1->file_name_length,
+ (uchar_t*)&file_name_attr2->file_name,
+ file_name_attr2->file_name_length,
+ err_val, ic, upcase, upcase_len);
}
|