summaryrefslogtreecommitdiff
path: root/drivers/s390/char/raw3270.h
diff options
context:
space:
mode:
authorSven Schnelle <svens@linux.ibm.com>2022-11-28 13:34:52 +0300
committerHeiko Carstens <hca@linux.ibm.com>2023-01-09 16:34:01 +0300
commit76485078702ae680c9683500ad9caafea05678b1 (patch)
treedf557c6cf1e5238204dada23794ce2f2984a5705 /drivers/s390/char/raw3270.h
parent164eb669348045894b50eaecc5936ec07b4307f0 (diff)
downloadlinux-76485078702ae680c9683500ad9caafea05678b1.tar.xz
s390/con3270: rewrite command line recalling
Command line recalling is the last user of the 3270 custom malloc() like allocator. Remove this dependency by using a statically allocated buffer for the saved command lines, and also remove the allocator. Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Tested-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'drivers/s390/char/raw3270.h')
-rw-r--r--drivers/s390/char/raw3270.h79
1 files changed, 0 insertions, 79 deletions
diff --git a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h
index 5ca1af6df935..19f2bc1ee72e 100644
--- a/drivers/s390/char/raw3270.h
+++ b/drivers/s390/char/raw3270.h
@@ -213,82 +213,3 @@ struct raw3270_notifier {
int raw3270_register_notifier(struct raw3270_notifier *);
void raw3270_unregister_notifier(struct raw3270_notifier *);
-/*
- * Little memory allocator for string objects.
- */
-struct string
-{
- struct list_head list;
- unsigned long size;
- unsigned long len;
- char string[];
-} __attribute__ ((aligned(8)));
-
-static inline struct string *
-alloc_string(struct list_head *free_list, unsigned long len)
-{
- struct string *cs, *tmp;
- unsigned long size;
-
- size = (len + 7L) & -8L;
- list_for_each_entry(cs, free_list, list) {
- if (cs->size < size)
- continue;
- if (cs->size > size + sizeof(struct string)) {
- char *endaddr = (char *) (cs + 1) + cs->size;
- tmp = (struct string *) (endaddr - size) - 1;
- tmp->size = size;
- cs->size -= size + sizeof(struct string);
- cs = tmp;
- } else
- list_del(&cs->list);
- cs->len = len;
- INIT_LIST_HEAD(&cs->list);
- return cs;
- }
- return NULL;
-}
-
-static inline unsigned long
-free_string(struct list_head *free_list, struct string *cs)
-{
- struct string *tmp;
- struct list_head *p, *left;
-
- /* Find out the left neighbour in free memory list. */
- left = free_list;
- list_for_each(p, free_list) {
- if (list_entry(p, struct string, list) > cs)
- break;
- left = p;
- }
- /* Try to merge with right neighbour = next element from left. */
- if (left->next != free_list) {
- tmp = list_entry(left->next, struct string, list);
- if ((char *) (cs + 1) + cs->size == (char *) tmp) {
- list_del(&tmp->list);
- cs->size += tmp->size + sizeof(struct string);
- }
- }
- /* Try to merge with left neighbour. */
- if (left != free_list) {
- tmp = list_entry(left, struct string, list);
- if ((char *) (tmp + 1) + tmp->size == (char *) cs) {
- tmp->size += cs->size + sizeof(struct string);
- return tmp->size;
- }
- }
- __list_add(&cs->list, left, left->next);
- return cs->size;
-}
-
-static inline void
-add_string_memory(struct list_head *free_list, void *mem, unsigned long size)
-{
- struct string *cs;
-
- cs = (struct string *) mem;
- cs->size = size - sizeof(struct string);
- free_string(free_list, cs);
-}
-