usr/src/cmd/samba/Solaris/sam-types.h
author Jon Tibble <meths@btinternet.com>
Mon, 04 May 2015 14:04:39 +0100
branchoi_151a
changeset 254 9c2a4ac793f0
parent 42 b6f829cb6d9e
permissions -rw-r--r--
Bash patch catchup including shellshock
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     1
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     2
 *	sam/types.h - SAM-FS types.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     3
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     4
 *  Description:
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     5
 *      Defines SAM-FS types and lots of other things.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     6
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     7
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     8
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     9
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    10
 *    SAM-QFS_notice_begin
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    11
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    12
 *      Solaris 2.x Sun Storage & Archiving Management File System
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    13
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    14
 *		Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    15
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    16
 *		U.S. Government Rights - Commercial software. Government users are
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    17
 *	subject to the Sun Microsystems, Inc. standard license agreement and applicable
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    18
 *	provisions of the FAR and its supplements.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    19
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    20
 *      	Use is subject to license terms. Sun, Sun Microsystems and the Sun logo
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    21
 *	are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    22
 *	and other countries.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    23
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    24
 *    SAM-QFS_notice_end
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    25
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    26
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    27
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    28
 *	LGPL NOTICE
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    29
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    30
 *	This library is free software; you can redistribute it and/or
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    31
 *	modify it under the terms of the GNU Lesser General Public
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    32
 *	License as published by the Free Software Foundation; either
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    33
 *	version 2.1 of the License, or (at your option) any later version.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    34
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    35
 *	This library is distributed in the hope that it will be useful,
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    36
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    37
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    38
 *	Lesser General Public License for more details.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    39
 *
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    40
 *	You should have received a copy of the GNU Lesser General Public
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    41
 *	License along with this library; if not, write to the Free Software
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    42
 *	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    43
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    44
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    45
#ifndef	_SAM_TYPES_H
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    46
#define	_SAM_TYPES_H
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    47
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    48
#ifdef sun
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    49
#pragma ident "$Revision$"
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    50
#endif
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    51
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    52
#ifdef linux
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    53
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    54
#ifndef __KERNEL__
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    55
#include <sys/types.h>
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    56
#include <netdb.h>
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    57
#endif /* __KERNEL__ */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    58
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    59
#else /* linux */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    60
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    61
#include <sys/types.h>
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    62
#include <netdb.h>
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    63
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    64
#endif /* linux */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    65
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    66
#include "sam-sys_types.h"
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    67
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    68
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    69
 * These typedefs are part of an emerging ANSI-C standard for fixed-size
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    70
 * integer types.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    71
 * They are available in Solaris 2.6 (and above) in /usr/include/sys/types.h.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    72
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    73
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    74
#if defined _SYS_INT_TYPES_H
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    75
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    76
 * (uint8_t, uint32_t and uint64_t are defined in Solaris 2.5
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    77
 * /usr/include/sys/synch.h.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    78
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    79
#define	_UINT8_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    80
#define	_UINT16_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    81
#define	_INT32_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    82
#define	_UINT32_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    83
#define	_INT64_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    84
#define	_UINT64_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    85
#endif  /* defined _SYS_INTTYPES_H */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    86
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    87
#if !defined _UINT8_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    88
#define	_UINT8_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    89
typedef unsigned char uint8_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    90
#endif  /* !defined _UINT8_T */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    91
#if !defined _UINT16_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    92
#define	_UINT16_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    93
typedef unsigned short uint16_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    94
#endif  /* !defined uint16_t */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    95
#if !defined _INT32_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    96
#define	_INT32_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    97
typedef int int32_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    98
#endif  /* !defined _INT32_T */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    99
#if !defined _UINT32_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   100
#define	_UINT32_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   101
typedef unsigned int uint32_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   102
#endif  /* !defined _UINT32_T */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   103
#if !defined _INT64_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   104
#define	_INT64_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   105
typedef long long int64_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   106
#endif  /* !defined _INT64_T */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   107
#if !defined _UINT64_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   108
#define	_UINT64_T
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   109
typedef unsigned long long uint64_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   110
#endif  /* !defined _UINT64_T */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   111
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   112
#if !defined(FALSE)
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   113
#define	FALSE   (0)
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   114
#endif
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   115
#if !defined(TRUE)
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   116
#define	TRUE	(1)
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   117
#endif
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   118
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   119
/* The following is for the lawyers */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   120
#define	COPYRIGHT "Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved. SUN PROPRIETARY/CONFIDENTIAL."
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   121
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   122
#define	RESELL_LIB "libresel.so"
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   123
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   124
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   125
 *  Set errno for MT and non-MT callers.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   126
 *  errno is defined differently for MT and non-MT compiled modules.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   127
 *  This macro may be used to properly return errno for both types
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   128
 *  of modules linked to non-MT compiled library modules.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   129
 *  The underlying Solaris errno function is ___errno().
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   130
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   131
extern int *___errno(void);
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   132
#define	SetErrno (*(___errno()))
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   133
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   134
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   135
 *  Return the difference between two pointers.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   136
 *  lint produces warning: possible ptrdiff_t overflow when two pointers
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   137
 *  are subtracted.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   138
 *  Returns 0 if the difference is negative.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   139
 *  The 'lint' version obviously will not do the work.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   140
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   141
#if !defined(lint)
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   142
#define	Ptrdiff(a, b) ((((char *)(a) - (char *)(b)) > 0) ? \
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   143
		((char *)(a) - (char *)(b)) : 0)
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   144
#else /* !defined(lint) */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   145
#define	Ptrdiff(a, b) (memcmp((a), (b), 1))
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   146
#endif /* !defined(lint) */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   147
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   148
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   149
 *  Round value to be structure aligned.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   150
 *  Structures may have a size that is not a multiple of 64-bits.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   151
 *  When these structures are packed in a file that will be memory
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   152
 *  mapped, the size must be rounded to a 64-bit multiple for SPARC
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   153
 *  and a 32-bit multiple for AMD.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   154
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   155
#if defined(__sparc)
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   156
#define	STRUCT_RND(v) ((((v)+sizeof (longlong_t)-1) \
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   157
	/ sizeof (longlong_t)) * sizeof (longlong_t))
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   158
#elif defined(__i386) || defined(__amd64) || defined(x86_64) || defined(ia64)
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   159
#define	STRUCT_RND(v) ((((v)+sizeof (int32_t)-1) \
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   160
	/ sizeof (int32_t)) * sizeof (int32_t))
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   161
#else
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   162
	** ERROR **  unknown architecture
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   163
#endif
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   164
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   165
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   166
 *  All filesystem OTW structures must be 64-bit aligned,
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   167
 *  regardless of the architecture for the server and clients.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   168
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   169
#define	STRUCT_RND64(v) ((((v)+sizeof (longlong_t)-1) \
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   170
	/ sizeof (longlong_t)) * sizeof (longlong_t))
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   171
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   172
#if defined(O_LARGEFILE)		/* Needed on open for large files */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   173
#define	SAM_O_LARGEFILE O_LARGEFILE
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   174
#else
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   175
#define	SAM_O_LARGEFILE 0
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   176
#endif
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   177
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   178
#define	SAM_FSTYPE 	"samfs"		/* st_fstype string for SAM-FS */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   179
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   180
#define	ROBOT_NO_SLOT 	0xffffffff	/* used to flag no slot. */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   181
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   182
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   183
 * When the space left on a tape (in units of 1024) falls below this,
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   184
 * the tape will be considered full.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   185
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   186
#define	TAPE_IS_FULL 100
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   187
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   188
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   189
 * HASAM running file
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   190
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   191
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   192
#define	HASAM_TMP_DIR   "/var/run"
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   193
#define	HASAM_RUN_FILE  HASAM_TMP_DIR"/hasam_running"
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   194
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   195
#define	BARCODE_LEN 	36		/* length of barcode w/o null by */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   196
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   197
typedef	int		ATOM_INT_T;	/* Int with atomic memory reference */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   198
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   199
typedef uint64_t 	fsize_t;	/* Size of a file in bytes */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   200
typedef int64_t 	sfsize_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   201
#define	FSIZE_MAX 	0x7fffffffffffffff
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   202
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   203
typedef char uname_t[32];		/* Device name */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   204
typedef char upath_t[128];		/* Path name */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   205
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   206
typedef char mtype_t[5];		/* Media type */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   207
typedef char vsn_t[32];			/* ANSI Volume serial name, 31 chars */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   208
					/* null terminated */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   209
					/* Tape VSNs are 6 chars or less */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   210
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   211
typedef char host_t[MAXHOSTNAMELEN];	/* Host name */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   212
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   213
typedef uint16_t media_t;		/* Media type */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   214
typedef uint16_t dtype_t;		/* Device type */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   215
typedef uint16_t equ_t;			/* Equipment ordinal */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   216
#define	EQU_MAX 65534			/* Maximum value for equipment ordinal */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   217
					/* (need one reserved for historian) */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   218
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   219
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   220
 * Common memory mapped file prefix.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   221
 * If the MfValid field becomes zero, the file should be renewed.
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   222
 * MapFileDetach() then MapFileAttach().
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   223
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   224
typedef struct MappedFile {
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   225
	uint32_t MfMagic;		/* Magic number of file */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   226
	uint32_t MfLen;			/* Length of file mapped */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   227
	uint32_t MfValid;		/* File valid if non-zero */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   228
} MappedFile_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   229
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   230
typedef uint32_t sam_ino_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   231
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   232
typedef struct sam_id {			/* Inode identification */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   233
	sam_ino_t ino;			/* I-number */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   234
	int32_t gen;			/* Generation number */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   235
} sam_id_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   236
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   237
typedef struct csum {			/* Data verification value */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   238
	uint32_t csum_val[4];
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   239
} csum_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   240
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   241
typedef int32_t sam_time_t;		/* 32-bit time */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   242
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   243
typedef struct sam_timestruc {
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   244
	int32_t	tv_sec;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   245
	int32_t	tv_nsec;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   246
} sam_timestruc_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   247
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   248
typedef struct sam_flagtext {
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   249
	uint64_t flagmask;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   250
	char	*flagtext;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   251
} sam_flagtext_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   252
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   253
#define	SAM_POINTER(t) union { t *ptr; uint32_t p32; uint64_t p64; }
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   254
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   255
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   256
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   257
 * the following used in the SC_fsreleaser system call
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   258
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   259
#define	RELEASER_STARTED	1
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   260
#define	RELEASER_FINISHED	0
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   261
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   262
#define	DF_THR_STK		(0)
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   263
#define	SM_THR_STK		DF_THR_STK
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   264
#define	MD_THR_STK		DF_THR_STK
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   265
#define	LG_THR_STK		DF_THR_STK
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   266
#define	HG_THR_STK		DF_THR_STK
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   267
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   268
/*
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   269
 * Rounding directions
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   270
 */
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   271
typedef enum sam_round {
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   272
	SAM_ROUND_DOWN = 0,
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   273
	SAM_ROUND_UP = 1
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   274
} sam_round_t;
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   275
b6f829cb6d9e Import sfw build 147
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   276
#endif  /* _SAM_TYPES_H */