a code reduction function addition to cam_xpt

mjacob at freebsd.org mjacob at freebsd.org
Mon Dec 4 15:11:14 PST 2006



Was there ever a consensus about this to the point of:

a) Yes, this is a nice thing to have
b) Should it be a define or a function?

I obviously  think yes for #a. I lean toward a function. Comments?

>> > >+void                   xpt_print(struct cam_path *path, const char 
>> *fmt,
>> > >...);
>> > >  int                   xpt_path_string(struct cam_path *path, char 
>> *str,
>> > >                                        size_t str_len);
>> > >  path_id_t             xpt_path_path_id(struct cam_path *path);
>> >
>> > Would not be better a preprocessing stub?
>> >
>> > something like:
>> >
>> > #define XPT_PRINT(path, fmt, ...) do {
>> >            \
>> >              xpt_print_path(path);
>> >                      \
>> >              printf(fmt, __VA_ARGS__);
>> >                  \
>> > } while (0)
>> 
>> Why?  What is gained?  FWIW, when I added if_printif it reduced kernel
>> size by several KB.  If there's a similar effect here we should take
>> advantage of it.
>
> It is simply faster (one function calling less), even if probabilly
> this could be mitigated with -fomit-frame-pointer (IMHO, this is not
> as over used as if_printf...).
>
> Attilio
>
>
> -- 
> Peace can only be achieved by understanding - A. Einstein
>


More information about the freebsd-scsi mailing list