File: ramdisk.h

package info (click to toggle)
gnumach 2:1.8+git20190109-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 19,608 kB
  • sloc: ansic: 289,241; sh: 4,496; asm: 1,756; makefile: 383; awk: 45
file content (47 lines) | stat: -rw-r--r-- 1,431 bytes parent folder | download
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
#ifndef _KERN_RAMDISK_H_
#define _KERN_RAMDISK_H_

#include <vm/pmap.h>
#include <device/io_req.h>
#include <device/conf.h>

/* Maximum number of ramdisk devices */
#define RAMDISK_MAX 4

/* The block size used (userspace requires 512) */
#define RAMDISK_BLOCKSZ 512

/* Name associated to the ramdisk major */
#define RAMDISK_NAME "rd"
#define RAMDISK_NAMESZ (sizeof RAMDISK_NAME + sizeof (int) * 3 + 1)

/* Create a new ramdisk of the given size. On success, if out_no and/or out_ptr
 * are not NULL, the device number and pointer to the ramdisk's data are stored
 * there. Returns D_SUCCESS or D_NO_MEMORY.  */
int ramdisk_create(vm_size_t size, const void *initdata, int *out_no);

/* Device operations */
int ramdisk_open(dev_t, int, io_req_t);
int ramdisk_getstat(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t *);
int ramdisk_read(dev_t, io_req_t);
int ramdisk_write(dev_t, io_req_t);
vm_offset_t ramdisk_mmap(dev_t, vm_offset_t, vm_prot_t);

/* dev_ops initializer to be used from <machine>/conf.c */
#define RAMDISK_DEV_OPS { \
		.d_name = RAMDISK_NAME, \
		.d_open = ramdisk_open, \
		.d_close = nulldev_close, \
		.d_read = ramdisk_read, \
		.d_write = ramdisk_write, \
		.d_getstat = ramdisk_getstat, \
		.d_setstat = nulldev_setstat, \
		.d_mmap = ramdisk_mmap, \
		.d_async_in = nodev, \
		.d_reset = nulldev, \
		.d_port_death = nulldev_portdeath, \
		.d_subdev = 0, \
		.d_dev_info = nodev, \
	}

#endif