提交 5dda4ca5 编写于 作者: P Peter Hurley 提交者: Greg Kroah-Hartman

tty: Rename tty buffer memory_used field

Trim up the memory_used field name to mem_used.
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 4d18e6ef
...@@ -89,7 +89,7 @@ void tty_buffer_unlock_exclusive(struct tty_port *port) ...@@ -89,7 +89,7 @@ void tty_buffer_unlock_exclusive(struct tty_port *port)
int tty_buffer_space_avail(struct tty_port *port) int tty_buffer_space_avail(struct tty_port *port)
{ {
int space = port->buf.mem_limit - atomic_read(&port->buf.memory_used); int space = port->buf.mem_limit - atomic_read(&port->buf.mem_used);
return max(space, 0); return max(space, 0);
} }
...@@ -129,7 +129,7 @@ void tty_buffer_free_all(struct tty_port *port) ...@@ -129,7 +129,7 @@ void tty_buffer_free_all(struct tty_port *port)
buf->head = &buf->sentinel; buf->head = &buf->sentinel;
buf->tail = &buf->sentinel; buf->tail = &buf->sentinel;
atomic_set(&buf->memory_used, 0); atomic_set(&buf->mem_used, 0);
} }
/** /**
...@@ -162,7 +162,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size) ...@@ -162,7 +162,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
/* Should possibly check if this fails for the largest buffer we /* Should possibly check if this fails for the largest buffer we
have queued and recycle that ? */ have queued and recycle that ? */
if (atomic_read(&port->buf.memory_used) > port->buf.mem_limit) if (atomic_read(&port->buf.mem_used) > port->buf.mem_limit)
return NULL; return NULL;
p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC); p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
if (p == NULL) if (p == NULL)
...@@ -170,7 +170,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size) ...@@ -170,7 +170,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
found: found:
tty_buffer_reset(p, size); tty_buffer_reset(p, size);
atomic_add(size, &port->buf.memory_used); atomic_add(size, &port->buf.mem_used);
return p; return p;
} }
...@@ -188,7 +188,7 @@ static void tty_buffer_free(struct tty_port *port, struct tty_buffer *b) ...@@ -188,7 +188,7 @@ static void tty_buffer_free(struct tty_port *port, struct tty_buffer *b)
struct tty_bufhead *buf = &port->buf; struct tty_bufhead *buf = &port->buf;
/* Dumb strategy for now - should keep some stats */ /* Dumb strategy for now - should keep some stats */
WARN_ON(atomic_sub_return(b->size, &buf->memory_used) < 0); WARN_ON(atomic_sub_return(b->size, &buf->mem_used) < 0);
if (b->size > MIN_TTYB_SIZE) if (b->size > MIN_TTYB_SIZE)
kfree(b); kfree(b);
...@@ -533,7 +533,7 @@ void tty_buffer_init(struct tty_port *port) ...@@ -533,7 +533,7 @@ void tty_buffer_init(struct tty_port *port)
buf->head = &buf->sentinel; buf->head = &buf->sentinel;
buf->tail = &buf->sentinel; buf->tail = &buf->sentinel;
init_llist_head(&buf->free); init_llist_head(&buf->free);
atomic_set(&buf->memory_used, 0); atomic_set(&buf->mem_used, 0);
atomic_set(&buf->priority, 0); atomic_set(&buf->priority, 0);
INIT_WORK(&buf->work, flush_to_ldisc); INIT_WORK(&buf->work, flush_to_ldisc);
buf->mem_limit = TTYB_DEFAULT_MEM_LIMIT; buf->mem_limit = TTYB_DEFAULT_MEM_LIMIT;
......
...@@ -60,7 +60,7 @@ struct tty_bufhead { ...@@ -60,7 +60,7 @@ struct tty_bufhead {
atomic_t priority; atomic_t priority;
struct tty_buffer sentinel; struct tty_buffer sentinel;
struct llist_head free; /* Free queue head */ struct llist_head free; /* Free queue head */
atomic_t memory_used; /* In-use buffers excluding free list */ atomic_t mem_used; /* In-use buffers excluding free list */
int mem_limit; int mem_limit;
struct tty_buffer *tail; /* Active buffer */ struct tty_buffer *tail; /* Active buffer */
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册