All of lore.kernel.org
 help / color / mirror / Atom feed
* mtdoops: find_next_position() explained?
@ 2011-04-15  9:54 Rick Ramstetter
  0 siblings, 0 replies; only message in thread
From: Rick Ramstetter @ 2011-04-15  9:54 UTC (permalink / raw)
  To: linux-mtd

Hello,

Can anyone explain the logic behind the following block of code from
mtdoops' find_next_position()?

+	for (page = 0; page < cxt->oops_pages; page++) {
+		mtd->read(mtd, page * OOPS_PAGE_SIZE, 4, &retlen, (u_char *) &count);
+		if (count == 0xffffffff)
+			continue;
+		if (maxcount == 0xffffffff) {
+			maxcount = count;
+			maxpos = page;
+		} else if ((count < 0x40000000) && (maxcount > 0xc0000000)) {
+			maxcount = count;
+			maxpos = page;
+		} else if ((count > maxcount) && (count < 0xc0000000)) {
+			maxcount = count;
+			maxpos = page;
+		} else if ((count > maxcount) && (count > 0xc0000000)
+					&& (maxcount > 0x80000000)) {
+			maxcount = count;
+			maxpos = page;
+		}


I expected to see something along the lines of the following:
+		if (maxcount == 0xffffffff || count > maxcount) {
+			maxcount = count;
+			maxpos = page;
+		}


Thank you,
-Rick

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-15  9:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-15  9:54 mtdoops: find_next_position() explained? Rick Ramstetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.