1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef TARGET_CORE_FILE_H
3 #define TARGET_CORE_FILE_H
4 
5 #include <target/target_core_base.h>
6 
7 #define FD_VERSION		"4.0"
8 
9 #define FD_MAX_DEV_NAME		256
10 #define FD_MAX_DEV_PROT_NAME	FD_MAX_DEV_NAME + 16
11 #define FD_DEVICE_QUEUE_DEPTH	32
12 #define FD_MAX_DEVICE_QUEUE_DEPTH 128
13 #define FD_BLOCKSIZE		512
14 /*
15  * Limited by the number of iovecs (2048) per vfs_[writev,readv] call
16  */
17 #define FD_MAX_BYTES		8388608
18 
19 #define RRF_EMULATE_CDB		0x01
20 #define RRF_GOT_LBA		0x02
21 
22 #define FBDF_HAS_PATH		0x01
23 #define FBDF_HAS_SIZE		0x02
24 #define FDBD_HAS_BUFFERED_IO_WCE 0x04
25 #define FDBD_HAS_ASYNC_IO	 0x08
26 #define FDBD_FORMAT_UNIT_SIZE	2048
27 
28 struct fd_dev {
29 	struct se_device dev;
30 
31 	u32		fbd_flags;
32 	unsigned char	fd_dev_name[FD_MAX_DEV_NAME];
33 	/* Unique Ramdisk Device ID in Ramdisk HBA */
34 	u32		fd_dev_id;
35 	/* Number of SG tables in sg_table_array */
36 	u32		fd_table_count;
37 	u32		fd_queue_depth;
38 	u32		fd_block_size;
39 	unsigned long long fd_dev_size;
40 	struct file	*fd_file;
41 	struct file	*fd_prot_file;
42 	/* FILEIO HBA device is connected to */
43 	struct fd_host *fd_host;
44 } ____cacheline_aligned;
45 
46 struct fd_host {
47 	u32		fd_host_dev_id_count;
48 	/* Unique FILEIO Host ID */
49 	u32		fd_host_id;
50 } ____cacheline_aligned;
51 
52 #endif /* TARGET_CORE_FILE_H */
53