Linux Kernel
3.7.1
|
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/compiler.h>
#include <linux/fs.h>
#include <linux/nls.h>
#include <linux/smp.h>
#include <linux/pagemap.h>
#include "types.h"
#include "volume.h"
#include "layout.h"
Go to the source code of this file.
Data Structures | |
struct | option_t |
Macros | |
#define | default_upcase_len 0x10000 |
Enumerations | |
enum | NTFS_CONSTANTS { NTFS_BLOCK_SIZE = 512, NTFS_BLOCK_SIZE_BITS = 9, NTFS_SB_MAGIC = 0x5346544e, NTFS_MAX_NAME_LEN = 255, NTFS_MAX_ATTR_NAME_LEN = 255, NTFS_MAX_CLUSTER_SIZE = 64 * 1024, NTFS_MAX_PAGES_PER_CLUSTER = NTFS_MAX_CLUSTER_SIZE / PAGE_CACHE_SIZE } |
enum NTFS_CONSTANTS |
allocate_compression_buffers - allocate the decompression buffers
Caller has to hold the ntfs_lock mutex.
Return 0 on success or -ENOMEM if the allocations failed.
Definition at line 75 of file compress.c.
free_compression_buffers - free the decompression buffers
Caller has to hold the ntfs_lock mutex.
Definition at line 90 of file compress.c.
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.
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 482 of file compress.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 .
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 .
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...
post_read_mst_fixup - deprotect multi sector transfer protected data : pointer to the data to deprotect : size in bytes of
Perform the necessary post read multi sector transfer fixup and detect the presence of incomplete multi sector transfers. - In that case, overwrite the magic of the ntfs record header being processed with "BAAD" (in memory only!) and abort processing.
Return 0 on success and -EINVAL on error ("BAAD" magic will be present).
NOTE: We consider the absence / invalidity of an update sequence array to mean that the structure is not protected at all and hence doesn't need to be fixed up. Thus, we return success and not failure in this case. This is in contrast to pre_write_mst_fixup(), see below.
void post_write_mst_fixup | ( | NTFS_RECORD * | b | ) |
post_write_mst_fixup - fast deprotect multi sector transfer protected data : pointer to the data to deprotect
Perform the necessary post write multi sector transfer fixup, not checking for any errors, because we assume we have just used pre_write_mst_fixup(), thus the data will be fine or we would never have gotten here.
pre_write_mst_fixup - apply multi sector transfer protection : pointer to the data to protect : size in bytes of
Perform the necessary pre write multi sector transfer fixup on the data pointer to by of .
Return 0 if fixup applied (success) or -EINVAL if no fixup was performed (assumed not needed). This is in contrast to post_read_mst_fixup() above.
NOTE: We consider the absence / invalidity of an update sequence array to mean that the structure is not subject to protection and hence doesn't need to be fixed up. This means that you have to create a valid update sequence array header in the ntfs record before calling this function, otherwise it will fail (the header needs to contain the position of the update sequence array together with the number of elements in the array). You also need to initialise the update sequence number before calling this function otherwise a random word will be used (whatever was in the record at that position at that time).
typedef __attribute__ |
struct address_space_operations ntfs_aops |
struct kmem_cache* ntfs_attr_ctx_cache |
struct kmem_cache* ntfs_big_inode_cache |
struct inode_operations ntfs_dir_inode_ops |
struct file_operations ntfs_dir_ops |
struct file_operations ntfs_empty_file_ops |
struct inode_operations ntfs_empty_inode_ops |
struct export_operations ntfs_export_ops |
Export operations allowing NFS exporting of mounted NTFS partitions.
We use the default ->encode_fh() for now. Note that they use 32 bits to store the inode number which is an unsigned long so on 64-bit architectures is usually 64 bits so it would all fail horribly on huge volumes. I guess we need to define our own encode and decode fh functions that store 64-bit inode numbers at some point but for now we will ignore the problem...
We also use the default ->get_name() helper (used by ->decode_fh() via fs/exportfs/expfs.c::find_exported_dentry()) as that is completely fs independent.
The default ->get_parent() just returns -EACCES so we have to provide our own and the default ->get_dentry() is incompatible with NTFS due to not allowing the inode number 0 which is used in NTFS for the system file $MFT and due to using iget() whereas NTFS needs ntfs_iget().
struct inode_operations ntfs_file_inode_ops |
struct file_operations ntfs_file_ops |
struct kmem_cache* ntfs_index_ctx_cache |
struct kmem_cache* ntfs_inode_cache |
struct address_space_operations ntfs_mst_aops |
struct kmem_cache* ntfs_name_cache |