Re: request_module rehash

From: Tigran Aivazian (tigran@sco.COM)
Date: Fri Jan 14 2000 - 03:24:41 EST


On Thu, 13 Jan 2000, James Manning wrote:
> I was thinking about the cases where request_module's return
> isn't checked... isn't this broken code and the calling code
> should be checking < 0 and return'ing -ENODEV (or similar)?

No, I don't think it is broken. The programming model used here is:

  check the relevant kernel data structures looking for a feature X;
  if (the feature is not found)
    request_module("feature-X");
  again check the relevant kernel data structures looking for X;
  if (still not found)
     return -EWHATEVERAPPROPRIATEFORTHISDRIVER;

Now, if the check for the feature is more than just some flag being set,
the above code can be optimized to save the second check if superfluous:

  check the relevant kernel data structures looking for a feature X;
  if (the feature is not found)
    if (request_module("feature-X") == 0)
      again check the relevant kernel data structures looking for X;
  if (not found)
     return -EWHATEVERAPPROPRIATEFORTHISDRIVER;

see, the above does the second check only if the module successfully
loaded because there is no way for some feature to be added to the kernel
otherwise.

Therefore, to uniformly return -ENODEV would seem inappropriate, because
some places may decide to panic() if the feature is critical, others may
not even print a warning (e.g. looking for PPP compression) but just go on
working with reduced functionality.

Does this answer your question?

Regards,
------
Tigran A. Aivazian | http://www.sco.com
Escalations Research Group | tel: +44-(0)1923-813796
Santa Cruz Operation Ltd | http://www.ocston.org/~tigran

  

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:23 EST