Author: adrian.chadd
Date: Sat May 2 20:41:47 2009
New Revision: 14022
Modified:
branches/LUSCA_HEAD/tools/ufsdump.c
Log:
Migrate ufsdump to use the store log API header printing code;
update the code to use the file number in the log printing.
Modified: branches/LUSCA_HEAD/tools/ufsdump.c
==============================================================================
--- branches/LUSCA_HEAD/tools/ufsdump.c (original)
+++ branches/LUSCA_HEAD/tools/ufsdump.c Sat May 2 20:41:47 2009
@@ -55,6 +55,7 @@
char *storeurl;
squid_file_sz file_size; /* swap file size - object size
+ metadata */
int hdr_size; /* metadata size */
+ int swap_filen;
};
typedef struct _rebuild_entry rebuild_entry_t;
@@ -72,6 +73,7 @@
bzero(re, sizeof(*re));
re->hdr_size = -1;
re->file_size = -1;
+ re->swap_filen = -1;
}
const char *
@@ -177,7 +179,7 @@
storeSwapLogData sd;
sd.op = SWAP_LOG_ADD;
- sd.swap_filen = 0x12345678; /* XXX this should be based on
the filename
*/
+ sd.swap_filen = re->swap_filen;
sd.timestamp = re->mi.timestamp;
sd.lastref = re->mi.lastref;
sd.expires = re->mi.expires;
@@ -238,6 +240,7 @@
rebuild_entry_init(&re);
(void) read_file(path, &re);
+ re.swap_filen = fn;
(void) write_swaplog_entry(&re);
rebuild_entry_done(&re);
@@ -247,19 +250,6 @@
}
}
-void
-print_header(store_ufs_dir_t *ud, int fd)
-{
- char buf[sizeof(storeSwapLogData)];
- storeSwapLogHeader *sh = (storeSwapLogHeader *) buf;
-
- bzero(buf, sizeof(buf));
- sh->op = SWAP_LOG_VERSION;
- sh->version = 1;
- sh->record_size = sizeof(storeSwapLogData);
- write(1, sh, sizeof(storeSwapLogData));
-}
-
int
main(int argc, char *argv[])
{
@@ -276,8 +266,8 @@
store_ufs_init(&store_ufs_info, argv[1], atoi(argv[2]), atoi(argv[3]));
- /* Output swap header */
- print_header(&store_ufs_info, 1);
+ /* Output swap header to stdout */
+ (void) storeSwapLogPrintHeader(1);
read_dir(&store_ufs_info);
store_ufs_done(&store_ufs_info);
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---