mirror of
https://github.com/akuker/RASCSI.git
synced 2025-02-04 01:30:40 +00:00
Added copy support to rasctl
This commit is contained in:
parent
4cfeb32aa8
commit
3b250f0eff
@ -40,7 +40,7 @@ The rascsi host to connect to, default is 'localhost'.
|
||||
.BR \-l\fI
|
||||
List all of the devices that are currently being emulated by RaSCSI, as well as their current status.
|
||||
.TP
|
||||
.BR \-m\fI " "\fIOLD_NAME:NEW_NAME
|
||||
.BR \-m\fI " "\fICURRENT_NAME:NEW_NAME
|
||||
Rename an image file in the default image folder.
|
||||
.TP
|
||||
.BR \-p\fI " " \fIPORT
|
||||
@ -55,9 +55,12 @@ Display server-side settings like available images or supported device types.
|
||||
.BR \-v\fI " " \fI
|
||||
Display the rascsi version.
|
||||
.TP
|
||||
.BR \-x\fI " "\fIFILENAME
|
||||
.BR \-w\fI " "\fIFILENAME
|
||||
Delete an image file in the default image folder.
|
||||
.TP
|
||||
.BR \-x\fI " "\fICURRENT_NAME:NEW_NAME
|
||||
Copy an image file in the default image folder.
|
||||
.TP
|
||||
.BR \-i\fI " " \fIID
|
||||
ID is the SCSI ID that you want to control. (0-7)
|
||||
.TP
|
||||
|
@ -35,7 +35,7 @@ OPTIONS
|
||||
-l List all of the devices that are currently being emulated by
|
||||
RaSCSI, as well as their current status.
|
||||
|
||||
-m OLD_NAME:NEW_NAME
|
||||
-m CURRENT_NAME:NEW_NAME
|
||||
Rename an image file in the default image folder.
|
||||
|
||||
-p PORT
|
||||
@ -49,9 +49,12 @@ OPTIONS
|
||||
|
||||
-v Display the rascsi version.
|
||||
|
||||
-x FILENAME
|
||||
-w FILENAME
|
||||
Delete an image file in the default image folder.
|
||||
|
||||
-x CURRENT_NAME:NEW_NAME
|
||||
Copy an image file in the default image folder.
|
||||
|
||||
-i ID ID is the SCSI ID that you want to control. (0-7)
|
||||
|
||||
-c CMD Command is the operation being requested. Options are:
|
||||
|
@ -249,7 +249,26 @@ void CommandRenameImage(const string&hostname, int port, const string& image_par
|
||||
command.add_params(image_params.substr(separatorPos + 1));
|
||||
}
|
||||
else {
|
||||
cerr << "Error: Invalid file description '" << image_params << "', format is OLD_NAME:NEW_NAME" << endl;
|
||||
cerr << "Error: Invalid file description '" << image_params << "', format is CURRENT_NAME:NEW_NAME" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
PbResult result;
|
||||
SendCommand(hostname.c_str(), port, command, result);
|
||||
}
|
||||
|
||||
void CommandCopyImage(const string&hostname, int port, const string& image_params)
|
||||
{
|
||||
PbCommand command;
|
||||
command.set_operation(COPY_IMAGE);
|
||||
|
||||
size_t separatorPos = image_params.find(COMPONENT_SEPARATOR);
|
||||
if (separatorPos != string::npos) {
|
||||
command.add_params(image_params.substr(0, separatorPos));
|
||||
command.add_params(image_params.substr(separatorPos + 1));
|
||||
}
|
||||
else {
|
||||
cerr << "Error: Invalid file description '" << image_params << "', format is CURENT_NAME:NEW_NAME" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@ -558,7 +577,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
opterr = 1;
|
||||
int opt;
|
||||
while ((opt = getopt(argc, argv, "a:b:c:d:f:g:h:i:m:n:p:r:t:u:x:lsv")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "a:b:c:d:f:g:h:i:m:n:p:r:t:u:x:w:lsv")) != -1) {
|
||||
switch (opt) {
|
||||
case 'i':
|
||||
device->set_id(optarg[0] - '0');
|
||||
@ -676,6 +695,11 @@ int main(int argc, char* argv[])
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
command.set_operation(COPY_IMAGE);
|
||||
image_params = optarg;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
command.set_operation(DELETE_IMAGE);
|
||||
image_params = optarg;
|
||||
break;
|
||||
@ -711,6 +735,10 @@ int main(int argc, char* argv[])
|
||||
CommandRenameImage(hostname, port, image_params);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
case COPY_IMAGE:
|
||||
CommandCopyImage(hostname, port, image_params);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
case DEVICE_INFO:
|
||||
CommandDeviceInfo(hostname, port, command);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user