Rename NTFS_SECTOR_SIZE to NTFS_BLOCK_SIZE to keep in sync with kernel driver.
(Logical change 1.653)edge.strict_endians
parent
eab699277f
commit
14db887f8e
|
@ -99,6 +99,8 @@ xx/xx/2004 - 2.0.0-WIP
|
|||
attrib.[hc]::ntfs_attr_{add,rm}(), respectively. (Anton)
|
||||
- Update sparse/compressed/encrypted bits in STANDARD_INFORMATION
|
||||
during inode sync. (Yura)
|
||||
- Rename NTFS_SECTOR_SIZE to NTFS_BLOCK_SIZE to keep in sync with
|
||||
kernel driver. (Yura)
|
||||
|
||||
04/09/2004 - 1.9.4 - Urgent bug fixes.
|
||||
|
||||
|
|
|
@ -158,12 +158,9 @@ typedef enum {
|
|||
#define ntfs_is_empty_record(x) ( ntfs_is_magic (x, empty) )
|
||||
#define ntfs_is_empty_recordp(p) ( ntfs_is_magicp(p, empty) )
|
||||
|
||||
/*
|
||||
* Defines for the NTFS filesystem. Don't want to use BLOCK_SIZE and
|
||||
* BLOCK_SIZE_BITS from the kernel as that is 1024 and hence too high for us.
|
||||
*/
|
||||
#define NTFS_SECTOR_SIZE 512
|
||||
#define NTFS_SECTOR_SIZE_BITS 9
|
||||
|
||||
#define NTFS_BLOCK_SIZE 512
|
||||
#define NTFS_BLOCK_SIZE_BITS 9
|
||||
|
||||
/*
|
||||
* The Update Sequence Array (usa) is an array of the u16 values which belong
|
||||
|
|
|
@ -1365,7 +1365,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt,
|
|||
Dprintf("%s(): Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n",
|
||||
__FUNCTION__, (unsigned long long)na->ni->mft_no,
|
||||
na->type, (long long)pos);
|
||||
if (bk_cnt < 0 || bk_size % NTFS_SECTOR_SIZE) {
|
||||
if (bk_cnt < 0 || bk_size % NTFS_BLOCK_SIZE) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1417,7 +1417,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt,
|
|||
Dprintf("%s(): Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n",
|
||||
__FUNCTION__, (unsigned long long)na->ni->mft_no,
|
||||
na->type, (long long)pos);
|
||||
if (bk_cnt < 0 || bk_size % NTFS_SECTOR_SIZE) {
|
||||
if (bk_cnt < 0 || bk_size % NTFS_BLOCK_SIZE) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count,
|
|||
{
|
||||
s64 br, i;
|
||||
|
||||
if (bksize & (bksize - 1) || bksize % NTFS_SECTOR_SIZE) {
|
||||
if (bksize & (bksize - 1) || bksize % NTFS_BLOCK_SIZE) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count,
|
|||
{
|
||||
s64 written, i;
|
||||
|
||||
if (count < 0 || bksize % NTFS_SECTOR_SIZE) {
|
||||
if (count < 0 || bksize % NTFS_BLOCK_SIZE) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
|
|||
ir = (INDEX_ROOT*)((u8*)ctx->attr +
|
||||
le16_to_cpu(ctx->attr->value_offset));
|
||||
index_block_size = le32_to_cpu(ir->index_block_size);
|
||||
if (index_block_size < NTFS_SECTOR_SIZE ||
|
||||
if (index_block_size < NTFS_BLOCK_SIZE ||
|
||||
index_block_size & (index_block_size - 1)) {
|
||||
Dprintf("Index block size %u is invalid.\n", index_block_size);
|
||||
goto put_err_out;
|
||||
|
@ -699,7 +699,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
|
|||
|
||||
/* Determine the size of a vcn in the directory index. */
|
||||
index_block_size = le32_to_cpu(ir->index_block_size);
|
||||
if (index_block_size < NTFS_SECTOR_SIZE ||
|
||||
if (index_block_size < NTFS_BLOCK_SIZE ||
|
||||
index_block_size & (index_block_size - 1)) {
|
||||
Dprintf("Index block size %u is invalid.\n", index_block_size);
|
||||
goto dir_err_out;
|
||||
|
|
|
@ -296,9 +296,9 @@ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref,
|
|||
m->mft_record_number = cpu_to_le32(MREF(mref));
|
||||
}
|
||||
m->magic = magic_FILE;
|
||||
if (vol->mft_record_size >= NTFS_SECTOR_SIZE)
|
||||
if (vol->mft_record_size >= NTFS_BLOCK_SIZE)
|
||||
m->usa_count = cpu_to_le16(vol->mft_record_size /
|
||||
NTFS_SECTOR_SIZE + 1);
|
||||
NTFS_BLOCK_SIZE + 1);
|
||||
else {
|
||||
m->usa_count = cpu_to_le16(1);
|
||||
Dprintf("Sector size is bigger than MFT record size. "
|
||||
|
|
|
@ -50,9 +50,9 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size)
|
|||
/* Decrement usa_count to get number of fixups. */
|
||||
usa_count = le16_to_cpu(b->usa_count) - 1;
|
||||
/* Size and alignment checks. */
|
||||
if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 ||
|
||||
if (size & (NTFS_BLOCK_SIZE - 1) || usa_ofs & 1 ||
|
||||
(u32)(usa_ofs + (usa_count * 2)) > size ||
|
||||
(size >> NTFS_SECTOR_SIZE_BITS) != usa_count) {
|
||||
(size >> NTFS_BLOCK_SIZE_BITS) != usa_count) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size)
|
|||
/*
|
||||
* Position in protected data of first u16 that needs fixing up.
|
||||
*/
|
||||
data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1;
|
||||
data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1;
|
||||
/*
|
||||
* Check for incomplete multi sector transfer(s).
|
||||
*/
|
||||
|
@ -84,11 +84,11 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size)
|
|||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
data_pos += NTFS_SECTOR_SIZE/sizeof(u16);
|
||||
data_pos += NTFS_BLOCK_SIZE/sizeof(u16);
|
||||
}
|
||||
/* Re-setup the variables. */
|
||||
usa_count = le16_to_cpu(b->usa_count) - 1;
|
||||
data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1;
|
||||
data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1;
|
||||
/* Fixup all sectors. */
|
||||
while (usa_count--) {
|
||||
/*
|
||||
|
@ -97,7 +97,7 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size)
|
|||
*/
|
||||
*data_pos = *(++usa_pos);
|
||||
/* Increment position in data as well. */
|
||||
data_pos += NTFS_SECTOR_SIZE/sizeof(u16);
|
||||
data_pos += NTFS_BLOCK_SIZE/sizeof(u16);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -138,9 +138,9 @@ int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size)
|
|||
/* Decrement usa_count to get number of fixups. */
|
||||
usa_count = le16_to_cpu(b->usa_count) - 1;
|
||||
/* Size and alignment checks. */
|
||||
if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 ||
|
||||
if (size & (NTFS_BLOCK_SIZE - 1) || usa_ofs & 1 ||
|
||||
(u32)(usa_ofs + (usa_count * 2)) > size ||
|
||||
(size >> NTFS_SECTOR_SIZE_BITS) != usa_count) {
|
||||
(size >> NTFS_BLOCK_SIZE_BITS) != usa_count) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size)
|
|||
usn = cpu_to_le16(usn);
|
||||
*usa_pos = usn;
|
||||
/* Position in data of first u16 that needs fixing up. */
|
||||
data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1;
|
||||
data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1;
|
||||
/* Fixup all sectors. */
|
||||
while (usa_count--) {
|
||||
/*
|
||||
|
@ -167,7 +167,7 @@ int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size)
|
|||
/* Apply fixup to data. */
|
||||
*data_pos = usn;
|
||||
/* Increment position in data as well. */
|
||||
data_pos += NTFS_SECTOR_SIZE/sizeof(u16);
|
||||
data_pos += NTFS_BLOCK_SIZE/sizeof(u16);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ void ntfs_mst_post_write_fixup(NTFS_RECORD *b)
|
|||
usa_pos = (u16*)b + usa_ofs/sizeof(u16);
|
||||
|
||||
/* Position in protected data of first u16 that needs fixing up. */
|
||||
data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1;
|
||||
data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1;
|
||||
|
||||
/* Fixup all sectors. */
|
||||
while (usa_count--) {
|
||||
|
@ -203,7 +203,7 @@ void ntfs_mst_post_write_fixup(NTFS_RECORD *b)
|
|||
*data_pos = *(++usa_pos);
|
||||
|
||||
/* Increment position in data as well. */
|
||||
data_pos += NTFS_SECTOR_SIZE/sizeof(u16);
|
||||
data_pos += NTFS_BLOCK_SIZE/sizeof(u16);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2132,9 +2132,9 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name,
|
|||
/* Setup header. */
|
||||
ia_val->magic = magic_INDX;
|
||||
ia_val->usa_ofs = cpu_to_le16(sizeof(INDEX_ALLOCATION));
|
||||
if (index_block_size >= NTFS_SECTOR_SIZE)
|
||||
if (index_block_size >= NTFS_BLOCK_SIZE)
|
||||
ia_val->usa_count = cpu_to_le16(index_block_size /
|
||||
NTFS_SECTOR_SIZE + 1);
|
||||
NTFS_BLOCK_SIZE + 1);
|
||||
else {
|
||||
ia_val->usa_count = cpu_to_le16(1);
|
||||
Qprintf("Sector size is bigger than index block size. Setting "
|
||||
|
|
|
@ -295,7 +295,7 @@ static void restart_header_sanity(RESTART_PAGE_HEADER *rstr, u8 *buf)
|
|||
/* Verify the location and size of the update sequence array. */
|
||||
usa_end_ofs = le16_to_cpu(rstr->usa_ofs) +
|
||||
le16_to_cpu(rstr->usa_count) * sizeof(u16);
|
||||
if (page_size / NTFS_SECTOR_SIZE + 1 != le16_to_cpu(rstr->usa_count))
|
||||
if (page_size / NTFS_BLOCK_SIZE + 1 != le16_to_cpu(rstr->usa_count))
|
||||
log_err_exit(buf, "Restart page header in $LogFile is "
|
||||
"corrupt: Update sequence array size is "
|
||||
"wrong. Cannot handle this yet.\n");
|
||||
|
@ -304,7 +304,7 @@ static void restart_header_sanity(RESTART_PAGE_HEADER *rstr, u8 *buf)
|
|||
"corrupt: Update sequence array overlaps "
|
||||
"restart page header. Cannot handle this "
|
||||
"yet.\n");
|
||||
if (usa_end_ofs > NTFS_SECTOR_SIZE - sizeof(u16))
|
||||
if (usa_end_ofs > NTFS_BLOCK_SIZE - sizeof(u16))
|
||||
log_err_exit(buf, "Restart page header in $LogFile is "
|
||||
"corrupt: Update sequence array overlaps or "
|
||||
"is behind first protected sequence number. "
|
||||
|
|
Loading…
Reference in New Issue