client.h 2.7 KB

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