on circular files and an extension to truncate()
From: porte64
Date: Wed Mar 18 2009 - 07:15:36 EST
Hello,
How about extending the truncate() system call to enable
truncating files from the beginning also ?
This would be useful to help handle history files (logs ...).
One step further -- and i guess many people have already
thought about this:
Circular files could be introduced. I mean files whose
size remains fixed when written to, with the data wrapping
in a circular fashion. This would typically require an
additionnal position parameter ("cursor offset") in userland
stat_t structures.
So circular files would be a sub-category of regular files,
where the write() system call has special handling and updates
the cursor offset.
One advantage of such an implementation is that is would not
depend on the filesystem, and would help in many applications
in which big amounts of data is copied to another file.
I have poor knowledge of the linux kernel so i cannot see
if this suggestion has annoying side-effects and/or
poses compatibility issues.
However, the weaker idea of implementing truncate() with the
possibility to discard data at the beginning of files, then
extending the file, would help a lot.
Phil
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/