Author: adrian.chadd
Date: Fri Jul 17 00:08:00 2009
New Revision: 14202
Modified:
playpen/LUSCA_HEAD_storework/libsqstore/rebuild_entry.c
playpen/LUSCA_HEAD_storework/libsqstore/rebuild_entry.h
Log:
Add a function to write a swaplog ADD entry to the given FD
Modified: playpen/LUSCA_HEAD_storework/libsqstore/rebuild_entry.c
==============================================================================
--- playpen/LUSCA_HEAD_storework/libsqstore/rebuild_entry.c (original)
+++ playpen/LUSCA_HEAD_storework/libsqstore/rebuild_entry.c Fri Jul 17
00:08:00 2009
@@ -109,3 +109,24 @@
tlv_free(tlv_list);
return (parsed > 1);
}
+
+int
+write_swaplog_entry(int fd, rebuild_entry_t *re)
+{
+ storeSwapLogData sd;
+
+ sd.op = SWAP_LOG_ADD;
+ sd.swap_filen = re->swap_filen;
+ sd.timestamp = re->mi.timestamp;
+ sd.lastref = re->mi.lastref;
+ sd.expires = re->mi.expires;
+ sd.lastmod = re->mi.lastmod;
+ sd.swap_file_sz = re->file_size;
+ sd.refcount = re->mi.refcount;
+ sd.flags = re->mi.flags;
+
+ memcpy(&sd.key, re->md5_key, sizeof(sd.key));
+ if (write(fd, &sd, sizeof(sd)) <= 0)
+ return 0;
+ return 1;
+}
Modified: playpen/LUSCA_HEAD_storework/libsqstore/rebuild_entry.h
==============================================================================
--- playpen/LUSCA_HEAD_storework/libsqstore/rebuild_entry.h (original)
+++ playpen/LUSCA_HEAD_storework/libsqstore/rebuild_entry.h Fri Jul 17
00:08:00 2009
@@ -16,6 +16,6 @@
extern void rebuild_entry_done(rebuild_entry_t *re);
extern void rebuild_entry_init(rebuild_entry_t *re);
extern int parse_header(char *buf, int len, rebuild_entry_t *re);
-
+extern int write_swaplog_entry(int fd, rebuild_entry_t *re);
#endif
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---