Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
mst.c File Reference
#include "ntfs.h"

Go to the source code of this file.

Functions

int post_read_mst_fixup (NTFS_RECORD *b, const u32 size)
 
int pre_write_mst_fixup (NTFS_RECORD *b, const u32 size)
 
void post_write_mst_fixup (NTFS_RECORD *b)
 

Function Documentation

int post_read_mst_fixup ( NTFS_RECORD *  b,
const u32  size 
)

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.

Definition at line 42 of file mst.c.

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.

Definition at line 179 of file mst.c.

int pre_write_mst_fixup ( NTFS_RECORD *  b,
const u32  size 
)

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).

Definition at line 123 of file mst.c.