Chapter 5. Utility programs

libjf is not only a library (static and or shared), but a complete tool to develop and manage journaled applications. As seen in the previous chapter, some utility programs are supplied to help in journal management.

5.1. jf_create: journal creation

If you have to create a journal without writing your own "hello world derived application", you can use utility program jf_create. This is a usage example:

tiian@linux:~/tutorial> jf_create -j jf_tut_foo-journal -n 5
tiian@linux:~/tutorial> ls -la jf_tut_foo-journal
-rw-r--r--  1 tiian users 8278 2005-08-29 22:12 jf_tut_foo-journal
tiian@linux:~/tutorial> jf_report -j jf_tut_foo-journal
<?xml version="1.0" encoding="UTF-8"?>
<journal>
  <header magic_number='0x41524153' version='1' file_id_mask='0x38' 
      file_id_mask_shift='3' size_mask='0xffffffc0' size_mask_shift='6' 
      file_size='4194304' file_num='3' rotation_threshold='0.800' 
      ctrl_recs='36' journal_recs='32980' />
  <journaled_file_table max_files='8' number_of_files='1' 
      file_table='0x804b170'>
    <file id='0' name='jf_tut_foo-journal' last_pos='32980' last_size='0' 
        status='0' last_uc_pos='0' last_uc_size='32980' stream='0x804b008' />
  </journaled_file_table>
  <records>
  </records>
</journal>
    
a journal able to manage at least 5 journaled files has been created. Looking at the output produced by jf_report we can see the created journal can manage up to 7 (8 - 1) journaled files. First journaled file is reserved because it's the journal itself.