socsvn commit: r289915 - soc2013/def/crashdump-head/sys/kern

def at FreeBSD.org def at FreeBSD.org
Wed Aug 19 09:37:33 UTC 2015


Author: def
Date: Wed Aug 19 09:37:32 2015
New Revision: 289915
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289915

Log:
  Remember next offset instead of last offset.

Modified:
  soc2013/def/crashdump-head/sys/kern/kern_shutdown.c

Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c
==============================================================================
--- soc2013/def/crashdump-head/sys/kern/kern_shutdown.c	Wed Aug 19 09:26:37 2015	(r289914)
+++ soc2013/def/crashdump-head/sys/kern/kern_shutdown.c	Wed Aug 19 09:37:32 2015	(r289915)
@@ -151,8 +151,7 @@
 	uint8_t		kdc_iv[KERNELDUMP_IV_SIZE];
 	keyInstance	kdc_ki;
 	cipherInstance	kdc_ci;
-	off_t		kdc_lastoffset;
-	size_t		kdc_lastlength;
+	off_t		kdc_nextoffset;
 } dumpcrypto;
 
 static struct kerneldumpkey *dumpkey;
@@ -871,8 +870,7 @@
 	if (error <= 0)
 		return (EINVAL);
 
-	kdc->kdc_lastoffset = 0;
-	kdc->kdc_lastlength = 0;
+	kdc->kdc_nextoffset = 0;
 
 	di->kdc = kdc;
 	di->kdk = kdk;
@@ -1017,6 +1015,7 @@
 	struct kerneldumpcrypto *kdc;
 	int error;
 	size_t nbytes;
+	off_t nextoffset;
 
 	kdc = di->kdc;
 
@@ -1029,13 +1028,10 @@
 		return (EINVAL);
 
 	/* Data have to be written continuously. */
-	if (kdc->kdc_lastoffset != 0 &&
-	    kdc->kdc_lastoffset + kdc->kdc_lastlength != offset) {
+	if (kdc->kdc_nextoffset != 0 && kdc->kdc_nextoffset != offset)
 		return (EINVAL);
-	}
 
-	kdc->kdc_lastoffset = offset;
-	kdc->kdc_lastlength = length;
+	nextoffset = offset + (off_t)length;
 
 	while (length > 0) {
 		if (length >= sizeof(buf))
@@ -1062,6 +1058,8 @@
 		length -= nbytes;
 	}
 
+	kdc->kdc_nextoffset = nextoffset;
+
 	return (0);
 }
 #endif


More information about the svn-soc-all mailing list