mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
sd-journal: add comments that journal_file_move_to() may break previous read data
We have already made similar mistakes several times, e.g.b8478c14c7
, andb596d06c38
. Let's document the function invalidates previously read objects.
This commit is contained in:
parent
a1640191b4
commit
df04b9ed86
@ -643,6 +643,10 @@ static int journal_file_move_to(
|
||||
assert(f);
|
||||
assert(ret);
|
||||
|
||||
/* This function may clear, overwrite, or alter previously cached entries. After this function has
|
||||
* been called, all objects except for one obtained by this function are invalidated and must be
|
||||
* re-read before use. */
|
||||
|
||||
if (size <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
@ -878,6 +882,10 @@ int journal_file_move_to_object(JournalFile *f, ObjectType type, uint64_t offset
|
||||
|
||||
assert(f);
|
||||
|
||||
/* Even if this function fails, it may clear, overwrite, or alter previously cached entries. After
|
||||
* this function has been called, all objects except for one obtained by this function are
|
||||
* invalidated and must be re-read before use.. */
|
||||
|
||||
/* Objects may only be located at multiple of 64 bit */
|
||||
if (!VALID64(offset))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||
|
Loading…
Reference in New Issue
Block a user