#ifndef _RMFORMAT_H
#define _RMFORMAT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <strings.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/param.h>
#include <unistd.h>
#include <limits.h>
#include <volmgt.h>
#include <sys/vtoc.h>
#include <locale.h>
#include <libintl.h>
#include <dirent.h>
#include <sys/dkio.h>
#include <sys/dktp/fdisk.h>
#include <sys/smedia.h>
#include <sys/efi_partition.h>
#ifdef DEBUG
#define DPRINTF(str) (void) printf(str)
#define DPRINTF1(str, a) (void) printf(str, a)
#define DPRINTF2(str, a, b) (void) printf(str, a, b)
#define DPRINTF3(str, a, b, c) (void) printf(str, a, b, c)
#define DPRINTF4(str, a, b, c, d) (void) printf(str, a, b, c, d)
#else
#define DPRINTF(str)
#define DPRINTF1(str, a)
#define DPRINTF2(str, a, b)
#define DPRINTF3(str, a, b, c)
#define DPRINTF4(str, a, b, c, d)
#endif
#define PERROR(string) my_perror(gettext(string))
#ifdef sparc
#define les(val) ((((val)&0xFF)<<8)|(((val)>>8)&0xFF))
#define lel(val) (((unsigned)(les((val)&0x0000FFFF))<<16) | \
(les((unsigned)((val)&0xffff0000)>>16)))
#else
#define les(val) (val)
#define lel(val) (val)
#endif
#ifdef sparc
#define GET_32(addr) \
((*((uint8_t *)((char *)addr)) << 24) | \
(*((uint8_t *)(((char *)addr)+1)) << 16) |\
(*((uint8_t *)(((char *)addr)+2)) << 8) | \
(*((uint8_t *)(((char *)addr)+3))))
#else
#define GET_32(addr) (*(uint32_t *)addr)
#endif
#define VERIFY_READ 1
#define VERIFY_WRITE 2
#define WP_MSG_0 "Medium is already write protected\n"
#define WP_MSG_1 "Medium is password protected : use -W option.\n"
#define WP_MSG_2 "Medium is Read Write protected : use -R option.\n"
#define WP_MSG_3 "Medium is not Write protected\n"
#define WP_MSG_4 "Medium is Read Write protected.\n"
#define WP_MSG_5 "Changing to write protect with password.\n"
#define WP_MSG_6 "Medium is already password protected\n"
#define WP_MSG_7 "Medium is not password protected\n"
#define WP_MSG_8 "Medium is password write protected\n"
#define WP_MSG_9 "Changing to Read Write protected\n"
#define WP_MSG_10 "Wrong password or access denied\n"
#define WP_UNKNOWN "Error, can not determine the state of the medium\n"
#define WP_ERROR "Error, write protect operation failed\n"
#define CHECK_TYPE_NOT_CDROM 1
#define CHECK_DEVICE_NOT_READY 2
#define CHECK_DEVICE_NOT_WRITABLE 4
#define CHECK_NO_MEDIA 8
#define CHECK_MEDIA_IS_NOT_WRITABLE 0x10
#define CHECK_MEDIA_IS_NOT_BLANK 0x20
#define CHECK_MEDIA_IS_NOT_ERASABLE 0x40
#define CHECK_DEVICE_IS_CD_WRITABLE 0x100
#define CHECK_DEVICE_IS_DVD_WRITABLE 0x200
#define CHECK_DEVICE_IS_DVD_READABLE 0x400
#define INQUIRY_DATA_LENGTH 96
#define DVD_CONFIG_SIZE 0x20
extern int uscsi_error;
struct fdisk_part {
uint8_t bootid;
uint8_t systid;
uint32_t relsect;
uint32_t numsect;
};
struct fdisk_info {
struct fdisk_part part[FD_NUMPART];
};
typedef struct device {
char *d_node;
char *d_name;
int d_fd;
uchar_t *d_inq;
} device_t;
#ifdef __cplusplus
}
#endif
#endif