Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Mar 2017 19:58:28 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Mariusz Zaborski <oshogbo@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r314945 - head/sys/boot/i386/libi386
Message-ID:  <20170309193117.F1564@besplex.bde.org>
In-Reply-To: <201703090513.v295D8QT061407@repo.freebsd.org>
References:  <201703090513.v295D8QT061407@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 9 Mar 2017, Mariusz Zaborski wrote:

> Log:
>  Some style(9) fixes. No functional changes.
>
>  Submitted by:	kczekirda
>  Sponsored by:	Oktawave
>  MFC after:	3 weeks
>  Differential Revision:	https://reviews.freebsd.org/D9395

About half of this is backwards, or just moves the style bugs.

> Modified: head/sys/boot/i386/libi386/pxe.c
> ==============================================================================
> --- head/sys/boot/i386/libi386/pxe.c	Thu Mar  9 04:20:00 2017	(r314944)
> +++ head/sys/boot/i386/libi386/pxe.c	Thu Mar  9 05:13:07 2017	(r314945)
> @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
>
> /*
>  * Allocate the PXE buffers statically instead of sticking grimy fingers into
> - * BTX's private data area.  The scratch buffer is used to send information to
> + * BTX's private data area. The scratch buffer is used to send information to
>  * the PXE BIOS, and the data buffer is used to receive data from the PXE BIOS.
>  */

Backwards.  Sentence breaks are 2 spaces in KNF.

> #define	PXE_BUFFER_SIZE		0x2000
> @@ -57,11 +57,11 @@ __FBSDID("$FreeBSD$");
> static char	scratch_buffer[PXE_BUFFER_SIZE];
> static char	data_buffer[PXE_BUFFER_SIZE];

This uses the delicate KNF style of a tab after the type declaration,
but not the even more delicate KNF style of another space after that
tab except for pointers (the space is to line up the variable names
after adding a '*' for pointers), but not the delicate KNF style of a
tab after the storage class.  This style doesn't work well with
complicated and otherwise-verbose declarations.

>
> -static pxenv_t	*pxenv_p = NULL;        /* PXENV+ */
> -static pxe_t	*pxe_p   = NULL;	/* !PXE */
> -static BOOTPLAYER	bootplayer;	/* PXE Cached information. */
> +static pxenv_t *pxenv_p = NULL;	/* PXENV+ */
> +static pxe_t *pxe_p = NULL;		/* !PXE */
> +static BOOTPLAYER bootplayer;	/* PXE Cached information. */

These changes are mostly backwards.  2 of 3 declarations had short
type declarations for which the KNF tab worked right.

>
> -static int 	pxe_debug = 0;
> +static int	pxe_debug = 0;
> static int	pxe_sock = -1;
> static int	pxe_opens = 0;

Nearby declarations still have the tabs.  The only clear fix here is
changing 1 <space><tab> to plain <tab>.

There are main other style bugs here.  Mostly initializations to 0 or
NULL, and only some variables with comments and the comments banal
or backwards.

>
> @@ -72,7 +72,7 @@ static void	bangpxe_call(int func);
>
> static int	pxe_init(void);
> static int	pxe_strategy(void *devdata, int flag, daddr_t dblk,
> -			     size_t size, char *buf, size_t *rsize);
> +			    size_t size, char *buf, size_t *rsize);

Backwards.  The continuation indentation was originally gnu style
(indent -lp).  Now it is random tabs, with nothing lining up.  KNF
uses 4 spaces (indent -ci4), where it is unclear where the spaces start,
but it is normal to start them under the function name.

> static int	pxe_open(struct open_file *f, ...);
> static int	pxe_close(struct open_file *f);
> static int	pxe_print(int verbose);

Half-KNF with spaces after the storage class and a tab after the type
declaration is used fairly consistently.

> @@ -84,7 +84,7 @@ static int	pxe_netif_match(struct netif
> static int	pxe_netif_probe(struct netif *nif, void *machdep_hint);
> static void	pxe_netif_init(struct iodesc *desc, void *machdep_hint);
> static int	pxe_netif_get(struct iodesc *desc, void *pkt, size_t len,
> -			      time_t timeout);
> +			    time_t timeout);

Backwards, as above, except the random tabs give alignment further from
gnu style.

> @@ -140,8 +140,8 @@ struct devsw pxedisk = {
>
> /*
>  * This function is called by the loader to enable PXE support if we
> - * are booted by PXE.  The passed in pointer is a pointer to the
> - * PXENV+ structure.
> + * are booted by PXE. The passed in pointer is a pointer to the PXENV+
> + * structure.
>  */

Declarations are harder to format than statements, so there aren't many
more backwards changes, exept most changes to comments are to reverse-
style their sentence breaks.

> ...
> @@ -449,19 +448,19 @@ struct nfs_iodesc {
> 	/* structure truncated here */
> };
> extern struct	nfs_iodesc nfs_root_node;
> -extern int      rpc_port;
> +extern int		rpc_port;

2 tabs is excessive, and doesn't even line up the variable name with the
previous line.

>
> static void
> pxe_rpcmountcall()
> {
> 	struct	iodesc *d;
> -	int     error;
> +	int		error;

Further from KNF.  types and names are not indented (by a tab) for local
variables in KNF.  FreeBSD dropped the bogus rule to indent in the
middle of 'struct iodesc' (this rule just makes unrelated names line
up), but the above still uses it.  The above didn't indent '*d', but it
indented 'error' by a tab.  Now it has all the old errors, plus an extra
tab for 'error'.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170309193117.F1564>