Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
unistr.c File Reference
#include <linux/slab.h>
#include "types.h"
#include "debug.h"
#include "ntfs.h"

Go to the source code of this file.

Functions

bool ntfs_are_names_equal (const ntfschar *s1, size_t s1_len, const ntfschar *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, const ntfschar *upcase, const u32 upcase_size)
 
1 during the comparison.

The following characters are considered invalid: '"', '*', '<', '>' and '?'.

int ntfs_collate_names (const ntfschar *name1, const u32 name1_len, const ntfschar *name2, const u32 name2_len, const int err_val, const IGNORE_CASE_BOOL ic, const ntfschar *upcase, const u32 upcase_len)
 
int ntfs_ucsncmp (const ntfschar *s1, const ntfschar *s2, size_t n)
 
int ntfs_ucsncasecmp (const ntfschar *s1, const ntfschar *s2, size_t n, const ntfschar *upcase, const u32 upcase_size)
 
void ntfs_upcase_name (ntfschar *name, u32 name_len, const ntfschar *upcase, const u32 upcase_len)
 
void ntfs_file_upcase_value (FILE_NAME_ATTR *file_name_attr, const ntfschar *upcase, const u32 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 ntfschar *upcase, const u32 upcase_len)
 
int ntfs_nlstoucs (const ntfs_volume *vol, const char *ins, const int ins_len, ntfschar **outs)
 
int ntfs_ucstonls (const ntfs_volume *vol, const ntfschar *ins, const int ins_len, unsigned char **outs, int outs_len)
 

Function Documentation

bool ntfs_are_names_equal ( const ntfschar s1,
size_t  s1_len,
const ntfschar s2,
size_t  s2_len,
const IGNORE_CASE_BOOL  ic,
const ntfschar upcase,
const u32  upcase_size 
)

ntfs_are_names_equal - compare two Unicode names for equality : name to compare to : length in Unicode characters of : name to compare to : length in Unicode characters of : ignore case bool : upcase table (only if == IGNORE_CASE) : length in Unicode characters of (if present)

Compare the names and and return 'true' (1) if the names are identical, or 'false' (0) if they are not identical. If is IGNORE_CASE, the table is used to performa a case insensitive comparison.

Definition at line 68 of file unistr.c.

int ntfs_collate_names ( const ntfschar name1,
const u32  name1_len,
const ntfschar name2,
const u32  name2_len,
const int  err_val,
const IGNORE_CASE_BOOL  ic,
const ntfschar upcase,
const u32  upcase_len 
)

Definition at line 97 of file unistr.c.

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 ntfschar upcase,
const u32  upcase_len 
)

Definition at line 224 of file unistr.c.

void ntfs_file_upcase_value ( FILE_NAME_ATTR *  file_name_attr,
const ntfschar upcase,
const u32  upcase_len 
)

Definition at line 217 of file unistr.c.

int ntfs_nlstoucs ( const ntfs_volume vol,
const char ins,
const int  ins_len,
ntfschar **  outs 
)

ntfs_nlstoucs - convert NLS string to little endian Unicode string : ntfs volume which we are working with : input NLS string buffer : length of input string in bytes : on return contains the allocated output Unicode string buffer

Convert the input string , which is in whatever format the loaded NLS map dictates, into a little endian, 2-byte Unicode string.

This function allocates the string and the caller is responsible for calling kmem_cache_free(ntfs_name_cache, *); when finished with it.

On success the function returns the number of Unicode characters written to the output string * (>= 0), not counting the terminating Unicode NULL character. * is set to the allocated output string buffer.

On error, a negative number corresponding to the error code is returned. In that case the output string is not allocated. Both * and * are then undefined.

This might look a bit odd due to fast path optimization...

Definition at line 259 of file unistr.c.

int ntfs_ucsncasecmp ( const ntfschar s1,
const ntfschar s2,
size_t  n,
const ntfschar upcase,
const u32  upcase_size 
)

ntfs_ucsncasecmp - compare two little endian Unicode strings, ignoring case : first string : second string
: maximum unicode characters to compare : upcase table : upcase table size in Unicode characters

Compare the first
characters of the Unicode strings and , ignoring case. The strings in little endian format and appropriate le16_to_cpu() conversion is performed on non-little endian machines.

Each character is uppercased using the table before the comparison.

The function returns an integer less than, equal to, or greater than zero if (or the first
Unicode characters thereof) is found, respectively, to be less than, to match, or be greater than .

Definition at line 185 of file unistr.c.

int ntfs_ucsncmp ( const ntfschar s1,
const ntfschar s2,
size_t  n 
)

ntfs_ucsncmp - compare two little endian Unicode strings : first string : second string
: maximum unicode characters to compare

Compare the first
characters of the Unicode strings and , The strings in little endian format and appropriate le16_to_cpu() conversion is performed on non-little endian machines.

The function returns an integer less than, equal to, or greater than zero if (or the first
Unicode characters thereof) is found, respectively, to be less than, to match, or be greater than .

Definition at line 149 of file unistr.c.

int ntfs_ucstonls ( const ntfs_volume vol,
const ntfschar ins,
const int  ins_len,
unsigned char **  outs,
int  outs_len 
)

ntfs_ucstonls - convert little endian Unicode string to NLS string : ntfs volume which we are working with : input Unicode string buffer : length of input string in Unicode characters : on return contains the (allocated) output NLS string buffer : length of output string buffer in bytes

Convert the input little endian, 2-byte Unicode string , of length into the string format dictated by the loaded NLS.

If * is NULL, this function allocates the string and the caller is responsible for calling kfree(*); when finished with it. In this case is ignored and can be 0.

On success the function returns the number of bytes written to the output string * (>= 0), not counting the terminating NULL byte. If the output string buffer was allocated, * is set to it.

On error, a negative number corresponding to the error code is returned. In that case the output string is not allocated. The contents of * are then undefined.

This might look a bit odd due to fast path optimization...

Definition at line 336 of file unistr.c.

void ntfs_upcase_name ( ntfschar name,
u32  name_len,
const ntfschar upcase,
const u32  upcase_len 
)

Definition at line 206 of file unistr.c.