summaryrefslogtreecommitdiff
path: root/pkg/sshfs/patch/0004-Use-struct-list_head-instead-of-GList.patch
blob: aadb3ff38d3ad31a1c4cfd56c0e7de216d423d66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 3ed67a49b1daf016a2cffaad89fdfb2b4a89892c Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Sun, 5 Jun 2016 17:30:20 -0700
Subject: [PATCH] Use struct list_head instead of GList

---
 sshfs.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/sshfs.c b/sshfs.c
index 391afdd..9c074a3 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -2090,14 +2090,14 @@ static int sshfs_req_pending(struct request *req)
 static int sftp_readdir_async(struct buffer *handle, void *buf, off_t offset,
 			     fuse_fill_dir_t filler)
 {
+	int done = 0;
 	int err = 0;
 	int outstanding = 0;
 	int max = READDIR_START;
-	GList *list = NULL;
-
-	int done = 0;
+	struct list_head list;
 
 	assert(offset == 0);
+	list_init(&list);
 	while (!done || outstanding) {
 		struct request *req;
 		struct buffer name;
@@ -2112,16 +2112,14 @@ static int sftp_readdir_async(struct buffer *handle, void *buf, off_t offset,
 				break;
 			}
 
-			list = g_list_append(list, req);
+			list_add(&req->list, &list);
 			outstanding++;
 		}
 
 		if (outstanding) {
-			GList *first;
 			/* wait for response to next request */
-			first = g_list_first(list);
-			req = first->data;
-			list = g_list_delete_link(list, first);
+			req = list_entry(list.prev, struct request, list);
+			list_del(&req->list);
 			outstanding--;
 
 			if (done) {
@@ -2160,7 +2158,7 @@ static int sftp_readdir_async(struct buffer *handle, void *buf, off_t offset,
 			}
 		}
 	}
-	assert(list == NULL);
+	assert(list_empty(&list));
 
 	return err;
 }
-- 
2.24.0