xref: /linux/drivers/s390/char/hmcdrv_ftp.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
28f933b10SRalf Hoppe /*
38f933b10SRalf Hoppe  *    SE/HMC Drive FTP Services
48f933b10SRalf Hoppe  *
58f933b10SRalf Hoppe  *    Copyright IBM Corp. 2013
68f933b10SRalf Hoppe  *    Author(s): Ralf Hoppe (rhoppe@de.ibm.com)
78f933b10SRalf Hoppe  */
88f933b10SRalf Hoppe 
98f933b10SRalf Hoppe #ifndef __HMCDRV_FTP_H__
108f933b10SRalf Hoppe #define __HMCDRV_FTP_H__
118f933b10SRalf Hoppe 
128f933b10SRalf Hoppe #include <linux/types.h> /* size_t, loff_t */
138f933b10SRalf Hoppe 
148f933b10SRalf Hoppe /*
158f933b10SRalf Hoppe  * HMC drive FTP Service max. length of path (w/ EOS)
168f933b10SRalf Hoppe  */
178f933b10SRalf Hoppe #define HMCDRV_FTP_FIDENT_MAX 192
188f933b10SRalf Hoppe 
198f933b10SRalf Hoppe /**
208f933b10SRalf Hoppe  * enum hmcdrv_ftp_cmdid - HMC drive FTP commands
218f933b10SRalf Hoppe  * @HMCDRV_FTP_NOOP: do nothing (only for probing)
228f933b10SRalf Hoppe  * @HMCDRV_FTP_GET: read a file
238f933b10SRalf Hoppe  * @HMCDRV_FTP_PUT: (over-) write a file
248f933b10SRalf Hoppe  * @HMCDRV_FTP_APPEND: append to a file
258f933b10SRalf Hoppe  * @HMCDRV_FTP_DIR: list directory long (ls -l)
268f933b10SRalf Hoppe  * @HMCDRV_FTP_NLIST: list files, no directories (name list)
278f933b10SRalf Hoppe  * @HMCDRV_FTP_DELETE: delete a file
288f933b10SRalf Hoppe  * @HMCDRV_FTP_CANCEL: cancel operation (SCLP/LPAR only)
298f933b10SRalf Hoppe  */
308f933b10SRalf Hoppe enum hmcdrv_ftp_cmdid {
318f933b10SRalf Hoppe 	HMCDRV_FTP_NOOP = 0,
328f933b10SRalf Hoppe 	HMCDRV_FTP_GET = 1,
338f933b10SRalf Hoppe 	HMCDRV_FTP_PUT = 2,
348f933b10SRalf Hoppe 	HMCDRV_FTP_APPEND = 3,
358f933b10SRalf Hoppe 	HMCDRV_FTP_DIR = 4,
368f933b10SRalf Hoppe 	HMCDRV_FTP_NLIST = 5,
378f933b10SRalf Hoppe 	HMCDRV_FTP_DELETE = 6,
388f933b10SRalf Hoppe 	HMCDRV_FTP_CANCEL = 7
398f933b10SRalf Hoppe };
408f933b10SRalf Hoppe 
418f933b10SRalf Hoppe /**
428f933b10SRalf Hoppe  * struct hmcdrv_ftp_cmdspec - FTP command specification
438f933b10SRalf Hoppe  * @id: FTP command ID
448f933b10SRalf Hoppe  * @ofs: offset in file
458f933b10SRalf Hoppe  * @fname: filename (ASCII), null-terminated
468f933b10SRalf Hoppe  * @buf: kernel-space transfer data buffer, 4k aligned
478f933b10SRalf Hoppe  * @len: (max) number of bytes to transfer from/to @buf
488f933b10SRalf Hoppe  */
498f933b10SRalf Hoppe struct hmcdrv_ftp_cmdspec {
508f933b10SRalf Hoppe 	enum hmcdrv_ftp_cmdid id;
518f933b10SRalf Hoppe 	loff_t ofs;
528f933b10SRalf Hoppe 	const char *fname;
538f933b10SRalf Hoppe 	void __kernel *buf;
548f933b10SRalf Hoppe 	size_t len;
558f933b10SRalf Hoppe };
568f933b10SRalf Hoppe 
578f933b10SRalf Hoppe int hmcdrv_ftp_startup(void);
588f933b10SRalf Hoppe void hmcdrv_ftp_shutdown(void);
598f933b10SRalf Hoppe int hmcdrv_ftp_probe(void);
608f933b10SRalf Hoppe ssize_t hmcdrv_ftp_do(const struct hmcdrv_ftp_cmdspec *ftp);
618f933b10SRalf Hoppe ssize_t hmcdrv_ftp_cmd(char __kernel *cmd, loff_t offset,
628f933b10SRalf Hoppe 		       char __user *buf, size_t len);
638f933b10SRalf Hoppe 
648f933b10SRalf Hoppe #endif	 /* __HMCDRV_FTP_H__ */
65