Checkpoint for the night,
added a few more stub headers, fleshed out a few stub headers, added a FIXME file, added various compatibility macros git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@25 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
parent
23f28c4f75
commit
a713518f5d
|
@ -0,0 +1,16 @@
|
|||
* We need to revist the following sections to ensure there are no
|
||||
licensing issues:
|
||||
|
||||
sys/sysmacros.h - Parts borrowed from libsolcompat
|
||||
sys/dkio.h - All borrowed from libsolcompat
|
||||
sys/dklabel.h - All borrowed from libsolcompat
|
||||
sys/types32.h - All borrowed from libsolcompat
|
||||
sys/isa_defs.h - AlL borrowed from libsolcompat
|
||||
sys/u8_textprep.h - AlL borrowed from libsolcompat
|
||||
sys/u8_textprep_data - AlL borrowed from libsolcompat
|
||||
sys/acl.h _ All borrowed from libsolcompat
|
||||
sys/acl_impl.h _ All borrowed from libsolcompat
|
||||
|
||||
* Fix failure in rw lock test 6
|
||||
|
||||
* Non-atomic 64bit support for kstat.h
|
|
@ -0,0 +1,289 @@
|
|||
/*
|
||||
* 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
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* 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_ACL_H
|
||||
#define _SYS_ACL_H
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/acl_impl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_ACL_ENTRIES (1024) /* max entries of each type */
|
||||
typedef struct acl {
|
||||
int a_type; /* the type of ACL entry */
|
||||
uid_t a_id; /* the entry in -uid or gid */
|
||||
o_mode_t a_perm; /* the permission field */
|
||||
} aclent_t;
|
||||
|
||||
typedef struct ace {
|
||||
uid_t a_who; /* uid or gid */
|
||||
uint32_t a_access_mask; /* read,write,... */
|
||||
uint16_t a_flags; /* see below */
|
||||
uint16_t a_type; /* allow or deny */
|
||||
} ace_t;
|
||||
|
||||
typedef struct acl_info acl_t;
|
||||
|
||||
/*
|
||||
* The following are Defined types for an aclent_t.
|
||||
*/
|
||||
#define USER_OBJ (0x01) /* object owner */
|
||||
#define USER (0x02) /* additional users */
|
||||
#define GROUP_OBJ (0x04) /* owning group of the object */
|
||||
#define GROUP (0x08) /* additional groups */
|
||||
#define CLASS_OBJ (0x10) /* file group class and mask entry */
|
||||
#define OTHER_OBJ (0x20) /* other entry for the object */
|
||||
#define ACL_DEFAULT (0x1000) /* default flag */
|
||||
/* default object owner */
|
||||
#define DEF_USER_OBJ (ACL_DEFAULT | USER_OBJ)
|
||||
/* default additional users */
|
||||
#define DEF_USER (ACL_DEFAULT | USER)
|
||||
/* default owning group */
|
||||
#define DEF_GROUP_OBJ (ACL_DEFAULT | GROUP_OBJ)
|
||||
/* default additional groups */
|
||||
#define DEF_GROUP (ACL_DEFAULT | GROUP)
|
||||
/* default mask entry */
|
||||
#define DEF_CLASS_OBJ (ACL_DEFAULT | CLASS_OBJ)
|
||||
/* default other entry */
|
||||
#define DEF_OTHER_OBJ (ACL_DEFAULT | OTHER_OBJ)
|
||||
|
||||
/*
|
||||
* The following are defined for ace_t.
|
||||
*/
|
||||
#define ACE_READ_DATA 0x00000001
|
||||
#define ACE_LIST_DIRECTORY 0x00000001
|
||||
#define ACE_WRITE_DATA 0x00000002
|
||||
#define ACE_ADD_FILE 0x00000002
|
||||
#define ACE_APPEND_DATA 0x00000004
|
||||
#define ACE_ADD_SUBDIRECTORY 0x00000004
|
||||
#define ACE_READ_NAMED_ATTRS 0x00000008
|
||||
#define ACE_WRITE_NAMED_ATTRS 0x00000010
|
||||
#define ACE_EXECUTE 0x00000020
|
||||
#define ACE_DELETE_CHILD 0x00000040
|
||||
#define ACE_READ_ATTRIBUTES 0x00000080
|
||||
#define ACE_WRITE_ATTRIBUTES 0x00000100
|
||||
#define ACE_DELETE 0x00010000
|
||||
#define ACE_READ_ACL 0x00020000
|
||||
#define ACE_WRITE_ACL 0x00040000
|
||||
#define ACE_WRITE_OWNER 0x00080000
|
||||
#define ACE_SYNCHRONIZE 0x00100000
|
||||
|
||||
#define ACE_FILE_INHERIT_ACE 0x0001
|
||||
#define ACE_DIRECTORY_INHERIT_ACE 0x0002
|
||||
#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004
|
||||
#define ACE_INHERIT_ONLY_ACE 0x0008
|
||||
#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010
|
||||
#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020
|
||||
#define ACE_IDENTIFIER_GROUP 0x0040
|
||||
#define ACE_INHERITED_ACE 0x0080
|
||||
#define ACE_OWNER 0x1000
|
||||
#define ACE_GROUP 0x2000
|
||||
#define ACE_EVERYONE 0x4000
|
||||
|
||||
#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000
|
||||
#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001
|
||||
#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002
|
||||
#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003
|
||||
|
||||
#define ACL_AUTO_INHERIT 0x0001
|
||||
#define ACL_PROTECTED 0x0002
|
||||
#define ACL_DEFAULTED 0x0004
|
||||
#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED| \
|
||||
ACL_DEFAULTED)
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
/*
|
||||
* These are only applicable in a CIFS context.
|
||||
*/
|
||||
#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04
|
||||
#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05
|
||||
#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06
|
||||
#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07
|
||||
#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08
|
||||
#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09
|
||||
#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A
|
||||
#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B
|
||||
#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C
|
||||
#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D
|
||||
#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E
|
||||
#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F
|
||||
#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
|
||||
|
||||
#define ACE_ALL_TYPES 0x001F
|
||||
|
||||
typedef struct ace_object {
|
||||
uid_t a_who; /* uid or gid */
|
||||
uint32_t a_access_mask; /* read,write,... */
|
||||
uint16_t a_flags; /* see below */
|
||||
uint16_t a_type; /* allow or deny */
|
||||
uint8_t a_obj_type[16]; /* obj type */
|
||||
uint8_t a_inherit_obj_type[16]; /* inherit obj */
|
||||
} ace_object_t;
|
||||
|
||||
#endif
|
||||
|
||||
#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \
|
||||
ACE_ADD_FILE|ACE_APPEND_DATA|ACE_ADD_SUBDIRECTORY|ACE_READ_NAMED_ATTRS| \
|
||||
ACE_WRITE_NAMED_ATTRS|ACE_EXECUTE|ACE_DELETE_CHILD|ACE_READ_ATTRIBUTES| \
|
||||
ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \
|
||||
ACE_WRITE_OWNER|ACE_SYNCHRONIZE)
|
||||
|
||||
/*
|
||||
* The following flags are supported by both NFSv4 ACLs and ace_t.
|
||||
*/
|
||||
#define ACE_NFSV4_SUP_FLAGS (ACE_FILE_INHERIT_ACE | \
|
||||
ACE_DIRECTORY_INHERIT_ACE | \
|
||||
ACE_NO_PROPAGATE_INHERIT_ACE | \
|
||||
ACE_INHERIT_ONLY_ACE | \
|
||||
ACE_IDENTIFIER_GROUP)
|
||||
|
||||
#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE| \
|
||||
ACE_IDENTIFIER_GROUP)
|
||||
#define ACE_INHERIT_FLAGS (ACE_FILE_INHERIT_ACE| \
|
||||
ACE_DIRECTORY_INHERIT_ACE|ACE_NO_PROPAGATE_INHERIT_ACE|ACE_INHERIT_ONLY_ACE)
|
||||
|
||||
/* cmd args to acl(2) for aclent_t */
|
||||
#define GETACL 1
|
||||
#define SETACL 2
|
||||
#define GETACLCNT 3
|
||||
|
||||
/* cmd's to manipulate ace acls. */
|
||||
#define ACE_GETACL 4
|
||||
#define ACE_SETACL 5
|
||||
#define ACE_GETACLCNT 6
|
||||
|
||||
/* minimal acl entries from GETACLCNT */
|
||||
#define MIN_ACL_ENTRIES 4
|
||||
|
||||
#if !defined(_KERNEL)
|
||||
|
||||
/* acl check errors */
|
||||
#define GRP_ERROR 1
|
||||
#define USER_ERROR 2
|
||||
#define OTHER_ERROR 3
|
||||
#define CLASS_ERROR 4
|
||||
#define DUPLICATE_ERROR 5
|
||||
#define MISS_ERROR 6
|
||||
#define MEM_ERROR 7
|
||||
#define ENTRY_ERROR 8
|
||||
|
||||
|
||||
/*
|
||||
* similar to ufs_acl.h: changed to char type for user commands (tar, cpio)
|
||||
* Attribute types
|
||||
*/
|
||||
#define UFSD_FREE ('0') /* Free entry */
|
||||
#define UFSD_ACL ('1') /* Access Control Lists */
|
||||
#define UFSD_DFACL ('2') /* reserved for future use */
|
||||
#define ACE_ACL ('3') /* ace_t style acls */
|
||||
|
||||
/*
|
||||
* flag to [f]acl_get()
|
||||
* controls whether a trivial acl should be returned.
|
||||
*/
|
||||
#define ACL_NO_TRIVIAL 0x2
|
||||
|
||||
|
||||
/*
|
||||
* Flags to control acl_totext()
|
||||
*/
|
||||
|
||||
#define ACL_APPEND_ID 0x1 /* append uid/gid to user/group entries */
|
||||
#define ACL_COMPACT_FMT 0x2 /* build ACL in ls -V format */
|
||||
#define ACL_NORESOLVE 0x4 /* don't do name service lookups */
|
||||
|
||||
/*
|
||||
* Legacy aclcheck errors for aclent_t ACLs
|
||||
*/
|
||||
#define EACL_GRP_ERROR GRP_ERROR
|
||||
#define EACL_USER_ERROR USER_ERROR
|
||||
#define EACL_OTHER_ERROR OTHER_ERROR
|
||||
#define EACL_CLASS_ERROR CLASS_ERROR
|
||||
#define EACL_DUPLICATE_ERROR DUPLICATE_ERROR
|
||||
#define EACL_MISS_ERROR MISS_ERROR
|
||||
#define EACL_MEM_ERROR MEM_ERROR
|
||||
#define EACL_ENTRY_ERROR ENTRY_ERROR
|
||||
|
||||
#define EACL_INHERIT_ERROR 9 /* invalid inherit flags */
|
||||
#define EACL_FLAGS_ERROR 10 /* unknown flag value */
|
||||
#define EACL_PERM_MASK_ERROR 11 /* unknown permission */
|
||||
#define EACL_COUNT_ERROR 12 /* invalid acl count */
|
||||
|
||||
#define EACL_INVALID_SLOT 13 /* invalid acl slot */
|
||||
#define EACL_NO_ACL_ENTRY 14 /* Entry doesn't exist */
|
||||
#define EACL_DIFF_TYPE 15 /* acls aren't same type */
|
||||
|
||||
#define EACL_INVALID_USER_GROUP 16 /* need user/group name */
|
||||
#define EACL_INVALID_STR 17 /* invalid acl string */
|
||||
#define EACL_FIELD_NOT_BLANK 18 /* can't have blank field */
|
||||
#define EACL_INVALID_ACCESS_TYPE 19 /* invalid access type */
|
||||
#define EACL_UNKNOWN_DATA 20 /* Unrecognized data in ACL */
|
||||
#define EACL_MISSING_FIELDS 21 /* missing fields in acl */
|
||||
|
||||
#define EACL_INHERIT_NOTDIR 22 /* Need dir for inheritance */
|
||||
|
||||
extern int aclcheck(aclent_t *, int, int *);
|
||||
extern int acltomode(aclent_t *, int, mode_t *);
|
||||
extern int aclfrommode(aclent_t *, int, mode_t *);
|
||||
extern int aclsort(int, int, aclent_t *);
|
||||
extern char *acltotext(aclent_t *, int);
|
||||
extern aclent_t *aclfromtext(char *, int *);
|
||||
extern void acl_free(acl_t *);
|
||||
extern int acl_get(const char *, int, acl_t **);
|
||||
extern int facl_get(int, int, acl_t **);
|
||||
extern int acl_set(const char *, acl_t *acl);
|
||||
extern int facl_set(int, acl_t *acl);
|
||||
extern int acl_strip(const char *, uid_t, gid_t, mode_t);
|
||||
extern int acl_trivial(const char *);
|
||||
extern char *acl_totext(acl_t *, int);
|
||||
extern int acl_fromtext(const char *, acl_t **);
|
||||
extern int acl_check(acl_t *, int);
|
||||
|
||||
#else /* !defined(_KERNEL) */
|
||||
|
||||
extern void ksort(caddr_t, int, int, int (*)(void *, void *));
|
||||
extern int cmp2acls(void *, void *);
|
||||
|
||||
#endif /* !defined(_KERNEL) */
|
||||
|
||||
#if defined(__STDC__)
|
||||
extern int acl(const char *path, int cmd, int cnt, void *buf);
|
||||
extern int facl(int fd, int cmd, int cnt, void *buf);
|
||||
#else /* !__STDC__ */
|
||||
extern int acl();
|
||||
extern int facl();
|
||||
#endif /* defined(__STDC__) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ACL_H */
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* 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
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* 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_ACL_IMPL_H
|
||||
#define _SYS_ACL_IMPL_H
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* acl flags
|
||||
*
|
||||
* ACL_AUTO_INHERIT, ACL_PROTECTED and ACL_DEFAULTED
|
||||
* flags can also be stored in this field.
|
||||
*/
|
||||
#define ACL_IS_TRIVIAL 0x10000
|
||||
#define ACL_IS_DIR 0x20000
|
||||
|
||||
typedef enum acl_type {
|
||||
ACLENT_T = 0,
|
||||
ACE_T = 1
|
||||
} acl_type_t;
|
||||
|
||||
struct acl_info {
|
||||
acl_type_t acl_type; /* style of acl */
|
||||
int acl_cnt; /* number of acl entries */
|
||||
int acl_entry_size; /* sizeof acl entry */
|
||||
int acl_flags; /* special flags about acl */
|
||||
void *acl_aclp; /* the acl */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ACL_IMPL_H */
|
|
@ -1,4 +1,6 @@
|
|||
#ifndef _SPL_CTYPE_H
|
||||
#define _SPL_CTYPE_H
|
||||
|
||||
#include <linux/ctype.h>
|
||||
|
||||
#endif /* SPL_CTYPE_H */
|
||||
|
|
|
@ -0,0 +1,484 @@
|
|||
/*
|
||||
* 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
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* 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_DKIO_H
|
||||
#define _SYS_DKIO_H
|
||||
|
||||
|
||||
|
||||
#include <sys/dklabel.h> /* Needed for NDKMAP define */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structures and definitions for disk io control commands
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structures used as data by ioctl calls.
|
||||
*/
|
||||
|
||||
#define DK_DEVLEN 16 /* device name max length, including */
|
||||
/* unit # & NULL (ie - "xyc1") */
|
||||
|
||||
/*
|
||||
* Used for controller info
|
||||
*/
|
||||
struct dk_cinfo {
|
||||
char dki_cname[DK_DEVLEN]; /* controller name (no unit #) */
|
||||
ushort_t dki_ctype; /* controller type */
|
||||
ushort_t dki_flags; /* flags */
|
||||
ushort_t dki_cnum; /* controller number */
|
||||
uint_t dki_addr; /* controller address */
|
||||
uint_t dki_space; /* controller bus type */
|
||||
uint_t dki_prio; /* interrupt priority */
|
||||
uint_t dki_vec; /* interrupt vector */
|
||||
char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */
|
||||
uint_t dki_unit; /* unit number */
|
||||
uint_t dki_slave; /* slave number */
|
||||
ushort_t dki_partition; /* partition number */
|
||||
ushort_t dki_maxtransfer; /* max. transfer size in DEV_BSIZE */
|
||||
};
|
||||
|
||||
/*
|
||||
* Controller types
|
||||
*/
|
||||
#define DKC_UNKNOWN 0
|
||||
#define DKC_CDROM 1 /* CD-ROM, SCSI or otherwise */
|
||||
#define DKC_WDC2880 2
|
||||
#define DKC_XXX_0 3 /* unassigned */
|
||||
#define DKC_XXX_1 4 /* unassigned */
|
||||
#define DKC_DSD5215 5
|
||||
#define DKC_ACB4000 7
|
||||
#define DKC_MD21 8
|
||||
#define DKC_XXX_2 9 /* unassigned */
|
||||
#define DKC_NCRFLOPPY 10
|
||||
#define DKC_SMSFLOPPY 12
|
||||
#define DKC_SCSI_CCS 13 /* SCSI CCS compatible */
|
||||
#define DKC_INTEL82072 14 /* native floppy chip */
|
||||
#define DKC_MD 16 /* meta-disk (virtual-disk) driver */
|
||||
#define DKC_INTEL82077 19 /* 82077 floppy disk controller */
|
||||
#define DKC_DIRECT 20 /* Intel direct attached device i.e. IDE */
|
||||
#define DKC_PCMCIA_MEM 21 /* PCMCIA memory disk-like type */
|
||||
#define DKC_PCMCIA_ATA 22 /* PCMCIA AT Attached type */
|
||||
#define DKC_VBD 23 /* virtual block device */
|
||||
|
||||
/*
|
||||
* Sun reserves up through 1023
|
||||
*/
|
||||
|
||||
#define DKC_CUSTOMER_BASE 1024
|
||||
|
||||
/*
|
||||
* Flags
|
||||
*/
|
||||
#define DKI_BAD144 0x01 /* use DEC std 144 bad sector fwding */
|
||||
#define DKI_MAPTRK 0x02 /* controller does track mapping */
|
||||
#define DKI_FMTTRK 0x04 /* formats only full track at a time */
|
||||
#define DKI_FMTVOL 0x08 /* formats only full volume at a time */
|
||||
#define DKI_FMTCYL 0x10 /* formats only full cylinders at a time */
|
||||
#define DKI_HEXUNIT 0x20 /* unit number is printed as 3 hex digits */
|
||||
#define DKI_PCMCIA_PFD 0x40 /* PCMCIA pseudo-floppy memory card */
|
||||
|
||||
/*
|
||||
* Used for all partitions
|
||||
*/
|
||||
struct dk_allmap {
|
||||
struct dk_map dka_map[NDKMAP];
|
||||
};
|
||||
|
||||
#if defined(_SYSCALL32)
|
||||
struct dk_allmap32 {
|
||||
struct dk_map32 dka_map[NDKMAP];
|
||||
};
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
/*
|
||||
* Definition of a disk's geometry
|
||||
*/
|
||||
struct dk_geom {
|
||||
unsigned short dkg_ncyl; /* # of data cylinders */
|
||||
unsigned short dkg_acyl; /* # of alternate cylinders */
|
||||
unsigned short dkg_bcyl; /* cyl offset (for fixed head area) */
|
||||
unsigned short dkg_nhead; /* # of heads */
|
||||
unsigned short dkg_obs1; /* obsolete */
|
||||
unsigned short dkg_nsect; /* # of data sectors per track */
|
||||
unsigned short dkg_intrlv; /* interleave factor */
|
||||
unsigned short dkg_obs2; /* obsolete */
|
||||
unsigned short dkg_obs3; /* obsolete */
|
||||
unsigned short dkg_apc; /* alternates per cyl (SCSI only) */
|
||||
unsigned short dkg_rpm; /* revolutions per minute */
|
||||
unsigned short dkg_pcyl; /* # of physical cylinders */
|
||||
unsigned short dkg_write_reinstruct; /* # sectors to skip, writes */
|
||||
unsigned short dkg_read_reinstruct; /* # sectors to skip, reads */
|
||||
unsigned short dkg_extra[7]; /* for compatible expansion */
|
||||
};
|
||||
|
||||
/*
|
||||
* These defines are for historic compatibility with old drivers.
|
||||
*/
|
||||
#define dkg_bhead dkg_obs1 /* used to be head offset */
|
||||
#define dkg_gap1 dkg_obs2 /* used to be gap1 */
|
||||
#define dkg_gap2 dkg_obs3 /* used to be gap2 */
|
||||
|
||||
/*
|
||||
* Disk io control commands
|
||||
* Warning: some other ioctls with the DIOC prefix exist elsewhere.
|
||||
* The Generic DKIOC numbers are from 0 - 50.
|
||||
* The Floppy Driver uses 51 - 100.
|
||||
* The Hard Disk (except SCSI) 101 - 106. (these are obsolete)
|
||||
* The CDROM Driver 151 - 200.
|
||||
* The USCSI ioctl 201 - 250.
|
||||
*/
|
||||
#define DKIOC (0x04 << 8)
|
||||
|
||||
/*
|
||||
* The following ioctls are generic in nature and need to be
|
||||
* suported as appropriate by all disk drivers
|
||||
*/
|
||||
#define DKIOCGGEOM (DKIOC|1) /* Get geometry */
|
||||
#define DKIOCINFO (DKIOC|3) /* Get info */
|
||||
#define DKIOCEJECT (DKIOC|6) /* Generic 'eject' */
|
||||
#define DKIOCGVTOC (DKIOC|11) /* Get VTOC */
|
||||
#define DKIOCSVTOC (DKIOC|12) /* Set VTOC & Write to Disk */
|
||||
|
||||
/*
|
||||
* Disk Cache Controls. These ioctls should be supported by
|
||||
* all disk drivers.
|
||||
*
|
||||
* DKIOCFLUSHWRITECACHE when used from user-mode ignores the ioctl
|
||||
* argument, but it should be passed as NULL to allow for future
|
||||
* reinterpretation. From user-mode, this ioctl request is synchronous.
|
||||
*
|
||||
* When invoked from within the kernel, the arg can be NULL to indicate
|
||||
* a synchronous request or can be the address of a struct dk_callback
|
||||
* to request an asynchronous callback when the flush request is complete.
|
||||
* In this case, the flag to the ioctl must include FKIOCTL and the
|
||||
* dkc_callback field of the pointed to struct must be non-null or the
|
||||
* request is made synchronously.
|
||||
*
|
||||
* In the callback case: if the ioctl returns 0, a callback WILL be performed.
|
||||
* If the ioctl returns non-zero, a callback will NOT be performed.
|
||||
* NOTE: In some cases, the callback may be done BEFORE the ioctl call
|
||||
* returns. The caller's locking strategy should be prepared for this case.
|
||||
*/
|
||||
#define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */
|
||||
|
||||
struct dk_callback {
|
||||
void (*dkc_callback)(void *dkc_cookie, int error);
|
||||
void *dkc_cookie;
|
||||
int dkc_flag;
|
||||
};
|
||||
|
||||
/* bit flag definitions for dkc_flag */
|
||||
#define FLUSH_VOLATILE 0x1 /* Bit 0: if set, only flush */
|
||||
/* volatile cache; otherwise, flush */
|
||||
/* volatile and non-volatile cache */
|
||||
|
||||
#define DKIOCGETWCE (DKIOC|36) /* Get current write cache */
|
||||
/* enablement status */
|
||||
#define DKIOCSETWCE (DKIOC|37) /* Enable/Disable write cache */
|
||||
|
||||
/*
|
||||
* The following ioctls are used by Sun drivers to communicate
|
||||
* with their associated format routines. Support of these ioctls
|
||||
* is not required of foreign drivers
|
||||
*/
|
||||
#define DKIOCSGEOM (DKIOC|2) /* Set geometry */
|
||||
#define DKIOCSAPART (DKIOC|4) /* Set all partitions */
|
||||
#define DKIOCGAPART (DKIOC|5) /* Get all partitions */
|
||||
#define DKIOCG_PHYGEOM (DKIOC|32) /* get physical geometry */
|
||||
#define DKIOCG_VIRTGEOM (DKIOC|33) /* get virtual geometry */
|
||||
|
||||
/*
|
||||
* The following ioctl's are removable media support
|
||||
*/
|
||||
#define DKIOCLOCK (DKIOC|7) /* Generic 'lock' */
|
||||
#define DKIOCUNLOCK (DKIOC|8) /* Generic 'unlock' */
|
||||
#define DKIOCSTATE (DKIOC|13) /* Inquire insert/eject state */
|
||||
#define DKIOCREMOVABLE (DKIOC|16) /* is media removable */
|
||||
|
||||
|
||||
/*
|
||||
* ioctl for hotpluggable devices
|
||||
*/
|
||||
#define DKIOCHOTPLUGGABLE (DKIOC|35) /* is hotpluggable */
|
||||
|
||||
/*
|
||||
* Ioctl to force driver to re-read the alternate partition and rebuild
|
||||
* the internal defect map.
|
||||
*/
|
||||
#define DKIOCADDBAD (DKIOC|20) /* Re-read the alternate map (IDE) */
|
||||
#define DKIOCGETDEF (DKIOC|21) /* read defect list (IDE) */
|
||||
|
||||
/*
|
||||
* Used by applications to get disk defect information from IDE
|
||||
* drives.
|
||||
*/
|
||||
#ifdef _SYSCALL32
|
||||
struct defect_header32 {
|
||||
int head;
|
||||
caddr32_t buffer;
|
||||
};
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
struct defect_header {
|
||||
int head;
|
||||
caddr_t buffer;
|
||||
};
|
||||
|
||||
#define DKIOCPARTINFO (DKIOC|22) /* Get partition or slice parameters */
|
||||
|
||||
/*
|
||||
* Used by applications to get partition or slice information
|
||||
*/
|
||||
#ifdef _SYSCALL32
|
||||
struct part_info32 {
|
||||
daddr32_t p_start;
|
||||
int p_length;
|
||||
};
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
struct part_info {
|
||||
daddr_t p_start;
|
||||
int p_length;
|
||||
};
|
||||
|
||||
/* The following ioctls are for Optical Memory Device */
|
||||
#define DKIOC_EBP_ENABLE (DKIOC|40) /* enable by pass erase on write */
|
||||
#define DKIOC_EBP_DISABLE (DKIOC|41) /* disable by pass erase on write */
|
||||
|
||||
/*
|
||||
* This state enum is the argument passed to the DKIOCSTATE ioctl.
|
||||
*/
|
||||
enum dkio_state { DKIO_NONE, DKIO_EJECTED, DKIO_INSERTED, DKIO_DEV_GONE };
|
||||
|
||||
#define DKIOCGMEDIAINFO (DKIOC|42) /* get information about the media */
|
||||
|
||||
/*
|
||||
* ioctls to read/write mboot info.
|
||||
*/
|
||||
#define DKIOCGMBOOT (DKIOC|43) /* get mboot info */
|
||||
#define DKIOCSMBOOT (DKIOC|44) /* set mboot info */
|
||||
|
||||
/*
|
||||
* ioctl to get the device temperature.
|
||||
*/
|
||||
#define DKIOCGTEMPERATURE (DKIOC|45) /* get temperature */
|
||||
|
||||
/*
|
||||
* Used for providing the temperature.
|
||||
*/
|
||||
|
||||
struct dk_temperature {
|
||||
uint_t dkt_flags; /* Flags */
|
||||
short dkt_cur_temp; /* Current disk temperature */
|
||||
short dkt_ref_temp; /* reference disk temperature */
|
||||
};
|
||||
|
||||
#define DKT_BYPASS_PM 0x1
|
||||
#define DKT_INVALID_TEMP 0xFFFF
|
||||
|
||||
|
||||
/*
|
||||
* Used for Media info or the current profile info
|
||||
*/
|
||||
struct dk_minfo {
|
||||
uint_t dki_media_type; /* Media type or profile info */
|
||||
uint_t dki_lbsize; /* Logical blocksize of media */
|
||||
diskaddr_t dki_capacity; /* Capacity as # of dki_lbsize blks */
|
||||
};
|
||||
|
||||
/*
|
||||
* Media types or profiles known
|
||||
*/
|
||||
#define DK_UNKNOWN 0x00 /* Media inserted - type unknown */
|
||||
|
||||
|
||||
/*
|
||||
* SFF 8090 Specification Version 3, media types 0x01 - 0xfffe are retained to
|
||||
* maintain compatibility with SFF8090. The following define the
|
||||
* optical media type.
|
||||
*/
|
||||
#define DK_REMOVABLE_DISK 0x02 /* Removable Disk */
|
||||
#define DK_MO_ERASABLE 0x03 /* MO Erasable */
|
||||
#define DK_MO_WRITEONCE 0x04 /* MO Write once */
|
||||
#define DK_AS_MO 0x05 /* AS MO */
|
||||
#define DK_CDROM 0x08 /* CDROM */
|
||||
#define DK_CDR 0x09 /* CD-R */
|
||||
#define DK_CDRW 0x0A /* CD-RW */
|
||||
#define DK_DVDROM 0x10 /* DVD-ROM */
|
||||
#define DK_DVDR 0x11 /* DVD-R */
|
||||
#define DK_DVDRAM 0x12 /* DVD_RAM or DVD-RW */
|
||||
|
||||
/*
|
||||
* Media types for other rewritable magnetic media
|
||||
*/
|
||||
#define DK_FIXED_DISK 0x10001 /* Fixed disk SCSI or otherwise */
|
||||
#define DK_FLOPPY 0x10002 /* Floppy media */
|
||||
#define DK_ZIP 0x10003 /* IOMEGA ZIP media */
|
||||
#define DK_JAZ 0x10004 /* IOMEGA JAZ media */
|
||||
|
||||
#define DKIOCSETEFI (DKIOC|17) /* Set EFI info */
|
||||
#define DKIOCGETEFI (DKIOC|18) /* Get EFI info */
|
||||
|
||||
#define DKIOCPARTITION (DKIOC|9) /* Get partition info */
|
||||
|
||||
/*
|
||||
* Ioctls to get/set volume capabilities related to Logical Volume Managers.
|
||||
* They include the ability to get/set capabilities and to issue a read to a
|
||||
* specific underlying device of a replicated device.
|
||||
*/
|
||||
|
||||
#define DKIOCGETVOLCAP (DKIOC | 25) /* Get volume capabilities */
|
||||
#define DKIOCSETVOLCAP (DKIOC | 26) /* Set volume capabilities */
|
||||
#define DKIOCDMR (DKIOC | 27) /* Issue a directed read */
|
||||
|
||||
typedef uint_t volcapinfo_t;
|
||||
|
||||
typedef uint_t volcapset_t;
|
||||
|
||||
#define DKV_ABR_CAP 0x00000001 /* Support Appl.Based Recovery */
|
||||
#define DKV_DMR_CAP 0x00000002 /* Support Directed Mirror Read */
|
||||
|
||||
typedef struct volcap {
|
||||
volcapinfo_t vc_info; /* Capabilities available */
|
||||
volcapset_t vc_set; /* Capabilities set */
|
||||
} volcap_t;
|
||||
|
||||
#define VOL_SIDENAME 256
|
||||
|
||||
typedef struct vol_directed_rd {
|
||||
int vdr_flags;
|
||||
offset_t vdr_offset;
|
||||
size_t vdr_nbytes;
|
||||
size_t vdr_bytesread;
|
||||
void *vdr_data;
|
||||
int vdr_side;
|
||||
char vdr_side_name[VOL_SIDENAME];
|
||||
} vol_directed_rd_t;
|
||||
|
||||
#define DKV_SIDE_INIT (-1)
|
||||
#define DKV_DMR_NEXT_SIDE 0x00000001
|
||||
#define DKV_DMR_DONE 0x00000002
|
||||
#define DKV_DMR_ERROR 0x00000004
|
||||
#define DKV_DMR_SUCCESS 0x00000008
|
||||
#define DKV_DMR_SHORT 0x00000010
|
||||
|
||||
#ifdef _MULTI_DATAMODEL
|
||||
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
|
||||
#pragma pack(4)
|
||||
#endif
|
||||
typedef struct vol_directed_rd32 {
|
||||
int32_t vdr_flags;
|
||||
offset_t vdr_offset; /* 64-bit element on 32-bit alignment */
|
||||
size32_t vdr_nbytes;
|
||||
size32_t vdr_bytesread;
|
||||
caddr32_t vdr_data;
|
||||
int32_t vdr_side;
|
||||
char vdr_side_name[VOL_SIDENAME];
|
||||
} vol_directed_rd32_t;
|
||||
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
|
||||
#pragma pack()
|
||||
#endif
|
||||
#endif /* _MULTI_DATAMODEL */
|
||||
|
||||
/*
|
||||
* The ioctl is used to fetch disk's device type, vendor ID,
|
||||
* model number/product ID, firmware revision and serial number together.
|
||||
*
|
||||
* Currently there are two device types - DKD_ATA_TYPE which means the
|
||||
* disk is driven by cmdk/ata or dad/uata driver, and DKD_SCSI_TYPE
|
||||
* which means the disk is driven by sd/scsi hba driver.
|
||||
*/
|
||||
#define DKIOC_GETDISKID (DKIOC|46)
|
||||
|
||||
/* These two labels are for dkd_dtype of dk_disk_id_t */
|
||||
#define DKD_ATA_TYPE 0x01 /* ATA disk or legacy mode SATA disk */
|
||||
#define DKD_SCSI_TYPE 0x02 /* SCSI disk or native mode SATA disk */
|
||||
|
||||
#define DKD_ATA_MODEL 40 /* model number length */
|
||||
#define DKD_ATA_FWVER 8 /* firmware revision length */
|
||||
#define DKD_ATA_SERIAL 20 /* serial number length */
|
||||
|
||||
#define DKD_SCSI_VENDOR 8 /* vendor ID length */
|
||||
#define DKD_SCSI_PRODUCT 16 /* product ID length */
|
||||
#define DKD_SCSI_REVLEVEL 4 /* revision level length */
|
||||
#define DKD_SCSI_SERIAL 12 /* serial number length */
|
||||
|
||||
/*
|
||||
* The argument type for DKIOC_GETDISKID ioctl.
|
||||
*/
|
||||
typedef struct dk_disk_id {
|
||||
uint_t dkd_dtype;
|
||||
union {
|
||||
struct {
|
||||
char dkd_amodel[DKD_ATA_MODEL]; /* 40 bytes */
|
||||
char dkd_afwver[DKD_ATA_FWVER]; /* 8 bytes */
|
||||
char dkd_aserial[DKD_ATA_SERIAL]; /* 20 bytes */
|
||||
} ata_disk_id;
|
||||
struct {
|
||||
char dkd_svendor[DKD_SCSI_VENDOR]; /* 8 bytes */
|
||||
char dkd_sproduct[DKD_SCSI_PRODUCT]; /* 16 bytes */
|
||||
char dkd_sfwver[DKD_SCSI_REVLEVEL]; /* 4 bytes */
|
||||
char dkd_sserial[DKD_SCSI_SERIAL]; /* 12 bytes */
|
||||
} scsi_disk_id;
|
||||
} disk_id;
|
||||
} dk_disk_id_t;
|
||||
|
||||
/*
|
||||
* The ioctl is used to update the firmware of device.
|
||||
*/
|
||||
#define DKIOC_UPDATEFW (DKIOC|47)
|
||||
|
||||
/* The argument type for DKIOC_UPDATEFW ioctl */
|
||||
typedef struct dk_updatefw {
|
||||
caddr_t dku_ptrbuf; /* pointer to firmware buf */
|
||||
uint_t dku_size; /* firmware buf length */
|
||||
uint8_t dku_type; /* firmware update type */
|
||||
} dk_updatefw_t;
|
||||
|
||||
#ifdef _SYSCALL32
|
||||
typedef struct dk_updatefw_32 {
|
||||
caddr32_t dku_ptrbuf; /* pointer to firmware buf */
|
||||
uint_t dku_size; /* firmware buf length */
|
||||
uint8_t dku_type; /* firmware update type */
|
||||
} dk_updatefw_32_t;
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
/*
|
||||
* firmware update type - temporary or permanent use
|
||||
*/
|
||||
#define FW_TYPE_TEMP 0x0 /* temporary use */
|
||||
#define FW_TYPE_PERM 0x1 /* permanent use */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_DKIO_H */
|
|
@ -0,0 +1,268 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (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
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* 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 1990-2002 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DKLABEL_H
|
||||
#define _SYS_DKLABEL_H
|
||||
|
||||
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/types32.h>
|
||||
#include <sys/isa_defs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Miscellaneous defines
|
||||
*/
|
||||
#define DKL_MAGIC 0xDABE /* magic number */
|
||||
#define FKL_MAGIC 0xff /* magic number for DOS floppies */
|
||||
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
#define NDKMAP 16 /* # of logical partitions */
|
||||
#define DK_LABEL_LOC 1 /* location of disk label */
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
#define NDKMAP 8 /* # of logical partitions */
|
||||
#define DK_LABEL_LOC 0 /* location of disk label */
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
|
||||
#define LEN_DKL_ASCII 128 /* length of dkl_asciilabel */
|
||||
#define LEN_DKL_VVOL 8 /* length of v_volume */
|
||||
#define DK_LABEL_SIZE 512 /* size of disk label */
|
||||
#define DK_MAX_BLOCKS 0x7fffffff /* max # of blocks handled */
|
||||
|
||||
/*
|
||||
* Reserve two cylinders on SCSI disks.
|
||||
* One is for the backup disk label and the other is for the deviceid.
|
||||
*
|
||||
* IPI disks only reserve one cylinder, but they will go away soon.
|
||||
* CDROMs do not reserve any cylinders.
|
||||
*/
|
||||
#define DK_ACYL 2
|
||||
|
||||
/*
|
||||
* Format of a Sun disk label.
|
||||
* Resides in cylinder 0, head 0, sector 0.
|
||||
*
|
||||
* sizeof (struct dk_label) should be 512 (the current sector size),
|
||||
* but should the sector size increase, this structure should remain
|
||||
* at the beginning of the sector.
|
||||
*/
|
||||
|
||||
/*
|
||||
* partition headers: section 1
|
||||
* Returned in struct dk_allmap by ioctl DKIOC[SG]APART (dkio(7I))
|
||||
*/
|
||||
struct dk_map {
|
||||
daddr_t dkl_cylno; /* starting cylinder */
|
||||
daddr_t dkl_nblk; /* number of blocks; if == 0, */
|
||||
/* partition is undefined */
|
||||
};
|
||||
|
||||
/*
|
||||
* partition headers: section 1
|
||||
* Fixed size for on-disk dk_label
|
||||
*/
|
||||
struct dk_map32 {
|
||||
daddr32_t dkl_cylno; /* starting cylinder */
|
||||
daddr32_t dkl_nblk; /* number of blocks; if == 0, */
|
||||
/* partition is undefined */
|
||||
};
|
||||
|
||||
/*
|
||||
* partition headers: section 2,
|
||||
* brought over from AT&T SVr4 vtoc structure.
|
||||
*/
|
||||
struct dk_map2 {
|
||||
uint16_t p_tag; /* ID tag of partition */
|
||||
uint16_t p_flag; /* permission flag */
|
||||
};
|
||||
|
||||
struct dkl_partition {
|
||||
uint16_t p_tag; /* ID tag of partition */
|
||||
uint16_t p_flag; /* permision flags */
|
||||
daddr32_t p_start; /* start sector no of partition */
|
||||
int32_t p_size; /* # of blocks in partition */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* VTOC inclusions from AT&T SVr4
|
||||
* Fixed sized types for on-disk VTOC
|
||||
*/
|
||||
|
||||
struct dk_vtoc {
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
uint32_t v_bootinfo[3]; /* info for mboot (unsupported) */
|
||||
uint32_t v_sanity; /* to verify vtoc sanity */
|
||||
uint32_t v_version; /* layout version */
|
||||
char v_volume[LEN_DKL_VVOL]; /* volume name */
|
||||
uint16_t v_sectorsz; /* sector size in bytes */
|
||||
uint16_t v_nparts; /* number of partitions */
|
||||
uint32_t v_reserved[10]; /* free space */
|
||||
struct dkl_partition v_part[NDKMAP]; /* partition headers */
|
||||
time32_t timestamp[NDKMAP]; /* partition timestamp (unsupported) */
|
||||
char v_asciilabel[LEN_DKL_ASCII]; /* for compatibility */
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
uint32_t v_version; /* layout version */
|
||||
char v_volume[LEN_DKL_VVOL]; /* volume name */
|
||||
uint16_t v_nparts; /* number of partitions */
|
||||
struct dk_map2 v_part[NDKMAP]; /* partition hdrs, sec 2 */
|
||||
uint32_t v_bootinfo[3]; /* info needed by mboot */
|
||||
uint32_t v_sanity; /* to verify vtoc sanity */
|
||||
uint32_t v_reserved[10]; /* free space */
|
||||
time32_t v_timestamp[NDKMAP]; /* partition timestamp */
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* define the amount of disk label padding needed to make
|
||||
* the entire structure occupy 512 bytes.
|
||||
*/
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
#define LEN_DKL_PAD (DK_LABEL_SIZE - \
|
||||
((sizeof (struct dk_vtoc) + \
|
||||
(4 * sizeof (uint32_t)) + \
|
||||
(12 * sizeof (uint16_t)) + \
|
||||
(2 * (sizeof (uint16_t))))))
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
#define LEN_DKL_PAD (DK_LABEL_SIZE \
|
||||
- ((LEN_DKL_ASCII) + \
|
||||
(sizeof (struct dk_vtoc)) + \
|
||||
(sizeof (struct dk_map32) * NDKMAP) + \
|
||||
(14 * (sizeof (uint16_t))) + \
|
||||
(2 * (sizeof (uint16_t)))))
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
|
||||
|
||||
struct dk_label {
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
struct dk_vtoc dkl_vtoc; /* vtoc inclusions from AT&T SVr4 */
|
||||
uint32_t dkl_pcyl; /* # of physical cylinders */
|
||||
uint32_t dkl_ncyl; /* # of data cylinders */
|
||||
uint16_t dkl_acyl; /* # of alternate cylinders */
|
||||
uint16_t dkl_bcyl; /* cyl offset (for fixed head area) */
|
||||
uint32_t dkl_nhead; /* # of heads */
|
||||
uint32_t dkl_nsect; /* # of data sectors per track */
|
||||
uint16_t dkl_intrlv; /* interleave factor */
|
||||
uint16_t dkl_skew; /* skew factor */
|
||||
uint16_t dkl_apc; /* alternates per cyl (SCSI only) */
|
||||
uint16_t dkl_rpm; /* revolutions per minute */
|
||||
uint16_t dkl_write_reinstruct; /* # sectors to skip, writes */
|
||||
uint16_t dkl_read_reinstruct; /* # sectors to skip, reads */
|
||||
uint16_t dkl_extra[4]; /* for compatible expansion */
|
||||
char dkl_pad[LEN_DKL_PAD]; /* unused part of 512 bytes */
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
char dkl_asciilabel[LEN_DKL_ASCII]; /* for compatibility */
|
||||
struct dk_vtoc dkl_vtoc; /* vtoc inclusions from AT&T SVr4 */
|
||||
uint16_t dkl_write_reinstruct; /* # sectors to skip, writes */
|
||||
uint16_t dkl_read_reinstruct; /* # sectors to skip, reads */
|
||||
char dkl_pad[LEN_DKL_PAD]; /* unused part of 512 bytes */
|
||||
uint16_t dkl_rpm; /* rotations per minute */
|
||||
uint16_t dkl_pcyl; /* # physical cylinders */
|
||||
uint16_t dkl_apc; /* alternates per cylinder */
|
||||
uint16_t dkl_obs1; /* obsolete */
|
||||
uint16_t dkl_obs2; /* obsolete */
|
||||
uint16_t dkl_intrlv; /* interleave factor */
|
||||
uint16_t dkl_ncyl; /* # of data cylinders */
|
||||
uint16_t dkl_acyl; /* # of alternate cylinders */
|
||||
uint16_t dkl_nhead; /* # of heads in this partition */
|
||||
uint16_t dkl_nsect; /* # of 512 byte sectors per track */
|
||||
uint16_t dkl_obs3; /* obsolete */
|
||||
uint16_t dkl_obs4; /* obsolete */
|
||||
struct dk_map32 dkl_map[NDKMAP]; /* logical partition headers */
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
uint16_t dkl_magic; /* identifies this label format */
|
||||
uint16_t dkl_cksum; /* xor checksum of sector */
|
||||
};
|
||||
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
#define dkl_asciilabel dkl_vtoc.v_asciilabel
|
||||
#define v_timestamp timestamp
|
||||
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
|
||||
/*
|
||||
* These defines are for historic compatibility with old drivers.
|
||||
*/
|
||||
#define dkl_gap1 dkl_obs1 /* used to be gap1 */
|
||||
#define dkl_gap2 dkl_obs2 /* used to be gap2 */
|
||||
#define dkl_bhead dkl_obs3 /* used to be label head offset */
|
||||
#define dkl_ppart dkl_obs4 /* used to by physical partition */
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
|
||||
struct fk_label { /* DOS floppy label */
|
||||
uchar_t fkl_type;
|
||||
uchar_t fkl_magich;
|
||||
uchar_t fkl_magicl;
|
||||
uchar_t filler;
|
||||
};
|
||||
|
||||
/*
|
||||
* Layout of stored fabricated device id (on-disk)
|
||||
*/
|
||||
#define DK_DEVID_BLKSIZE (512)
|
||||
#define DK_DEVID_SIZE (DK_DEVID_BLKSIZE - ((sizeof (uchar_t) * 7)))
|
||||
#define DK_DEVID_REV_MSB (0)
|
||||
#define DK_DEVID_REV_LSB (1)
|
||||
|
||||
struct dk_devid {
|
||||
uchar_t dkd_rev_hi; /* revision (MSB) */
|
||||
uchar_t dkd_rev_lo; /* revision (LSB) */
|
||||
uchar_t dkd_flags; /* flags (not used yet) */
|
||||
uchar_t dkd_devid[DK_DEVID_SIZE]; /* devid stored here */
|
||||
uchar_t dkd_checksum3; /* checksum (MSB) */
|
||||
uchar_t dkd_checksum2;
|
||||
uchar_t dkd_checksum1;
|
||||
uchar_t dkd_checksum0; /* checksum (LSB) */
|
||||
};
|
||||
|
||||
#define DKD_GETCHKSUM(dkd) ((dkd)->dkd_checksum3 << 24) + \
|
||||
((dkd)->dkd_checksum2 << 16) + \
|
||||
((dkd)->dkd_checksum1 << 8) + \
|
||||
((dkd)->dkd_checksum0)
|
||||
|
||||
#define DKD_FORMCHKSUM(c, dkd) (dkd)->dkd_checksum3 = hibyte(hiword((c))); \
|
||||
(dkd)->dkd_checksum2 = lobyte(hiword((c))); \
|
||||
(dkd)->dkd_checksum1 = hibyte(loword((c))); \
|
||||
(dkd)->dkd_checksum0 = lobyte(loword((c)));
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_DKLABEL_H */
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _SPL_DNLC_H
|
||||
#define _SPL_DNLC_H
|
||||
|
||||
#endif /* SPL_DNLC_H */
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _SPL_SWAPNODE_H
|
||||
#define _SPL_SWAPNODE_H
|
||||
|
||||
#endif /* SPL_SWAPNODE_H */
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef _SPL_INT_TYPES_H
|
||||
#define _SPL_INT_TYPES_H
|
||||
|
||||
#include <sys/inttypes.h>
|
||||
|
||||
#endif /* SPL_INT_TYPES_H */
|
|
@ -1,4 +1,482 @@
|
|||
#ifndef _SPL_ISA_DEFS_H
|
||||
#define _SPL_ISA_DEFS_H
|
||||
/*
|
||||
* 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
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* 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
|
||||
*/
|
||||
|
||||
#endif /* SPL_ISA_DEFS_H */
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ISA_DEFS_H
|
||||
#define _SYS_ISA_DEFS_H
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This header file serves to group a set of well known defines and to
|
||||
* set these for each instruction set architecture. These defines may
|
||||
* be divided into two groups; characteristics of the processor and
|
||||
* implementation choices for Solaris on a processor.
|
||||
*
|
||||
* Processor Characteristics:
|
||||
*
|
||||
* _LITTLE_ENDIAN / _BIG_ENDIAN:
|
||||
* The natural byte order of the processor. A pointer to an int points
|
||||
* to the least/most significant byte of that int.
|
||||
*
|
||||
* _STACK_GROWS_UPWARD / _STACK_GROWS_DOWNWARD:
|
||||
* The processor specific direction of stack growth. A push onto the
|
||||
* stack increases/decreases the stack pointer, so it stores data at
|
||||
* successively higher/lower addresses. (Stackless machines ignored
|
||||
* without regrets).
|
||||
*
|
||||
* _LONG_LONG_HTOL / _LONG_LONG_LTOH:
|
||||
* A pointer to a long long points to the most/least significant long
|
||||
* within that long long.
|
||||
*
|
||||
* _BIT_FIELDS_HTOL / _BIT_FIELDS_LTOH:
|
||||
* The C compiler assigns bit fields from the high/low to the low/high end
|
||||
* of an int (most to least significant vs. least to most significant).
|
||||
*
|
||||
* _IEEE_754:
|
||||
* The processor (or supported implementations of the processor)
|
||||
* supports the ieee-754 floating point standard. No other floating
|
||||
* point standards are supported (or significant). Any other supported
|
||||
* floating point formats are expected to be cased on the ISA processor
|
||||
* symbol.
|
||||
*
|
||||
* _CHAR_IS_UNSIGNED / _CHAR_IS_SIGNED:
|
||||
* The C Compiler implements objects of type `char' as `unsigned' or
|
||||
* `signed' respectively. This is really an implementation choice of
|
||||
* the compiler writer, but it is specified in the ABI and tends to
|
||||
* be uniform across compilers for an instruction set architecture.
|
||||
* Hence, it has the properties of a processor characteristic.
|
||||
*
|
||||
* _CHAR_ALIGNMENT / _SHORT_ALIGNMENT / _INT_ALIGNMENT / _LONG_ALIGNMENT /
|
||||
* _LONG_LONG_ALIGNMENT / _DOUBLE_ALIGNMENT / _LONG_DOUBLE_ALIGNMENT /
|
||||
* _POINTER_ALIGNMENT / _FLOAT_ALIGNMENT:
|
||||
* The ABI defines alignment requirements of each of the primitive
|
||||
* object types. Some, if not all, may be hardware requirements as
|
||||
* well. The values are expressed in "byte-alignment" units.
|
||||
*
|
||||
* _MAX_ALIGNMENT:
|
||||
* The most stringent alignment requirement as specified by the ABI.
|
||||
* Equal to the maximum of all the above _XXX_ALIGNMENT values.
|
||||
*
|
||||
* _ALIGNMENT_REQUIRED:
|
||||
* True or false (1 or 0) whether or not the hardware requires the ABI
|
||||
* alignment.
|
||||
*
|
||||
* _LONG_LONG_ALIGNMENT_32
|
||||
* The 32-bit ABI supported by a 64-bit kernel may have different
|
||||
* alignment requirements for primitive object types. The value of this
|
||||
* identifier is expressed in "byte-alignment" units.
|
||||
*
|
||||
* _HAVE_CPUID_INSN
|
||||
* This indicates that the architecture supports the 'cpuid'
|
||||
* instruction as defined by Intel. (Intel allows other vendors
|
||||
* to extend the instruction for their own purposes.)
|
||||
*
|
||||
*
|
||||
* Implementation Choices:
|
||||
*
|
||||
* _ILP32 / _LP64:
|
||||
* This specifies the compiler data type implementation as specified in
|
||||
* the relevant ABI. The choice between these is strongly influenced
|
||||
* by the underlying hardware, but is not absolutely tied to it.
|
||||
* Currently only two data type models are supported:
|
||||
*
|
||||
* _ILP32:
|
||||
* Int/Long/Pointer are 32 bits. This is the historical UNIX
|
||||
* and Solaris implementation. Due to its historical standing,
|
||||
* this is the default case.
|
||||
*
|
||||
* _LP64:
|
||||
* Long/Pointer are 64 bits, Int is 32 bits. This is the chosen
|
||||
* implementation for 64-bit ABIs such as SPARC V9.
|
||||
*
|
||||
* _I32LPx:
|
||||
* A compilation environment where 'int' is 32-bit, and
|
||||
* longs and pointers are simply the same size.
|
||||
*
|
||||
* In all cases, Char is 8 bits and Short is 16 bits.
|
||||
*
|
||||
* _SUNOS_VTOC_8 / _SUNOS_VTOC_16 / _SVR4_VTOC_16:
|
||||
* This specifies the form of the disk VTOC (or label):
|
||||
*
|
||||
* _SUNOS_VTOC_8:
|
||||
* This is a VTOC form which is upwardly compatible with the
|
||||
* SunOS 4.x disk label and allows 8 partitions per disk.
|
||||
*
|
||||
* _SUNOS_VTOC_16:
|
||||
* In this format the incore vtoc image matches the ondisk
|
||||
* version. It allows 16 slices per disk, and is not
|
||||
* compatible with the SunOS 4.x disk label.
|
||||
*
|
||||
* Note that these are not the only two VTOC forms possible and
|
||||
* additional forms may be added. One possible form would be the
|
||||
* SVr4 VTOC form. The symbol for that is reserved now, although
|
||||
* it is not implemented.
|
||||
*
|
||||
* _SVR4_VTOC_16:
|
||||
* This VTOC form is compatible with the System V Release 4
|
||||
* VTOC (as implemented on the SVr4 Intel and 3b ports) with
|
||||
* 16 partitions per disk.
|
||||
*
|
||||
*
|
||||
* _DMA_USES_PHYSADDR / _DMA_USES_VIRTADDR
|
||||
* This describes the type of addresses used by system DMA:
|
||||
*
|
||||
* _DMA_USES_PHYSADDR:
|
||||
* This type of DMA, used in the x86 implementation,
|
||||
* requires physical addresses for DMA buffers. The 24-bit
|
||||
* addresses used by some legacy boards is the source of the
|
||||
* "low-memory" (<16MB) requirement for some devices using DMA.
|
||||
*
|
||||
* _DMA_USES_VIRTADDR:
|
||||
* This method of DMA allows the use of virtual addresses for
|
||||
* DMA transfers.
|
||||
*
|
||||
* _FIRMWARE_NEEDS_FDISK / _NO_FDISK_PRESENT
|
||||
* This indicates the presence/absence of an fdisk table.
|
||||
*
|
||||
* _FIRMWARE_NEEDS_FDISK
|
||||
* The fdisk table is required by system firmware. If present,
|
||||
* it allows a disk to be subdivided into multiple fdisk
|
||||
* partitions, each of which is equivalent to a separate,
|
||||
* virtual disk. This enables the co-existence of multiple
|
||||
* operating systems on a shared hard disk.
|
||||
*
|
||||
* _NO_FDISK_PRESENT
|
||||
* If the fdisk table is absent, it is assumed that the entire
|
||||
* media is allocated for a single operating system.
|
||||
*
|
||||
* _HAVE_TEM_FIRMWARE
|
||||
* Defined if this architecture has the (fallback) option of
|
||||
* using prom_* calls for doing I/O if a suitable kernel driver
|
||||
* is not available to do it.
|
||||
*
|
||||
* _DONT_USE_1275_GENERIC_NAMES
|
||||
* Controls whether or not device tree node names should
|
||||
* comply with the IEEE 1275 "Generic Names" Recommended
|
||||
* Practice. With _DONT_USE_GENERIC_NAMES, device-specific
|
||||
* names identifying the particular device will be used.
|
||||
*
|
||||
* __i386_COMPAT
|
||||
* This indicates whether the i386 ABI is supported as a *non-native*
|
||||
* mode for the platform. When this symbol is defined:
|
||||
* - 32-bit xstat-style system calls are enabled
|
||||
* - 32-bit xmknod-style system calls are enabled
|
||||
* - 32-bit system calls use i386 sizes -and- alignments
|
||||
*
|
||||
* Note that this is NOT defined for the i386 native environment!
|
||||
*
|
||||
* __x86
|
||||
* This is ONLY a synonym for defined(__i386) || defined(__amd64)
|
||||
* which is useful only insofar as these two architectures share
|
||||
* common attributes. Analogous to __sparc.
|
||||
*
|
||||
* _PSM_MODULES
|
||||
* This indicates whether or not the implementation uses PSM
|
||||
* modules for processor support, reading /etc/mach from inside
|
||||
* the kernel to extract a list.
|
||||
*
|
||||
* _RTC_CONFIG
|
||||
* This indicates whether or not the implementation uses /etc/rtc_config
|
||||
* to configure the real-time clock in the kernel.
|
||||
*
|
||||
* _UNIX_KRTLD
|
||||
* This indicates that the implementation uses a dynamically
|
||||
* linked unix + krtld to form the core kernel image at boot
|
||||
* time, or (in the absence of this symbol) a prelinked kernel image.
|
||||
*
|
||||
* _OBP
|
||||
* This indicates the firmware interface is OBP.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following set of definitions characterize Solaris on AMD's
|
||||
* 64-bit systems.
|
||||
*/
|
||||
#if defined(__x86_64) || defined(__amd64)
|
||||
|
||||
#if !defined(__amd64)
|
||||
#define __amd64 /* preferred guard */
|
||||
#endif
|
||||
|
||||
#if !defined(__x86)
|
||||
#define __x86
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics"
|
||||
*/
|
||||
#define _LITTLE_ENDIAN
|
||||
#define _STACK_GROWS_DOWNWARD
|
||||
#define _LONG_LONG_LTOH
|
||||
#define _BIT_FIELDS_LTOH
|
||||
#define _IEEE_754
|
||||
#define _CHAR_IS_SIGNED
|
||||
#define _BOOL_ALIGNMENT 1
|
||||
#define _CHAR_ALIGNMENT 1
|
||||
#define _SHORT_ALIGNMENT 2
|
||||
#define _INT_ALIGNMENT 4
|
||||
#define _FLOAT_ALIGNMENT 4
|
||||
#define _FLOAT_COMPLEX_ALIGNMENT 4
|
||||
#define _LONG_ALIGNMENT 8
|
||||
#define _LONG_LONG_ALIGNMENT 8
|
||||
#define _DOUBLE_ALIGNMENT 8
|
||||
#define _DOUBLE_COMPLEX_ALIGNMENT 8
|
||||
#define _LONG_DOUBLE_ALIGNMENT 16
|
||||
#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 16
|
||||
#define _POINTER_ALIGNMENT 8
|
||||
#define _MAX_ALIGNMENT 16
|
||||
#define _ALIGNMENT_REQUIRED 1
|
||||
|
||||
/*
|
||||
* Different alignment constraints for the i386 ABI in compatibility mode
|
||||
*/
|
||||
#define _LONG_LONG_ALIGNMENT_32 4
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices".
|
||||
*/
|
||||
#if !defined(_LP64)
|
||||
#define _LP64
|
||||
#endif
|
||||
#if !defined(_I32LPx) && defined(_KERNEL)
|
||||
#define _I32LPx
|
||||
#endif
|
||||
#define _MULTI_DATAMODEL
|
||||
#define _SUNOS_VTOC_16
|
||||
#define _DMA_USES_PHYSADDR
|
||||
#define _FIRMWARE_NEEDS_FDISK
|
||||
#define __i386_COMPAT
|
||||
#define _PSM_MODULES
|
||||
#define _RTC_CONFIG
|
||||
#define _DONT_USE_1275_GENERIC_NAMES
|
||||
#define _HAVE_CPUID_INSN
|
||||
|
||||
/*
|
||||
* The feature test macro __i386 is generic for all processors implementing
|
||||
* the Intel 386 instruction set or a superset of it. Specifically, this
|
||||
* includes all members of the 386, 486, and Pentium family of processors.
|
||||
*/
|
||||
#elif defined(__i386) || defined(__i386__)
|
||||
|
||||
#if !defined(__i386)
|
||||
#define __i386
|
||||
#endif
|
||||
|
||||
#if !defined(__x86)
|
||||
#define __x86
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics"
|
||||
*/
|
||||
#define _LITTLE_ENDIAN
|
||||
#define _STACK_GROWS_DOWNWARD
|
||||
#define _LONG_LONG_LTOH
|
||||
#define _BIT_FIELDS_LTOH
|
||||
#define _IEEE_754
|
||||
#define _CHAR_IS_SIGNED
|
||||
#define _BOOL_ALIGNMENT 1
|
||||
#define _CHAR_ALIGNMENT 1
|
||||
#define _SHORT_ALIGNMENT 2
|
||||
#define _INT_ALIGNMENT 4
|
||||
#define _FLOAT_ALIGNMENT 4
|
||||
#define _FLOAT_COMPLEX_ALIGNMENT 4
|
||||
#define _LONG_ALIGNMENT 4
|
||||
#define _LONG_LONG_ALIGNMENT 4
|
||||
#define _DOUBLE_ALIGNMENT 4
|
||||
#define _DOUBLE_COMPLEX_ALIGNMENT 4
|
||||
#define _LONG_DOUBLE_ALIGNMENT 4
|
||||
#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 4
|
||||
#define _POINTER_ALIGNMENT 4
|
||||
#define _MAX_ALIGNMENT 4
|
||||
#define _ALIGNMENT_REQUIRED 0
|
||||
|
||||
#define _LONG_LONG_ALIGNMENT_32 _LONG_LONG_ALIGNMENT
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices".
|
||||
*/
|
||||
#define _ILP32
|
||||
#if !defined(_I32LPx) && defined(_KERNEL)
|
||||
#define _I32LPx
|
||||
#endif
|
||||
#define _SUNOS_VTOC_16
|
||||
#define _DMA_USES_PHYSADDR
|
||||
#define _FIRMWARE_NEEDS_FDISK
|
||||
#define _PSM_MODULES
|
||||
#define _RTC_CONFIG
|
||||
#define _DONT_USE_1275_GENERIC_NAMES
|
||||
#define _HAVE_CPUID_INSN
|
||||
|
||||
/*
|
||||
* The following set of definitions characterize the Solaris on SPARC systems.
|
||||
*
|
||||
* The symbol __sparc indicates any of the SPARC family of processor
|
||||
* architectures. This includes SPARC V7, SPARC V8 and SPARC V9.
|
||||
*
|
||||
* The symbol __sparcv8 indicates the 32-bit SPARC V8 architecture as defined
|
||||
* by Version 8 of the SPARC Architecture Manual. (SPARC V7 is close enough
|
||||
* to SPARC V8 for the former to be subsumed into the latter definition.)
|
||||
*
|
||||
* The symbol __sparcv9 indicates the 64-bit SPARC V9 architecture as defined
|
||||
* by Version 9 of the SPARC Architecture Manual.
|
||||
*
|
||||
* The symbols __sparcv8 and __sparcv9 are mutually exclusive, and are only
|
||||
* relevant when the symbol __sparc is defined.
|
||||
*/
|
||||
/*
|
||||
* XXX Due to the existence of 5110166, "defined(__sparcv9)" needs to be added
|
||||
* to support backwards builds. This workaround should be removed in s10_71.
|
||||
*/
|
||||
#elif defined(__sparc) || defined(__sparcv9) || defined(__sparc__)
|
||||
#if !defined(__sparc)
|
||||
#define __sparc
|
||||
#endif
|
||||
|
||||
/*
|
||||
* You can be 32-bit or 64-bit, but not both at the same time.
|
||||
*/
|
||||
#if defined(__sparcv8) && defined(__sparcv9)
|
||||
#error "SPARC Versions 8 and 9 are mutually exclusive choices"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Existing compilers do not set __sparcv8. Years will transpire before
|
||||
* the compilers can be depended on to set the feature test macro. In
|
||||
* the interim, we'll set it here on the basis of historical behaviour;
|
||||
* if you haven't asked for SPARC V9, then you must've meant SPARC V8.
|
||||
*/
|
||||
#if !defined(__sparcv9) && !defined(__sparcv8)
|
||||
#define __sparcv8
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics" shared between
|
||||
* all Solaris on SPARC systems.
|
||||
*/
|
||||
#define _BIG_ENDIAN
|
||||
#define _STACK_GROWS_DOWNWARD
|
||||
#define _LONG_LONG_HTOL
|
||||
#define _BIT_FIELDS_HTOL
|
||||
#define _IEEE_754
|
||||
#define _CHAR_IS_SIGNED
|
||||
#define _BOOL_ALIGNMENT 1
|
||||
#define _CHAR_ALIGNMENT 1
|
||||
#define _SHORT_ALIGNMENT 2
|
||||
#define _INT_ALIGNMENT 4
|
||||
#define _FLOAT_ALIGNMENT 4
|
||||
#define _FLOAT_COMPLEX_ALIGNMENT 4
|
||||
#define _LONG_LONG_ALIGNMENT 8
|
||||
#define _DOUBLE_ALIGNMENT 8
|
||||
#define _DOUBLE_COMPLEX_ALIGNMENT 8
|
||||
#define _ALIGNMENT_REQUIRED 1
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices" shared between versions.
|
||||
*/
|
||||
#define _SUNOS_VTOC_8
|
||||
#define _DMA_USES_VIRTADDR
|
||||
#define _NO_FDISK_PRESENT
|
||||
#define _HAVE_TEM_FIRMWARE
|
||||
#define _OBP
|
||||
|
||||
/*
|
||||
* The following set of definitions characterize the implementation of
|
||||
* 32-bit Solaris on SPARC V8 systems.
|
||||
*/
|
||||
#if defined(__sparcv8)
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics"
|
||||
*/
|
||||
#define _LONG_ALIGNMENT 4
|
||||
#define _LONG_DOUBLE_ALIGNMENT 8
|
||||
#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 8
|
||||
#define _POINTER_ALIGNMENT 4
|
||||
#define _MAX_ALIGNMENT 8
|
||||
|
||||
#define _LONG_LONG_ALIGNMENT_32 _LONG_LONG_ALIGNMENT
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices"
|
||||
*/
|
||||
#define _ILP32
|
||||
#if !defined(_I32LPx) && defined(_KERNEL)
|
||||
#define _I32LPx
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following set of definitions characterize the implementation of
|
||||
* 64-bit Solaris on SPARC V9 systems.
|
||||
*/
|
||||
#elif defined(__sparcv9)
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics"
|
||||
*/
|
||||
#define _LONG_ALIGNMENT 8
|
||||
#define _LONG_DOUBLE_ALIGNMENT 16
|
||||
#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 16
|
||||
#define _POINTER_ALIGNMENT 8
|
||||
#define _MAX_ALIGNMENT 16
|
||||
|
||||
#define _LONG_LONG_ALIGNMENT_32 _LONG_LONG_ALIGMENT
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices"
|
||||
*/
|
||||
#if !defined(_LP64)
|
||||
#define _LP64
|
||||
#endif
|
||||
#if !defined(_I32LPx)
|
||||
#define _I32LPx
|
||||
#endif
|
||||
#define _MULTI_DATAMODEL
|
||||
|
||||
#else
|
||||
#error "unknown SPARC version"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* #error is strictly ansi-C, but works as well as anything for K&R systems.
|
||||
*/
|
||||
#else
|
||||
#error "ISA not supported"
|
||||
#endif
|
||||
|
||||
#if defined(_ILP32) && defined(_LP64)
|
||||
#error "Both _ILP32 and _LP64 are defined"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ISA_DEFS_H */
|
||||
|
|
|
@ -130,6 +130,35 @@ kstat_delete(kstat_t *ksp)
|
|||
return;
|
||||
}
|
||||
|
||||
/* FIXME - NONE OF THIS IS ATOMIC, IT SHOULD BE. For the moment this is
|
||||
* OK since it is only used for the noncritical kstat counters */
|
||||
static __inline__ uint64_t
|
||||
atomic_add_64(volatile uint64_t *target, uint64_t delta)
|
||||
{
|
||||
uint64_t rc = *target;
|
||||
*target += delta;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static __inline__ uint64_t
|
||||
atomic_add_64_nv(volatile uint64_t *target, uint64_t delta)
|
||||
{
|
||||
*target += delta;
|
||||
return *target;
|
||||
}
|
||||
|
||||
static __inline__ uint64_t
|
||||
atomic_cas_64(volatile uint64_t *target, uint64_t cmp,
|
||||
uint64_t newval)
|
||||
{
|
||||
uint64_t rc = *target;
|
||||
|
||||
if (*target == cmp)
|
||||
*target = newval;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -64,7 +64,44 @@ extern "C" {
|
|||
#define bzero(ptr,size) memset(ptr,0,size)
|
||||
#define bcopy(src,dest,size) memcpy(dest,src,size)
|
||||
#define ASSERT(x) BUG_ON(!(x))
|
||||
#define ASSERT3U(left,OP,right) BUG_ON(!((left) OP (right)))
|
||||
#define VERIFY(x)
|
||||
|
||||
#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
|
||||
const TYPE __left = (TYPE)(LEFT); \
|
||||
const TYPE __right = (TYPE)(RIGHT); \
|
||||
if (!(__left OP __right)) \
|
||||
BUG(); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
|
||||
#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
|
||||
#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
|
||||
|
||||
#define ASSERT3S(x, y, z) VERIFY3S(x, y, z)
|
||||
#define ASSERT3U(x, y, z) VERIFY3U(x, y, z)
|
||||
#define ASSERT3P(x, y, z) VERIFY3P(x, y, z)
|
||||
|
||||
/* Dtrace probes do not exist in the linux kernel */
|
||||
|
||||
#ifdef DTRACE_PROBE1
|
||||
#undef DTRACE_PROBE1
|
||||
#endif /* DTRACE_PROBE1 */
|
||||
#define DTRACE_PROBE1(a, b, c) ((void)0)
|
||||
|
||||
#ifdef DTRACE_PROBE2
|
||||
#undef DTRACE_PROBE2
|
||||
#endif /* DTRACE_PROBE2 */
|
||||
#define DTRACE_PROBE2(a, b, c, d, e) ((void)0)
|
||||
|
||||
#ifdef DTRACE_PROBE3
|
||||
#undef DTRACE_PROBE3
|
||||
#endif /* DTRACE_PROBE3 */
|
||||
#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0)
|
||||
|
||||
#ifdef DTRACE_PROBE4
|
||||
#undef DTRACE_PROBE4
|
||||
#endif /* DTRACE_PROBE4 */
|
||||
#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0)
|
||||
|
||||
/* Missing globals
|
||||
*/
|
||||
|
|
|
@ -24,9 +24,9 @@ typedef struct vmem { } vmem_t;
|
|||
typedef short pri_t;
|
||||
typedef struct timespec timestruc_t; /* definition per SVr4 */
|
||||
typedef longlong_t hrtime_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
typedef unsigned short ushort_t;
|
||||
typedef u_longlong_t len_t;
|
||||
typedef longlong_t diskaddr_t;
|
||||
typedef ushort_t o_mode_t;
|
||||
|
||||
#endif /* _SPL_TYPES_H */
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* 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_TYPES32_H
|
||||
#define _SYS_TYPES32_H
|
||||
|
||||
|
||||
|
||||
#include <sys/int_types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Interoperability types for programs. Used for:
|
||||
*
|
||||
* Crossing between 32-bit and 64-bit domains.
|
||||
*
|
||||
* On disk data formats such as filesystem meta data
|
||||
* and disk label.
|
||||
*
|
||||
* Note: Applications should never include this
|
||||
* header file.
|
||||
*/
|
||||
typedef uint32_t caddr32_t;
|
||||
typedef int32_t daddr32_t;
|
||||
typedef int32_t off32_t;
|
||||
typedef uint32_t ino32_t;
|
||||
typedef int32_t blkcnt32_t;
|
||||
typedef uint32_t fsblkcnt32_t;
|
||||
typedef uint32_t fsfilcnt32_t;
|
||||
typedef int32_t id32_t;
|
||||
typedef uint32_t major32_t;
|
||||
typedef uint32_t minor32_t;
|
||||
typedef int32_t key32_t;
|
||||
typedef uint32_t mode32_t;
|
||||
typedef uint32_t uid32_t;
|
||||
typedef uint32_t gid32_t;
|
||||
typedef uint32_t nlink32_t;
|
||||
typedef uint32_t dev32_t;
|
||||
typedef int32_t pid32_t;
|
||||
typedef uint32_t size32_t;
|
||||
typedef int32_t ssize32_t;
|
||||
typedef int32_t time32_t;
|
||||
typedef int32_t clock32_t;
|
||||
|
||||
struct timeval32 {
|
||||
time32_t tv_sec; /* seconds */
|
||||
int32_t tv_usec; /* and microseconds */
|
||||
};
|
||||
|
||||
typedef struct timespec32 {
|
||||
time32_t tv_sec; /* seconds */
|
||||
int32_t tv_nsec; /* and nanoseconds */
|
||||
} timespec32_t;
|
||||
|
||||
typedef struct timespec32 timestruc32_t;
|
||||
|
||||
typedef struct itimerspec32 {
|
||||
struct timespec32 it_interval;
|
||||
struct timespec32 it_value;
|
||||
} itimerspec32_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_TYPES32_H */
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//#include "dmu_config.h"
|
||||
|
||||
#ifdef HAVE_UNICODE
|
||||
#include_next <sys/u8_textprep.h>
|
||||
#else
|
||||
|
||||
#ifndef _SYS_U8_TEXTPREP_H
|
||||
#define _SYS_U8_TEXTPREP_H
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Unicode encoding conversion functions and their macros.
|
||||
*/
|
||||
#define UCONV_IN_BIG_ENDIAN 0x0001
|
||||
#define UCONV_OUT_BIG_ENDIAN 0x0002
|
||||
#define UCONV_IN_SYSTEM_ENDIAN 0x0004
|
||||
#define UCONV_OUT_SYSTEM_ENDIAN 0x0008
|
||||
#define UCONV_IN_LITTLE_ENDIAN 0x0010
|
||||
#define UCONV_OUT_LITTLE_ENDIAN 0x0020
|
||||
#define UCONV_IGNORE_NULL 0x0040
|
||||
#define UCONV_IN_ACCEPT_BOM 0x0080
|
||||
#define UCONV_OUT_EMIT_BOM 0x0100
|
||||
|
||||
extern int uconv_u16tou32(const uint16_t *, size_t *, uint32_t *, size_t *,
|
||||
int);
|
||||
extern int uconv_u16tou8(const uint16_t *, size_t *, uchar_t *, size_t *, int);
|
||||
extern int uconv_u32tou16(const uint32_t *, size_t *, uint16_t *, size_t *,
|
||||
int);
|
||||
extern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int);
|
||||
extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int);
|
||||
extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int);
|
||||
|
||||
/*
|
||||
* UTF-8 text preparation functions and their macros.
|
||||
*
|
||||
* Among the macros defined, U8_CANON_DECOMP, U8_COMPAT_DECOMP, and
|
||||
* U8_CANON_COMP are not public interfaces and must not be used directly
|
||||
* at the flag input argument.
|
||||
*/
|
||||
#define U8_STRCMP_CS (0x00000001)
|
||||
#define U8_STRCMP_CI_UPPER (0x00000002)
|
||||
#define U8_STRCMP_CI_LOWER (0x00000004)
|
||||
|
||||
#define U8_CANON_DECOMP (0x00000010)
|
||||
#define U8_COMPAT_DECOMP (0x00000020)
|
||||
#define U8_CANON_COMP (0x00000040)
|
||||
|
||||
#define U8_STRCMP_NFD (U8_CANON_DECOMP)
|
||||
#define U8_STRCMP_NFC (U8_CANON_DECOMP | U8_CANON_COMP)
|
||||
#define U8_STRCMP_NFKD (U8_COMPAT_DECOMP)
|
||||
#define U8_STRCMP_NFKC (U8_COMPAT_DECOMP | U8_CANON_COMP)
|
||||
|
||||
#define U8_TEXTPREP_TOUPPER (U8_STRCMP_CI_UPPER)
|
||||
#define U8_TEXTPREP_TOLOWER (U8_STRCMP_CI_LOWER)
|
||||
|
||||
#define U8_TEXTPREP_NFD (U8_STRCMP_NFD)
|
||||
#define U8_TEXTPREP_NFC (U8_STRCMP_NFC)
|
||||
#define U8_TEXTPREP_NFKD (U8_STRCMP_NFKD)
|
||||
#define U8_TEXTPREP_NFKC (U8_STRCMP_NFKC)
|
||||
|
||||
#define U8_TEXTPREP_IGNORE_NULL (0x00010000)
|
||||
#define U8_TEXTPREP_IGNORE_INVALID (0x00020000)
|
||||
#define U8_TEXTPREP_NOWAIT (0x00040000)
|
||||
|
||||
#define U8_UNICODE_320 (0)
|
||||
#define U8_UNICODE_500 (1)
|
||||
#define U8_UNICODE_LATEST (U8_UNICODE_500)
|
||||
|
||||
#define U8_VALIDATE_ENTIRE (0x00100000)
|
||||
#define U8_VALIDATE_CHECK_ADDITIONAL (0x00200000)
|
||||
#define U8_VALIDATE_UCS2_RANGE (0x00400000)
|
||||
|
||||
#define U8_ILLEGAL_CHAR (-1)
|
||||
#define U8_OUT_OF_RANGE_CHAR (-2)
|
||||
|
||||
extern int u8_validate(char *, size_t, char **, int, int *);
|
||||
extern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *);
|
||||
extern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t,
|
||||
int *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_UNICODE */
|
||||
|
||||
#endif /* _SYS_U8_TEXTPREP_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,8 @@
|
|||
#ifndef _SPL_VMSYSTM_H
|
||||
#define _SPL_VMSYSTM_H
|
||||
|
||||
#include <linux/mm.h>
|
||||
|
||||
#define physmem num_physpages
|
||||
|
||||
#endif /* SPL_VMSYSTM_H */
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _SPL_ANON_H
|
||||
#define _SPL_ANON_H
|
||||
|
||||
#endif /* SPL_ANON_H */
|
Loading…
Reference in New Issue