Re: [RFC][PATCH 1 of 4] Configfs is really sysfs

Joel Becker
2005-09-04T04:12:36Z

On Tue, Aug 30, 2005 at 04:28:46PM -0700, Andrew Morton wrote:
> Sure, but all that copying-and-pasting really sucks. I'm sure there's some
> way of providing the slightly different semantics from the same codebase?

What about the backing store? Specifically, sysfs_dirent vs
configfs_dirent.
The structures are almost identical. What's different?
configfs has a list of symlinks, as these are hard linkages and involve
pinning and reference counting. So, to merge the structures, you have
to add two pointers (a list_head) to every sysfs object.
Allocating, initializing, and freeing them really does appear to
be virtually identical. The functions that call the creation are very
different, but they could call the same thing. There are more types of
things in configfs, so all shared calls would have to be able to handle
them.
Oh, but the get_name() functions, the one that return the string
name of a _dirent, are very different. So you'd have to add another
pointer to the structure, a ->get_name() callback. That's an additional
pointer for every sysfs object.
The attach_attr() functions are different. Some of that is the
BIN_ATTR type of sysfs, which configfs doesn't and shouldn't have. In
that case, the code still works, as BIN_ATTR test wouldn't succeed.
They configure dentry_ops, which are different in sysfs and configfs.
So the API would have to change to specify the appropriate dentry_ops.
This is certainly not insurmountable. I don't know what you'd
call it, fs/libfs/backing_store.c? I'm interested in what the sysfs
folks have to say on this, and how much they'd like to help.

Joel

--

A good programming language should have features that make the
kind of people who use the phrase "software engineering" shake
their heads disapprovingly.
- Paul Graham

Joel Becker
Senior Member of Technical Staff
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127