Lines Matching +full:multi +full:-

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * mst.c - NTFS multi sector transfer protection handling code. Part of the
4 * Linux-NTFS project.
6 * Copyright (c) 2001-2004 Anton Altaparmakov
12 * post_read_mst_fixup - deprotect multi sector transfer protected data
16 * Perform the necessary post read multi sector transfer fixup and detect the
17 * presence of incomplete multi sector transfers. - In that case, overwrite the
21 * Return 0 on success and -EINVAL on error ("BAAD" magic will be present).
34 usa_ofs = le16_to_cpu(b->usa_ofs); in post_read_mst_fixup()
36 usa_count = le16_to_cpu(b->usa_count) - 1; in post_read_mst_fixup()
38 if ( size & (NTFS_BLOCK_SIZE - 1) || in post_read_mst_fixup()
49 * structures which means the data is consistent. - If it is in post_read_mst_fixup()
56 data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; in post_read_mst_fixup()
58 * Check for incomplete multi sector transfer(s). in post_read_mst_fixup()
60 while (usa_count--) { in post_read_mst_fixup()
63 * Incomplete multi sector transfer detected! )-: in post_read_mst_fixup()
67 b->magic = magic_BAAD; in post_read_mst_fixup()
68 return -EINVAL; in post_read_mst_fixup()
72 /* Re-setup the variables. */ in post_read_mst_fixup()
73 usa_count = le16_to_cpu(b->usa_count) - 1; in post_read_mst_fixup()
74 data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; in post_read_mst_fixup()
76 while (usa_count--) { in post_read_mst_fixup()
89 * pre_write_mst_fixup - apply multi sector transfer protection
93 * Perform the necessary pre write multi sector transfer fixup on the data
96 * Return 0 if fixup applied (success) or -EINVAL if no fixup was performed
116 if (!b || ntfs_is_baad_record(b->magic) || in pre_write_mst_fixup()
117 ntfs_is_hole_record(b->magic)) in pre_write_mst_fixup()
118 return -EINVAL; in pre_write_mst_fixup()
120 usa_ofs = le16_to_cpu(b->usa_ofs); in pre_write_mst_fixup()
122 usa_count = le16_to_cpu(b->usa_count) - 1; in pre_write_mst_fixup()
124 if ( size & (NTFS_BLOCK_SIZE - 1) || in pre_write_mst_fixup()
128 return -EINVAL; in pre_write_mst_fixup()
133 * (skipping 0 and -1, i.e. 0xffff). in pre_write_mst_fixup()
141 data_pos = (le16*)b + NTFS_BLOCK_SIZE/sizeof(le16) - 1; in pre_write_mst_fixup()
143 while (usa_count--) { in pre_write_mst_fixup()
158 * post_write_mst_fixup - fast deprotect multi sector transfer protected data
161 * Perform the necessary post write multi sector transfer fixup, not checking
169 u16 usa_ofs = le16_to_cpu(b->usa_ofs); in post_write_mst_fixup()
170 u16 usa_count = le16_to_cpu(b->usa_count) - 1; in post_write_mst_fixup()
176 data_pos = (le16*)b + NTFS_BLOCK_SIZE/sizeof(le16) - 1; in post_write_mst_fixup()
179 while (usa_count--) { in post_write_mst_fixup()