fs/pipe: express 'pipe_empty()' in terms of 'pipe_occupancy()'
That's what 'pipe_full()' does, so it's more consistent. But more importantly it gets the type limits right when the pipe head and tail are no longer necessarily 'unsigned int'. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
848e076317
commit
74d42bdb3a
1 changed files with 10 additions and 10 deletions
|
@ -176,16 +176,6 @@ static inline bool pipe_has_watch_queue(const struct pipe_inode_info *pipe)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* pipe_empty - Return true if the pipe is empty
|
||||
* @head: The pipe ring head pointer
|
||||
* @tail: The pipe ring tail pointer
|
||||
*/
|
||||
static inline bool pipe_empty(unsigned int head, unsigned int tail)
|
||||
{
|
||||
return head == tail;
|
||||
}
|
||||
|
||||
/**
|
||||
* pipe_occupancy - Return number of slots used in the pipe
|
||||
* @head: The pipe ring head pointer
|
||||
|
@ -196,6 +186,16 @@ static inline unsigned int pipe_occupancy(unsigned int head, unsigned int tail)
|
|||
return (pipe_index_t)(head - tail);
|
||||
}
|
||||
|
||||
/**
|
||||
* pipe_empty - Return true if the pipe is empty
|
||||
* @head: The pipe ring head pointer
|
||||
* @tail: The pipe ring tail pointer
|
||||
*/
|
||||
static inline bool pipe_empty(unsigned int head, unsigned int tail)
|
||||
{
|
||||
return !pipe_occupancy(head, tail);
|
||||
}
|
||||
|
||||
/**
|
||||
* pipe_full - Return true if the pipe is full
|
||||
* @head: The pipe ring head pointer
|
||||
|
|
Loading…
Add table
Reference in a new issue