LWN.net Logo

A new API for kfifo?

A new API for kfifo?

Posted Aug 20, 2009 9:29 UTC (Thu) by stefani (subscriber, #5846)
Parent article: A new API for kfifo?

About the record handling:

The record functions supports three kinds of record types:

- Records with a fixed size of bytes
- Records with a variable length between 0 and 255 bytes
- Records with a variable length between 0 and 65535 bytes

The return value of the record handling functions is well thought, because it makes it much easier to determinate if the function fails:

- 0 means everything is okay
- a return value lower or equal then the passed length means that the copy_*_user() function has failed
- a value greater the passed length means the record does not fit into the destination buffer/fifo.

It makes no sense to cut off a record, so a return value not equal 0 signals a failure.

Add the *total pointer to the record out functions makes sense, if using variable length records. There must be a way to return the length of the processed record, otherwise the caller don't know the size of the variable length record. You can set the *total pointer to NULL if this value is not requiered.

BTW: Stefani is a girls name, so he is she ;-)


(Log in to post comments)

A new API for kfifo?

Posted Aug 20, 2009 13:24 UTC (Thu) by jake (editor, #205) [Link]

> BTW: Stefani is a girls name, so he is she ;-)

Oh my. I am terribly sorry about that. Fixed now.

Thanks!

jake

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds