Deleted Added
full compact
ctladm.c (268363) ctladm.c (272911)
1/*-
2 * Copyright (c) 2003, 2004 Silicon Graphics International Corp.
3 * Copyright (c) 1997-2007 Kenneth D. Merry
4 * Copyright (c) 2012 The FreeBSD Foundation
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

--- 27 unchanged lines hidden (view full) ---

36 */
37/*
38 * CAM Target Layer exercise program.
39 *
40 * Author: Ken Merry <ken@FreeBSD.org>
41 */
42
43#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003, 2004 Silicon Graphics International Corp.
3 * Copyright (c) 1997-2007 Kenneth D. Merry
4 * Copyright (c) 2012 The FreeBSD Foundation
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

--- 27 unchanged lines hidden (view full) ---

36 */
37/*
38 * CAM Target Layer exercise program.
39 *
40 * Author: Ken Merry <ken@FreeBSD.org>
41 */
42
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/usr.sbin/ctladm/ctladm.c 268363 2014-07-07 11:05:04Z mav $");
44__FBSDID("$FreeBSD: head/usr.sbin/ctladm/ctladm.c 272911 2014-10-10 19:41:09Z mav $");
45
46#include <sys/ioctl.h>
47#include <sys/types.h>
48#include <sys/stat.h>
49#include <sys/param.h>
50#include <sys/linker.h>
51#include <sys/queue.h>
52#include <sys/callout.h>

--- 3116 unchanged lines hidden (view full) ---

3169 }
3170
3171 if (ioctl(fd, CTL_LUN_REQ, &req) == -1) {
3172 warn("%s: error issuing CTL_LUN_REQ ioctl", __func__);
3173 retval = 1;
3174 goto bailout;
3175 }
3176
45
46#include <sys/ioctl.h>
47#include <sys/types.h>
48#include <sys/stat.h>
49#include <sys/param.h>
50#include <sys/linker.h>
51#include <sys/queue.h>
52#include <sys/callout.h>

--- 3116 unchanged lines hidden (view full) ---

3169 }
3170
3171 if (ioctl(fd, CTL_LUN_REQ, &req) == -1) {
3172 warn("%s: error issuing CTL_LUN_REQ ioctl", __func__);
3173 retval = 1;
3174 goto bailout;
3175 }
3176
3177 if (req.status == CTL_LUN_ERROR) {
3178 warnx("%s: error returned from LUN creation request:\n%s",
3179 __func__, req.error_str);
3177 switch (req.status) {
3178 case CTL_LUN_ERROR:
3179 warnx("LUN creation error: %s", req.error_str);
3180 retval = 1;
3181 goto bailout;
3180 retval = 1;
3181 goto bailout;
3182 } else if (req.status != CTL_LUN_OK) {
3183 warnx("%s: unknown LUN creation request status %d",
3184 __func__, req.status);
3182 case CTL_LUN_WARNING:
3183 warnx("LUN creation warning: %s", req.error_str);
3184 break;
3185 case CTL_LUN_OK:
3186 break;
3187 default:
3188 warnx("unknown LUN creation status: %d", req.status);
3185 retval = 1;
3186 goto bailout;
3187 }
3188
3189 fprintf(stdout, "LUN created successfully\n");
3190 fprintf(stdout, "backend: %s\n", req.backend);
3191 fprintf(stdout, "device type: %d\n",req.reqdata.create.device_type);
3192 fprintf(stdout, "LUN size: %ju bytes\n",

--- 122 unchanged lines hidden (view full) ---

3315 }
3316
3317 if (ioctl(fd, CTL_LUN_REQ, &req) == -1) {
3318 warn("%s: error issuing CTL_LUN_REQ ioctl", __func__);
3319 retval = 1;
3320 goto bailout;
3321 }
3322
3189 retval = 1;
3190 goto bailout;
3191 }
3192
3193 fprintf(stdout, "LUN created successfully\n");
3194 fprintf(stdout, "backend: %s\n", req.backend);
3195 fprintf(stdout, "device type: %d\n",req.reqdata.create.device_type);
3196 fprintf(stdout, "LUN size: %ju bytes\n",

--- 122 unchanged lines hidden (view full) ---

3319 }
3320
3321 if (ioctl(fd, CTL_LUN_REQ, &req) == -1) {
3322 warn("%s: error issuing CTL_LUN_REQ ioctl", __func__);
3323 retval = 1;
3324 goto bailout;
3325 }
3326
3323 if (req.status == CTL_LUN_ERROR) {
3324 warnx("%s: error returned from LUN removal request:\n%s",
3325 __func__, req.error_str);
3327 switch (req.status) {
3328 case CTL_LUN_ERROR:
3329 warnx("LUN removal error: %s", req.error_str);
3326 retval = 1;
3327 goto bailout;
3330 retval = 1;
3331 goto bailout;
3328 } else if (req.status != CTL_LUN_OK) {
3329 warnx("%s: unknown LUN removal request status %d",
3330 __func__, req.status);
3332 case CTL_LUN_WARNING:
3333 warnx("LUN removal warning: %s", req.error_str);
3334 break;
3335 case CTL_LUN_OK:
3336 break;
3337 default:
3338 warnx("unknown LUN removal status: %d", req.status);
3331 retval = 1;
3332 goto bailout;
3333 }
3334
3339 retval = 1;
3340 goto bailout;
3341 }
3342
3335 printf("LUN %d deleted successfully\n", lun_id);
3343 printf("LUN %d removed successfully\n", lun_id);
3336
3337bailout:
3338 return (retval);
3339}
3340
3341static int
3342cctl_modify_lun(int fd, int argc, char **argv, char *combinedopt)
3343{

--- 48 unchanged lines hidden (view full) ---

3392 req.reqdata.modify.lun_size_bytes = lun_size;
3393
3394 if (ioctl(fd, CTL_LUN_REQ, &req) == -1) {
3395 warn("%s: error issuing CTL_LUN_REQ ioctl", __func__);
3396 retval = 1;
3397 goto bailout;
3398 }
3399
3344
3345bailout:
3346 return (retval);
3347}
3348
3349static int
3350cctl_modify_lun(int fd, int argc, char **argv, char *combinedopt)
3351{

--- 48 unchanged lines hidden (view full) ---

3400 req.reqdata.modify.lun_size_bytes = lun_size;
3401
3402 if (ioctl(fd, CTL_LUN_REQ, &req) == -1) {
3403 warn("%s: error issuing CTL_LUN_REQ ioctl", __func__);
3404 retval = 1;
3405 goto bailout;
3406 }
3407
3400 if (req.status == CTL_LUN_ERROR) {
3401 warnx("%s: error returned from LUN modification request:\n%s",
3402 __func__, req.error_str);
3408 switch (req.status) {
3409 case CTL_LUN_ERROR:
3410 warnx("LUN modification error: %s", req.error_str);
3403 retval = 1;
3404 goto bailout;
3411 retval = 1;
3412 goto bailout;
3405 } else if (req.status != CTL_LUN_OK) {
3406 warnx("%s: unknown LUN modification request status %d",
3407 __func__, req.status);
3413 case CTL_LUN_WARNING:
3414 warnx("LUN modification warning: %s", req.error_str);
3415 break;
3416 case CTL_LUN_OK:
3417 break;
3418 default:
3419 warnx("unknown LUN modification status: %d", req.status);
3408 retval = 1;
3409 goto bailout;
3410 }
3411
3412 printf("LUN %d modified successfully\n", lun_id);
3413
3414bailout:
3415 return (retval);

--- 1388 unchanged lines hidden ---
3420 retval = 1;
3421 goto bailout;
3422 }
3423
3424 printf("LUN %d modified successfully\n", lun_id);
3425
3426bailout:
3427 return (retval);

--- 1388 unchanged lines hidden ---