1/* This software is part of the OpenBeOS distribution and is covered
2** by the MIT License.
3*/
4#ifndef VIRTUAL_DRIVE_H
5#define VIRTUAL_DRIVE_H
6
7#include <Drivers.h>
8
9// virtualdrive device directory and control device, "/dev" relative
10#define VIRTUAL_DRIVE_DIRECTORY_REL			"misc/virtualdrive"
11#define VIRTUAL_DRIVE_CONTROL_DEVICE_REL	VIRTUAL_DRIVE_DIRECTORY_REL \
12											"/control"
13// virtualdrive device directory and control device, absolute
14#define VIRTUAL_DRIVE_DIRECTORY				"/dev/" \
15											VIRTUAL_DRIVE_DIRECTORY_REL
16#define VIRTUAL_DRIVE_CONTROL_DEVICE		"/dev/" \
17											VIRTUAL_DRIVE_CONTROL_DEVICE_REL
18
19#define VIRTUAL_DRIVE_IOCTL_BASE	(B_DEVICE_OP_CODES_END + 10001)
20
21enum {
22	VIRTUAL_DRIVE_REGISTER_FILE	= VIRTUAL_DRIVE_IOCTL_BASE,
23		// on control device: virtual_drive_info*, fills in device_name
24	VIRTUAL_DRIVE_UNREGISTER_FILE,
25		// on data device: none
26	VIRTUAL_DRIVE_GET_INFO,
27		// on data device: virtual_drive_info*
28};
29
30#define VIRTUAL_DRIVE_MAGIC	'VdIn'
31
32typedef struct virtual_drive_info {
33	uint32			magic;
34	size_t			drive_info_size;
35	char			file_name[B_PATH_NAME_LENGTH];
36	char			device_name[B_PATH_NAME_LENGTH];
37	device_geometry	geometry;
38	bool			use_geometry;
39	bool			halted;		// only valid for VIRTUAL_DRIVE_GET_INFO
40} virtual_drive_info;
41
42#endif	// VIRTUAL_DRIVE_H
43