jfs_types.h revision 7e7bd3dccbfe8f79e25e5c1554b5bc3a9aaca321
/*
* Copyright (c) International Business Machines Corp., 2000
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _H_JFS_TYPES
#define _H_JFS_TYPES
/*
* jfs_types.h:
*
*
* note: this header file must be the 1st include file
* of JFS include list in all JFS .c file.
*/
#ifdef _JFS_UTILITY
/* this is defined in asm/byteorder.h for i386, but
* is NOT defined in asm/byteorder.h for ppc (non-kernel).
* Until that is changed, we'll define it here. */
#define __BYTEORDER_HAS_U64__
//#include <asm/byteorder.h>
typedef unsigned short UniChar;
#else
#ifndef _ULS_UNICHAR_DEFINED
#else
typedef unsigned short UniChar;
#endif
#define _ULS_UNICHAR_DEFINED
#endif
#endif
/* #include "endian24.h" */
/*
* primitive types
*/
#ifdef _JFS_UTILITY
#ifndef _UINT_TYPES
/* unicode includes also define these */
#define _UINT_TYPES
#endif
#endif /* _JFS_UTILITY */
/*
* Holdovers from OS/2. Try to get away from using these altogether.
*/
typedef unsigned long ULONG;
typedef unsigned short USHORT;
typedef unsigned char UCHAR;
typedef void *PVOID;
#define MAXPATHLEN 255
/*
* Almost identical to Linux's timespec, but not quite
*/
struct timestruc_t {
};
/*
* handy
*/
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define LEFTMOSTONE 0x80000000
#if !defined(__sun)
typedef int boolean_t;
#endif
#define TRUE 1
#define FALSE 0
/*
* logical xd (lxd)
*/
typedef struct {
unsigned len:24;
unsigned off1:8;
} lxd_t;
/* lxd_t field construction */
{\
}
/* lxd_t field extraction */
/* lxd list */
typedef struct {
} lxdlist_t;
/*
* physical xd (pxd)
*/
typedef struct {
unsigned len:24;
unsigned addr1:8;
} pxd_t;
/* xd_t field construction */
{\
}
/* xd_t field extraction */
#define addressPXD(pxd)\
/* pxd list */
typedef struct {
} pxdlist_t;
/*
* data extent descriptor (dxd)
*/
typedef struct {
} dxd_t; /* - 16 - */
/* dxd_t flags */
/* dxd_t field construction
* Conveniently, the PXD macros work for DXD
*/
#define DXDaddress PXDaddress
#define addressDXD addressPXD
/*
* directory entry argument
*/
typedef struct component_name {
int namlen;
} component_t;
/*
* DASD limit information - stored in directory inode
*/
typedef struct dasd {
} dasd_t;
{\
}
{\
}
/*
* circular doubly-linked list (cdll)
*
* A circular doubly-linked list (cdll) is anchored by a pair of pointers,
* one to the head of the list and the other to the tail of the list.
* The elements are doubly linked so that an arbitrary element can be
* removed without a need to traverse the list.
* New elements can be added to the list before or after an existing element,
* at the head of the list, or at the tail of the list.
* A circle queue may be traversed in either direction.
*
* +----------+ +-------------------------------------+
* | | | |
* +->+-----+ | +->+-----+ +->+-----+ +->+-----+ |
* | | h +-+ | | h +--+ | n +----+ | n +--+
* | +-----+ | +-----+ | +-----+ | +-----+
* | | t +-+ +-----+ t | | | p +--+ | | p +--+
* | +-----+ | | | +-----+ | +-----+ | | +-----+ |
* +----------+ | +-----------------------+ | |
* | | | |
* | +-------------------------+
* | |
* +----------------------------+
*/
/*
* define header
*
* list header field definition in header element:
*
* type - type of list element struct embedding the link field
*/
#define CDLL_HEADER(type)\
struct {\
}
struct cdll_header {
struct cdll_header *head;
struct cdll_header *tail;
};
/*
* define link
*
* list link field definition in list element:
*
* type - type of parent list element struct embedding the link field
*/
#define CDLL_ENTRY(type)\
struct {\
}
struct cdll_entry {
struct cdll_entry *next;
struct cdll_entry *prev;
};
/*
* initialize header
*
* header - ptr to the header field in the header element
*/
}
/*
* scan list
*
* header - ptr to the header field in the header element
* elm - ptr to the element to be inserted
* field - name of the link field in the list element
*
* struct header_container *container;
* struct header_type *header;
* struct element_type *elm;
*
* header = &container->header_field;
* for (elm = header->head; elm != (void *)header; elm = elm->field.next)
*/
/*
* insert <elm> at head of list anchored at <header>
*
* header - ptr to the header field in the header element
* elm - ptr to the list element to be inserted
* field - name of the link field in the list element
*/
else\
}
/*
* insert <elm> at tail of list anchored at <header>
*
* header - ptr to the header field in the header element
* elm - ptr to the list element to be inserted
* field - name of the link field in the list element
*/
else\
}
/*
* insert <elm> after <listelm> of list anchored at <header>
*
* header - ptr to the header field in the header element
* listelm - ptr to the list element at insertion point
* elm - ptr to the list element to be inserted
* field - name of the link field in the list element
*/
else\
}
/*
* insert <elm> before <listelm> of list anchored at <header>
*
* header - ptr to the header field in the header element
* listelm - ptr to list element at insertion point
* elm - ptr to the element to be inserted
* field - name of the link field in the list element
*/
else\
}
/*
* remove <elm> from list anchored at <header>
*
* header - ptr to the header field in the header element
* elm - ptr to the list element to be removed
* field - name of the link field in the list element
*/
else\
else\
}
{\
else\
}\
}
{\
else\
}\
}
/*
* orphan list element
*/
/*
* single head doubly-linked list
*
* A list is headed by a single head pointer.
* The elements are doubly linked so that an arbitrary element can be
* removed without a need to traverse the list.
* New elements can be added to the list at the head of the list, or
* after an existing element (NO insert at tail).
* A list may only be traversed in the forward direction.
* (note: the list is NULL terminated in next field.)
*
* +-----+ +->+-----+ +->+-----+ +->+-----+
* | NULL| | | h +--+ | n +----+ | NULL|
* +-----+ | +-----+ | +-----+ +-----+
* | | | p +--+ | p +--+
* | | +-----+ | +-----+ |
* +-----------------------+ |
* | |
* +-------------------------+
*/
#define LIST_HEADER(type)\
struct {\
}
#define LIST_ENTRY(type)\
struct {\
}
/*
* scan list
*
* header - ptr to the header (field in header element)
* elm - ptr to the element to be inserted
* field - name of the link field in list element
*
* struct header_container *container;
* struct header_type *header;
* struct element_type *elm;
*
* header = &container->header_field;
* for (elm = header->head; elm; elm = elm->field.next)
*/
}
}
}
}
#endif /* !_H_JFS_TYPES */