Thread (3 messages) flat view 3 messages, 2 authors, 2017-02-12

Re: [PATH v2 net-next] net: remove member 'max' of struct scm_fp_list

From: Sergei Shtylyov <hidden>
Date: 2017-02-12 10:54:29

On 2/11/2017 5:36 AM, yuan linyu wrote:
quoted hunk ↗ jump to hunk
From: yuan linyu <redacted>

'max' only used at three places in scm.c,
1. in scm_fp_copy(), fpl->max = SCM_MAX_FD;
2. in scm_fp_copy(), if (fpl->count + num > fpl->max)
3. in scm_fp_dup(), new_fpl->max = new_fpl->count;
at place 2, fpl->max can be replaced with SCM_MAX_FD.
no other place read this 'max' again, so it can be removed.

Signed-off-by: yuan linyu <redacted>
---
v1->v2:
    update commit log to describe correct reason to remove 'max'

 include/net/scm.h |  3 +--
 net/core/scm.c    | 20 +++++---------------
 2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/include/net/scm.h b/include/net/scm.h
index 59fa93c..1301227 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -19,8 +19,7 @@ struct scm_creds {
 };

 struct scm_fp_list {
-	short			count;
-	short			max;
+	unsigned int	count;
    Why break the alignment in the 2nd column?
 	struct user_struct	*user;
 	struct file		*fp[SCM_MAX_FD];
 };
[...]

MBR, Sergei
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help