Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 179347
b: refs/heads/master
c: a5b9e2c
h: refs/heads/master
i:
  179345: ee1208e
  179343: 88b1043
v: v3
  • Loading branch information
Andi Kleen authored and Linus Torvalds committed Jan 16, 2010
1 parent a0993ea commit a4f3e9b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 64ce1037c5434b1d036cd99ecaee6e00496bc2e9
refs/heads/master: a5b9e2c1063046421ce01dcf5ddd7ec12567f3e1
3 changes: 3 additions & 0 deletions trunk/include/linux/kfifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ extern unsigned int kfifo_in(struct kfifo *fifo,
const void *from, unsigned int len);
extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
void *to, unsigned int len);
extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
void *to, unsigned int len, unsigned offset);


/**
* kfifo_reset - removes the entire FIFO contents
Expand Down
21 changes: 21 additions & 0 deletions trunk/kernel/kfifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,27 @@ unsigned int kfifo_out(struct kfifo *fifo, void *to, unsigned int len)
}
EXPORT_SYMBOL(kfifo_out);

/**
* kfifo_out_peek - copy some data from the FIFO, but do not remove it
* @fifo: the fifo to be used.
* @to: where the data must be copied.
* @len: the size of the destination buffer.
* @offset: offset into the fifo
*
* This function copies at most @len bytes at @offset from the FIFO
* into the @to buffer and returns the number of copied bytes.
* The data is not removed from the FIFO.
*/
unsigned int kfifo_out_peek(struct kfifo *fifo, void *to, unsigned int len,
unsigned offset)
{
len = min(kfifo_len(fifo), len + offset);

__kfifo_out_data(fifo, to, len, offset);
return len;
}
EXPORT_SYMBOL(kfifo_out_peek);

unsigned int __kfifo_out_generic(struct kfifo *fifo,
void *to, unsigned int len, unsigned int recsize,
unsigned int *total)
Expand Down

0 comments on commit a4f3e9b

Please sign in to comment.