Sidebar to smbmount patch (re mutating structs)
David Collier-Brown
David.Collier-Brown at canada.sun.com
Mon Jul 17 12:38:37 GMT 2000
Urban Widmark wrote:
> One of the problems I would like to fix is the dependency between the
> kernel sources (includes) and smbmount.
[description snipped]
At the binary level, it's fairly straightforward to
deal with callers passing in both "old" and "new"
formats of struct: just labourious.
> If smbmount is not changed and compiled vs new sources the problem is that
> smbmount sends a version 7 struct with only the version 6 fields
> initialized (it would be fine if it set the version to 6, but it grabs the
> kernel define which now says 7 ...). smbfs can't know this and will fail.
[anyone interested send me email: I have a paper
from my Multics days on the subject I can scan or
type in]
However, at the source level, there is a question as to
whether you really want to do so. I assume you wish
to be able to support smbmount in version x.y and x.y+1
of Linux (or Solaris, or whatever), and at some later
date phase out obsolescent versions.
However, this is "breaking the contract" between the
producer and the consumer of the struct, and is one of
the things one tries not to do. After banging their
heads against this for a while, the affected multicians
seem to have come to a consensus that
1. evolution WILL happen (which is trivially true)
2. if you don't evolve, you have to use the sources
for the old version, and forego the benefits of
the new version.
The result of this is a slow, steady migration forward,
and a limit on the need for the developers to bugfix
old versions in parallell with new versions,
Bugfixing old version while developing new ones is something
that developers generally get told to do by pointy-haired
managers, and cordially hate (;-))
So I reccomend that smbmount version x.y+1 be #ifdef'd
so as to require version 7 structs, and produce a
message explaining this requirement. In Slolaris cpp,
this would be:
#if version != 7
#error "This programs requires a version 7 fs_t struct \
which is available in Linux x.y and later. For Linux \
x.y-1 or earlier, use version m.n of this program."
#endif
--dave
--
David Collier-Brown, | Always do right. This will gratify some people
185 Ellerslie Ave., | and astonish the rest. -- Mark Twain
Willowdale, Ontario | //www.oreilly.com/catalog/samba/author.html
Work: (905) 415-2849 Home: (416) 223-8968 Email: davecb at canada.sun.com
More information about the samba-technical
mailing list