Re: lockf: initialization order

2019-02-22 Thread Todd C . Miller
On Fri, 22 Feb 2019 07:49:43 +0100, Anton Lindqvist wrote:

> Initialize the fields of `struct lockf' in the same order as the struct
> definition, with the ambition of making easier to inspect that all
> fields are properly initialized. Similar work has already been done in
> lf_split().

OK millert@

 - todd



lockf: initialization order

2019-02-21 Thread Anton Lindqvist
Hi,
Initialize the fields of `struct lockf' in the same order as the struct
definition, with the ambition of making easier to inspect that all
fields are properly initialized. Similar work has already been done in
lf_split().

Comments? OK?

Index: kern/vfs_lockf.c
===
RCS file: /cvs/src/sys/kern/vfs_lockf.c,v
retrieving revision 1.33
diff -u -p -r1.33 vfs_lockf.c
--- kern/vfs_lockf.c30 Jan 2019 17:04:04 -  1.33
+++ kern/vfs_lockf.c22 Feb 2019 06:44:46 -
@@ -243,15 +243,15 @@ lf_advlock(struct lockf_state **state, o
ls_rele(ls);
return (ENOLCK);
}
+   lock->lf_flags = flags;
+   lock->lf_type = fl->l_type;
lock->lf_start = start;
lock->lf_end = end;
lock->lf_id = id;
lock->lf_state = ls;
-   lock->lf_type = fl->l_type;
lock->lf_blk = NULL;
-   TAILQ_INIT(&lock->lf_blkhd);
-   lock->lf_flags = flags;
lock->lf_pid = (flags & F_POSIX) ? p->p_p->ps_pid : -1;
+   TAILQ_INIT(&lock->lf_blkhd);
 
switch (op) {
case F_SETLK: