I don't see the point of this.

Yes, style(9) says don't do that.  It is because of cpp issues.
It definately matters for userland-exposed definitions.

But the kernel is largely immune to this concern, even in .h files
Sice this is on one file, it matters even less since nothing in
any .h file will define kn, fp, p, or ub.

In the meantime, this provides a stronger understanding for the
programmer working *in this file*

Standing back further, how did this happen?  Someone felt more
comfortable leaving the names there when cloning the definitions
from the actual function start.  I don't think that is dangerous.

In summary, I think the style(9) advice has't place, and that
place isn't everywhere, or C itself would have made naming of
prototype arguments illegal to cover for the risk of cpp confusion.



henkjan gersen <[email protected]> wrote:

> Patch below removes a couple of variable names from function prototypes
> in sys_pipe.c to match style(9)
> 
> ---
> diff --git sys/kern/sys_pipe.c sys/kern/sys_pipe.c
> index 04ec907d21f..85e69af7741 100644
> --- sys/kern/sys_pipe.c
> +++ sys/kern/sys_pipe.c
> @@ -62,9 +62,9 @@ int   pipe_read(struct file *, struct uio *, int);
>  int    pipe_write(struct file *, struct uio *, int);
>  int    pipe_close(struct file *, struct proc *);
>  int    pipe_poll(struct file *, int events, struct proc *);
> -int    pipe_kqfilter(struct file *fp, struct knote *kn);
> +int    pipe_kqfilter(struct file *, struct knote *);
>  int    pipe_ioctl(struct file *, u_long, caddr_t, struct proc *);
> -int    pipe_stat(struct file *fp, struct stat *ub, struct proc *p);
> +int    pipe_stat(struct file *, struct stat *, struct proc *);
> 
>  static const struct fileops pipeops = {
>         .fo_read        = pipe_read,
> @@ -76,9 +76,9 @@ static const struct fileops pipeops = {
>         .fo_close       = pipe_close
>  };
> 
> -void   filt_pipedetach(struct knote *kn);
> -int    filt_piperead(struct knote *kn, long hint);
> -int    filt_pipewrite(struct knote *kn, long hint);
> +void   filt_pipedetach(struct knote *);
> +int    filt_piperead(struct knote *, long);
> +int    filt_pipewrite(struct knote *, long);
> 
>  const struct filterops pipe_rfiltops = {
>         .f_flags        = FILTEROP_ISFD,
> 

Reply via email to