Thread (2 messages) flat view 2 messages, 2 authors, 2017-10-25

Re: [RFC] net/unix_diag: Provide UDIAG_SHOW_VFS2 attribute to fetch complete inode number

From: Roman Mashak <hidden>
Date: 2017-10-25 13:55:14
Also in: lkml

Cyrill Gorcunov [off-list ref] writes:
Currently unix_diag_vfs structure reports unix socket inode
as u32 value which of course doesn't fit to ino_t type and
the number may be trimmed. Lets rather deprecate old UDIAG_SHOW_VFS
interface and provide UDIAG_SHOW_VFS2 (with one field "__zero" reserved
which we could extend in future).
[...]
-static int sk_diag_dump_vfs(struct sock *sk, struct sk_buff *nlskb)
+static int sk_diag_dump_vfs(struct sock *sk, struct sk_buff *nlskb, unsigned int flags)
 {
 	struct dentry *dentry = unix_sk(sk)->path.dentry;
 
 	if (dentry) {
-		struct unix_diag_vfs uv = {
-			.udiag_vfs_ino = d_backing_inode(dentry)->i_ino,
-			.udiag_vfs_dev = dentry->d_sb->s_dev,
-		};
-
-		return nla_put(nlskb, UNIX_DIAG_VFS, sizeof(uv), &uv);
+		if (flags & UDIAG_SHOW_VFS2) {
+			struct unix_diag_vfs uv = {
+				.udiag_vfs_ino = d_backing_inode(dentry)->i_ino,
+				.udiag_vfs_dev = dentry->d_sb->s_dev,
+			};
+			return nla_put(nlskb, UNIX_DIAG_VFS, sizeof(uv), &uv);
+		} else {
+			struct unix_diag_vfs2 uv = {
+				.udiag_vfs_ino = d_backing_inode(dentry)->i_ino,
+				.udiag_vfs_dev = dentry->d_sb->s_dev,
+			};
I think __zero should be explicitly set to 0.

[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help