Hi,
On 21/8/23 12:46, aitor wrote:
> I've improved a lot the garbage collector in the `eventfs` filesystem, mounted at "/dev/metadata/udev/events/serial".
>
> Now, the removal of the consumed uevent files is done from the vdev helper "event-put.c":
>
> https://github.com/jcnelson/vdev/blob/master/vdevd/helpers/LINUX/event-put.c
>
> This binary is the responsible for propagating device events to listening processes.
>
> There are two symlinks within each "/dev/metadata/udev/events/serial/libudev-CLIENT_PID-$slot" directory: "head" and "tail".
> As soon as a new event is propagated to the queue, the already consumed event pointed by "head" is automatically removed.
> It's worth to clarify that this removal is carried out as long as "head" and "tail" aren't pointing to the same file;
> otherwise, both symlinks would end up pointing one another, in which case the eventfs filesystem crashes. Therefore, the
> latest consumed event remains there until the propagation of the next event. This is the reason why you'll find always the
> same seqnum on every `libudev-CLIENT_PID-$slot` at any time.
You can see this behaviour in the new isos of gnuinos daedalus:
https://www.gnuinos.org/mirror/daedalus/
I you query the contents of the directories at "/dev/metadata/udev/events/serial", you'll find the lastly consumed event together
with both symlinks (head and tail) pointing to it. I think that this is what Jude Nelson had in mind when he developed eventfs.
Triggering new events (for example, by plugging in a USB device) the sequence number of the file increases.
There is another new in vdev: thanks to fuse, actually libudev monitors work in non-privileged mode as well. For example, you'll
be able to run as a regular user the example "test-libudevfs.c" at the end of this article:
https://www.gnuinos.org/libudev-compat/
As it has to be.
Thus, you'll be able to query the eventfs filesystem mounted at "/dev/metadata/udev/events/serial" by opening as a regular user
your favourite file manager. In it, part of the libudev-CLIENT_PID-$slot directories will be owned by root, whereas the rest will
be owned by you.
Cheers,
Aitor.