diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 9782f426..85cf8461 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2111,14 +2111,10 @@ typedef struct { this must be COLLATION_FILE_NAME. */ u32 index_block_size; /* Size of each index block in bytes (in the index allocation attribute). */ - s8 clusters_per_index_block; /* Cluster size of each index block (in + u8 clusters_per_index_block; /* Cluster size of each index block (in the index allocation attribute), when an index block is >= than a cluster, - otherwise this will be the -log of - the size (like how the encoding of - the mft record size and the index - record size found in the boot sector - work). Has to be a power of 2. */ + otherwise sectors per index block. */ u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ INDEX_HEADER index; /* Index header describing the following index entries. */ diff --git a/libntfs/dir.c b/libntfs/dir.c index 3b157011..0d29bf30 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1244,8 +1244,9 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, ni->vol->indx_record_size >> ni->vol->cluster_size_bits; else - ir->clusters_per_index_block = - -ni->vol->indx_record_size_bits; + ir->clusters_per_index_block = + ni->vol->indx_record_size >> + ni->vol->sector_size_bits; ir->index.entries_offset = cpu_to_le32(sizeof(INDEX_HEADER)); ir->index.index_length = cpu_to_le32(index_len); ir->index.allocated_size = cpu_to_le32(index_len);