Date: Mon, 24 Jun 2002 13:11:15 -0700 (PDT) From: Julian Elischer <julian@elischer.org> To: Bruce Evans <bde@FreeBSD.org> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys ucred.h Message-ID: <Pine.BSF.4.21.0206241259590.53748-100000@InterJet.elischer.org> In-Reply-To: <20020624113906.6695637B43A@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 24 Jun 2002, Bruce Evans wrote:
> bde 2002/06/24 04:37:57 PDT
>
> Modified files:
> sys/sys ucred.h
> Log:
> Fixed some style bugs (mainly excessive indentation).
>
> Not completely unapproved by: julian
No just MOSTLY objected to by: Julian
>
> Revision Changes Path
> 1.37 +24 -24 src/sys/sys/ucred.h
>
>
> Index: src/sys/sys/ucred.h
> diff -u src/sys/sys/ucred.h:1.36 src/sys/sys/ucred.h:1.37
> --- src/sys/sys/ucred.h:1.36 Sun Jun 23 23:22:00 2002
> +++ src/sys/sys/ucred.h Mon Jun 24 04:37:56 2002
> @@ -31,7 +31,7 @@
> * SUCH DAMAGE.
> *
> * @(#)ucred.h 8.4 (Berkeley) 1/9/95
> - * $FreeBSD: /amd/net/freefall/host/c/ncvs/src/sys/sys/ucred.h,v 1.36 2002/06/24 06:22:00 mini Exp $
> + * $FreeBSD: /amd/net/freefall/host/c/ncvs/src/sys/sys/ucred.h,v 1.37 2002/06/24 11:37:56 bde Exp $
> */
>
> #ifndef _SYS_UCRED_H_
> @@ -44,23 +44,23 @@
> * Only the suser() or suser_cred() function should be used for this.
> */
> struct ucred {
> - u_int cr_ref; /* reference count */
> + u_int cr_ref; /* reference count */
> #define cr_startcopy cr_uid
> - uid_t cr_uid; /* effective user id */
> - uid_t cr_ruid; /* real user id */
> - uid_t cr_svuid; /* saved user id */
> - short cr_ngroups; /* number of groups */
> - gid_t cr_groups[NGROUPS]; /* groups */
> - gid_t cr_rgid; /* real group id */
> - gid_t cr_svgid; /* saved user id */
> + uid_t cr_uid; /* effective user id */
> + uid_t cr_ruid; /* real user id */
> + uid_t cr_svuid; /* saved user id */
> + short cr_ngroups; /* number of groups */
> + gid_t cr_groups[NGROUPS]; /* groups */
> + gid_t cr_rgid; /* real group id */
> + gid_t cr_svgid; /* saved user id */
Now thanks to this commit, the field names are no longer neatly
in one indent level, but are instead at TWO DIFFERENT
indent levels this alligns (approximatly) the structure type
with the field names of simple types.. which makes no sense. (see example
later)
This is bogus and creates more work for the eye when scanning the
structure for a particular name.
to quite style:
"Try to make the structure readable by aligning the member names using
either one or two tabs depending upon your judgment."
not it says "member names" not "arbitrary words on the lines"
you have UNALIGNED the names.
please fix this!
it should look like:
u_int cr_ref; /* reference count */
#define cr_startcopy cr_uid
uid_t cr_uid; /* effective user id */
uid_t cr_ruid; /* real user id */
uid_t cr_svuid; /* saved user id */
short cr_ngroups; /* number of groups */
gid_t cr_groups[NGROUPS]; /* groups */
gid_t cr_rgid; /* real group id */
gid_t cr_svgid; /* saved user id */
struct uidinfo *cr_uidinfo; /* per euid resource consumption */
struct uidinfo *cr_ruidinfo; /* per ruid resource consumption */
struct prison *cr_prison; /* jail(4) */
not like this:
u_int cr_ref; /* reference count */
#define cr_startcopy cr_uid
uid_t cr_uid; /* effective user id */
uid_t cr_ruid; /* real user id */
uid_t cr_svuid; /* saved user id */
short cr_ngroups; /* number of groups */
gid_t cr_groups[NGROUPS]; /* groups */
gid_t cr_rgid; /* real group id */
gid_t cr_svgid; /* saved user id */
struct uidinfo *cr_uidinfo; /* per euid resource consumption */
struct uidinfo *cr_ruidinfo; /* per ruid resource consumption */
struct prison *cr_prison; /* jail(4) */
#define cr_endcopy cr_mtxp
struct mtx *cr_mtxp; /* protect refcount */
The changes below are good.
> struct uidinfo *cr_uidinfo; /* per euid resource consumption */
> struct uidinfo *cr_ruidinfo; /* per ruid resource consumption */
> struct prison *cr_prison; /* jail(4) */
> -#define cr_endcopy cr_mtxp
> +#define cr_endcopy cr_mtxp
> struct mtx *cr_mtxp; /* protect refcount */
> };
> -#define NOCRED ((struct ucred *)0) /* no credential available */
> -#define FSCRED ((struct ucred *)-1) /* filesystem credential */
> +#define NOCRED ((struct ucred *)0) /* no credential available */
> +#define FSCRED ((struct ucred *)-1) /* filesystem credential */
>
> /*
> * This is the external representation of struct ucred.
> @@ -75,26 +75,26 @@
> #define XUCRED_VERSION 0
>
> /* This can be used for both ucred and xucred structures. */
> -#define cr_gid cr_groups[0]
> +#define cr_gid cr_groups[0]
>
> #ifdef _KERNEL
> struct thread;
>
> -void cred_update_thread(struct thread *td);
> -void change_egid(struct ucred *newcred, gid_t egid);
> -void change_euid(struct ucred *newcred, struct uidinfo *euip);
> -void change_rgid(struct ucred *newcred, gid_t rgid);
> -void change_ruid(struct ucred *newcred, struct uidinfo *ruip);
> -void change_svgid(struct ucred *newcred, gid_t svgid);
> -void change_svuid(struct ucred *newcred, uid_t svuid);
> -void crcopy(struct ucred *dest, struct ucred *src);
> +void change_egid(struct ucred *newcred, gid_t egid);
> +void change_euid(struct ucred *newcred, struct uidinfo *euip);
> +void change_rgid(struct ucred *newcred, gid_t rgid);
> +void change_ruid(struct ucred *newcred, struct uidinfo *ruip);
> +void change_svgid(struct ucred *newcred, gid_t svgid);
> +void change_svuid(struct ucred *newcred, uid_t svuid);
> +void crcopy(struct ucred *dest, struct ucred *src);
> struct ucred *crdup(struct ucred *cr);
> -void crfree(struct ucred *cr);
> +void cred_update_thread(struct thread *td);
> +void crfree(struct ucred *cr);
> struct ucred *crget(void);
> struct ucred *crhold(struct ucred *cr);
> -int crshared(struct ucred *cr);
> -void cru2x(struct ucred *cr, struct xucred *xcr);
> -int groupmember(gid_t gid, struct ucred *cred);
> +int crshared(struct ucred *cr);
> +void cru2x(struct ucred *cr, struct xucred *xcr);
> +int groupmember(gid_t gid, struct ucred *cred);
> #endif /* _KERNEL */
>
> #endif /* !_SYS_UCRED_H_ */
>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0206241259590.53748-100000>
