diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-11-12 05:56:34 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-11-12 05:56:34 +0000 |
commit | dd425b701d6bf2f1d7813b41344918cd3c5f165e (patch) | |
tree | b21c32bcd4317aa5732a3d6e1d08fa42928ea090 /sys | |
parent | 6c17c07c6d331d45649187d08a544b5e91b73cad (diff) |
Merge dvdio.h and cdio.h, don't use typedefs, get rid of bitfields (no
good reason to use them, not packed structures anyway).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/cdio.h | 184 | ||||
-rw-r--r-- | sys/sys/dvdio.h | 173 | ||||
-rw-r--r-- | sys/sys/systm.h | 3 |
3 files changed, 185 insertions, 175 deletions
diff --git a/sys/sys/cdio.h b/sys/sys/cdio.h index 2bd5ac9d5fc..eb0934323eb 100644 --- a/sys/sys/cdio.h +++ b/sys/sys/cdio.h @@ -1,9 +1,12 @@ -/* $OpenBSD: cdio.h,v 1.7 1999/07/20 06:21:59 csapuntz Exp $ */ +/* $OpenBSD: cdio.h,v 1.8 1999/11/12 05:56:31 angelos Exp $ */ /* $NetBSD: cdio.h,v 1.11 1996/02/19 18:29:04 scottr Exp $ */ #ifndef _SYS_CDIO_H_ #define _SYS_CDIO_H_ +#include <sys/types.h> +#include <sys/ioccom.h> + /* Shared between kernel & process */ union msf_lba { @@ -235,4 +238,183 @@ struct ioc_load_unload { }; #define CDIOCLOADUNLOAD _IOW('c', 26, struct ioc_load_unload) +/* DVD definitions */ + +/* DVD-ROM Specific ioctls */ +#define DVD_READ_STRUCT _IOWR('d', 0, union dvd_struct) +#define DVD_WRITE_STRUCT _IOWR('d', 1, union dvd_struct) +#define DVD_AUTH _IOWR('d', 2, union dvd_authinfo) + +#define GPCMD_READ_DVD_STRUCTURE 0xad +#define GPCMD_SEND_DVD_STRUCTURE 0xad +#define GPCMD_REPORT_KEY 0xa4 +#define GPCMD_SEND_KEY 0xa3 + +/* DVD struct types */ +#define DVD_STRUCT_PHYSICAL 0x00 +#define DVD_STRUCT_COPYRIGHT 0x01 +#define DVD_STRUCT_DISCKEY 0x02 +#define DVD_STRUCT_BCA 0x03 +#define DVD_STRUCT_MANUFACT 0x04 + +struct dvd_layer { + u_int8_t book_version; + u_int8_t book_type; + u_int8_t min_rate; + u_int8_t disc_size; + u_int8_t layer_type; + u_int8_t track_path; + u_int8_t nlayers; + u_int8_t track_density; + u_int8_t linear_density; + u_int8_t bca; + u_int32_t start_sector; + u_int32_t end_sector; + u_int32_t end_sector_l0; +}; + +struct dvd_physical { + u_int8_t type; + + u_int8_t layer_num; + struct dvd_layer layer[4]; +}; + +struct dvd_copyright { + u_int8_t type; + + u_int8_t layer_num; + u_int8_t cpst; + u_int8_t rmi; +}; + +struct dvd_disckey { + u_int8_t type; + + u_int8_t agid; + u_int8_t value[2048]; +}; + +struct dvd_bca { + u_int8_t type; + + int len; + u_int8_t value[188]; +}; + +struct dvd_manufact { + u_int8_t type; + + u_int8_t layer_num; + int len; + u_int8_t value[2048]; +}; + +union dvd_struct { + u_int8_t type; + + struct dvd_physical physical; + struct dvd_copyright copyright; + struct dvd_disckey disckey; + struct dvd_bca bca; + struct dvd_manufact manufact; +}; + +/* + * DVD authentication ioctl + */ + +/* Authentication states */ +#define DVD_LU_SEND_AGID 0 +#define DVD_HOST_SEND_CHALLENGE 1 +#define DVD_LU_SEND_KEY1 2 +#define DVD_LU_SEND_CHALLENGE 3 +#define DVD_HOST_SEND_KEY2 4 + +/* Termination states */ +#define DVD_AUTH_ESTABLISHED 5 +#define DVD_AUTH_FAILURE 6 + +/* Other functions */ +#define DVD_LU_SEND_TITLE_KEY 7 +#define DVD_LU_SEND_ASF 8 +#define DVD_INVALIDATE_AGID 9 + +#if 0 +/* State data */ +typedef u_int8_t dvd_key[5]; /* 40-bit value, MSB is first elem. */ +typedef u_int8_t dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ +#endif + +#define DVD_KEY_SIZE 5 +#define DVD_CHALLENGE_SIZE 10 + +struct dvd_lu_send_agid { + u_int8_t type; + + u_int8_t agid; +}; + +struct dvd_host_send_challenge { + u_int8_t type; + + u_int8_t agid; + u_int8_t chal[DVD_CHALLENGE_SIZE]; +}; + +struct dvd_send_key { + u_int8_t type; + + u_int8_t agid; + u_int8_t key[DVD_KEY_SIZE]; +}; + +struct dvd_lu_send_challenge { + u_int8_t type; + + u_int8_t agid; + u_int8_t chal[DVD_CHALLENGE_SIZE]; +}; + +#define DVD_CPM_NO_COPYRIGHT 0 +#define DVD_CPM_COPYRIGHTED 1 + +#define DVD_CP_SEC_NONE 0 +#define DVD_CP_SEC_EXIST 1 + +#define DVD_CGMS_UNRESTRICTED 0 +#define DVD_CGMS_SINGLE 2 +#define DVD_CGMS_RESTRICTED 3 + +struct dvd_lu_send_title_key { + u_int8_t type; + + u_int8_t agid; + u_int8_t title_key[DVD_KEY_SIZE]; + int lba; + u_int8_t cpm; + u_int8_t cp_sec; + u_int8_t cgms; +}; + +struct dvd_lu_send_asf { + u_int8_t type; + + u_int8_t agid; + u_int8_t asf; +}; + +union dvd_authinfo { + u_int8_t type; + + struct dvd_lu_send_agid lsa; + struct dvd_host_send_challenge hsc; + struct dvd_send_key lsk; + struct dvd_lu_send_challenge lsc; + struct dvd_send_key hsk; + struct dvd_lu_send_title_key lstk; + struct dvd_lu_send_asf lsasf; +}; + +#define FIBMAP _IOWR('f', 122, daddr_t) #endif /* !_SYS_CDIO_H_ */ diff --git a/sys/sys/dvdio.h b/sys/sys/dvdio.h deleted file mode 100644 index 4f1bd1d5653..00000000000 --- a/sys/sys/dvdio.h +++ /dev/null @@ -1,173 +0,0 @@ -/* $OpenBSD: dvdio.h,v 1.1 1999/11/03 01:47:47 angelos Exp $ */ - -#include <sys/types.h> -#include <sys/ioccom.h> - -/* DVD-ROM Specific ioctls */ -#define DVD_READ_STRUCT _IOWR('d', 0, dvd_struct) -#define DVD_WRITE_STRUCT _IOWR('d', 1, dvd_struct) -#define DVD_AUTH _IOWR('d', 2, dvd_authinfo) - -#define GPCMD_READ_DVD_STRUCTURE 0xad -#define GPCMD_SEND_DVD_STRUCTURE 0xad -#define GPCMD_REPORT_KEY 0xa4 -#define GPCMD_SEND_KEY 0xa3 - -/* DVD struct types */ -#define DVD_STRUCT_PHYSICAL 0x00 -#define DVD_STRUCT_COPYRIGHT 0x01 -#define DVD_STRUCT_DISCKEY 0x02 -#define DVD_STRUCT_BCA 0x03 -#define DVD_STRUCT_MANUFACT 0x04 - -struct dvd_layer { - u_int8_t book_version : 4; - u_int8_t book_type : 4; - u_int8_t min_rate : 4; - u_int8_t disc_size : 4; - u_int8_t layer_type : 4; - u_int8_t track_path : 1; - u_int8_t nlayers : 2; - u_int8_t track_density : 4; - u_int8_t linear_density : 4; - u_int8_t bca : 1; - u_int32_t start_sector; - u_int32_t end_sector; - u_int32_t end_sector_l0; -}; - -struct dvd_physical { - u_int8_t type; - u_int8_t layer_num; - struct dvd_layer layer[4]; -}; - -struct dvd_copyright { - u_int8_t type; - - u_int8_t layer_num; - u_int8_t cpst; - u_int8_t rmi; -}; - -struct dvd_disckey { - u_int8_t type; - - unsigned agid : 2; - u_int8_t value[2048]; -}; - -struct dvd_bca { - u_int8_t type; - - int len; - u_int8_t value[188]; -}; - -struct dvd_manufact { - u_int8_t type; - - u_int8_t layer_num; - int len; - u_int8_t value[2048]; -}; - -typedef union { - u_int8_t type; - - struct dvd_physical physical; - struct dvd_copyright copyright; - struct dvd_disckey disckey; - struct dvd_bca bca; - struct dvd_manufact manufact; -} dvd_struct; - -/* - * DVD authentication ioctl - */ - -/* Authentication states */ -#define DVD_LU_SEND_AGID 0 -#define DVD_HOST_SEND_CHALLENGE 1 -#define DVD_LU_SEND_KEY1 2 -#define DVD_LU_SEND_CHALLENGE 3 -#define DVD_HOST_SEND_KEY2 4 - -/* Termination states */ -#define DVD_AUTH_ESTABLISHED 5 -#define DVD_AUTH_FAILURE 6 - -/* Other functions */ -#define DVD_LU_SEND_TITLE_KEY 7 -#define DVD_LU_SEND_ASF 8 -#define DVD_INVALIDATE_AGID 9 - -/* State data */ -typedef u_int8_t dvd_key[5]; /* 40-bit value, MSB is first elem. */ -typedef u_int8_t dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ - -struct dvd_lu_send_agid { - u_int8_t type; - unsigned agid : 2; -}; - -struct dvd_host_send_challenge { - u_int8_t type; - unsigned agid : 2; - - dvd_challenge chal; -}; - -struct dvd_send_key { - u_int8_t type; - unsigned agid : 2; - - dvd_key key; -}; - -struct dvd_lu_send_challenge { - u_int8_t type; - unsigned agid : 2; - - dvd_challenge chal; -}; - -#define DVD_CPM_NO_COPYRIGHT 0 -#define DVD_CPM_COPYRIGHTED 1 - -#define DVD_CP_SEC_NONE 0 -#define DVD_CP_SEC_EXIST 1 - -#define DVD_CGMS_UNRESTRICTED 0 -#define DVD_CGMS_SINGLE 2 -#define DVD_CGMS_RESTRICTED 3 - -struct dvd_lu_send_title_key { - u_int8_t type; - unsigned agid : 2; - - dvd_key title_key; - int lba; - unsigned cpm : 1; - unsigned cp_sec : 1; - unsigned cgms : 2; -}; - -struct dvd_lu_send_asf { - u_int8_t type; - unsigned agid : 2; - - unsigned asf : 1; -}; - -typedef union { - u_int8_t type; - - struct dvd_lu_send_agid lsa; - struct dvd_host_send_challenge hsc; - struct dvd_send_key lsk; - struct dvd_lu_send_challenge lsc; - struct dvd_send_key hsk; - struct dvd_lu_send_title_key lstk; - struct dvd_lu_send_asf lsasf; -} dvd_authinfo; diff --git a/sys/sys/systm.h b/sys/sys/systm.h index c68a72ac109..9d01618aef7 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.33 1999/11/07 17:39:14 provos Exp $ */ +/* $OpenBSD: systm.h,v 1.34 1999/11/12 05:56:33 angelos Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -154,6 +154,7 @@ void panic __P((const char *, ...)) #else __attribute__((__noreturn__)); #endif +char *bitmask_snprintf __P((u_quad_t, const char *, char *, size_t)); void __assert __P((const char *, const char *, int, const char *)) __attribute__((__noreturn__)); int printf __P((const char *, ...)) |