[systemd-devel] [PATCH 2/2] tmpfiles: support globbing for w option

Dave Reisner d at falconindy.com
Fri Sep 14 08:55:43 PDT 2012


On Fri, Sep 14, 2012 at 05:41:31PM +0200, Lennart Poettering wrote:
> On Fri, 14.09.12 11:24, Dave Reisner (d at falconindy.com) wrote:
> 
> > > And they do have the same effect on most fs, except on sysfs. Now I am
> > > wondering whether this is somthing to fix in the kernel, or to just accept.
> > 
> > Sure, except sysfs isn't a filesystem with a concept of streams and
> > files like most other filesystems.
> > 
> > > Kay, Michal, you are kernel guys, what do you think about this?
> > 
> > fs/sysfs/file.c has this comment about sysfs_write_file():
> > 
> > /*
> >  * <snip>
> >  * There is no easy way for us to know if userspace is only doing a partial
> >  * write, so we don't support them. We expect the entire buffer to come
> >  * on the first write.
> >  * Hint: if you're writing a value, first read the file, modify only the
> >  * the value you're changing, then write entire buffer back.
> >  */
> 
> Well, but this is not a partial write. THis is one write with an iovec...
> 
> Lennart

It's done in multiple writes because sysfs does not implement the
aio_write file operation. The fallback is to loop over the iov segments
and write them individually. Does it really make sense to implement
aio_write for a filesystem that merely exposes variables as "files"?

If the primary use case for tmpfiles 'w' is procfs/sysfs, shouldn't we
cater to the semantics of those filesystems? Why do we even write a
trailing newline?

d


More information about the systemd-devel mailing list