Changeset 2615
- Timestamp:
- 10/11/07 22:37:56 (1 year ago)
- Files:
-
- trunk/kernel/device_cmd.h (modified) (1 diff)
- trunk/lib/Makefile-files (modified) (1 diff)
- trunk/lib/syscall_unsetmapping-v21.hc (added)
- trunk/lib/syscall_unsetmapping.c (added)
- trunk/lib/vserver.h (modified) (1 diff)
- trunk/scripts/vserver.functions (modified) (1 diff)
- trunk/src/vdevmap.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/kernel/device_cmd.h
r2427 r2615 6 6 7 7 #define VCMD_set_mapping VC_CMD(DEVICE, 1, 0) 8 #define VCMD_unset_mapping VC_CMD(DEVICE, 2, 0) 8 9 9 10 struct vcmd_set_mapping_v0 { trunk/lib/Makefile-files
r2589 r2615 131 131 lib/syscall_setmapping.c \ 132 132 lib/syscall_setmapping-v21.hc \ 133 lib/syscall_unsetmapping.c \ 134 lib/syscall_unsetmapping-v21.hc \ 133 135 lib/syscall_schedinfo.c \ 134 136 lib/syscall_schedinfo-v21.hc \ trunk/lib/vserver.h
r2589 r2615 814 814 /* misc. syscalls */ 815 815 int vc_set_mapping(xid_t xid, const char *device, const char *target, uint32_t flags); 816 int vc_unset_mapping(xid_t xid, const char *device, const char *target, uint32_t flags); 816 817 817 818 trunk/scripts/vserver.functions
r2613 r2615 1276 1276 ${device:+--device "$device"} ${target:+--target "$target"} ) 1277 1277 1278 $_VDEVMAP --xid "$xid" "${vdevmap_opts[@]}" || return $?1278 $_VDEVMAP --xid "$xid" --set "${vdevmap_opts[@]}" || return $? 1279 1279 done 1280 1280 } trunk/src/vdevmap.c
r2490 r2615 44 44 { "version", no_argument, 0, CMD_VERSION }, 45 45 { "xid", required_argument, 0, 'x' }, 46 { "set", no_argument, 0, 's' }, 47 { "unset", no_argument, 0, 'u' }, 46 48 { "open", no_argument, 0, 'o' }, 47 49 { "create", no_argument, 0, 'c' }, … … 59 61 WRITE_STR(fd, cmd); 60 62 WRITE_MSG(fd, 61 " --xid <xid> [--flags <flags>] [--open] [--create] [--remap] [--device <dev>] [--target <dev>]\n" 63 " --xid <xid> {--set|--unset} [--flags <flags>] [--open] [--create]\n" 64 " [--device <dev>] [--remap --target <dev>]\n" 65 "\n" 66 " --flags <flags> Set the specified flags\n" 67 " --open Allow opening of the device\n" 68 " --create If SECURE_MKNOD is given, allow mknod(2)\n" 69 " --device <dev> Device to apply the command to\n" 70 " --remap Remap the device to the target\n" 71 " --target <dev> Target for --remap\n" 62 72 "\n" 63 73 "Please report bugs to " PACKAGE_BUGREPORT "\n"); … … 86 96 char *device = NULL; 87 97 char *target = NULL; 98 bool set = true; 88 99 unsigned long tmp = 0; 89 100 90 101 while (1) { 91 int c = getopt_long(argc, argv, "+x: ocrf:d:t:", CMDLINE_OPTIONS, 0);102 int c = getopt_long(argc, argv, "+x:suocrf:d:t:", CMDLINE_OPTIONS, 0); 92 103 if (c==-1) break; 93 104 … … 101 112 case 'd' : device = optarg; break; 102 113 case 't' : target = optarg; break; 114 case 's' : set = 1; break; 115 case 'u' : set = 0; break; 103 116 case 'f' : 104 117 if (!isNumberUnsigned(optarg, &tmp, false)) { … … 124 137 if (do_remap) flags |= VC_DATTR_REMAP; 125 138 126 if (xid==VC_NOCTX) 139 if (target && !do_remap) 140 WRITE_MSG(2, "Target specified without --remap; try '--help' for more information\n"); 141 else if (xid==VC_NOCTX) 127 142 WRITE_MSG(2, "No xid specified; try '--help' for more information\n"); 128 143 else if (optind!=argc) 129 144 WRITE_MSG(2, "Unused argument(s); try '--help' for more information\n"); 130 else if ( vc_set_mapping(xid, device, target, flags)==-1)145 else if (set && vc_set_mapping(xid, device, target, flags)==-1) 131 146 perror("vc_set_mapping()"); 147 else if (!set && vc_unset_mapping(xid, device, target, flags)==-1) 148 perror("vc_unset_mapping()"); 132 149 else 133 150 return EXIT_SUCCESS;
