RE: [PATCH v2 1/2] pkt-line: add packet_writel() and packet_read_line_gently()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Torsten Bögershausen [mailto:tboegi@xxxxxx]
> 
> 
> Does this work ?
> I would have expected
> packet_writel(fd, "line one", "line two", "line n"), NULL;
> 

No, that's actually not valid C syntax.

> >
> > which requires the use of variable number of arguments.  With your
> proposal that convenience is lost as you have to create an array of strings
> and pass that instead.  The usage just isn't as simple as the current model.
> >
> What is wrong with
> 
> int packet_write_fmt_gently(int fd, const char *fmt, ...) and we use it like
> this:
> if packet_write_fmt_gently(fd, "%s%s%s", "line one", "line two", "line n")
> 

Packets are not just strings; see pkt-line.h for more details but basically they are a length packet, followed by the data (in this particular case a string).  The packet_writel function is a convenience function to write out a variable number of packetized strings followed by a flush packet.  You're sample above would simply concatenate the three strings and then write a single packet.  A very different outcome. :)

> 
> 
> (Or do we need another one like)
> int packet_write_fmt_gently_flush(int fd, const char *fmt, ...)
> 
> Sorry if I am lost here




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]