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