Author: adrian.chadd
Date: Sun May 3 07:48:02 2009
New Revision: 14033
Modified:
branches/LUSCA_HEAD/tools/ufs_log_cat.c
Log:
Print the standardised object to stdout if its somewhat validish. :)
Modified: branches/LUSCA_HEAD/tools/ufs_log_cat.c
==============================================================================
--- branches/LUSCA_HEAD/tools/ufs_log_cat.c (original)
+++ branches/LUSCA_HEAD/tools/ufs_log_cat.c Sun May 3 07:48:02 2009
@@ -52,6 +52,7 @@
{
int r;
char buf[128];
+ storeSwapLogData sd;
size_t s = -1;
if (version == 1) {
@@ -68,8 +69,20 @@
num_objects++;
/* Decode the entry */
+ if (version == 1) {
+ memcpy(&sd, buf, sizeof(sd));
+ } else {
+ (void) storeSwapLogUpgradeEntry(&sd, (storeSwapLogDataOld *)
buf);
+ }
- /* Good? Echo it */
+ /* is it an ADD/DEL? Good. If not - count error and continue */
+ if (sd.op == SWAP_LOG_ADD || sd.op == SWAP_LOG_DEL) {
+ num_valid_objects++;
+ write(1, &sd, sizeof(sd));
+ } else {
+ debug(1, 5) ("error! Got swaplog entry op %d?!\n", sd.op);
+ num_invalid_objects++;
+ }
return 1;
}
@@ -125,6 +138,9 @@
version = 0;
#endif
}
+
+ /* begin echo'ing the log info */
+ storeSwapLogPrintHeader(1); /* to stdout */
/* Now - loop over until eof or error */
while (! feof(fp)) {
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---