symlink.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. static int coda_symlink_filler(struct file *file, struct page *page)
  22. {
  23. struct inode *inode = page->mapping->host;
  24. int error;
  25. struct coda_inode_info *cii;
  26. unsigned int len = PAGE_SIZE;
  27. char *p = kmap(page);
  28. lock_kernel();
  29. cii = ITOC(inode);
  30. error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len);
  31. unlock_kernel();
  32. if (error)
  33. goto fail;
  34. SetPageUptodate(page);
  35. kunmap(page);
  36. unlock_page(page);
  37. return 0;
  38. fail:
  39. SetPageError(page);
  40. kunmap(page);
  41. unlock_page(page);
  42. return error;
  43. }
  44. const struct address_space_operations coda_symlink_aops = {
  45. .readpage = coda_symlink_filler,
  46. };