symlink.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Symlink inode operations for Coda filesystem
  3. * Original version: (C) 1996 P. Braam and M. Callahan
  4. * Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University
  5. *
  6. * Carnegie Mellon encourages users to contribute improvements to
  7. * the Coda project. Contact Peter Braam (coda@cs.cmu.edu).
  8. */
  9. #include <linux/types.h>
  10. #include <linux/kernel.h>
  11. #include <linux/time.h>
  12. #include <linux/fs.h>
  13. #include <linux/stat.h>
  14. #include <linux/errno.h>
  15. #include <linux/pagemap.h>
  16. #include <linux/smp_lock.h>
  17. #include <linux/coda.h>
  18. #include <linux/coda_linux.h>
  19. #include <linux/coda_psdev.h>
  20. #include <linux/coda_fs_i.h>
  21. #include <linux/coda_proc.h>
  22. static int coda_symlink_filler(struct file *file, struct page *page)
  23. {
  24. struct inode *inode = page->mapping->host;
  25. int error;
  26. struct coda_inode_info *cii;
  27. unsigned int len = PAGE_SIZE;
  28. char *p = kmap(page);
  29. lock_kernel();
  30. cii = ITOC(inode);
  31. coda_vfs_stat.follow_link++;
  32. error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len);
  33. unlock_kernel();
  34. if (error)
  35. goto fail;
  36. SetPageUptodate(page);
  37. kunmap(page);
  38. unlock_page(page);
  39. return 0;
  40. fail:
  41. SetPageError(page);
  42. kunmap(page);
  43. unlock_page(page);
  44. return error;
  45. }
  46. const struct address_space_operations coda_symlink_aops = {
  47. .readpage = coda_symlink_filler,
  48. };