On 13.06.2013 17:07, Bart Van Assche wrote:
[...]
> The "%.*s" should only copy the data provided by the user, even if it
> is not '\0' terminated. Stripping the trailing newline is probably
> possible with something like the (untested) code below (will only work
> if there is only one newline in the input string and if it's at the
> end):
> shost_printk(KERN_INFO, target->scsi_host,
> PFX "Already connected to target port %.*s\n",
> (int)count - (memchr(buf, '\n', count) ==
> buf + count - 1), buf);
I thought more like this existing message (as the input string by the
user is possibly long with a lot of configuration options):
shost_printk(KERN_DEBUG, target->scsi_host, PFX
"new target: id_ext %016llx ioc_guid %016llx pkey %04x "
"service_id %016llx dgid %pI6\n",
(unsigned long long) be64_to_cpu(target->id_ext),
(unsigned long long) be64_to_cpu(target->ioc_guid),
be16_to_cpu(target->path.pkey),
(unsigned long long) be64_to_cpu(target->service_id),
target->path.dgid.raw);
But this thing takes a lot of code lines. Perhaps this string formatting
should be put into a macro/inline function then.
Cheers,
Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html