diff options
author | 2010-11-24 14:15:31 +0000 | |
---|---|---|
committer | 2010-11-24 14:15:31 +0000 | |
commit | 69a6ffbca4f7dea069af877f49e3b2583ba1ea76 (patch) | |
tree | 9a2e242efb4b80c5ac48661037031103845d48aa | |
parent | When disabling and enabling tables set the number of hosts that are up (diff) | |
download | wireguard-openbsd-69a6ffbca4f7dea069af877f49e3b2583ba1ea76.tar.xz wireguard-openbsd-69a6ffbca4f7dea069af877f49e3b2583ba1ea76.zip |
When dealing with disklabel UIDs (DUIDs) be specific and consistent with
naming.
ok krw@
-rw-r--r-- | sbin/disklabel/disklabel.c | 29 | ||||
-rw-r--r-- | sbin/disklabel/editor.c | 12 | ||||
-rw-r--r-- | sbin/disklabel/extern.h | 4 |
3 files changed, 23 insertions, 22 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 24dbd6cafdd..159d2cced70 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.173 2010/09/23 13:59:10 jsing Exp $ */ +/* $OpenBSD: disklabel.c,v 1.174 2010/11/24 14:15:31 jsing Exp $ */ /* * Copyright (c) 1987, 1993 @@ -467,7 +467,7 @@ l_perror(char *s) void readlabel(int f) { - char *partname, *partuid; + char *partname, *partduid; struct fstab *fsent; int i; @@ -483,21 +483,22 @@ readlabel(int f) } asprintf(&partname, "/dev/%s%c", dkname, 'a'); - asprintf(&partuid, "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx.a", + asprintf(&partduid, + "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx.a", lab.d_uid[0], lab.d_uid[1], lab.d_uid[2], lab.d_uid[3], lab.d_uid[4], lab.d_uid[5], lab.d_uid[6], lab.d_uid[7]); setfsent(); for (i = 0; i < MAXPARTITIONS; i++) { partname[strlen(dkname) + 5] = 'a' + i; - partuid[strlen(partuid) - 1] = 'a' + i; + partduid[strlen(partduid) - 1] = 'a' + i; fsent = getfsspec(partname); if (fsent == NULL) - fsent = getfsspec(partuid); + fsent = getfsspec(partduid); if (fsent) mountpoints[i] = strdup(fsent->fs_file); } endfsent(); - free(partuid); + free(partduid); free(partname); if (aflag) @@ -782,7 +783,7 @@ display(FILE *f, struct disklabel *lp, char unit, int all) lp->d_typename); fprintf(f, "label: %.*s\n", (int)sizeof(lp->d_packname), lp->d_packname); - fprintf(f, "uid: %02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx\n", + fprintf(f, "duid: %02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx\n", lp->d_uid[0], lp->d_uid[1], lp->d_uid[2], lp->d_uid[3], lp->d_uid[4], lp->d_uid[5], lp->d_uid[6], lp->d_uid[7]); fprintf(f, "flags:"); @@ -984,9 +985,9 @@ getnum(char *nptr, u_int64_t min, u_int64_t max, const char **errstr) } int -uid_parse(struct disklabel *lp, char *s) +duid_parse(struct disklabel *lp, char *s) { - u_char uid[8]; + u_char duid[8]; char c; int i; @@ -1003,11 +1004,11 @@ uid_parse(struct disklabel *lp, char *s) c -= ('A' - 10); else return -1; - uid[i / 2] <<= 4; - uid[i / 2] |= c & 0xf; + duid[i / 2] <<= 4; + duid[i / 2] |= c & 0xf; } - memcpy(lp->d_uid, &uid, sizeof(lp->d_uid)); + memcpy(lp->d_uid, &duid, sizeof(lp->d_uid)); return 0; } @@ -1110,8 +1111,8 @@ getasciilabel(FILE *f, struct disklabel *lp) strncpy(lp->d_packname, tp, sizeof (lp->d_packname)); continue; } - if (!strcmp(cp, "uid")) { - if (uid_parse(lp, tp) != 0) { + if (!strcmp(cp, "duid")) { + if (duid_parse(lp, tp) != 0) { warnx("line %d: bad %s: %s", lineno, cp, tp); errors++; } diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index e84e2b67c91..b1078bed231 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.245 2010/09/23 13:54:21 jsing Exp $ */ +/* $OpenBSD: editor.c,v 1.246 2010/11/24 14:15:31 jsing Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -130,7 +130,7 @@ struct partition **sort_partitions(struct disklabel *); void getdisktype(struct disklabel *, char *, char *); void find_bounds(struct disklabel *); void set_bounds(struct disklabel *); -void set_uid(struct disklabel *); +void set_duid(struct disklabel *); struct diskchunk *free_chunks(struct disklabel *); void mpcopy(char **, char **); int micmp(const void *, const void *); @@ -291,7 +291,7 @@ editor(struct disklabel *lp, int f) break; case 'i': - set_uid(&label); + set_duid(&label); break; case 'm': @@ -1614,7 +1614,7 @@ set_bounds(struct disklabel *lp) * Allow user to interactively change disklabel UID. */ void -set_uid(struct disklabel *lp) +set_duid(struct disklabel *lp) { char *s; int i; @@ -1625,13 +1625,13 @@ set_uid(struct disklabel *lp) lp->d_uid[4], lp->d_uid[5], lp->d_uid[6], lp->d_uid[7]); do { - s = getstring("uid", "The disklabel UID, given as a 16 " + s = getstring("duid", "The disklabel UID, given as a 16 " "character hexadecimal string.", NULL); if (s == NULL || strlen(s) == 0) { fputs("Command aborted\n", stderr); return; } - i = uid_parse(lp, s); + i = duid_parse(lp, s); if (i != 0) fputs("Invalid UID entered.\n", stderr); } while (i != 0); diff --git a/sbin/disklabel/extern.h b/sbin/disklabel/extern.h index 0b134391b04..4880a57b0bf 100644 --- a/sbin/disklabel/extern.h +++ b/sbin/disklabel/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.20 2010/09/23 13:54:21 jsing Exp $ */ +/* $OpenBSD: extern.h,v 1.21 2010/11/24 14:15:31 jsing Exp $ */ /* * Copyright (c) 2003 Theo de Raadt <deraadt@openbsd.org> @@ -25,7 +25,7 @@ char canonical_unit(struct disklabel *, char); double scale(u_int64_t, char, struct disklabel *); void display(FILE *, struct disklabel *, char, int); void display_partition(FILE *, struct disklabel *, int, char); -int uid_parse(struct disklabel *, char *); +int duid_parse(struct disklabel *, char *); void readlabel(int); struct disklabel *makebootarea(char *, struct disklabel *, int); |