26 .readdir = sysv_readdir,
30 static inline void dir_put_page(
struct page *
page)
36 static inline unsigned long dir_pages(
struct inode *
inode)
41 static int dir_commit_chunk(
struct page *
page, loff_t
pos,
unsigned len)
44 struct inode *
dir = mapping->
host;
48 if (pos+len > dir->
i_size) {
49 i_size_write(dir, pos+len);
50 mark_inode_dirty(dir);
59 static struct page * dir_get_page(
struct inode *dir,
unsigned long n)
62 struct page *page = read_mapping_page(mapping, n,
NULL);
70 unsigned long pos = filp->
f_pos;
71 struct inode *inode = filp->
f_path.dentry->d_inode;
75 unsigned long npages = dir_pages(inode);
81 for ( ; n < npages; n++, offset = 0) {
84 struct page *page = dir_get_page(inode, n);
91 for ( ;(
char*)de <= limit; de++) {
98 offset = (
char *)de - kaddr;
101 ((loff_t)n<<PAGE_CACHE_SHIFT) | offset,
102 fs16_to_cpu(SYSV_SB(sb), de->
inode),
113 filp->
f_pos = ((loff_t)n << PAGE_CACHE_SHIFT) |
offset;
120 static inline int namecompare(
int len,
int maxlen,
121 const char * name,
const char *
buffer)
123 if (len < maxlen && buffer[len])
125 return !
memcmp(name, buffer, len);
138 const char * name = dentry->
d_name.name;
140 struct inode * dir = dentry->
d_parent->d_inode;
142 unsigned long npages = dir_pages(dir);
143 struct page *page =
NULL;
148 start = SYSV_I(dir)->i_dir_start_lookup;
155 page = dir_get_page(dir, n);
160 for ( ; (
char *) de <= kaddr ; de++) {
172 }
while (n != start);
177 SYSV_I(dir)->i_dir_start_lookup =
n;
184 struct inode *dir = dentry->
d_parent->d_inode;
185 const char * name = dentry->
d_name.name;
187 struct page *page =
NULL;
189 unsigned long npages = dir_pages(dir);
196 for (n = 0; n <= npages; n++) {
197 page = dir_get_page(dir, n);
204 while ((
char *)de <= kaddr) {
225 memset (de->
name + namelen, 0, SYSV_DIRSIZE - namelen - 2);
227 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
229 mark_inode_dirty(dir);
241 struct inode *inode = page->
mapping->host;
243 loff_t pos =
page_offset(page) + (
char *)de - kaddr;
250 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
253 mark_inode_dirty(inode);
259 struct page *page = grab_cache_page(inode->
i_mapping, 0);
284 err = dir_commit_chunk(page, 0, 2 * SYSV_DIRSIZE);
296 struct page *page =
NULL;
297 unsigned long i, npages = dir_pages(inode);
299 for (i = 0; i < npages; i++) {
302 page = dir_get_page(inode, i);
311 for ( ;(
char *)de <= kaddr; de++) {
315 if (de->
name[0] !=
'.')
318 if (de->
inode == cpu_to_fs16(SYSV_SB(sb),
323 if (de->
name[1] !=
'.' || de->
name[2])
339 struct inode *dir = page->
mapping->host;
348 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
351 mark_inode_dirty(dir);
356 struct page *page = dir_get_page(dir, 0);
373 res = fs16_to_cpu(SYSV_SB(dentry->
d_sb), de->
inode);