Re: [PATCH] struct char_device

Oliver Xymoron (oxymoron@waste.org)
Tue, 22 May 2001 11:08:16 -0500 (CDT)


On Tue, 22 May 2001, Anton Altaparmakov wrote:

> Hello,
>
> At 15:18 22/05/01, Alexander Viro wrote:
> [snip cool stuff]
> >+struct char_device {
> >+ struct list_head hash;
> >+ atomic_t count;
> >+ dev_t dev;
> >+ atomic_t openers;
> >+ struct semaphore sem;
>
> Why not name consistently with the struct block_device?
> I.e.:
> struct char_device {
> struct list_head cd_hash;
> atomic_t cd_count;
> dev_t cd_dev;
> atomic_t cd_openers;
> struct semaphore cd_sem;
> };

Because foo_ is a throwback to the days when C compilers had a single
namespace for all structure elements, not a readability aid. If you need
foo_ to know what type of structure you're futzing with, you need to name
your variables better.

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/