Date: Fri, 8 May 2009 19:55:25 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 161785 for review Message-ID: <200905081955.n48JtPqu098732@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=161785 Change 161785 by zec@zec_tpx32 on 2009/05/08 19:54:29 Unbreak vimage(8) build. Affected files ... .. //depot/projects/vimage-commit2/src/usr.sbin/vimage/vimage.c#2 edit Differences ... ==== //depot/projects/vimage-commit2/src/usr.sbin/vimage/vimage.c#2 (text+ko) ==== @@ -78,7 +78,7 @@ int argc; char *argv[]; { - int s, i; + int s; char *shell; int cmd = VI_SWITCHTO; struct vi_req vi_req; @@ -117,13 +117,12 @@ strcpy(vi_req.vi_name, argv[2]); if (strcmp(argv[1], "-c") == 0) cmd = VI_CREATE; - if (strcmp(argv[1], "-m") == 0) - cmd = VI_MODIFY; if (strcmp(argv[1], "-i") == 0) cmd = VI_IFACE; } - vi_req.req_action = cmd; + vi_req.vi_api_cookie = VI_API_COOKIE; + vi_req.vi_req_action = cmd; switch (cmd) { case VI_GET: @@ -137,89 +136,26 @@ case VI_GETNEXT: case VI_GETNEXT_RECURSE: - vi_req.req_action = VI_GET; + vi_req.vi_req_action = VI_GET; if (ioctl(s, SIOCGPVIMAGE, (caddr_t)&vi_req) < 0) goto abort; vi_print(&vi_req); - vi_req.req_action = VI_GETNEXT_RECURSE; + vi_req.vi_req_action = VI_GETNEXT_RECURSE; while (ioctl(s, SIOCGPVIMAGE, (caddr_t)&vi_req) == 0) { vi_print(&vi_req); - vi_req.req_action = cmd; + vi_req.vi_req_action = cmd; } exit(0); case VI_IFACE: - /* here vi_chroot stores the current ifc name */ - strncpy(vi_req.vi_chroot, argv[3], sizeof(vi_req.vi_chroot)); - if (argc >= 5) - strncpy(vi_req.vi_if_xname, argv[4], + strncpy(vi_req.vi_if_xname, argv[3], sizeof(vi_req.vi_if_xname)); - else - vi_req.vi_if_xname[0] = 0; if (ioctl(s, SIOCSIFVIMAGE, (caddr_t)&vi_req) < 0) goto abort; - printf("%s@%s\n", vi_req.vi_chroot, vi_req.vi_name); + printf("%s@%s\n", vi_req.vi_if_xname, vi_req.vi_name); exit(0); case VI_CREATE: - case VI_MODIFY: - for (i = 3; i < argc-1; i += 2) { - if (strcmp(argv[i], "maxsockets") == 0) { - vi_req.req_action |= VI_SET_SOCK_LIMIT; - vi_req.vi_maxsockets = strtod(argv[i+1], NULL); - } - if (strcmp(argv[i], "cpumin") == 0) { - vi_req.req_action |= VI_SET_CPU_MIN; - vi_req.vi_cpu_min = - strtod(argv[i+1], NULL) * 10000; - if (vi_req.vi_cpu_min > 900000) { - fprintf(stderr, "error: cpumin must be between 0 and 90\n"); - exit(1); - } - } - if (strcmp(argv[i], "cpumax") == 0) { - vi_req.req_action |= VI_SET_CPU_MAX; - vi_req.vi_cpu_max = - strtod(argv[i+1], NULL) * 10000; - if (vi_req.vi_cpu_max < 10000 || - vi_req.vi_cpu_max > 1000000) { - fprintf(stderr, "error: cpumax must be between 1 and 100\n"); - exit(1); - } - } - if (strcmp(argv[i], "cpuweight") == 0) { - vi_req.req_action |= VI_SET_CPU_WEIGHT; - vi_req.vi_cpu_weight = strtod(argv[i+1], NULL); - if (vi_req.vi_cpu_weight < 1 || - vi_req.vi_cpu_weight > 10) { - fprintf(stderr, "error: cpuweight must be between 1 and 10\n"); - exit(1); - } - } - if (strcmp(argv[i], "intr") == 0) { - vi_req.req_action |= VI_SET_INTR_LIMIT; - vi_req.vi_intr_limit = - strtod(argv[i+1], NULL) * 10000; - if (vi_req.vi_intr_limit < 10000 || - vi_req.vi_intr_limit > 1000000) { - fprintf(stderr, "error: intr limit must be between 1 and 100\n"); - exit(1); - } - } - if (strcmp(argv[i], "child") == 0) { - vi_req.req_action |= VI_SET_CHILD_LIMIT; - vi_req.vi_child_limit = atoi(argv[i+1]); - } - if (strcmp(argv[i], "proc") == 0) { - vi_req.req_action |= VI_SET_PROC_LIMIT; - vi_req.vi_proc_limit = atoi(argv[i+1]); - } - if (strcmp(argv[i], "chroot") == 0) { - vi_req.req_action |= VI_SET_CHROOT; - strncpy(vi_req.vi_chroot, argv[i+1], - sizeof(vi_req.vi_chroot)); - } - } if (ioctl(s, SIOCSPVIMAGE, (caddr_t)&vi_req) < 0) goto abort; exit(0); @@ -229,16 +165,12 @@ if (ioctl(s, SIOCSPVIMAGE, (caddr_t)&vi_req) < 0) goto abort; - vi_req.req_action = VI_GET; + vi_req.vi_req_action = VI_GET; strcpy(vi_req.vi_name, "."); if (ioctl(s, SIOCGPVIMAGE, (caddr_t)&vi_req) < 0) { printf("XXX this should have not happened!\n"); goto abort; } - - if (strlen(vi_req.vi_chroot) && (chdir(vi_req.vi_chroot) || - chroot(vi_req.vi_chroot))) - goto abort; close(s); if (argc == 2) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905081955.n48JtPqu098732>