vserver 1.9.5.x5
[linux-2.6.git] / fs / jfs / jfs_unicode.h
index af6ccd2..69e25eb 100644 (file)
@@ -31,7 +31,7 @@ typedef struct {
 extern signed char UniUpperTable[512];
 extern UNICASERANGE UniUpperRange[];
 extern int get_UCSname(struct component_name *, struct dentry *);
-extern int jfs_strfromUCS_le(char *, const wchar_t *, int, struct nls_table *);
+extern int jfs_strfromUCS_le(char *, const __le16 *, int, struct nls_table *);
 
 #define free_UCSname(COMP) kfree((COMP)->name)
 
@@ -51,10 +51,10 @@ static inline wchar_t *UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2)
 /*
  * UniStrncpy:  Copy length limited string with pad
  */
-static inline wchar_t *UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2,
+static inline __le16 *UniStrncpy_le(__le16 * ucs1, const __le16 * ucs2,
                                  size_t n)
 {
-       wchar_t *anchor = ucs1;
+       __le16 *anchor = ucs1;
 
        while (n-- && *ucs2)    /* Copy the strings */
                *ucs1++ = *ucs2++;
@@ -68,7 +68,7 @@ static inline wchar_t *UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2,
 /*
  * UniStrncmp_le:  Compare length limited string - native to little-endian
  */
-static inline int UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2,
+static inline int UniStrncmp_le(const wchar_t * ucs1, const __le16 * ucs2,
                                size_t n)
 {
        if (!n)
@@ -81,10 +81,27 @@ static inline int UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2,
 }
 
 /*
- * UniStrncpy_le:  Copy length limited string with pad to little-endian
+ * UniStrncpy_to_le:  Copy length limited string with pad to little-endian
+ */
+static inline __le16 *UniStrncpy_to_le(__le16 * ucs1, const wchar_t * ucs2,
+                                      size_t n)
+{
+       __le16 *anchor = ucs1;
+
+       while (n-- && *ucs2)    /* Copy the strings */
+               *ucs1++ = cpu_to_le16(*ucs2++);
+
+       n++;
+       while (n--)             /* Pad with nulls */
+               *ucs1++ = 0;
+       return anchor;
+}
+
+/*
+ * UniStrncpy_from_le:  Copy length limited string with pad from little-endian
  */
-static inline wchar_t *UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2,
-                                    size_t n)
+static inline wchar_t *UniStrncpy_from_le(wchar_t * ucs1, const __le16 * ucs2,
+                                         size_t n)
 {
        wchar_t *anchor = ucs1;
 
@@ -97,7 +114,6 @@ static inline wchar_t *UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2,
        return anchor;
 }
 
-
 /*
  * UniToupper:  Convert a unicode character to upper case
  */