The unified diff between revisions [484483bf..] and [41da8c69..] is displayed below. It can also be downloaded as a raw diff.
#
#
# add_file "src/dump_storelog.c"
# content [e708a55bd0b15c97772181795c78eef592323abe]
#
============================================================
--- src/dump_storelog.c e708a55bd0b15c97772181795c78eef592323abe
+++ src/dump_storelog.c e708a55bd0b15c97772181795c78eef592323abe
@@ -0,0 +1,60 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "squid.h"
+
+
+void
+usage(void)
+{
+ printf("ERROR: I need the path to the swap log!\n");
+ exit(1);
+}
+
+#define NUMPERGO 1024
+
+void
+parse_store_records(storeSwapLogData *s, int num)
+{
+ int i;
+ printf("read %d records\n", num);
+ for (i = 0; i < num; i++) {
+#if 0
+ printf("Object: Op %s, lastref %d, timestamp %d, size %d, lastmod %d\n",
+ swap_log_op_str[(int)s[i].op],
+ (int) s[i].lastref,
+ (int) s[i].timestamp,
+ (int) s[i].swap_file_sz,
+ (int) s[i].lastmod);
+#endif
+ printf("%d\n", s[i].swap_file_sz);
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ storeSwapLogData s[NUMPERGO];
+ size_t ss = sizeof(s);
+ int fd, retval;
+
+ if (argc < 2) {
+ usage();
+ }
+ printf("NOTICE: opening: %s\n", argv[1]);
+ fd = open(argv[1], O_RDONLY);
+ if (fd < 0) {
+ perror("open");
+ exit(1);
+ }
+ do {
+ retval = read(fd, s, ss);
+ if (retval <= 0)
+ break;
+ parse_store_records(s, retval / sizeof(storeSwapLogData));
+ } while (retval > 0);
+
+ close(fd);
+ exit(0);
+}