+ n = LINE_BUFSIZE + n; /* The other case */
+ return n - 1;
+}
+
+int line_write_room(struct tty_struct *tty)
+{
+ struct line *line = tty->driver_data;
+ unsigned long flags;
+ int room;
+
+ if (tty->stopped)
+ return 0;
+
+ spin_lock_irqsave(&line->lock, flags);
+ room = write_room(line);
+ spin_unlock_irqrestore(&line->lock, flags);
+
+ /*XXX: Warning to remove */
+ if (0 == room)
+ printk(KERN_DEBUG "%s: %s: no room left in buffer\n",
+ __FUNCTION__,tty->name);
+ return room;
+}
+
+int line_chars_in_buffer(struct tty_struct *tty)
+{
+ struct line *line = tty->driver_data;
+ unsigned long flags;
+ int ret;
+
+ spin_lock_irqsave(&line->lock, flags);
+
+ /*write_room subtracts 1 for the needed NULL, so we readd it.*/
+ ret = LINE_BUFSIZE - (write_room(line) + 1);
+ spin_unlock_irqrestore(&line->lock, flags);
+
+ return ret;