On May 3, 2006, at 15:21, eric kustarz wrote:> There''s basically two writes that need to happen: one for time and one > for the subcommand string. The kernel just needs to make sure if a > write completes, the data is parseable (has a delimiter). Its then up > to the userland parser (zpool history) to figure out if there are > incomplete records, but the kernel guarantees it is parseable. The > userland command only prints out complete records, nothing partial. > So the userland command needs to handle if say for one "record" that > the time entry was written but the subcommand was not.I''m not clear on how the parser knows enough to do that. I believe I saw that a record looked like \0<arbitrary number of NUL-terminated strings> If this is correct, how can the parser know if a string (or part of one) got dropped? I think this might be a case where a structured record (like the compact XML suggestion made earlier) would help. At least having distinguished "start" and "end" markers (whether they be one byte each, or XML constructs) for a record looks necessary to me. --Ed
On Wed, May 03, 2006 at 03:34:56PM -0700, Ed Gould wrote:> I think this might be a case where a structured record (like the > compact XML suggestion made earlier) would help. At least having > distinguished "start" and "end" markers (whether they be one byte each, > or XML constructs) for a record looks necessary to me.NVLISTs are perfect for this...
Ed Gould wrote:> On May 3, 2006, at 15:21, eric kustarz wrote: > >> There''s basically two writes that need to happen: one for time and >> one for the subcommand string. The kernel just needs to make sure if >> a write completes, the data is parseable (has a delimiter). Its then >> up to the userland parser (zpool history) to figure out if there are >> incomplete records, but the kernel guarantees it is parseable. The >> userland command only prints out complete records, nothing partial. >> So the userland command needs to handle if say for one "record" that >> the time entry was written but the subcommand was not. > > > I''m not clear on how the parser knows enough to do that. I believe I > saw that a record looked like > > \0<arbitrary number of NUL-terminated strings> > > If this is correct, how can the parser know if a string (or part of > one) got dropped? >''\0''''t'' is the "start" marker. Read up until the next ''\0'', if the next char is not what you expected it to be then we must have had a write error, so then skip that record and read until the next "start" marker (''\0''''t''). eric> I think this might be a case where a structured record (like the > compact XML suggestion made earlier) would help. At least having > distinguished "start" and "end" markers (whether they be one byte > each, or XML constructs) for a record looks necessary to me. > > --Ed >