11 #include "libvmoddor.h"
13 static int luns_to_fd
[VMODDOR_MAX_DEVICES
];
15 int vmoddor_open(int lun
)
17 char device
[VMODDOR_SIZE_CARRIER_NAME
] = "";
20 if(luns_to_fd
[lun
] != 0)
21 return luns_to_fd
[lun
];
23 sprintf(device
, "/dev/vmoddor.%d", lun
);
25 ret
= open(device
, O_RDWR
, 0);
30 luns_to_fd
[lun
] = ret
;
34 int vmoddor_close(int lun
)
38 ret
= close(luns_to_fd
[lun
]);
43 int vmoddor_write(int lun
, struct vmoddor_warg val
)
47 struct vmoddor_arg argument
;
49 argument
.data
= val
.data
;
50 argument
.offset
= val
.offset
;
51 argument
.size
= val
.size
;
54 ret
= ioctl(fd
, VMODDOR_WRITE
, (char *)&argument
);