Discussion:
[PATCH 1/2] eppic: vhost_net_buffers - Adopt to struct sk_buff changes
Kamalesh Babulal
2016-12-14 13:19:24 UTC
Permalink
Linux kernel commit 56b174256b69 ("net: add rbnode to struct sk_buff"),
moves sk_buff->next into an union of sk_buff->{next/prev/tstamp/rb_node}.
Introduce this structure member change, while traversing the socket
buffer list.

Signed-off-by: Kamalesh Babulal <***@linux.vnet.ibm.com>
---
eppic_scripts/vhost_net_buffers.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/eppic_scripts/vhost_net_buffers.c b/eppic_scripts/vhost_net_buffers.c
index 39ae595..1260acb 100644
--- a/eppic_scripts/vhost_net_buffers.c
+++ b/eppic_scripts/vhost_net_buffers.c
@@ -45,7 +45,10 @@ vhost_net(struct vhost_net *net)
memset((char *)&(buff->data_len), 'L', 0x4);
}

- next = buff->next;
+ /*
+ * .next is the first entry.
+ */
+ next = (struct sk_buff *)(unsigned long)*buff;
}

head = (struct sk_buff_head *)&(sk->sk_write_queue);
@@ -60,8 +63,10 @@ vhost_net(struct vhost_net *net)
memset((char *)&(buff->data_len), 'L', 0x4);
}

- next = buff->next;
-
+ /*
+ * .next is the first entry.
+ */
+ next = (struct sk_buff *)(unsigned long)*buff;
}
}
}
--
2.7.4
Kamalesh Babulal
2016-12-14 13:19:25 UTC
Permalink
Linux kernel commit 38129a13e6e7 ("switch mnt_hash to hlist"),
moves mnt_hash from list_head to hlist_node. Introduce these
list type changes to iterate over the mounted filesystem and
walk dentries.

Signed-off-by: Kamalesh Babulal <***@linux.vnet.ibm.com>
---
eppic_scripts/dir_names.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/eppic_scripts/dir_names.c b/eppic_scripts/dir_names.c
index dbe6d00..6f6eb41 100644
--- a/eppic_scripts/dir_names.c
+++ b/eppic_scripts/dir_names.c
@@ -26,9 +26,12 @@ void
rm_names(struct dentry *dir)
{
struct list_head *next, *head;
+ unsigned int hash_len;
+ int i;

memset(dir->d_iname, 0, 0x20);
- memset(dir->d_name.name, 0, 0x20);
+ hash_len = *((unsigned int *)&dir->d_name);
+ memset(dir->d_name.name, 0, hash_len);

head = (struct list_head *)&(dir->d_subdirs);
next = (struct list_head *)dir->d_subdirs.next;
@@ -37,9 +40,9 @@ rm_names(struct dentry *dir)
{
struct dentry *child, *off = 0;

- child = (struct dentry *)((unsigned long)next - (unsigned long)&(off->d_u));
+ child = (struct dentry *)((unsigned long)next - (unsigned long)&(off->d_child));
rm_names(child);
- next = child->d_u.d_child.next;
+ next = child->d_child.next;
}

return;
@@ -49,29 +52,30 @@ int
vfs()
{
int i;
- struct list_head *tab;
+ struct hlist_bl_head *tab;
+ unsigned int d_hash_size = d_hash_mask;

- tab = (struct list_head *)mount_hashtable;
+ tab = (struct hlist_bl_head *)dentry_hashtable;

- for (i = 0; i < 256; i++)
+ for (i = 0; i < d_hash_size; i++)
{
- struct list_head *head, *next;
-
- head = (struct list_head *) (tab + i);
- next = (struct list_head *) head->next;
+ struct hlist_bl_head *head;
+ struct hlist_bl_node *head_node, *next;

- if (!next)
+ head = (struct hlist_bl_head *) (tab + i);
+ head_node = head->first;
+ if (!head_node)
continue;

- while (next != head)
+ next = head_node;
+
+ while (next)
{
- struct mount *mntfs;
- struct dentry *root;
+ struct dentry *root, *off = 0;

- mntfs = (struct mount *)((unsigned long)next);
- root = (struct dentry *)mntfs->mnt.mnt_root;
+ root = (struct dentry *)((unsigned long)next - (unsigned long)&(off->d_hash));
rm_names(root);
- next = mntfs->mnt_hash.next;
+ next = next->next;
}
}
return 1;
--
2.7.4
Loading...