global.h revision 052b6e8a13e1fb4be51ba482db6bb2e9833fa717
/*
* 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
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _GLOBAL_H
#define _GLOBAL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Definitions for Label types: L_TYPE_SOLORIS is the default Sun label
* a.k.a VTOC. L_TYPE_EFI is the EFI label type.
*/
#define L_TYPE_SOLARIS 0
#define L_TYPE_EFI 1
#ifndef UINT_MAX64
#define UINT_MAX64 0xffffffffffffffffULL
#endif
#ifndef UINT_MAX32
#define UINT_MAX32 0xffffffff
#endif
/*
* This is the size of the reserved partition.
* Valid in case of EFI labels.
*/
/*
* This file contains global definitions and declarations. It is intended
* to be included by everyone.
*/
#include <stdio.h>
#include <assert.h>
#include <memory.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/isa_defs.h>
#include "hardware_structs.h"
#include "defect.h"
#include "io.h"
/*
* These declarations are global state variables.
*/
char cur_menu; /* current menu level */
char last_menu; /* last menu level */
char option_msg; /* extended message options */
char diag_msg; /* extended diagnostic msgs */
char option_s; /* silent mode option */
char *option_f; /* input redirect option */
char *option_l; /* log file option */
char *option_d; /* forced disk option */
char *option_t; /* forced disk type option */
char *option_p; /* forced partition table option */
char *option_x; /* data file redirection option */
char *file_name; /* current data file name */
/* for useful error messages */
int expert_mode; /* enable for expert mode */
/* commands */
int need_newline; /* for correctly formatted output */
int dev_expert; /* enable for developer mode */
/* commands */
/*
* These declarations are used for quick access to information about
* the disk being worked on.
*/
int cur_file; /* file descriptor for current disk */
int cur_flags; /* flags for current disk */
int cur_label; /* current label type */
void *cur_buf; /* current disk's I/O buffer */
void *pattern_buf; /* current disk's pattern buffer */
int pcyl; /* # physical cyls */
int ncyl; /* # data cyls */
int acyl; /* # alt cyls */
int nhead; /* # heads */
int phead; /* # physical heads */
int apc; /* # alternates/cyl */
int solaris_offset; /* Solaris offset, this value is zero */
/* for non-fdisk machines. */
#if defined(_SUNOS_VTOC_16)
int bcyl; /* # other cyls */
#endif /* defined(_SUNOS_VTOC_16) */
int xstart; /* solaris partition start */
/* information accesses */
/*
* These defines are used to manipulate the physical characteristics of
* the current disk.
*/
/*
* Macro to convert a device number into a partition number
*/
/*
* These values define flags for the current disk (cur_flags).
*/
/*
* These flags are for the controller type flags field.
*/
/*
* This flag has been introduced only for SPARC ATA. Which has been approved
* at that time with the agreement in the next fix it will be removed and the
* format will be revamped with controller Ops structure not to have
* any operation to be NULL. As it makes things more modular.
*
* This flag is also used for PCMCIA pcata driver.
* The flag prevents reading or writing a defect list on the disk
* testing and console error reporting still work normally.
* and have not allocated any space for alternate cylinders to keep
* the bab block lists.
*/
/*
* Do not require confirmation to extract defect lists on SCSI
* and IPI drives, since this operation is instantaneous
*/
/*
* Macros to make life easier
*/
/*
* These flags are for the disk type flags field.
*/
/*
* These defines are used to access the ctlr specific
* disk type fields (based on ctlr flags).
*/
/*
* These flags are for the disk info flags field.
*/
/* labeled yet. */
/* currently formatting */
/*
* These flags are used to control disk command execution.
*/
/*
* Directional parameter for the op_rdwr controller op.
*/
#define DIR_READ 0
#define DIR_WRITE 1
/*
* These defines are the mode parameter for the checksum routines.
*/
#define CK_CHECKSUM 0 /* check checksum */
/*
* This is the base character for partition identifiers
*/
#define PARTITION_BASE '0'
/*
* Base pathname for devfs names to be stripped from physical name.
*/
#define DEVFS_PREFIX "/devices"
/*
* Function prototypes ... Both for ANSI and non-ANSI C compilers
*/
#ifdef __STDC__
int copy_solaris_part(struct ipart *);
int good_fdisk(void);
int fdisk_physical_name(char *);
#else /* __STDC__ */
int copy_solaris_part();
int good_fdisk();
int fdisk_physical_name();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _GLOBAL_H */