![]() |
![]() |
![]() |
atomic-install Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <atomic-install/journal.h> typedef ai_journal_t; int ai_journal_create (const char *journal_path
,const char *location
); int ai_journal_open (const char *journal_path
,ai_journal_t *ret
); int ai_journal_close (ai_journal_t j
); int ai_journal_get_maxpathlen (ai_journal_t j
); const char * ai_journal_get_filename_prefix (ai_journal_t j
); typedef ai_journal_file_t; ai_journal_file_t * ai_journal_get_files (ai_journal_t j
); ai_journal_file_t * ai_journal_file_next (ai_journal_file_t *f
); unsigned char ai_journal_file_flags (ai_journal_file_t *f
); int ai_journal_file_set_flag (ai_journal_file_t *f
,unsigned char new_flag
); const char * ai_journal_file_name (ai_journal_file_t *f
); const char * ai_journal_file_path (ai_journal_file_t *f
); unsigned long int ai_journal_get_flags (ai_journal_t j
); int ai_journal_set_flag (ai_journal_t j
,unsigned long int new_flag
);
typedef struct ai_journal *ai_journal_t;
The type describing an open journal. Returned by ai_journal_open()
; when done
with it, pass to ai_journal_close()
.
int ai_journal_create (const char *journal_path
,const char *location
);
Create a new journal file and fill it with files from source tree location
.
This function doesn't open the newly-created journal; for that, use
ai_journal_open()
afterwards.
|
path for the new journal file |
|
source tree location |
Returns : |
0 on success, errno otherwise |
int ai_journal_open (const char *journal_path
,ai_journal_t *ret
);
Open the journal file at journal_path
and put ai_journal_t for it at
location pointed by ret
. Note that ret
may be modified even if this
function fails (e.g. when journal contents are invalid).
|
path to the journal file |
|
location to store new ai_journal_t |
Returns : |
0 on success, errno otherwise |
int ai_journal_close (ai_journal_t j
);
Close the journal file.
|
an open journal |
Returns : |
0 on success, errno otherwise (very unlikely) |
int ai_journal_get_maxpathlen (ai_journal_t j
);
Get the maximum path length for files within the journal. This is the length
of ai_journal_file_path()
+ ai_journal_file_name()
for the longest path in
the journal. This variable can be used to allocate buffer quickly.
|
an open journal |
Returns : |
maximum path length |
const char * ai_journal_get_filename_prefix (ai_journal_t j
);
Get the random prefix used for temporary files associated with this journal (session).
|
an open journal |
Returns : |
a pointer to null-terminated prefix in the journal |
typedef char ai_journal_file_t;
The type describing a single file in the journal. Used via a pointer.
ai_journal_file_t * ai_journal_get_files (ai_journal_t j
);
Get the pointer to the first file in journal.
|
an open journal |
Returns : |
a pointer to ai_journal_file_t, or NULL if no files |
ai_journal_file_t * ai_journal_file_next (ai_journal_file_t *f
);
Get the pointer to the next file in journal.
|
the current file |
Returns : |
a pointer to ai_journal_file_t, or NULL if f is last |
unsigned char ai_journal_file_flags (ai_journal_file_t *f
);
Get flags for the specified file.
|
the file |
Returns : |
an 8-bit flag field contents |
int ai_journal_file_set_flag (ai_journal_file_t *f
,unsigned char new_flag
);
Set specified flag for the file.
|
the file |
|
bitfield for new flags to set |
Returns : |
0 on success, errno otherwise |
const char * ai_journal_file_name (ai_journal_file_t *f
);
Get the filename part of file path.
|
the file |
Returns : |
a pointer to static, null-terminated filename inside journal |
const char * ai_journal_file_path (ai_journal_file_t *f
);
Get the directory part of file path. The path is guaranteed to have a trailing slash, i.e. files in root directory will return '/'.
|
the file |
Returns : |
a pointer to static, null-terminated path inside journal |
unsigned long int ai_journal_get_flags (ai_journal_t j
);
Get global journal flags.
|
an open journal |
Returns : |
a 32-bit flag field contents |
int ai_journal_set_flag (ai_journal_t j
,unsigned long int new_flag
);
Set specified flag for the journal. The journal will be synced to disk afterwards.
|
an open journal |
|
bitfield for new flags to set |
Returns : |
0 on success, errno otherwise |