client.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * include/net/9p/client.h
  3. *
  4. * 9P Client Definitions
  5. *
  6. * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to:
  19. * Free Software Foundation
  20. * 51 Franklin Street, Fifth Floor
  21. * Boston, MA 02111-1301 USA
  22. *
  23. */
  24. #ifndef NET_9P_CLIENT_H
  25. #define NET_9P_CLIENT_H
  26. struct p9_client {
  27. spinlock_t lock; /* protect client structure */
  28. int msize;
  29. unsigned char dotu;
  30. struct p9_trans *trans;
  31. struct p9_conn *conn;
  32. struct p9_idpool *fidpool;
  33. struct list_head fidlist;
  34. };
  35. struct p9_fid {
  36. struct p9_client *clnt;
  37. u32 fid;
  38. int mode;
  39. struct p9_qid qid;
  40. u32 iounit;
  41. uid_t uid;
  42. void *aux;
  43. int rdir_fpos;
  44. int rdir_pos;
  45. struct p9_fcall *rdir_fcall;
  46. struct list_head flist;
  47. struct list_head dlist; /* list of all fids attached to a dentry */
  48. };
  49. struct p9_client *p9_client_create(struct p9_trans *trans, int msize,
  50. int dotu);
  51. void p9_client_destroy(struct p9_client *clnt);
  52. void p9_client_disconnect(struct p9_client *clnt);
  53. struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
  54. char *uname, u32 n_uname, char *aname);
  55. struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname,
  56. u32 n_uname, char *aname);
  57. struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
  58. int clone);
  59. int p9_client_open(struct p9_fid *fid, int mode);
  60. int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
  61. char *extension);
  62. int p9_client_clunk(struct p9_fid *fid);
  63. int p9_client_remove(struct p9_fid *fid);
  64. int p9_client_read(struct p9_fid *fid, char *data, u64 offset, u32 count);
  65. int p9_client_readn(struct p9_fid *fid, char *data, u64 offset, u32 count);
  66. int p9_client_write(struct p9_fid *fid, char *data, u64 offset, u32 count);
  67. int p9_client_uread(struct p9_fid *fid, char __user *data, u64 offset,
  68. u32 count);
  69. int p9_client_uwrite(struct p9_fid *fid, const char __user *data, u64 offset,
  70. u32 count);
  71. struct p9_stat *p9_client_stat(struct p9_fid *fid);
  72. int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst);
  73. struct p9_stat *p9_client_dirread(struct p9_fid *fid, u64 offset);
  74. #endif /* NET_9P_CLIENT_H */