/*
 * include/asm-s390/kl_cmp.h
 *
 * S390 version
 *   Copyright (C) 2001 IBM Deutschland Entwicklung GmbH,
 *                      IBM Corporation
 *
 * Derived from include/asm-i386/kl_cmp.h
 *   Copyright 1999 Silicon Graphics, Inc. All rights reserved.
 */
#ifndef __CMP_H
#define __CMP_H

#define DUMP_INDEX_MAGIC    0xdeadbeef
#define DUMP_INDEX_VERSION  31900
#define NUM_BUCKETS         65535

/*
 * Definitions for compressed cached reads.  I've recently lowered
 * these ... If they need to be increased later, I'll do so.
 */
#define CMP_HIGH_WATER_MARK 25
#define CMP_LOW_WATER_MARK  10

#define CMP_VM_CACHED   0x01
#define CMP_VM_UNCACHED 0x02


/*
 * This structure defines a page table entry, what each value will
 * contain.  Since these can be cached or uncached, we have a flags
 * variable to specify this.
 */
typedef struct _ptableentry {
	int          flags;                /* flags for page in cache   */
	int          length;               /* length of page            */
	int          cached;               /* cached (1 = yes, cached)  */
	paddr_t      addr;                 /* addr of page              */
	char         *data;                /* data in page              */
	struct _ptableentry *next;         /* ptr to next dump page     */
	struct _ptableentry *prev;         /* ptr to prev dump page     */
	struct _ptableentry *nextcache;    /* ptr to next cached page   */
	struct _ptableentry *prevcache;    /* ptr to prev cached page   */
} ptableentry;

/*
 * This is for the page table index from the compressed core dump.
 * This is separate from the page table entries because these are
 * simply addresses off of the compressed core dump, and not the
 * actual data from the core dump.  If we hash these values, we gain
 * a lot of performance because we only have 1 to search for the
 * page data, 1 to search for the index, and return if both searches
 * failed.
 */
typedef struct _ptableindex {
	dump_page_t dir;             /* directory entry of page         */
	paddr_t addr;                /* address of page offset          */
	off_t coreaddr;            /* address of page in core         */
	unsigned int hash;           /* hash value for this index item  */
	struct _ptableindex *next;   /* next pointer                    */
} ptableindex;

typedef struct dump_index_s {
	unsigned int magic_number;   /* dump index magic number         */
	unsigned int version_number; /* dump index version number       */
	struct timeval timebuf;      /* time of the dump                */
} dump_index_t;

extern ptableentry *cache_head;
extern ptableentry *cache_tail;

#endif
