LWN.net Logo

Safe seeks

Safe seeks

Posted Apr 6, 2005 16:29 UTC (Wed) by amw (subscriber, #29081)
Parent article: Safe seeks

"this patch represents a change in how device drivers should be written, but the actual API has not been changed in any incompatible ways. Unmodified drivers will still work - at least, as well as they did before."
This is not true, at least it wasn't true of my driver and neither will it be true of any other driver including the "if (ppos != &filp->f_pos) return -ESPIPE;" code fragment quoted (which I, and presumably many others orginally got from Rubini & Corbet's "Linux Device Drivers", 2nd edition, p164). Until recently, all users of my driver had 2.6.5 kernels or earlier, then someone started using 2.6.8 and my driver broke, returning Illegal Seek on every write. Now I've toned down my test to "if (*ppos != filp->f_pos) return -ESPIPE;", but you shouldn't claim that "the actual API has not been changed in any incompatible ways. Unmodified drivers will still work" when the semantics of the well established relationship between the filp & ppos arguments has changed.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds