PERFORCE change 30248 for review
Peter Wemm
peter at FreeBSD.org
Wed Apr 30 20:09:06 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=30248
Change 30248 by peter at peter_daintree on 2003/04/30 20:08:44
IFC @30247
Affected files ...
.. //depot/projects/hammer/sbin/vinum/commands.c#4 integrate
.. //depot/projects/hammer/sbin/vinum/list.c#4 integrate
.. //depot/projects/hammer/sbin/vinum/v.c#4 integrate
.. //depot/projects/hammer/sbin/vinum/vext.h#3 integrate
.. //depot/projects/hammer/sys/conf/Makefile.amd64#6 integrate
.. //depot/projects/hammer/sys/conf/files.amd64#6 integrate
.. //depot/projects/hammer/sys/conf/ldscript.amd64#5 integrate
.. //depot/projects/hammer/sys/conf/options.amd64#6 integrate
.. //depot/projects/hammer/usr.bin/m4/eval.c#2 integrate
Differences ...
==== //depot/projects/hammer/sbin/vinum/commands.c#4 (text+ko) ====
@@ -36,31 +36,11 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
- * $Id: commands.c,v 1.15 2001/05/22 08:40:21 grog Exp grog $
- * $FreeBSD: src/sbin/vinum/commands.c,v 1.46 2003/03/15 20:49:38 phk Exp $
+ * $Id: commands.c,v 1.22 2003/04/28 06:19:06 grog Exp $
+ * $FreeBSD: src/sbin/vinum/commands.c,v 1.47 2003/05/01 01:39:49 grog Exp $
*/
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <netdb.h>
-#include <paths.h>
-#include <setjmp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
#include "vext.h"
-#include <sys/types.h>
-#include <sys/linker.h>
-#include <sys/module.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-#include <readline/history.h>
-#include <readline/readline.h>
#include <devstat.h>
static void dorename(struct vinum_rename_msg *msg, const char *oldname, const char *name, int maxlen);
@@ -122,8 +102,8 @@
char *configline;
configline = fgets(buffer, BUFSIZE, dfd);
- if (history)
- fprintf(history, "%s", buffer);
+ if (History)
+ fprintf(History, "%s", buffer);
if (configline == NULL) {
if (ferror(dfd))
@@ -268,6 +248,9 @@
}
}
checkupdates(); /* make sure we're updating */
+ /* Arguably we should be cleverer about this. */
+ if (no_devfs)
+ make_devices();
}
}
@@ -277,28 +260,31 @@
char reply[32];
int error;
- printf(" WARNING! This command will completely wipe out your vinum configuration.\n"
- " All data will be lost. If you really want to do this, enter the text\n\n"
- " NO FUTURE\n"
- " Enter text -> ");
- fgets(reply, sizeof(reply), stdin);
- if (strcmp(reply, "NO FUTURE\n")) /* changed his mind */
- printf("\n No change\n");
- else {
- error = ioctl(superdev, VINUM_RESETCONFIG, NULL); /* trash config on disk */
- if (error) {
- if (errno == EBUSY)
- fprintf(stderr, "Can't reset configuration: objects are in use\n");
- else
- perror("Can't find vinum config");
- } else {
- if (no_devfs)
- make_devices(); /* recreate the /dev/vinum hierarchy */
- printf("\b Vinum configuration obliterated\n");
- start_daemon(); /* then restart the daemon */
+ if (isatty(STDIN_FILENO)) {
+ printf(" WARNING! This command will completely wipe out your vinum configuration.\n"
+ " All data will be lost. If you really want to do this, enter the text\n\n"
+ " NO FUTURE\n"
+ " Enter text -> ");
+ fgets(reply, sizeof(reply), stdin);
+ if (strcmp(reply, "NO FUTURE\n")) /* changed his mind */
+ printf("\n No change\n");
+ else {
+ error = ioctl(superdev, VINUM_RESETCONFIG, NULL); /* trash config on disk */
+ if (error) {
+ if (errno == EBUSY)
+ fprintf(stderr, "Can't reset configuration: objects are in use\n");
+ else
+ perror("Can't find vinum config");
+ } else {
+ if (no_devfs)
+ make_devices(); /* recreate the /dev/vinum hierarchy */
+ printf("\b Vinum configuration obliterated\n");
+ start_daemon(); /* then restart the daemon */
+ }
}
- }
- checkupdates(); /* make sure we're updating */
+ checkupdates(); /* make sure we're updating */
+ } else
+ fprintf(stderr, "Please enter this command from a terminal\n");
}
/* Initialize subdisks */
@@ -310,8 +296,8 @@
int objno;
enum objecttype type; /* type returned */
- if (history)
- fflush(history); /* don't let all the kids do it. */
+ if (History)
+ fflush(History); /* don't let all the kids do it. */
for (objindex = 0; objindex < argc; objindex++) {
objno = find_object(argv[objindex], &type); /* find the object */
if (objno < 0)
@@ -399,13 +385,6 @@
}
}
if (failed == 0) {
-#if 0
- message->index = plexno; /* pass object number */
- message->type = plex_object; /* and type of object */
- message->state = object_up;
- message->force = 1; /* insist */
- ioctl(superdev, VINUM_SETSTATE, message);
-#endif
syslog(LOG_INFO | LOG_KERN, "plex %s initialized", plex.name);
} else
syslog(LOG_ERR | LOG_KERN, "couldn't initialize plex %s, %d processes died",
@@ -545,10 +524,11 @@
for (i = 0; i < devs; i++) {
struct devstat *stat = &statinfo.dinfo->devices[i];
+ /* Submitted by Pete Carah <pete at ns.altadena.net> */
if ((((stat->device_type & DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_DIRECT) /* disk device */
- || ((stat->device_type & DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_STORARRAY)) /* storage array */
- &&((stat->device_type & DEVSTAT_TYPE_PASS) == 0) /* and not passthrough */
- &&((stat->device_name[0] != '\0'))) { /* and it has a name */
+ ||((stat->device_type & DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_STORARRAY)) /* storage array */
+ &&((stat->device_type & DEVSTAT_TYPE_PASS) == 0) /* and not passthrough */
+ &&((stat->device_name[0] != '\0'))) { /* and it has a name */
sprintf(enamelist, _PATH_DEV "%s%d", stat->device_name, stat->unit_number);
token[tokens] = enamelist; /* point to it */
tokens++; /* one more token */
@@ -2098,7 +2078,8 @@
/*
* First, check our drives.
*/
- if (argc & 1) {
+ if ((argc < 2)
+ || (argc & 1)) {
fprintf(stderr, "You need an even number of drives to create a mirrored volume\n");
return;
}
==== //depot/projects/hammer/sbin/vinum/list.c#4 (text+ko) ====
@@ -39,27 +39,13 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
- * $Id: list.c,v 1.25 2000/12/20 03:38:43 grog Exp grog $
- * $FreeBSD: src/sbin/vinum/list.c,v 1.37 2003/03/15 20:49:38 phk Exp $
+ * $Id: list.c,v 1.32 2003/04/28 06:19:06 grog Exp $
+ * $FreeBSD: src/sbin/vinum/list.c,v 1.38 2003/05/01 01:38:55 grog Exp $
*/
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <netdb.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
+#include "vext.h"
#include <sys/utsname.h>
-#include <sys/resource.h>
-#include "vext.h"
#include <dev/vinum/request.h>
-/* #include <dev/vinum/vinumhdr.h> */
#include <devstat.h>
/*
@@ -599,6 +585,8 @@
(long long) sd.sectors * DEV_BSIZE,
(long long) sd.sectors / (MEGABYTE / DEV_BSIZE),
sd_state(sd.state));
+ if (sd.flags & VF_RETRYERRORS)
+ printf("\t\tretryerrors\n");
if (sd.plexno >= 0) {
get_plex_info(&plex, sd.plexno);
printf("\t\tPlex %s", plex.name);
@@ -828,6 +816,21 @@
return &text[11];
}
+/* Return the difference in microseconds between two timevals. */
+inline struct timeval
+timediff(struct timeval then, struct timeval now)
+{
+ struct timeval diff;
+
+ diff.tv_sec = now.tv_sec - then.tv_sec;
+ diff.tv_usec = now.tv_usec - then.tv_usec;
+ if (diff.tv_usec < 0) {
+ diff.tv_usec += 1000000;
+ diff.tv_sec--;
+ }
+ return diff;
+}
+
void
vinum_info(int argc, char *argv[], char *argv0[])
{
@@ -835,6 +838,8 @@
struct mc malloced;
int i;
struct rqinfo rq;
+ struct timeval lasttime; /* time of previous request */
+ struct timeval diff; /* difference from now */
if (ioctl(superdev, VINUM_GETCONFIG, &vinum_conf) < 0) {
perror("Can't get vinum config");
@@ -848,7 +853,8 @@
perror("Can't get information");
return;
}
- printf("Total of %d blocks malloced, total memory: %d\nMaximum allocs: %8d, malloc table at 0x%08x\n",
+ printf("Total of %d blocks malloced, total memory: %d\n"
+ "Maximum allocs: %8d, malloc table at 0x%08x\n",
meminfo.mallocs,
meminfo.total_malloced,
meminfo.highwater,
@@ -875,147 +881,194 @@
(char *) &malloced.file);
}
if (Verbose) {
- printf("\nTime\t\t Event\t Buf\tDev\t Offset\tBytes\tSD\tSDoff\tDoffset\tGoffset\n\n");
+ if (Verbose > 1) {
+ lasttime.tv_sec = 0;
+ lasttime.tv_usec = 0;
+ printf("\n Time\t\t Event\t Buf\tDev\t Offset\t"
+ "Bytes\tSD\tSDoff\tDoffset\tGoffset\n\n");
+ } else
+ printf("\nTime\t\t Event\t Buf\tDev\t Offset\tBytes\tSD"
+ "\tSDoff\tDoffset\tGoffset\n\n");
for (i = RQINFO_SIZE - 1; i >= 0; i--) { /* go through the request list in order */
*((int *) &rq) = i;
if (ioctl(superdev, VINUM_RQINFO, &rq) < 0) {
perror("Can't get information");
return;
}
- /* Compress devminor into something printable. */
- rq.devminor = (rq.devminor & 0xff)
- | ((rq.devminor & 0xfff0000) >> 8);
- switch (rq.type) {
- case loginfo_unused: /* never been used */
- break;
+ if (rq.type != loginfo_unused) {
+ switch (Verbose) {
+ case 2:
+ if ((lasttime.tv_usec != 0) || (lasttime.tv_sec != 0)) {
+ diff = timediff(lasttime, rq.timestamp);
+ if (diff.tv_sec != 0)
+ printf("\n+ %d.%06d sec:\n ", diff.tv_sec, diff.tv_usec);
+ else
+ printf("+%6d µs ", diff.tv_usec);
+ } else
+ printf(" ");
+ break;
+
+ case 3:
+ if ((lasttime.tv_usec != 0) || (lasttime.tv_sec != 0))
+ diff = timediff(lasttime, rq.timestamp);
+ if (diff.tv_sec != 0)
+ printf("\n+ %d.%06d sec:\n ", diff.tv_sec, diff.tv_usec);
+ else if (rq.type == loginfo_iodone) {
+ diff = timediff(rq.info.rqe.launchtime, rq.timestamp);
+ printf("+%6d µs ",
+ diff.tv_usec);
+ } else
+ printf(" ");
+ break;
+
+ default:
+ break;
+ }
- case loginfo_user_bp: /* this is the bp when strategy is called */
- printf("%s %dVS %s %p\t%2d.%-6d 0x%9llx\t%d\n",
- timetext(&rq.timestamp),
- rq.type,
- rq.info.b.b_iocmd == BIO_READ ? "Read " : "Write",
- rq.bp,
- rq.devmajor,
- rq.devminor,
- rq.info.b.b_blkno,
- rq.info.b.b_bcount);
- break;
+ /* Compress devminor into something printable. */
+ rq.devminor = (rq.devminor & 0xff)
+ | ((rq.devminor & 0xfff0000) >> 8);
+ switch (rq.type) {
+ case loginfo_user_bp: /* this is the bp when strategy is called */
+ printf("%s %dVS %s %p\t%2d.%-6d 0x%9llx\t%d\n",
+ timetext(&rq.timestamp),
+ rq.type,
+ rq.info.b.b_iocmd == BIO_READ ? "Read " : "Write",
+ rq.bp,
+ rq.devmajor,
+ rq.devminor,
+ rq.info.b.b_blkno,
+ rq.info.b.b_bcount);
+ break;
- case loginfo_sdiol: /* subdisk I/O launch */
- case loginfo_user_bpl: /* and this is the bp at launch time */
- printf("%s %dLR %s %p\t%2d.%-6d 0x%9llx\t%ld\n",
- timetext(&rq.timestamp),
- rq.type,
- rq.info.b.b_iocmd == BIO_READ ? "Read " : "Write",
- rq.bp,
- rq.devmajor,
- rq.devminor,
- rq.info.b.b_blkno,
- rq.info.b.b_bcount);
- break;
+ case loginfo_sdiol: /* subdisk I/O launch */
+ case loginfo_user_bpl: /* and this is the bp at launch time */
+ printf("%s %dLR %s %p\t%2d.%-6d 0x%9llx\t%ld\n",
+ timetext(&rq.timestamp),
+ rq.type,
+ rq.info.b.b_iocmd == BIO_READ ? "Read " : "Write",
+ rq.bp,
+ rq.devmajor,
+ rq.devminor,
+ rq.info.b.b_blkno,
+ rq.info.b.b_bcount);
+ break;
- case loginfo_rqe: /* user RQE */
- printf("%s 3RQ %s %p\t%2d.%-6d 0x%9llx\t%ld\t%d\t%6x\t%6x\t%x\n",
- timetext(&rq.timestamp),
- rq.info.rqe.b.b_iocmd == BIO_READ ? "Read " : "Write",
- rq.bp,
- rq.devmajor,
- rq.devminor,
- rq.info.rqe.b.b_blkno,
- rq.info.rqe.b.b_bcount,
- rq.info.rqe.sdno,
- rq.info.rqe.sdoffset,
- rq.info.rqe.dataoffset,
- rq.info.rqe.groupoffset);
- break;
+ case loginfo_rqe: /* user RQE */
+ /*
+ * We have two timestamps
+ * in this request, and
+ * they might not agree by
+ * one or two µs. Make
+ * them agree by force.
+ */
+ rq.timestamp = rq.info.rqe.launchtime;
+ printf("%s 3RQ %s %p\t%2d.%-6d 0x%9llx\t%ld\t%d\t%6x\t%6x\t%x\n",
+ timetext(&rq.timestamp),
+ rq.info.rqe.b.b_iocmd == BIO_READ ? "Read " : "Write",
+ rq.bp,
+ rq.devmajor,
+ rq.devminor,
+ rq.info.rqe.b.b_blkno,
+ rq.info.rqe.b.b_bcount,
+ rq.info.rqe.sdno,
+ rq.info.rqe.sdoffset,
+ rq.info.rqe.dataoffset,
+ rq.info.rqe.groupoffset);
+ break;
- case loginfo_iodone: /* iodone called */
- printf("%s 4DN %s %p\t%2d.%-6d 0x%9llx\t%ld\t%d\t%6x\t%6x\t%x\n",
- timetext(&rq.timestamp),
- rq.info.rqe.b.b_iocmd == BIO_READ ? "Read " : "Write",
- rq.bp,
- rq.devmajor,
- rq.devminor,
- rq.info.rqe.b.b_blkno,
- rq.info.rqe.b.b_bcount,
- rq.info.rqe.sdno,
- rq.info.rqe.sdoffset,
- rq.info.rqe.dataoffset,
- rq.info.rqe.groupoffset);
- break;
+ case loginfo_iodone: /* iodone called */
+ printf("%s 4DN %s %p\t%2d.%-6d 0x%9llx\t%ld\t%d\t%6x\t%6x\t%x\n",
+ timetext(&rq.timestamp),
+ rq.info.rqe.b.b_iocmd == BIO_READ ? "Read " : "Write",
+ rq.bp,
+ rq.devmajor,
+ rq.devminor,
+ rq.info.rqe.b.b_blkno,
+ rq.info.rqe.b.b_bcount,
+ rq.info.rqe.sdno,
+ rq.info.rqe.sdoffset,
+ rq.info.rqe.dataoffset,
+ rq.info.rqe.groupoffset);
+ break;
- case loginfo_raid5_data: /* RAID-5 write data block */
- printf("%s 5RD %s %p\t%2d.%-6d 0x%9llx\t%ld\t%d\t%6x\t%6x\t%x\n",
- timetext(&rq.timestamp),
- rq.info.rqe.b.b_iocmd == BIO_READ ? "Read " : "Write",
- rq.bp,
- rq.devmajor,
- rq.devminor,
- rq.info.rqe.b.b_blkno,
- rq.info.rqe.b.b_bcount,
- rq.info.rqe.sdno,
- rq.info.rqe.sdoffset,
- rq.info.rqe.dataoffset,
- rq.info.rqe.groupoffset);
- break;
+ case loginfo_raid5_data: /* RAID-5 write data block */
+ printf("%s 5RD %s %p\t%2d.%-6d 0x%9llx\t%ld\t%d\t%6x\t%6x\t%x\n",
+ timetext(&rq.timestamp),
+ rq.info.rqe.b.b_iocmd == BIO_READ ? "Read " : "Write",
+ rq.bp,
+ rq.devmajor,
+ rq.devminor,
+ rq.info.rqe.b.b_blkno,
+ rq.info.rqe.b.b_bcount,
+ rq.info.rqe.sdno,
+ rq.info.rqe.sdoffset,
+ rq.info.rqe.dataoffset,
+ rq.info.rqe.groupoffset);
+ break;
- case loginfo_raid5_parity: /* RAID-5 write parity block */
- printf("%s 6RP %s %p\t%2d.%-6d 0x%9llx\t%ld\t%d\t%6x\t%6x\t%x\n",
- timetext(&rq.timestamp),
- rq.info.rqe.b.b_iocmd == BIO_READ ? "Read " : "Write",
- rq.bp,
- rq.devmajor,
- rq.devminor,
- rq.info.rqe.b.b_blkno,
- rq.info.rqe.b.b_bcount,
- rq.info.rqe.sdno,
- rq.info.rqe.sdoffset,
- rq.info.rqe.dataoffset,
- rq.info.rqe.groupoffset);
- break;
+ case loginfo_raid5_parity: /* RAID-5 write parity block */
+ printf("%s 6RP %s %p\t%2d.%-6d 0x%9llx\t%ld\t%d\t%6x\t%6x\t%x\n",
+ timetext(&rq.timestamp),
+ rq.info.rqe.b.b_iocmd == BIO_READ ? "Read " : "Write",
+ rq.bp,
+ rq.devmajor,
+ rq.devminor,
+ rq.info.rqe.b.b_blkno,
+ rq.info.rqe.b.b_bcount,
+ rq.info.rqe.sdno,
+ rq.info.rqe.sdoffset,
+ rq.info.rqe.dataoffset,
+ rq.info.rqe.groupoffset);
+ break;
- case loginfo_sdio: /* subdisk I/O */
- printf("%s %dVS %s %p\t\t 0x%9llx\t%ld\t%d\n",
- timetext(&rq.timestamp),
- rq.type,
- rq.info.b.b_iocmd == BIO_READ ? "Read " : "Write",
- rq.bp,
- rq.info.b.b_blkno,
- rq.info.b.b_bcount,
- rq.devminor);
- break;
+ case loginfo_sdio: /* subdisk I/O */
+ printf("%s %dVS %s %p\t\t 0x%9llx\t%ld\t%d\n",
+ timetext(&rq.timestamp),
+ rq.type,
+ rq.info.b.b_iocmd == BIO_READ ? "Read " : "Write",
+ rq.bp,
+ rq.info.b.b_blkno,
+ rq.info.b.b_bcount,
+ rq.devminor);
+ break;
- case loginfo_sdiodone: /* subdisk I/O done */
- printf("%s %dSD %s %p\t\t 0x%9llx\t%ld\t%d\n",
- timetext(&rq.timestamp),
- rq.type,
- rq.info.b.b_iocmd == BIO_READ ? "Read " : "Write",
- rq.bp,
- rq.info.b.b_blkno,
- rq.info.b.b_bcount,
- rq.devminor);
- break;
+ case loginfo_sdiodone: /* subdisk I/O done */
+ printf("%s %dSD %s %p\t\t 0x%9llx\t%ld\t%d\n",
+ timetext(&rq.timestamp),
+ rq.type,
+ rq.info.b.b_iocmd == BIO_READ ? "Read " : "Write",
+ rq.bp,
+ rq.info.b.b_blkno,
+ rq.info.b.b_bcount,
+ rq.devminor);
+ break;
- case loginfo_lockwait:
- printf("%s Lockwait %p\t 0x%x\n",
- timetext(&rq.timestamp),
- rq.bp,
- rq.info.lockinfo.stripe);
- break;
+ case loginfo_lockwait:
+ printf("%s Lockwait %p\t 0x%x\n",
+ timetext(&rq.timestamp),
+ rq.bp,
+ rq.info.lockinfo.stripe);
+ break;
- case loginfo_lock:
- printf("%s Lock %p\t 0x%x\n",
- timetext(&rq.timestamp),
- rq.bp,
- rq.info.lockinfo.stripe);
- break;
+ case loginfo_lock:
+ printf("%s Lock %p\t 0x%x\n",
+ timetext(&rq.timestamp),
+ rq.bp,
+ rq.info.lockinfo.stripe);
+ break;
- case loginfo_unlock:
- printf("%s Unlock\t %p\t 0x%x\n",
- timetext(&rq.timestamp),
- rq.bp,
- rq.info.lockinfo.stripe);
- break;
+ case loginfo_unlock:
+ printf("%s Unlock\t %p\t 0x%x\n",
+ timetext(&rq.timestamp),
+ rq.bp,
+ rq.info.lockinfo.stripe);
+ break;
+ default:
+ printf("*** invalid log type: %d ***\n", rq.type);
+ }
+ if (Verbose > 1)
+ lasttime = rq.timestamp;
}
}
}
@@ -1214,7 +1267,7 @@
{
int i;
- if (argc == 0) { /* start everything */
+ if (argc == 0) { /* dump everything */
int devs = devstat_getnumdevs(NULL);
struct statinfo statinfo;
char *namelist;
==== //depot/projects/hammer/sbin/vinum/v.c#4 (text+ko) ====
@@ -36,37 +36,14 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
- * $Id: v.c,v 1.31 2000/09/03 01:29:26 grog Exp grog $
- * $FreeBSD: src/sbin/vinum/v.c,v 1.37 2003/01/16 23:48:34 joerg Exp $
+ * $Id: v.c,v 1.35 2003/04/26 02:02:49 grog Exp $
+ * $FreeBSD: src/sbin/vinum/v.c,v 1.38 2003/05/01 01:39:42 grog Exp $
*/
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <grp.h>
-#include <sys/mman.h>
-#include <netdb.h>
-#include <paths.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
#include "vext.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <readline/history.h>
-#include <readline/readline.h>
-#include <sys/linker.h>
-#include <sys/module.h>
-#include <sys/resource.h>
-#include <sys/sysctl.h>
FILE *cf; /* config file handle */
-FILE *history; /* history file */
+FILE *History; /* history file */
char *historyfile; /* and its name */
char *dateformat; /* format in which to store date */
@@ -150,11 +127,11 @@
errno);
exit(1);
}
- history = fopen(historyfile, "a+");
- if (history != NULL) {
+ History = fopen(historyfile, "a+");
+ if (History != NULL) {
timestamp();
- fprintf(history, "*** " VINUMMOD " started ***\n");
- fflush(history); /* before we start the daemon */
+ fprintf(History, "*** " VINUMMOD " started ***\n");
+ fflush(History); /* before we start the daemon */
}
if (sysctlbyname("vfs.devfs.generation", NULL, NULL, NULL, 0) == 0)
no_devfs = 0;
@@ -246,8 +223,8 @@
if (tokens)
parseline(tokens, token); /* and do what he says */
}
- if (history)
- fflush(history);
+ if (History)
+ fflush(History);
}
}
return 0; /* normal completion */
@@ -336,11 +313,11 @@
int j;
enum keyword command; /* command to execute */
- if (history != NULL) { /* save the command to history file */
+ if (History != NULL) { /* save the command to history file */
timestamp();
for (i = 0; i < args; i++) /* all args */
- fprintf(history, "%s ", argv[i]);
- fputs("\n", history);
+ fprintf(History, "%s ", argv[i]);
+ fputs("\n", History);
}
if ((args == 0) /* empty line */
||(*argv[0] == '#')) /* or a comment, */
@@ -544,9 +521,9 @@
perror(VINUMMOD ": Can't write to " _PATH_DEV);
return;
}
- if (history) {
+ if (History) {
timestamp();
- fprintf(history, "*** Created devices ***\n");
+ fprintf(History, "*** Created devices ***\n");
}
if (superdev >= 0) /* super device open */
close(superdev);
@@ -559,10 +536,9 @@
if (mknod(VINUM_SUPERDEV_NAME,
S_IRUSR | S_IWUSR | S_IFCHR, /* user only */
- makedev(VINUM_CDEV_MAJOR, VINUM_SUPERDEV)) < 0)
+ makedev(VINUM_CDEV_MAJOR, VINUM_SUPERDEV_VOL)) < 0)
fprintf(stderr, "Can't create %s: %s\n", VINUM_SUPERDEV_NAME, strerror(errno));
-
superdev = open(VINUM_SUPERDEV_NAME, O_RDWR); /* open the super device */
if (superdev < 0) {
perror(VINUM_SUPERDEV_NAME);
@@ -570,7 +546,7 @@
}
if (mknod(VINUM_DAEMON_DEV_NAME, /* daemon super device */
S_IRUSR | S_IWUSR | S_IFCHR, /* user only */
- makedev(VINUM_CDEV_MAJOR, VINUM_DAEMON_DEV)) < 0)
+ makedev(VINUM_CDEV_MAJOR, VINUM_DAEMON_VOL)) < 0)
fprintf(stderr, "Can't create %s: %s\n", VINUM_DAEMON_DEV_NAME, strerror(errno));
if (ioctl(superdev, VINUM_GETCONFIG, &vinum_conf) < 0) {
@@ -608,26 +584,29 @@
get_volume_info(&vol, volno);
if (vol.state != volume_unallocated) { /* we could have holes in our lists */
- voldev = VINUMDEV(volno, 0, 0, VINUM_VOLUME_TYPE); /* create a device number */
+ voldev = VINUMDEV(volno, VINUM_VOLUME_TYPE); /* create a device number */
/* Create /dev/vinum/<myvol> */
sprintf(filename, VINUM_DIR "/%s", vol.name);
if (mknod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, voldev) < 0)
fprintf(stderr, "Can't create %s: %s\n", filename, strerror(errno));
- (void)chown(filename, UID_ROOT, gid_operator);
+ else
+ chown(filename, UID_ROOT, gid_operator);
/* Create /dev/vinum/vol/<myvol> */
sprintf(filename, VINUM_DIR "/vol/%s", vol.name);
if (mknod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, voldev) < 0)
fprintf(stderr, "Can't create %s: %s\n", filename, strerror(errno));
- (void)chown(filename, UID_ROOT, gid_operator);
+ else
+ chown(filename, UID_ROOT, gid_operator);
if (vol.plexes > 0) {
/* Create /dev/vinum/vol/<myvol>.plex/ */
sprintf(filename, VINUM_DIR "/vol/%s.plex", vol.name);
if (mkdir(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IXOTH) < 0)
fprintf(stderr, "Can't create %s: %s\n", filename, strerror(errno));
- (void)chown(filename, UID_ROOT, gid_operator);
+ else
+ chown(filename, UID_ROOT, gid_operator);
}
if (recurse)
for (plexno = 0; plexno < vol.plexes; plexno++)
@@ -654,23 +633,26 @@
sprintf(filename, VINUM_DIR "/plex/%s", plex.name);
if (mknod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, plexdev) < 0)
fprintf(stderr, "Can't create %s: %s\n", filename, strerror(errno));
- (void)chown(filename, UID_ROOT, gid_operator);
+ else
+ chown(filename, UID_ROOT, gid_operator);
if (plex.volno >= 0) {
get_volume_info(&vol, plex.volno);
- plexdev = VINUMDEV(plex.volno, plexno, 0, VINUM_PLEX_TYPE);
+ plexdev = VINUMDEV(plex.volno, VINUM_PLEX_TYPE);
/* Create device /dev/vinum/vol/<vol>.plex/<plex> */
sprintf(filename, VINUM_DIR "/vol/%s.plex/%s", vol.name, plex.name);
if (mknod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, plexdev) < 0)
fprintf(stderr, "Can't create %s: %s\n", filename, strerror(errno));
- (void)chown(filename, UID_ROOT, gid_operator);
+ else
+ chown(filename, UID_ROOT, gid_operator);
/* Create directory /dev/vinum/vol/<vol>.plex/<plex>.sd */
sprintf(filename, VINUM_DIR "/vol/%s.plex/%s.sd", vol.name, plex.name);
if (mkdir(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IXOTH) < 0)
fprintf(stderr, "Can't create %s: %s\n", filename, strerror(errno));
- (void)chown(filename, UID_ROOT, gid_operator);
+ else
+ chown(filename, UID_ROOT, gid_operator);
}
if (recurse) {
for (sdno = 0; sdno < plex.subdisks; sdno++) {
@@ -696,7 +678,8 @@
sprintf(filename, VINUM_DIR "/sd/%s", sd.name);
if (mknod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, sddev) < 0)
fprintf(stderr, "Can't create %s: %s\n", filename, strerror(errno));
- (void)chown(filename, UID_ROOT, gid_operator);
+ else
+ chown(filename, UID_ROOT, gid_operator);
}
}
@@ -877,7 +860,7 @@
char datetext[MAXDATETEXT];
time_t sec;
- if (history != NULL) {
+ if (History != NULL) {
if (gettimeofday(&now, NULL) != 0) {
fprintf(stderr, "Can't get time: %s\n", strerror(errno));
return;
@@ -885,7 +868,7 @@
sec = now.tv_sec;
date = localtime(&sec);
strftime(datetext, MAXDATETEXT, dateformat, date),
- fprintf(history,
+ fprintf(History,
"%s.%06ld ",
datetext,
now.tv_usec);
==== //depot/projects/hammer/sbin/vinum/vext.h#3 (text+ko) ====
@@ -35,14 +35,15 @@
*/
/*
- * $Id: vext.h,v 1.19 2001/05/23 23:00:12 grog Exp grog $
- * $FreeBSD: src/sbin/vinum/vext.h,v 1.26 2003/02/16 14:13:23 phk Exp $
+ * $Id: vext.h,v 1.22 2003/04/28 06:19:06 grog Exp $
+ * $FreeBSD: src/sbin/vinum/vext.h,v 1.27 2003/05/01 01:40:16 grog Exp $
*/
#define MAXARGS 64 /* maximum number of args on a line */
#define PLEXINITSIZE 65536 /* init in this size chunks */
#define MAXPLEXINITSIZE 65536 /* max chunk size to use for init */
#define MAXDATETEXT 128 /* date text in history (far too much) */
+#define VINUMDEBUG /* for including kernel headers */
enum {
KILOBYTE = 1024,
@@ -54,8 +55,31 @@
#define DEFAULT_HISTORYFILE "/var/log/vinum_history" /* default name for history stuff */
+#include <ctype.h>
+#include <errno.h>
#include <sys/param.h>
-#include <sys/errno.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <grp.h>
+#include <netdb.h>
+#include <paths.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/linker.h>
+#include <sys/module.h>
+#include <sys/resource.h>
+#include <readline/history.h>
+#include <readline/readline.h>
+#include <sys/sysctl.h>
+
#include <sys/time.h>
#include <sys/bio.h>
#include <sys/buf.h>
@@ -67,7 +91,6 @@
#include <sys/syslog.h>
#include <sys/fcntl.h>
#include <sys/queue.h>
-#include <setjmp.h>
#include <stdarg.h>
#include <vm/vm.h>
#include <dev/vinum/vinumvar.h>
@@ -178,7 +201,7 @@
extern int dowait; /* wait for children to exit */
extern char *objectname; /* name for some functions */
-extern FILE *history; /* history file */
+extern FILE *History; /* history file */
/* Structures to read kernel data into */
extern struct __vinum_conf vinum_conf; /* configuration information */
==== //depot/projects/hammer/sys/conf/Makefile.amd64#6 (text+ko) ====
@@ -2,7 +2,7 @@
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91
# from FreeBSD: src/sys/conf/Makefile.i386,v 1.255 2002/02/20 23:35:49
-# $FreeBSD: src/sys/conf/Makefile.amd64,v 1.5 2003/04/15 21:29:11 phk Exp $
+# $FreeBSD: src/sys/conf/Makefile.amd64,v 1.6 2003/05/01 02:59:24 peter Exp $
#
# Makefile for FreeBSD
#
@@ -28,9 +28,7 @@
OBJCOPY= x86_64-unknown-freebsd5.0-objcopy
OBJDUMP= x86_64-unknown-freebsd5.0-objdump
MACHINE_ARCH= amd64
-#COPTFLAGS= # none, -O crashes the 3.2 cross compiler I have
-NO_CPU_COPTFLAGS= true
-
+NO_CPU_COPTFLAGS= true # minimize cross compile pain
# Which version of config(8) is required.
%VERSREQ= 500012
==== //depot/projects/hammer/sys/conf/files.amd64#6 (text+ko) ====
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $FreeBSD: src/sys/conf/files.amd64,v 1.10 2003/02/28 21:59:13 ru Exp $
+# $FreeBSD: src/sys/conf/files.amd64,v 1.11 2003/05/01 02:59:24 peter Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
==== //depot/projects/hammer/sys/conf/ldscript.amd64#5 (text+ko) ====
@@ -1,4 +1,4 @@
-/* Default linker script, for normal executables */
+/* $FreeBSD: src/sys/conf/ldscript.amd64,v 1.8 2003/05/01 02:59:24 peter Exp $ */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(btext)
==== //depot/projects/hammer/sys/conf/options.amd64#6 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options.amd64,v 1.5 2003/04/12 09:40:37 des Exp $
+# $FreeBSD: src/sys/conf/options.amd64,v 1.6 2003/05/01 02:59:24 peter Exp $
# Options specific to the AMD x86-64 platform kernels
MAXMEM
==== //depot/projects/hammer/usr.bin/m4/eval.c#2 (text+ko) ====
@@ -48,7 +48,7 @@
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/m4/eval.c,v 1.20 2002/07/15 02:15:12 jmallett Exp $");
+__FBSDID("$FreeBSD: src/usr.bin/m4/eval.c,v 1.21 2003/05/01 02:36:27 tjr Exp $");
/*
* eval.c
@@ -241,8 +241,10 @@
/*
* dosys - execute system command
*/
- if (argc > 2)
+ if (argc > 2) {
+ fflush(NULL);
sysval = system(argv[2]);
+ }
break;
case SYSVTYPE:
More information about the p4-projects
mailing list