Re: [RFC, 2.6] a simple FIFO implementation
From: Paul Jackson
Date: Thu Sep 16 2004 - 11:05:23 EST
> Did you read my second patch ?
Not closely enough ... ;). Yes - your removal of 'len' does
indeed seem to have addressed Andrews key initial comment.
> 'size' field instead of an 'end'
The start, end, put, get names in that *.pdf might be a
bit quicker to read.
I suspect that more readers would come away with the right
understanding, first time, if you struct was (taken roughly
from the *.pdf, using an 'end' one bigger than *.pdf uses):
/* kfifo is empty, not full, when head == tail */
struct kfifo {
unsigned char *start; /* [start, end) */
unsigned char *end;
unsigned char *head; /* next input char goes in here */
unsigned char *tail; /* next output char comes from here */
spinlock_t lock;
};
then your structure:
struct kfifo {
unsigned int head;
unsigned int tail;
unsigned int size;
spinlock_t lock;
unsigned char *buffer;
};
Differences include names, all pointers, ordering of struct elements,
and comments. Perhaps some of these differences will look better to
you than others.
> I wonder if replacing the kfifo_get/kfifo_put implementations with
> something like:
Quite possibly.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/