hmcdrv_ftp.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * SE/HMC Drive FTP Services
  4. *
  5. * Copyright IBM Corp. 2013
  6. * Author(s): Ralf Hoppe ([email protected])
  7. */
  8. #ifndef __HMCDRV_FTP_H__
  9. #define __HMCDRV_FTP_H__
  10. #include <linux/types.h> /* size_t, loff_t */
  11. /*
  12. * HMC drive FTP Service max. length of path (w/ EOS)
  13. */
  14. #define HMCDRV_FTP_FIDENT_MAX 192
  15. /**
  16. * enum hmcdrv_ftp_cmdid - HMC drive FTP commands
  17. * @HMCDRV_FTP_NOOP: do nothing (only for probing)
  18. * @HMCDRV_FTP_GET: read a file
  19. * @HMCDRV_FTP_PUT: (over-) write a file
  20. * @HMCDRV_FTP_APPEND: append to a file
  21. * @HMCDRV_FTP_DIR: list directory long (ls -l)
  22. * @HMCDRV_FTP_NLIST: list files, no directories (name list)
  23. * @HMCDRV_FTP_DELETE: delete a file
  24. * @HMCDRV_FTP_CANCEL: cancel operation (SCLP/LPAR only)
  25. */
  26. enum hmcdrv_ftp_cmdid {
  27. HMCDRV_FTP_NOOP = 0,
  28. HMCDRV_FTP_GET = 1,
  29. HMCDRV_FTP_PUT = 2,
  30. HMCDRV_FTP_APPEND = 3,
  31. HMCDRV_FTP_DIR = 4,
  32. HMCDRV_FTP_NLIST = 5,
  33. HMCDRV_FTP_DELETE = 6,
  34. HMCDRV_FTP_CANCEL = 7
  35. };
  36. /**
  37. * struct hmcdrv_ftp_cmdspec - FTP command specification
  38. * @id: FTP command ID
  39. * @ofs: offset in file
  40. * @fname: filename (ASCII), null-terminated
  41. * @buf: kernel-space transfer data buffer, 4k aligned
  42. * @len: (max) number of bytes to transfer from/to @buf
  43. */
  44. struct hmcdrv_ftp_cmdspec {
  45. enum hmcdrv_ftp_cmdid id;
  46. loff_t ofs;
  47. const char *fname;
  48. void __kernel *buf;
  49. size_t len;
  50. };
  51. int hmcdrv_ftp_startup(void);
  52. void hmcdrv_ftp_shutdown(void);
  53. int hmcdrv_ftp_probe(void);
  54. ssize_t hmcdrv_ftp_do(const struct hmcdrv_ftp_cmdspec *ftp);
  55. ssize_t hmcdrv_ftp_cmd(char __kernel *cmd, loff_t offset,
  56. char __user *buf, size_t len);
  57. #endif /* __HMCDRV_FTP_H__ */