/* Should be called while holding line->lock (this does not modify data).  */
static int write_room(struct line *line)
/* Should be called while holding line->lock (this does not modify data).  */
static int write_room(struct line *line)
{
	int n;
	if (line->buffer == NULL)
		return LINE_BUFSIZE - 1;
	n = line->head - line->tail;
	if (n <= 0)
		n += LINE_BUFSIZE;
	return n - 1;
}