summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/s390/char/hmcdrv_ftp.h
blob: f3643a7b36765a58f53d0a5394dd60cc9b58c1a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *    SE/HMC Drive FTP Services
 *
 *    Copyright IBM Corp. 2013
 *    Author(s): Ralf Hoppe (rhoppe@de.ibm.com)
 */

#ifndef __HMCDRV_FTP_H__
#define __HMCDRV_FTP_H__

#include <linux/types.h> /* size_t, loff_t */

/*
 * HMC drive FTP Service max. length of path (w/ EOS)
 */
#define HMCDRV_FTP_FIDENT_MAX 192

/**
 * enum hmcdrv_ftp_cmdid - HMC drive FTP commands
 * @HMCDRV_FTP_NOOP: do nothing (only for probing)
 * @HMCDRV_FTP_GET: read a file
 * @HMCDRV_FTP_PUT: (over-) write a file
 * @HMCDRV_FTP_APPEND: append to a file
 * @HMCDRV_FTP_DIR: list directory long (ls -l)
 * @HMCDRV_FTP_NLIST: list files, no directories (name list)
 * @HMCDRV_FTP_DELETE: delete a file
 * @HMCDRV_FTP_CANCEL: cancel operation (SCLP/LPAR only)
 */
enum hmcdrv_ftp_cmdid {
	HMCDRV_FTP_NOOP = 0,
	HMCDRV_FTP_GET = 1,
	HMCDRV_FTP_PUT = 2,
	HMCDRV_FTP_APPEND = 3,
	HMCDRV_FTP_DIR = 4,
	HMCDRV_FTP_NLIST = 5,
	HMCDRV_FTP_DELETE = 6,
	HMCDRV_FTP_CANCEL = 7
};

/**
 * struct hmcdrv_ftp_cmdspec - FTP command specification
 * @id: FTP command ID
 * @ofs: offset in file
 * @fname: filename (ASCII), null-terminated
 * @buf: kernel-space transfer data buffer, 4k aligned
 * @len: (max) number of bytes to transfer from/to @buf
 */
struct hmcdrv_ftp_cmdspec {
	enum hmcdrv_ftp_cmdid id;
	loff_t ofs;
	const char *fname;
	void __kernel *buf;
	size_t len;
};

int hmcdrv_ftp_startup(void);
void hmcdrv_ftp_shutdown(void);
int hmcdrv_ftp_probe(void);
ssize_t hmcdrv_ftp_do(const struct hmcdrv_ftp_cmdspec *ftp);
ssize_t hmcdrv_ftp_cmd(char __kernel *cmd, loff_t offset,
		       char __user *buf, size_t len);

#endif	 /* __HMCDRV_FTP_H__ */