[Patch v3 4/7] set vmcoreinfo for kcore

bhe at redhat.com bhe at redhat.com
Tue Aug 12 03:08:50 PDT 2014


On 08/01/14 at 07:12am, Atsushi Kumagai wrote:

> >+#define UNINITIALIZED  ((ulong)(-1))
> >+int set_kcore_vmcoreinfo(uint64_t vmcoreinfo_addr, uint64_t vmcoreinfo_len)
> >+{
> >+	int i;
> >+	ulong kvaddr;
> >+	off_t offset;
> >+	char note[MAX_SIZE_NHDR];
> >+	int size_desc;
> >+	off_t offset_desc;
> >+
......
> >+
> >+	if (offset == UNINITIALIZED){
> >+		ERRMSG("Can't seek the dump memory(%s). %s\n",
> >+		    name_memory, strerror(errno));
> >+		return FALSE;
> >+	}
> >+
> >+        if (lseek(fd_memory, offset, SEEK_SET) != offset){
> >+		ERRMSG("Can't seek the dump memory(%s). %s\n",
> >+		    name_memory, strerror(errno));
> >+		return FALSE;
> >+	}
> 
> These two error messages are the same, they aren't helpful for debugging.
> I think the former should be like "Can't get the offset of VMCOREINFO".

Yeah, great idea, will change.


> >+/* Returns the physical address of start of crash notes buffer for a kernel. */
> >+static int get_sys_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len)
> >+{
> 
> This function just return the result status, so please use TRUE or FALSE
> as the return value instead of 0 or -1.

Will do.

> 

> >+	if (!(fp = fopen("/sys/kernel/vmcoreinfo", "r")))
> >+		return -1;
> >+
> >+	if (!fgets(line, sizeof(line), fp))
> >+		ERRMSG("Cannot parse %s: %s\n", "/sys/kernel/vmcoreinfo", strerror(errno));
> >+	count = sscanf(line, "%Lx %Lx", &temp, &temp2);
> >+	if (count != 2)
> >+		ERRMSG("Cannot parse %s: %s\n", "/sys/kernel/vmcoreinfo", strerror(errno));
> 
> The messages are the same, too.

Will change.

> 
> 
> Thanks
> Atsushi Kumagai
> 



More information about the kexec mailing list