Lines Matching +full:block +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Squashfs - a compressed read only filesystem for Linux
16 * the metablock containing the directory and the offset into the
17 * decompressed block (<block, offset>).
22 * compressed metadata block, and therefore, can share the start block.
24 * header containing the shared start block value, and a sequence of directory
25 * entries, each of which share the shared start block. A new directory header
26 * is written once/if the inode start block changes. The directory
32 * in each metadata block. Directories are sorted in alphabetical order,
35 * location of the metadata block the filename is in has been found.
36 * The general idea of the index is ensure only one metadata block needs to be
57 * block containing it, and the directory index this represents.
60 * (if any) we have managed to read - the index isn't essential, just
67 struct squashfs_sb_info *msblk = sb->s_fs_info; in get_dir_index_using_name()
87 size = le32_to_cpu(index->size) + 1; in get_dir_index_using_name()
91 err = squashfs_read_metadata(sb, index->name, &index_start, in get_dir_index_using_name()
96 index->name[size] = '\0'; in get_dir_index_using_name()
98 if (strcmp(index->name, name) > 0) in get_dir_index_using_name()
101 length = le32_to_cpu(index->index); in get_dir_index_using_name()
102 *next_block = le32_to_cpu(index->start_block) + in get_dir_index_using_name()
103 msblk->directory_table; in get_dir_index_using_name()
111 * Return index (f_pos) of the looked up metadata block. Translate in get_dir_index_using_name()
112 * from internal f_pos to external f_pos which is offset by 3 because in get_dir_index_using_name()
123 const unsigned char *name = dentry->d_name.name; in squashfs_lookup()
124 int len = dentry->d_name.len; in squashfs_lookup()
126 struct squashfs_sb_info *msblk = dir->i_sb->s_fs_info; in squashfs_lookup()
129 u64 block = squashfs_i(dir)->start + msblk->directory_table; in squashfs_lookup() local
130 int offset = squashfs_i(dir)->offset; in squashfs_lookup() local
134 TRACE("Entered squashfs_lookup [%llx:%x]\n", block, offset); in squashfs_lookup()
139 return ERR_PTR(-ENOMEM); in squashfs_lookup()
143 err = -ENAMETOOLONG; in squashfs_lookup()
147 length = get_dir_index_using_name(dir->i_sb, &block, &offset, in squashfs_lookup()
148 squashfs_i(dir)->dir_idx_start, in squashfs_lookup()
149 squashfs_i(dir)->dir_idx_offset, in squashfs_lookup()
150 squashfs_i(dir)->dir_idx_cnt, name); in squashfs_lookup()
156 err = squashfs_read_metadata(dir->i_sb, &dirh, &block, in squashfs_lookup()
157 &offset, sizeof(dirh)); in squashfs_lookup()
168 while (dir_count--) { in squashfs_lookup()
172 err = squashfs_read_metadata(dir->i_sb, dire, &block, in squashfs_lookup()
173 &offset, sizeof(*dire)); in squashfs_lookup()
177 size = le16_to_cpu(dire->size) + 1; in squashfs_lookup()
183 err = squashfs_read_metadata(dir->i_sb, dire->name, in squashfs_lookup()
184 &block, &offset, size); in squashfs_lookup()
190 if (name[0] < dire->name[0]) in squashfs_lookup()
193 if (len == size && !strncmp(name, dire->name, len)) { in squashfs_lookup()
197 off = le16_to_cpu(dire->offset); in squashfs_lookup()
199 (short) le16_to_cpu(dire->inode_number); in squashfs_lookup()
206 inode = squashfs_iget(dir->i_sb, ino, ino_num); in squashfs_lookup()
217 err = -EIO; in squashfs_lookup()
220 ERROR("Unable to read directory block [%llx:%x]\n", in squashfs_lookup()
221 squashfs_i(dir)->start + msblk->directory_table, in squashfs_lookup()
222 squashfs_i(dir)->offset); in squashfs_lookup()