File: s390_dump.c

package info (click to toggle)
crash 7.0.8-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 36,348 kB
  • ctags: 13,100
  • sloc: ansic: 135,839; makefile: 495
file content (110 lines) | stat: -rwxr-xr-x 2,123 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* s390_dump.c - core analysis suite
 *
 * Copyright (C) 2001, 2002 Mission Critical Linux, Inc.
 * Copyright (C) 2002, 2003, 2004, 2005, 2006 David Anderson
 * Copyright (C) 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. All rights reserved.
 * Copyright (C) 2005 Michael Holzheu, IBM Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 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.
 */
#include "defs.h"
//#include <asm/page.h>
#include "ibm_common.h"

static FILE * s390_file;

int 
is_s390_dump(char *file) 
{
	FILE* fh;
	long long int magic;
	size_t items ATTRIBUTE_UNUSED;
	int rc;

	fh = fopen(file,"r");
	items = fread(&magic, sizeof(magic), 1,fh);
	if(magic == 0xa8190173618f23fdLL)
		rc = TRUE;
	else
		rc = FALSE;
	fclose(fh);
	return rc;
}

FILE*
s390_dump_init(char *file)
{
        if ((s390_file = fopen(file, "r+")) == NULL) {
		if ((s390_file = fopen(file, "r")) == NULL)
			return NULL;
	}

	return s390_file;
}

int
read_s390_dumpfile(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
{
	paddr += S390_DUMP_HEADER_SIZE;

        if (fseek(s390_file, (ulong)paddr, SEEK_SET) != 0) 
		return SEEK_ERROR;

        if (fread(bufptr, 1 , cnt, s390_file) != cnt) 
		return READ_ERROR;

	return 0;
}

int
write_s390_dumpfile(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
{
	return WRITE_ERROR;
}

#define S390_PAGE_SHIFT   12
#define S390_PAGE_SIZE    (1UL << S390_PAGE_SHIFT)

uint
s390_page_size(void)
{
	return S390_PAGE_SIZE;
}

int 
s390_memory_used(void)
{
	return 0;
}

int 
s390_free_memory(void)
{
	return 0;
}

int 
s390_memory_dump(FILE *fp)
{
	return 0;
}

ulong 
get_s390_panic_task(void)
{
	return BADVAL;
}

void 
get_s390_panicmsg(char *buf)
{
	return;
}