Hi,<br>Sorry for the late reply. Yes, I want to display the checksums of files in /boot which have been modified within the last 10 minutes, and I want to do that in C. Thank you very much for pointing me to the right direction, and thank you for always be so helpful.<br>
<br>Best regards,<br>Wahid<br><br><br><div class="gmail_quote">On Tue, Mar 5, 2013 at 6:25 PM, Richard W.M. Jones <span dir="ltr"><<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Mar 05, 2013 at 05:04:05PM +0100, Khan Ferdous Wahid wrote:<br>
> I have upgraded my kernel as you mentioned and everything is fine<br>
> now. I wrote the following code to check the integrity of /boot<br>
> directory in guest image. Now my question is- how could I check the<br>
> integrity of files that are modified in last 10 minutes inside /boot<br>
> directory? I use boot directory as an example directory.<br>
<br>
</div>AIUI you want to display the checksums of files in /boot which have<br>
been modified within the last 10 minutes?  Recursively or just to<br>
/boot directory without subdirectories?<br>
<br>
The easiest way is:<br>
<br>
  virt-ls -lR -a disk --checksum --time-relative /boot | awk '$6 <= 10*60'<br>
<br>
If you want to do that in C instead of using virt-ls, then take a look<br>
at the source of virt-ls -- it is written in C.  A good place to start<br>
would be here:<br>
<br>
  <a href="https://github.com/libguestfs/libguestfs/blob/master/cat/virt-ls.c#L443" target="_blank">https://github.com/libguestfs/libguestfs/blob/master/cat/virt-ls.c#L443</a><br>
<br>
especially the functions 'visit', 'show_file' and 'do_ls_lR'.<br>
<br>
I would caution you that the 'visit' function shown above would have<br>
trouble with very large directories *if* using libguestfs < 1.20.<br>
These bugs were fixed in libguestfs 1.20 and above.<br>
<div class="im"><br>
Rich.<br>
<br>
--<br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" target="_blank">http://people.redhat.com/~rjones</a><br>
</div>virt-p2v converts physical machines to virtual machines.  Boot with a<br>
live CD or over the network (PXE) and turn machines into KVM guests.<br>
<a href="http://libguestfs.org/virt-v2v" target="_blank">http://libguestfs.org/virt-v2v</a><br>
</blockquote></div><br>