4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * This file contents the definitions for rmformat utility
45 #include <sys/param.h>
54 #include <sys/dktp/fdisk.h>
55 #include <sys/smedia.h>
56 #include <sys/efi_partition.h>
59 #define DPRINTF(str) (void) printf(str)
60 #define DPRINTF1(str, a) (void) printf(str, a)
61 #define DPRINTF2(str, a, b) (void) printf(str, a, b)
62 #define DPRINTF3(str, a, b, c) (void) printf(str, a, b, c)
63 #define DPRINTF4(str, a, b, c, d) (void) printf(str, a, b, c, d)
66 #define DPRINTF1(str, a)
67 #define DPRINTF2(str, a, b)
68 #define DPRINTF3(str, a, b, c)
69 #define DPRINTF4(str, a, b, c, d)
72 #define PERROR(string) my_perror(gettext(string))
74 /* Little endian and big endian */
76 #define les(val) ((((val)&0xFF)<<8)|(((val)>>8)&0xFF))
77 #define lel(val) (((unsigned)(les((val)&0x0000FFFF))<<16) | \
78 (les((unsigned)((val)&0xffff0000)>>16)))
80 #define les(val) (val)
81 #define lel(val) (val)
84 /* To avoid misalign access in sparc */
86 #define GET_32(addr) \
87 ((*((uint8_t *)((char *)addr)) << 24) | \
88 (*((uint8_t *)(((char *)addr)+1)) << 16) |\
89 (*((uint8_t *)(((char *)addr)+2)) << 8) | \
90 (*((uint8_t *)(((char *)addr)+3))))
93 #define GET_32(addr) (*(uint32_t *)addr)
97 #define VERIFY_WRITE 2
99 /* w_flag and others */
100 #define WP_MSG_0 "Medium is already write protected\n"
101 #define WP_MSG_1 "Medium is password protected : use -W option.\n"
102 #define WP_MSG_2 "Medium is Read Write protected : use -R option.\n"
103 #define WP_MSG_3 "Medium is not Write protected\n"
106 #define WP_MSG_4 "Medium is Read Write protected.\n"
107 #define WP_MSG_5 "Changing to write protect with password.\n"
108 #define WP_MSG_6 "Medium is already password protected\n"
109 #define WP_MSG_7 "Medium is not password protected\n"
114 #define WP_MSG_8 "Medium is password write protected\n"
115 #define WP_MSG_9 "Changing to Read Write protected\n"
116 #define WP_MSG_10 "Wrong password or access denied\n"
117 #define WP_UNKNOWN "Error, can not determine the state of the medium\n"
118 #define WP_ERROR "Error, write protect operation failed\n"
121 * Condition to be checked for a device
123 #define CHECK_TYPE_NOT_CDROM 1
124 #define CHECK_DEVICE_NOT_READY 2
125 #define CHECK_DEVICE_NOT_WRITABLE 4
126 #define CHECK_NO_MEDIA 8
127 #define CHECK_MEDIA_IS_NOT_WRITABLE 0x10
128 #define CHECK_MEDIA_IS_NOT_BLANK 0x20
129 #define CHECK_MEDIA_IS_NOT_ERASABLE 0x40
130 #define CHECK_DEVICE_IS_CD_WRITABLE 0x100
131 #define CHECK_DEVICE_IS_DVD_WRITABLE 0x200
132 #define CHECK_DEVICE_IS_DVD_READABLE 0x400
134 #define INQUIRY_DATA_LENGTH 96
135 #define DVD_CONFIG_SIZE 0x20
137 int uscsi_error
; /* used for debugging failed uscsi */
139 /* fdisk related structures */
142 uint8_t bootid
; /* Bootable? (Active/Inactive) */
143 uint8_t systid
; /* OS type */
144 uint32_t relsect
; /* Beginning of partition */
149 struct fdisk_part part
[FD_NUMPART
];
152 typedef struct device
{
163 #endif /* _RMFORMAT_H */