dir.c (e1fb4d05d5a3265f1f6769bee034175f91ecc2dd) | dir.c (aa49b4cf7dbf45438563f0ff6a2d23a68b70a7b9) |
---|---|
1/* 2 * linux/fs/nfs/dir.c 3 * 4 * Copyright (C) 1992 Rick Sladkey 5 * 6 * nfs directory handling functions 7 * 8 * 10 Apr 1996 Added silly rename for unlink --okir --- 516 unchanged lines hidden (view full) --- 525 */ 526static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 527{ 528 struct dentry *dentry = filp->f_path.dentry; 529 struct inode *inode = dentry->d_inode; 530 nfs_readdir_descriptor_t my_desc, 531 *desc = &my_desc; 532 struct nfs_entry my_entry; | 1/* 2 * linux/fs/nfs/dir.c 3 * 4 * Copyright (C) 1992 Rick Sladkey 5 * 6 * nfs directory handling functions 7 * 8 * 10 Apr 1996 Added silly rename for unlink --okir --- 516 unchanged lines hidden (view full) --- 525 */ 526static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 527{ 528 struct dentry *dentry = filp->f_path.dentry; 529 struct inode *inode = dentry->d_inode; 530 nfs_readdir_descriptor_t my_desc, 531 *desc = &my_desc; 532 struct nfs_entry my_entry; |
533 struct nfs_fh fh; 534 struct nfs_fattr fattr; 535 long res; | 533 int res = -ENOMEM; |
536 537 dfprintk(FILE, "NFS: readdir(%s/%s) starting at cookie %llu\n", 538 dentry->d_parent->d_name.name, dentry->d_name.name, 539 (long long)filp->f_pos); 540 nfs_inc_stats(inode, NFSIOS_VFSGETDENTS); 541 542 /* 543 * filp->f_pos points to the dirent entry number. --- 5 unchanged lines hidden (view full) --- 549 550 desc->file = filp; 551 desc->dir_cookie = &nfs_file_open_context(filp)->dir_cookie; 552 desc->decode = NFS_PROTO(inode)->decode_dirent; 553 desc->plus = NFS_USE_READDIRPLUS(inode); 554 555 my_entry.cookie = my_entry.prev_cookie = 0; 556 my_entry.eof = 0; | 534 535 dfprintk(FILE, "NFS: readdir(%s/%s) starting at cookie %llu\n", 536 dentry->d_parent->d_name.name, dentry->d_name.name, 537 (long long)filp->f_pos); 538 nfs_inc_stats(inode, NFSIOS_VFSGETDENTS); 539 540 /* 541 * filp->f_pos points to the dirent entry number. --- 5 unchanged lines hidden (view full) --- 547 548 desc->file = filp; 549 desc->dir_cookie = &nfs_file_open_context(filp)->dir_cookie; 550 desc->decode = NFS_PROTO(inode)->decode_dirent; 551 desc->plus = NFS_USE_READDIRPLUS(inode); 552 553 my_entry.cookie = my_entry.prev_cookie = 0; 554 my_entry.eof = 0; |
557 my_entry.fh = &fh; 558 my_entry.fattr = &fattr; 559 nfs_fattr_init(&fattr); | 555 my_entry.fh = nfs_alloc_fhandle(); 556 my_entry.fattr = nfs_alloc_fattr(); 557 if (my_entry.fh == NULL || my_entry.fattr == NULL) 558 goto out_alloc_failed; 559 |
560 desc->entry = &my_entry; 561 562 nfs_block_sillyrename(dentry); 563 res = nfs_revalidate_mapping(inode, filp->f_mapping); 564 if (res < 0) 565 goto out; 566 567 while(!desc->entry->eof) { --- 25 unchanged lines hidden (view full) --- 593 res = 0; 594 break; 595 } 596 } 597out: 598 nfs_unblock_sillyrename(dentry); 599 if (res > 0) 600 res = 0; | 560 desc->entry = &my_entry; 561 562 nfs_block_sillyrename(dentry); 563 res = nfs_revalidate_mapping(inode, filp->f_mapping); 564 if (res < 0) 565 goto out; 566 567 while(!desc->entry->eof) { --- 25 unchanged lines hidden (view full) --- 593 res = 0; 594 break; 595 } 596 } 597out: 598 nfs_unblock_sillyrename(dentry); 599 if (res > 0) 600 res = 0; |
601 dfprintk(FILE, "NFS: readdir(%s/%s) returns %ld\n", | 601out_alloc_failed: 602 nfs_free_fattr(my_entry.fattr); 603 nfs_free_fhandle(my_entry.fh); 604 dfprintk(FILE, "NFS: readdir(%s/%s) returns %d\n", |
602 dentry->d_parent->d_name.name, dentry->d_name.name, 603 res); 604 return res; 605} 606 607static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) 608{ 609 struct dentry *dentry = filp->f_path.dentry; --- 1399 unchanged lines hidden --- | 605 dentry->d_parent->d_name.name, dentry->d_name.name, 606 res); 607 return res; 608} 609 610static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) 611{ 612 struct dentry *dentry = filp->f_path.dentry; --- 1399 unchanged lines hidden --- |