geom.c (157580) | geom.c (162867) |
---|---|
1/*- 2 * Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sbin/geom/core/geom.c 157580 2006-04-07 15:33:04Z pjd $"); | 28__FBSDID("$FreeBSD: head/sbin/geom/core/geom.c 162867 2006-09-30 14:39:18Z pjd $"); |
29 30#include <sys/param.h> 31#include <sys/linker.h> 32#include <sys/module.h> 33#include <sys/stat.h> 34#include <sys/sysctl.h> 35#include <ctype.h> 36#include <err.h> --- 33 unchanged lines hidden (view full) --- 70 71struct g_command std_commands[] = { 72 { "help", 0, std_help, G_NULL_OPTS, NULL }, 73 { "list", 0, std_list, G_NULL_OPTS, 74 "[name ...]" 75 }, 76 { "status", 0, std_status, 77 { | 29 30#include <sys/param.h> 31#include <sys/linker.h> 32#include <sys/module.h> 33#include <sys/stat.h> 34#include <sys/sysctl.h> 35#include <ctype.h> 36#include <err.h> --- 33 unchanged lines hidden (view full) --- 70 71struct g_command std_commands[] = { 72 { "help", 0, std_help, G_NULL_OPTS, NULL }, 73 { "list", 0, std_list, G_NULL_OPTS, 74 "[name ...]" 75 }, 76 { "status", 0, std_status, 77 { |
78 { 's', "script", NULL, G_TYPE_NONE }, | 78 { 's', "script", NULL, G_TYPE_BOOL }, |
79 G_OPT_SENTINEL 80 }, 81 "[-s] [name ...]" 82 }, 83 { "load", G_FLAG_VERBOSE | G_FLAG_LOADKLD, std_load, G_NULL_OPTS, NULL }, 84 { "unload", G_FLAG_VERBOSE, std_unload, G_NULL_OPTS, NULL }, 85 G_CMD_SENTINEL 86}; --- 10 unchanged lines hidden (view full) --- 97 return; 98 } 99 if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0) 100 fprintf(stderr, " [-v]"); 101 for (i = 0; ; i++) { 102 opt = &cmd->gc_options[i]; 103 if (opt->go_name == NULL) 104 break; | 79 G_OPT_SENTINEL 80 }, 81 "[-s] [name ...]" 82 }, 83 { "load", G_FLAG_VERBOSE | G_FLAG_LOADKLD, std_load, G_NULL_OPTS, NULL }, 84 { "unload", G_FLAG_VERBOSE, std_unload, G_NULL_OPTS, NULL }, 85 G_CMD_SENTINEL 86}; --- 10 unchanged lines hidden (view full) --- 97 return; 98 } 99 if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0) 100 fprintf(stderr, " [-v]"); 101 for (i = 0; ; i++) { 102 opt = &cmd->gc_options[i]; 103 if (opt->go_name == NULL) 104 break; |
105 if (opt->go_val != NULL || opt->go_type == G_TYPE_NONE) | 105 if (opt->go_val != NULL || G_OPT_TYPE(opt) == G_TYPE_BOOL) |
106 fprintf(stderr, " ["); 107 else 108 fprintf(stderr, " "); 109 fprintf(stderr, "-%c", opt->go_char); | 106 fprintf(stderr, " ["); 107 else 108 fprintf(stderr, " "); 109 fprintf(stderr, "-%c", opt->go_char); |
110 if (opt->go_type != G_TYPE_NONE) | 110 if (G_OPT_TYPE(opt) != G_TYPE_BOOL) |
111 fprintf(stderr, " %s", opt->go_name); | 111 fprintf(stderr, " %s", opt->go_name); |
112 if (opt->go_val != NULL || opt->go_type == G_TYPE_NONE) | 112 if (opt->go_val != NULL || G_OPT_TYPE(opt) == G_TYPE_BOOL) |
113 fprintf(stderr, "]"); 114 } 115 fprintf(stderr, "\n"); 116} 117 118static void 119usage(void) 120{ --- 92 unchanged lines hidden (view full) --- 213 214/* 215 * Add given option to gctl_req. 216 */ 217static void 218set_option(struct gctl_req *req, struct g_option *opt, const char *val) 219{ 220 | 113 fprintf(stderr, "]"); 114 } 115 fprintf(stderr, "\n"); 116} 117 118static void 119usage(void) 120{ --- 92 unchanged lines hidden (view full) --- 213 214/* 215 * Add given option to gctl_req. 216 */ 217static void 218set_option(struct gctl_req *req, struct g_option *opt, const char *val) 219{ 220 |
221 if (opt->go_type == G_TYPE_NUMBER) { | 221 if (G_OPT_TYPE(opt) == G_TYPE_NUMBER) { |
222 intmax_t number; 223 224 errno = 0; 225 number = strtoimax(optarg, NULL, 0); 226 if (errno != 0) { 227 err(EXIT_FAILURE, "Invalid value for '%c' argument.", 228 opt->go_char); 229 } 230 opt->go_val = malloc(sizeof(intmax_t)); 231 if (opt->go_val == NULL) 232 errx(EXIT_FAILURE, "No memory."); 233 *(intmax_t *)opt->go_val = number; 234 235 gctl_ro_param(req, opt->go_name, sizeof(intmax_t), opt->go_val); | 222 intmax_t number; 223 224 errno = 0; 225 number = strtoimax(optarg, NULL, 0); 226 if (errno != 0) { 227 err(EXIT_FAILURE, "Invalid value for '%c' argument.", 228 opt->go_char); 229 } 230 opt->go_val = malloc(sizeof(intmax_t)); 231 if (opt->go_val == NULL) 232 errx(EXIT_FAILURE, "No memory."); 233 *(intmax_t *)opt->go_val = number; 234 235 gctl_ro_param(req, opt->go_name, sizeof(intmax_t), opt->go_val); |
236 } else if (opt->go_type == G_TYPE_STRING) { | 236 } else if (G_OPT_TYPE(opt) == G_TYPE_STRING) { |
237 gctl_ro_param(req, opt->go_name, -1, optarg); | 237 gctl_ro_param(req, opt->go_name, -1, optarg); |
238 } else /* if (opt->go_type == G_TYPE_NONE) */ { | 238 } else if (G_OPT_TYPE(opt) == G_TYPE_BOOL) { |
239 opt->go_val = malloc(sizeof(int)); 240 if (opt->go_val == NULL) 241 errx(EXIT_FAILURE, "No memory."); 242 *(int *)opt->go_val = *val - '0'; 243 244 gctl_ro_param(req, opt->go_name, sizeof(int), 245 opt->go_val); | 239 opt->go_val = malloc(sizeof(int)); 240 if (opt->go_val == NULL) 241 errx(EXIT_FAILURE, "No memory."); 242 *(int *)opt->go_val = *val - '0'; 243 244 gctl_ro_param(req, opt->go_name, sizeof(int), 245 opt->go_val); |
246 } else { 247 assert(!"Invalid type"); |
|
246 } 247} 248 249/* 250 * 1. Add given argument by caller. 251 * 2. Add default values of not given arguments. 252 * 3. Add the rest of arguments. 253 */ --- 8 unchanged lines hidden (view full) --- 262 263 *opts = '\0'; 264 if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0) 265 strlcat(opts, "v", sizeof(opts)); 266 for (i = 0; ; i++) { 267 opt = &cmd->gc_options[i]; 268 if (opt->go_name == NULL) 269 break; | 248 } 249} 250 251/* 252 * 1. Add given argument by caller. 253 * 2. Add default values of not given arguments. 254 * 3. Add the rest of arguments. 255 */ --- 8 unchanged lines hidden (view full) --- 264 265 *opts = '\0'; 266 if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0) 267 strlcat(opts, "v", sizeof(opts)); 268 for (i = 0; ; i++) { 269 opt = &cmd->gc_options[i]; 270 if (opt->go_name == NULL) 271 break; |
272 assert(G_OPT_TYPE(opt) != 0); 273 assert((opt->go_type & ~G_TYPE_MASK) == 0); |
|
270 strlcatf(opts, sizeof(opts), "%c", opt->go_char); | 274 strlcatf(opts, sizeof(opts), "%c", opt->go_char); |
271 if (opt->go_type != G_TYPE_NONE) | 275 if (G_OPT_TYPE(opt) != G_TYPE_BOOL) |
272 strlcat(opts, ":", sizeof(opts)); 273 } 274 275 /* 276 * Add specified arguments. 277 */ 278 while ((ch = getopt(*argc, *argv, opts)) != -1) { 279 /* Standard (not passed to kernel) options. */ 280 switch (ch) { 281 case 'v': 282 verbose = 1; 283 continue; 284 } 285 /* Options passed to kernel. */ 286 opt = find_option(cmd, ch); 287 if (opt == NULL) 288 usage(); 289 if (G_OPT_ISDONE(opt)) { | 276 strlcat(opts, ":", sizeof(opts)); 277 } 278 279 /* 280 * Add specified arguments. 281 */ 282 while ((ch = getopt(*argc, *argv, opts)) != -1) { 283 /* Standard (not passed to kernel) options. */ 284 switch (ch) { 285 case 'v': 286 verbose = 1; 287 continue; 288 } 289 /* Options passed to kernel. */ 290 opt = find_option(cmd, ch); 291 if (opt == NULL) 292 usage(); 293 if (G_OPT_ISDONE(opt)) { |
290 fprintf(stderr, "Flag '%c' specified twice.\n", 291 opt->go_char); | 294 warnx("Option '%c' specified twice.", opt->go_char); |
292 usage(); 293 } 294 G_OPT_DONE(opt); 295 | 295 usage(); 296 } 297 G_OPT_DONE(opt); 298 |
296 if (opt->go_type == G_TYPE_NONE) | 299 if (G_OPT_TYPE(opt) == G_TYPE_BOOL) |
297 set_option(req, opt, "1"); 298 else 299 set_option(req, opt, optarg); 300 } 301 *argc -= optind; 302 *argv += optind; 303 304 /* 305 * Add not specified arguments, but with default values. 306 */ 307 for (i = 0; ; i++) { 308 opt = &cmd->gc_options[i]; 309 if (opt->go_name == NULL) 310 break; 311 if (G_OPT_ISDONE(opt)) 312 continue; 313 | 300 set_option(req, opt, "1"); 301 else 302 set_option(req, opt, optarg); 303 } 304 *argc -= optind; 305 *argv += optind; 306 307 /* 308 * Add not specified arguments, but with default values. 309 */ 310 for (i = 0; ; i++) { 311 opt = &cmd->gc_options[i]; 312 if (opt->go_name == NULL) 313 break; 314 if (G_OPT_ISDONE(opt)) 315 continue; 316 |
314 if (opt->go_type == G_TYPE_NONE) { | 317 if (G_OPT_TYPE(opt) == G_TYPE_BOOL) { |
315 assert(opt->go_val == NULL); 316 set_option(req, opt, "0"); 317 } else { 318 if (opt->go_val == NULL) { | 318 assert(opt->go_val == NULL); 319 set_option(req, opt, "0"); 320 } else { 321 if (opt->go_val == NULL) { |
319 fprintf(stderr, "Flag '%c' not specified.\n", | 322 warnx("Option '%c' not specified.", |
320 opt->go_char); 321 usage(); 322 } else { | 323 opt->go_char); 324 usage(); 325 } else { |
323 if (opt->go_type == G_TYPE_NUMBER) { | 326 if (G_OPT_TYPE(opt) == G_TYPE_NUMBER) { |
324 gctl_ro_param(req, opt->go_name, 325 sizeof(intmax_t), opt->go_val); | 327 gctl_ro_param(req, opt->go_name, 328 sizeof(intmax_t), opt->go_val); |
326 } else /* if (opt->go_type == G_TYPE_STRING)*/ { | 329 } else if (G_OPT_TYPE(opt) == G_TYPE_STRING) { |
327 gctl_ro_param(req, opt->go_name, -1, 328 opt->go_val); | 330 gctl_ro_param(req, opt->go_name, -1, 331 opt->go_val); |
332 } else { 333 assert(!"Invalid type"); |
|
329 } 330 } 331 } 332 } 333 /* 334 * Add rest of given arguments. 335 */ 336 gctl_ro_param(req, "nargs", sizeof(int), argc); --- 64 unchanged lines hidden (view full) --- 401 char buf[4096]; 402 403 /* First try to find a command defined by a class. */ 404 cmd = find_command(argv[0], GEOM_CLASS_CMDS); 405 if (cmd == NULL) { 406 /* Now, try to find a standard command. */ 407 cmd = find_command(argv[0], GEOM_STD_CMDS); 408 if (cmd == NULL) { | 334 } 335 } 336 } 337 } 338 /* 339 * Add rest of given arguments. 340 */ 341 gctl_ro_param(req, "nargs", sizeof(int), argc); --- 64 unchanged lines hidden (view full) --- 406 char buf[4096]; 407 408 /* First try to find a command defined by a class. */ 409 cmd = find_command(argv[0], GEOM_CLASS_CMDS); 410 if (cmd == NULL) { 411 /* Now, try to find a standard command. */ 412 cmd = find_command(argv[0], GEOM_STD_CMDS); 413 if (cmd == NULL) { |
409 fprintf(stderr, "Unknown command: %s\n", argv[0]); | 414 warnx("Unknown command: %s.", argv[0]); |
410 usage(); 411 } 412 if (!std_available(cmd->gc_name)) { | 415 usage(); 416 } 417 if (!std_available(cmd->gc_name)) { |
413 fprintf(stderr, "Command '%s' not available.\n", 414 argv[0]); | 418 warnx("Command '%s' not available.", argv[0]); |
415 exit(EXIT_FAILURE); 416 } 417 } 418 if ((cmd->gc_flags & G_FLAG_LOADKLD) != 0) 419 load_module(); 420 421 req = gctl_get_handle(); 422 gctl_ro_param(req, "class", -1, gclass_name); --- 9 unchanged lines hidden (view full) --- 432 flags = set_flags(cmd); 433 cmd->gc_func(req, flags); 434 errstr = req->error; 435 } else { 436 gctl_rw_param(req, "output", sizeof(buf), buf); 437 errstr = gctl_issue(req); 438 } 439 if (errstr != NULL && errstr[0] != '\0') { | 419 exit(EXIT_FAILURE); 420 } 421 } 422 if ((cmd->gc_flags & G_FLAG_LOADKLD) != 0) 423 load_module(); 424 425 req = gctl_get_handle(); 426 gctl_ro_param(req, "class", -1, gclass_name); --- 9 unchanged lines hidden (view full) --- 436 flags = set_flags(cmd); 437 cmd->gc_func(req, flags); 438 errstr = req->error; 439 } else { 440 gctl_rw_param(req, "output", sizeof(buf), buf); 441 errstr = gctl_issue(req); 442 } 443 if (errstr != NULL && errstr[0] != '\0') { |
440 fprintf(stderr, "%s\n", errstr); | 444 warnx("%s", errstr); |
441 if (strncmp(errstr, "warning: ", strlen("warning: ")) != 0) { 442 gctl_free(req); 443 exit(EXIT_FAILURE); 444 } 445 } 446 if (buf[0] != '\0') 447 printf("%s", buf); 448 gctl_free(req); --- 32 unchanged lines hidden (view full) --- 481 } 482 err(EXIT_FAILURE, "Cannot access library"); 483 } 484 dlh = dlopen(path, RTLD_NOW); 485 if (dlh == NULL) 486 errx(EXIT_FAILURE, "Cannot open library: %s.", dlerror()); 487 lib_version = dlsym(dlh, "lib_version"); 488 if (lib_version == NULL) { | 445 if (strncmp(errstr, "warning: ", strlen("warning: ")) != 0) { 446 gctl_free(req); 447 exit(EXIT_FAILURE); 448 } 449 } 450 if (buf[0] != '\0') 451 printf("%s", buf); 452 gctl_free(req); --- 32 unchanged lines hidden (view full) --- 485 } 486 err(EXIT_FAILURE, "Cannot access library"); 487 } 488 dlh = dlopen(path, RTLD_NOW); 489 if (dlh == NULL) 490 errx(EXIT_FAILURE, "Cannot open library: %s.", dlerror()); 491 lib_version = dlsym(dlh, "lib_version"); 492 if (lib_version == NULL) { |
489 fprintf(stderr, "Cannot find symbol %s: %s.\n", "lib_version", 490 dlerror()); | 493 warnx("Cannot find symbol %s: %s.", "lib_version", dlerror()); |
491 dlclose(dlh); 492 exit(EXIT_FAILURE); 493 } 494 if (*lib_version != G_LIB_VERSION) { 495 dlclose(dlh); 496 errx(EXIT_FAILURE, "%s and %s are not synchronized.", 497 getprogname(), path); 498 } 499 version = dlsym(dlh, "version"); 500 if (version == NULL) { | 494 dlclose(dlh); 495 exit(EXIT_FAILURE); 496 } 497 if (*lib_version != G_LIB_VERSION) { 498 dlclose(dlh); 499 errx(EXIT_FAILURE, "%s and %s are not synchronized.", 500 getprogname(), path); 501 } 502 version = dlsym(dlh, "version"); 503 if (version == NULL) { |
501 fprintf(stderr, "Cannot find symbol %s: %s.\n", "version", 502 dlerror()); | 504 warnx("Cannot find symbol %s: %s.", "version", dlerror()); |
503 dlclose(dlh); 504 exit(EXIT_FAILURE); 505 } 506 class_commands = dlsym(dlh, "class_commands"); 507 if (class_commands == NULL) { | 505 dlclose(dlh); 506 exit(EXIT_FAILURE); 507 } 508 class_commands = dlsym(dlh, "class_commands"); 509 if (class_commands == NULL) { |
508 fprintf(stderr, "Cannot find symbol %s: %s.\n", 509 "class_commands", dlerror()); | 510 warnx("Cannot find symbol %s: %s.", "class_commands", 511 dlerror()); |
510 dlclose(dlh); 511 exit(EXIT_FAILURE); 512 } 513} 514 515/* 516 * Class name should be all capital letters. 517 */ --- 165 unchanged lines hidden (view full) --- 683static int 684std_list_available(void) 685{ 686 struct gmesh mesh; 687 struct gclass *classp; 688 int error; 689 690 error = geom_gettree(&mesh); | 512 dlclose(dlh); 513 exit(EXIT_FAILURE); 514 } 515} 516 517/* 518 * Class name should be all capital letters. 519 */ --- 165 unchanged lines hidden (view full) --- 685static int 686std_list_available(void) 687{ 688 struct gmesh mesh; 689 struct gclass *classp; 690 int error; 691 692 error = geom_gettree(&mesh); |
691 if (error != 0) { 692 fprintf(stderr, "Cannot get GEOM tree: %s.\n", strerror(error)); 693 exit(EXIT_FAILURE); 694 } | 693 if (error != 0) 694 errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); |
695 classp = find_class(&mesh, gclass_name); 696 geom_deletetree(&mesh); 697 if (classp != NULL) 698 return (1); 699 return (0); 700} 701 702static void 703std_list(struct gctl_req *req, unsigned flags __unused) 704{ 705 struct gmesh mesh; 706 struct gclass *classp; 707 struct ggeom *gp; 708 const char *name; 709 int error, i, nargs; 710 711 error = geom_gettree(&mesh); | 695 classp = find_class(&mesh, gclass_name); 696 geom_deletetree(&mesh); 697 if (classp != NULL) 698 return (1); 699 return (0); 700} 701 702static void 703std_list(struct gctl_req *req, unsigned flags __unused) 704{ 705 struct gmesh mesh; 706 struct gclass *classp; 707 struct ggeom *gp; 708 const char *name; 709 int error, i, nargs; 710 711 error = geom_gettree(&mesh); |
712 if (error != 0) { 713 fprintf(stderr, "Cannot get GEOM tree: %s.\n", strerror(error)); 714 exit(EXIT_FAILURE); 715 } | 712 if (error != 0) 713 errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); |
716 classp = find_class(&mesh, gclass_name); 717 if (classp == NULL) { 718 geom_deletetree(&mesh); | 714 classp = find_class(&mesh, gclass_name); 715 if (classp == NULL) { 716 geom_deletetree(&mesh); |
719 fprintf(stderr, "Class %s not found.\n", gclass_name); | 717 warnx("Class %s not found.", gclass_name); |
720 return; 721 } 722 nargs = gctl_get_int(req, "nargs"); 723 if (nargs > 0) { 724 for (i = 0; i < nargs; i++) { 725 name = gctl_get_ascii(req, "arg%d", i); 726 gp = find_geom(classp, name); 727 if (gp != NULL) 728 list_one_geom(gp); 729 else | 718 return; 719 } 720 nargs = gctl_get_int(req, "nargs"); 721 if (nargs > 0) { 722 for (i = 0; i < nargs; i++) { 723 name = gctl_get_ascii(req, "arg%d", i); 724 gp = find_geom(classp, name); 725 if (gp != NULL) 726 list_one_geom(gp); 727 else |
730 fprintf(stderr, "No such geom: %s.\n", name); | 728 warnx("No such geom: %s.", name); |
731 } 732 } else { 733 LIST_FOREACH(gp, &classp->lg_geom, lg_geom) { 734 if (LIST_EMPTY(&gp->lg_provider)) 735 continue; 736 list_one_geom(gp); 737 } 738 } --- 103 unchanged lines hidden (view full) --- 842 struct gmesh mesh; 843 struct gclass *classp; 844 struct ggeom *gp; 845 const char *name; 846 int name_len, status_len; 847 int error, i, n, nargs, script; 848 849 error = geom_gettree(&mesh); | 729 } 730 } else { 731 LIST_FOREACH(gp, &classp->lg_geom, lg_geom) { 732 if (LIST_EMPTY(&gp->lg_provider)) 733 continue; 734 list_one_geom(gp); 735 } 736 } --- 103 unchanged lines hidden (view full) --- 840 struct gmesh mesh; 841 struct gclass *classp; 842 struct ggeom *gp; 843 const char *name; 844 int name_len, status_len; 845 int error, i, n, nargs, script; 846 847 error = geom_gettree(&mesh); |
850 if (error != 0) { 851 fprintf(stderr, "Cannot get GEOM tree: %s.\n", strerror(error)); 852 exit(EXIT_FAILURE); 853 } | 848 if (error != 0) 849 errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); |
854 classp = find_class(&mesh, gclass_name); 855 if (classp == NULL) { | 850 classp = find_class(&mesh, gclass_name); 851 if (classp == NULL) { |
856 fprintf(stderr, "Class %s not found.\n", gclass_name); | 852 warnx("Class %s not found.", gclass_name); |
857 goto end; 858 } 859 nargs = gctl_get_int(req, "nargs"); 860 script = gctl_get_int(req, "script"); 861 name_len = strlen("Name"); 862 status_len = strlen("Status"); 863 if (nargs > 0) { 864 for (i = 0, n = 0; i < nargs; i++) { 865 name = gctl_get_ascii(req, "arg%d", i); 866 gp = find_geom(classp, name); 867 if (gp == NULL) | 853 goto end; 854 } 855 nargs = gctl_get_int(req, "nargs"); 856 script = gctl_get_int(req, "script"); 857 name_len = strlen("Name"); 858 status_len = strlen("Status"); 859 if (nargs > 0) { 860 for (i = 0, n = 0; i < nargs; i++) { 861 name = gctl_get_ascii(req, "arg%d", i); 862 gp = find_geom(classp, name); 863 if (gp == NULL) |
868 fprintf(stderr, "No such geom: %s.\n", name); | 864 warnx("No such geom: %s.", name); |
869 else { 870 status_update_len(gp, &name_len, &status_len); 871 n++; 872 } 873 } 874 if (n == 0) 875 goto end; 876 } else { --- 124 unchanged lines hidden --- | 865 else { 866 status_update_len(gp, &name_len, &status_len); 867 n++; 868 } 869 } 870 if (n == 0) 871 goto end; 872 } else { --- 124 unchanged lines hidden --- |