On Fri, 2011-02-11 at 22:25 +0200, Martin Paljak wrote: > >>>> Furthermore, any cardmod adjustments can be implemented and isolated > >>>> with ifdef-s, > >>> > >>> The only #ifdef ENABLED_CARDMOD left is in ctx, and that could easily be > >>> removed as it tests the app_name for "cardmod" (The cardmod/Makefile.am > >>> has one to compile or not.) That test for the app_name is needed today > >>> because of the way the readers are initialized, and the cardmod looks > >>> like a separate driver. This could change if the mods were merged better > >>> in reader-pcsc.c > >> > >> As you said above, "The cardmod modifications to > >> reader-pcsc for the most part turn off all these features, so they don't > >> get accidentally executed and cause problems.". > >> > >> > >> #ifdef-s in reader-pcsc.c are OK to assure those limitations. > >> But those ifdef-s only should exist in reader-pcsc.c, as the only reader > >> driver the minidriver will know about is the pcsc driver. And to make it > >> very sure, if the codebase is compiled to produce minidriver DLL, the > >> extra ifdef-s will guarantee that those restrictions are enforced > >> (actually it should be assured by the minidriver code that nothing gets > >> called that would "confuse" reader-pcsc.c) > >> > > > > I would still assume that the first thing a combined driver would do > > would be to set a "use_provided_readers" or "cardmod_mode" flag so > > "#ifdef"s are not used, but "if" statements are. > > > > This would allow the same build to be used for both cardmod and pkcs#11. > > If-s should suffice, I assume the same. Eventually #ifdef-s and a separate > compile could probably allow to reduce the overall binary dll size even more.
BTW: There was a _standalone_ reader-cardmod.c proposed on Monday. It uses the 'init' function to pass in the handles. Making 'init' a stub and using its body for the new 'use_reader' function should be enough to make it work with current trunk. The only thing that could be shared with the original reader-pcsc.c is 'transmit'. And even that could be re-written from scratch if closer coupling to the underlying platform is required. Regards Andre http://www.opensc-project.org/pipermail/opensc-devel/2011-February/015910.html http://www.opensc-project.org/pipermail/opensc-devel/attachments/20110207/5b57cb23/attachment-0001.c _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel