11 #define KMSG_COMPONENT "zfcp"
12 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
15 #include <linux/slab.h>
16 #include <linux/types.h>
18 #include <asm/compat.h>
24 #define ZFCP_CFDC_CMND_DOWNLOAD_NORMAL 0x00010001
25 #define ZFCP_CFDC_CMND_DOWNLOAD_FORCE 0x00010101
26 #define ZFCP_CFDC_CMND_FULL_ACCESS 0x00000201
27 #define ZFCP_CFDC_CMND_RESTRICTED_ACCESS 0x00000401
28 #define ZFCP_CFDC_CMND_UPLOAD 0x00010002
30 #define ZFCP_CFDC_DOWNLOAD 0x00000001
31 #define ZFCP_CFDC_UPLOAD 0x00000002
32 #define ZFCP_CFDC_WITH_CONTROL_FILE 0x00010000
34 #define ZFCP_CFDC_IOC_MAGIC 0xDD
35 #define ZFCP_CFDC_IOC \
36 _IOWR(ZFCP_CFDC_IOC_MAGIC, 0, struct zfcp_cfdc_data)
59 void __user *user_buffer)
65 length =
min((
unsigned int)size, sg->
length);
74 static int zfcp_cfdc_copy_to_user(
void __user *user_buffer,
81 length =
min((
unsigned int) size, sg->
length);
96 snprintf(busid,
sizeof(busid),
"0.0.%04x", devno);
137 static int zfcp_cfdc_sg_setup(
int command,
struct scatterlist *sg,
138 u8 __user *control_file)
149 retval = zfcp_cfdc_copy_from_user(sg, control_file);
166 sizeof(req->
qtcb->bottom.support.els));
169 static long zfcp_cfdc_dev_ioctl(
struct file *
file,
unsigned int command,
183 data_user = compat_ptr(arg);
185 data_user = (
void __user *)arg;
196 retval = PTR_ERR(data);
205 retval = zfcp_cfdc_set_fsf(fsf_cfdc, data->
command);
207 adapter = zfcp_cfdc_get_adapter(data->
devno);
213 retval = zfcp_cfdc_sg_setup(data->
command, fsf_cfdc->
sg,
219 retval = PTR_ERR(req);
228 zfcp_cfdc_req_to_sense(data, req);
229 retval =
copy_to_user(data_user, data,
sizeof(*data_user));
236 retval = zfcp_cfdc_copy_to_user(&data_user->
control_file,
254 .unlocked_ioctl = zfcp_cfdc_dev_ioctl,
256 .compat_ioctl = zfcp_cfdc_dev_ioctl,
264 .fops = &zfcp_cfdc_fops,
297 zfcp_sdev = sdev_to_zfcp(sdev);
309 u16 subtable = table >> 16;
311 const char *act_type[] = {
"unknown",
"OS",
"WWPN",
"DID",
"LUN" };
313 if (subtable && subtable <
ARRAY_SIZE(act_type))
315 "Access denied according to ACT rule type %s, "
316 "rule %d\n", act_type[subtable], rule);
328 "Access denied to port 0x%016Lx\n",
329 (
unsigned long long)port->
wwpn);
349 "Access denied to LUN 0x%016Lx on port 0x%016Lx\n",
350 zfcp_scsi_dev_lun(sdev),
351 (
unsigned long long)zfcp_sdev->
port->wwpn);
352 zfcp_act_eval_err(zfcp_sdev->
port->adapter, qual->
halfword[0]);
353 zfcp_act_eval_err(zfcp_sdev->
port->adapter, qual->
halfword[1]);
374 "LUN 0x%Lx on port 0x%Lx is already in "
375 "use by CSS%d, MIF Image ID %x\n",
376 zfcp_scsi_dev_lun(sdev),
377 (
unsigned long long)zfcp_sdev->
port->wwpn,
381 zfcp_act_eval_err(zfcp_sdev->
port->adapter, qual->
word[2]);
419 "0x%016Lx on port 0x%016Lx opened read-only\n",
420 zfcp_scsi_dev_lun(sdev),
421 (
unsigned long long)zfcp_sdev->
port->wwpn);
424 if (!shared && !rw) {
426 "not supported (LUN 0x%016Lx, port 0x%016Lx)\n",
427 zfcp_scsi_dev_lun(sdev),
428 (
unsigned long long)zfcp_sdev->
port->wwpn);
436 "Shared read-write access not supported "
437 "(LUN 0x%016Lx, port 0x%016Lx)\n",
438 zfcp_scsi_dev_lun(sdev),
439 (
unsigned long long)zfcp_sdev->
port->wwpn);