logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0004-Use-struct-list_head-instead-of-GList.patch (1559B)


  1. From 3ed67a49b1daf016a2cffaad89fdfb2b4a89892c Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Sun, 5 Jun 2016 17:30:20 -0700
  4. Subject: [PATCH] Use struct list_head instead of GList
  5. ---
  6. sshfs.c | 16 +++++++---------
  7. 1 file changed, 7 insertions(+), 9 deletions(-)
  8. diff --git a/sshfs.c b/sshfs.c
  9. index 391afdd..9c074a3 100644
  10. --- a/sshfs.c
  11. +++ b/sshfs.c
  12. @@ -2090,14 +2090,14 @@ static int sshfs_req_pending(struct request *req)
  13. static int sftp_readdir_async(struct buffer *handle, void *buf, off_t offset,
  14. fuse_fill_dir_t filler)
  15. {
  16. + int done = 0;
  17. int err = 0;
  18. int outstanding = 0;
  19. int max = READDIR_START;
  20. - GList *list = NULL;
  21. -
  22. - int done = 0;
  23. + struct list_head list;
  24. assert(offset == 0);
  25. + list_init(&list);
  26. while (!done || outstanding) {
  27. struct request *req;
  28. struct buffer name;
  29. @@ -2112,16 +2112,14 @@ static int sftp_readdir_async(struct buffer *handle, void *buf, off_t offset,
  30. break;
  31. }
  32. - list = g_list_append(list, req);
  33. + list_add(&req->list, &list);
  34. outstanding++;
  35. }
  36. if (outstanding) {
  37. - GList *first;
  38. /* wait for response to next request */
  39. - first = g_list_first(list);
  40. - req = first->data;
  41. - list = g_list_delete_link(list, first);
  42. + req = list_entry(list.prev, struct request, list);
  43. + list_del(&req->list);
  44. outstanding--;
  45. if (done) {
  46. @@ -2160,7 +2158,7 @@ static int sftp_readdir_async(struct buffer *handle, void *buf, off_t offset,
  47. }
  48. }
  49. }
  50. - assert(list == NULL);
  51. + assert(list_empty(&list));
  52. return err;
  53. }
  54. --
  55. 2.24.0