Piotr Jasiukajtis / estibi wrote: > Garrett D'Amore pisze: > >> For someone who wants to get their feet wet in the kernel, an relatively >> easy task would be to clean up some of the cases where char * is used, >> but const char * could be used instead. >> >> For example, the ddi_log_sysevent(), ddi_create_minor_node(), and >> similar interfaces take char * arguments, where const char * would be >> sufficient. (IMO, the use of char * in these things makes it harder to >> use const char * elsewhere, especially in device drivers.) >> >> Another benefit is that the compiler can do better optimizations on some >> of these routines. In places like ddi_log_sysevent() (and the >> underlying structures and code), this could add up, especially on >> particularly busy systems where a lot of sysevents are getting tossed >> around. >> >> There are probably a bunch more opportunities to cleanup char * -> const >> char *, but if anyone wants to help out here, let me know. If I don't >> hear any takers for this oss-bite-sized task (which doesn't have a CR at >> the moment, I think), I might just do it myself. >> >> -- Garrett >> > Since I hit a little deeper with the changes I have a question... > What functions I just shouldn't touch in order to not break the > compatibility with drivers? >
In general, any *argument* to a function can be made const char * (assuming that it isn't modified), but I'd avoid changing any function return from char * to const char * if they are part of the DDI. (As a general rule, if the the function has a man page, then its return value shouldn't be changed. If it doesn't have a man page, then its probably only internal to ON and it should be fine.) If you provide a list of candidate functions, I can review them. -- Garrett > > _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code