15 static unsigned qnx6_lfile_checksum(
char *
name,
unsigned size)
20 crc = ((crc >> 1) + *(name++)) ^
21 ((crc & 0x00000001) ? 0x80000000 : 0);
26 static struct page *qnx6_get_page(
struct inode *dir,
unsigned long n)
35 static inline unsigned long dir_pages(
struct inode *
inode)
40 static unsigned last_entry(
struct inode *inode,
unsigned long page_nr)
42 unsigned long last_byte = inode->
i_size;
59 struct page *page = read_mapping_page(mapping, n,
NULL);
61 return ERR_CAST(page);
66 static int qnx6_dir_longfilename(
struct inode *inode,
84 lf = qnx6_longname(s, de, &page);
90 lf_size = fs16_to_cpu(sbi, lf->
lf_size);
102 qnx6_lfile_checksum(lf->
lf_fname, lf_size))
107 if (filldir(dirent, lf->
lf_fname, lf_size, pos, de_inode,
118 static int qnx6_readdir(
struct file *filp,
void *dirent,
filldir_t filldir)
120 struct inode *inode = filp->
f_path.dentry->d_inode;
124 unsigned long npages = dir_pages(inode);
132 for ( ; !done && n < npages; n++, start = 0) {
133 struct page *page = qnx6_get_page(inode, n);
134 int limit = last_entry(inode, n);
140 filp->
f_pos = (n + 1) << PAGE_CACHE_SHIFT;
141 return PTR_ERR(page);
146 u32 no_inode = fs32_to_cpu(sbi, de->de_inode);
148 if (!no_inode || !size)
155 if (!qnx6_dir_longfilename(inode,
157 dirent, pos, no_inode,
164 " inode:%u\n", size, de->de_fname,
166 if (filldir(dirent, de->de_fname, size,
183 static unsigned qnx6_long_match(
int len,
const char *name,
195 thislen = fs16_to_cpu(sbi, lf->
lf_size);
196 if (len != thislen) {
202 return fs32_to_cpu(sbi, de->
de_inode);
211 static unsigned qnx6_match(
struct super_block *s,
int len,
const char *name,
216 return fs32_to_cpu(sbi, de->
de_inode);
222 struct page **res_page)
226 struct page *page =
NULL;
228 unsigned long npages = dir_pages(dir);
243 page = qnx6_get_page(dir, n);
245 int limit = last_entry(dir, n);
249 for (i = 0; i <
limit; i++, de++) {
254 ino = qnx6_match(s, len, name, de);
257 }
else if (de->
de_size == 0xff) {
260 ino = qnx6_long_match(len,
266 "filename size in inode.\n");
273 }
while (n != start);
285 .readdir = qnx6_readdir,