Netdev List
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Daniel Ngu <daniel.dy.ngu@gmail.com>
Cc: Jonathan Kim <jonathankim@gctsemi.com>,
	Dean ahn <deanahn@gctsemi.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH] Staging: gdm724x: gdm_lte.c: fixed coding style
Date: Sun, 16 Mar 2014 12:31:21 -0700	[thread overview]
Message-ID: <1394998281.5689.63.camel@joe-AO722> (raw)
In-Reply-To: <1394997876.5689.60.camel@joe-AO722>

On Sun, 2014-03-16 at 12:24 -0700, Joe Perches wrote:

> > @@ -551,28 +583,41 @@ static void gdm_lte_netif_rx(struct net_device *dev, char *buf, int len, int fla
> []
> >  			struct dhcp_packet {
> 
> This one would be better fixed by moving the struct definition
> out of this function altogether.
> 
> >  				u8 op;      /* BOOTREQUEST or BOOTREPLY */
> > -				u8 htype;   /* hardware address type. 1 = 10mb ethernet */
> > +				u8 htype;   /* hardware address type.
> > +					       1 = 10mb ethernet */
> >  				u8 hlen;    /* hardware address length */
> >  				u8 hops;    /* used by relay agents only */
> >  				u32 xid;    /* unique id */
> > -				u16 secs;   /* elapsed since client began acquisition/renewal */
> > +				u16 secs;   /* elapsed since client began
> > +					       acquisition/renewal */
> >  				u16 flags;  /* only one flag so far: */
> > -				#define BROADCAST_FLAG 0x8000 /* "I need broadcast replies" */
> > -				u32 ciaddr; /* client IP (if client is in BOUND, RENEW or REBINDING state) */
> > +				#define BROADCAST_FLAG 0x8000 /* "I need
> > +								 broadcast
> > +								 replies" */
> > +				u32 ciaddr; /* client IP (if client is in
> > +					       BOUND, RENEW or REBINDING
> > +					       state) */
> >  				u32 yiaddr; /* 'your' (client) IP address */
> > -				/* IP address of next server to use in bootstrap, returned in DHCPOFFER, DHCPACK by server */
> > +				/* IP address of next server to use in
> > +				 * bootstrap, returned in DHCPOFFER, DHCPACK by
> > +				 * server */
> >  				u32 siaddr_nip;
> >  				u32 gateway_nip; /* relay agent IP address */
> > -				u8 chaddr[16];   /* link-layer client hardware address (MAC) */
> > +				u8 chaddr[16];   /* link-layer client hardware
> > +						    address (MAC) */
> >  				u8 sname[64];    /* server host name (ASCIZ) */
> >  				u8 file[128];    /* boot file name (ASCIZ) */
> > -				u32 cookie;      /* fixed first four option bytes (99,130,83,99 dec) */
> > +				u32 cookie;      /* fixed first four option
> > +						    bytes (99,130,83,99 dec) */
> >  			} __packed;

Also, the net/ipv4/ipconfig.c definition
seems a lot more sensible as it uses endian
specific types

struct bootp_pkt {		/* BOOTP packet format */
	struct iphdr iph;	/* IP header */
	struct udphdr udph;	/* UDP header */
	u8 op;			/* 1=request, 2=reply */
	u8 htype;		/* HW address type */
	u8 hlen;		/* HW address length */
	u8 hops;		/* Used only by gateways */
	__be32 xid;		/* Transaction ID */
	__be16 secs;		/* Seconds since we started */
	__be16 flags;		/* Just what it says */
	__be32 client_ip;		/* Client's IP address if known */
	__be32 your_ip;		/* Assigned IP address */
	__be32 server_ip;		/* (Next, e.g. NFS) Server's IP address */
	__be32 relay_ip;		/* IP address of BOOTP relay */
	u8 hw_addr[16];		/* Client's HW address */
	u8 serv_name[64];	/* Server host name */
	u8 boot_file[128];	/* Name of boot file */
	u8 exten[312];		/* DHCP options / BOOTP vendor extensions */
};

It'd probably be better to make that struct definition public
and use it instead.

           reply	other threads:[~2014-03-16 19:31 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1394997876.5689.60.camel@joe-AO722>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394998281.5689.63.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=daniel.dy.ngu@gmail.com \
    --cc=deanahn@gctsemi.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=jonathankim@gctsemi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox