-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input parameter handling for sg_wr_mode fails... #40
Comments
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@1048 6180dd3e-e324-4e3e-922d-17de1ae2f315
I tend to use the sdparm utility instead of sg_wr_mode. The existing code probably worked as long as -c or -C was the last option. Anyway svn rev 1048 now mirrored here should fix it. Could you test it? And if you have a general test script (or just a hex file for input) could you send it to me and I can put it in the inhex directory? |
Hi Doug, And thanks for the quick reply. Placing the -c/-C option as a last one didn't make any difference because when the while loop for scanning the parameters is done (no more arguments found), the optarg content is returned as NULL. Unfortunately, I can't provide any general test script for this. I have several scripts for multiple internal test cases and this was just one that started failing. I did used sdparm to do a one off test to verify that the functionality of the device was OK but since I'm mostly using these sg_utils for range of tests, I thought that it would be great to have this still fixed. I like the approach you have in here, easy to track down what is the problem, in case there is one :) Thanks for the good job! Affe |
Inspired by this bug fix, I added a --mfile=MF option so that the mask data could also be placed in a separate file (svn rev: 1049]. Then in the inhex directory the wr_mode_cont.hex and wr_mode_mask.hex files have been added. Now those files can be used together with the Linux scsi_debug driver to turn off and on the WCE bit. (i.e. Write Cache Enable). |
Hello,
I updated to the latest version of sg3_utils and noticed that some of my test scripts didn't work anymore. After a quick study, I noticed that the sg_wr_mode input parameters are not handled right. Seems that after the latest changes, calling build_mode_page has been moved out from the while clause that's parsing the input parameters. When the build_mode_page is now called, optarg parameter is already NULL. Following changes fixed that for me (-c and -C parameters) but I'm not sure if there's more cases that needs to be updated/fixed.
BR, Affe
@@ -378,8 +378,10 @@ main(int argc, char * argv[])
pr2serr("Cannot have both --contents= and --cfile= options\n");
return SG_LIB_SYNTAX_ERROR;
}
The text was updated successfully, but these errors were encountered: