/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_RAMDISK_H
#define _SYS_RAMDISK_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* /dev names:
* /dev/ramdiskctl - control device
*/
/*
* Minor number 0 is reserved for the controlling device. All other ramdisks
* are assigned minor numbers 1..rd_max_disks. The minor number is used as
* an index into the 'rd_devstate' structures.
*/
#define RD_CTL_MINOR 0
/*
* Maximum number of ramdisks supported by this driver.
*/
/*
* Properties exported by the driver.
*/
/*
* Strip any "ramdisk-" prefix from the name of OBP-created ramdisks.
*/
{ \
}
/*
* Strip any ",raw" suffix from the name of pseudo ramdisk devices.
*/
{ \
*str = '\0'; \
}
/*
* Interface between the ramdisk(7D) driver and ramdiskadm(1M). Use is:
*
* fd = open("/dev/ramdiskctl", O_RDWR | O_EXCL);
*
* 'ramdiskctl' must be opened exclusively. Access is controlled by permissions
* on the device, which is 0644 by default. Write-access is required for the
* allocation and deletion of ramdisks, but only read-access is required for
* the remaining ioctls which simply return information.
*
* ioctl usage:
*
* struct rd_ioctl ri;
*
* strlcpy(ri.ri_name, "somediskname", sizeof (ri.ri_name));
* ri.ri_size = somedisksize;
* ioctl(fd, RD_CREATE_DISK, &ri);
*
* strlcpy(ri.ri_name, "somediskname", sizeof (ri.ri_name));
* ioctl(fd, RD_DELETE_DISK, &ri);
*
* (only ramdisks created using the RD_CREATE_DISK ioctl can be deleted
* by the RD_DELETE_DISK ioctl).
*
* Note that these ioctls are completely private, and only for the use of
* ramdiskadm(1M).
*/
struct rd_ioctl {
};
#if defined(_KERNEL)
/*
* We limit the maximum number of active ramdisk devices to 32, tuneable
* up to a maximum of 1023. Minor 0 is always reserved for the controlling
* device. You can change this by setting a value for 'max_disks' in
* ramdisk.conf.
*/
/*
* The maximum amount of memory that can be consumed before starving the
* kernel depends loosely on the number of cpus, the speed of those cpus,
* and other hardware characteristics, and is thus highly machine-dependent.
* The default value of 'rd_percent_physmem' is 25% of physical memory,
* but this can be changed by setting a value for 'percent_physmem' in
* ramdisk.conf.
*/
/*
* Maximum size of a physical transfer?
*/
/*
* A real OBP-created ramdisk consists of one or more physical address
* ranges; these are described by the 'existing' property, whose value
* is a (corresponding) number of {phys,size} pairs.
*/
typedef struct {
/*
* The entire state of each ramdisk device. The rd_dip field will reference
* the actual devinfo for real OBP-created ramdisks, or the generic devinfo
* 'rd_dip' for pseudo ramdisk devices.
*/
typedef struct rd_devstate {
/*
* {rd_nexisting, rd_existing} and {rd_npages, rd_ppa} are
* mutually exclusive; the former describe an OBP-created
* ramdisk, the latter a 'pseudo' ramdisk.
*/
/*
* Fields describing a virtual window onto the physical ramdisk,
* giving the offset within the ramdisk of the window, its size,
* and its virtual address (in the kernel heap).
*/
/*
*/
/*
* Fields to maintain a faked geometry of the disk.
*/
/*
* Kstat stuff.
*/
extern int is_pseudo_device(dev_info_t *);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_RAMDISK_H */