Fix a couple of camcontrol issues that popped up on sparc64:
- bzero the CCB header in getdevtree() and set the path properly, to avoid having random garbage in the CCB header. - if the lun isn't specified in a device specifier, it should default to 0, not whatever random data happens to be in the lun variable. - move the prototype for getdevtree() out from under #ifndef MINIMALISTIC, since it is used in both cases. Submitted by: Marius Strobl <marius@alchemy.franken.de> (mostly) MFC After: 2 weeks
This commit is contained in:
parent
99a137339e
commit
7387d6633f
@ -166,7 +166,9 @@ camcontrol_optret getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum,
|
||||
const char **subopt);
|
||||
#ifndef MINIMALISTIC
|
||||
static int getdevlist(struct cam_device *device);
|
||||
#endif /* MINIMALISTIC */
|
||||
static int getdevtree(void);
|
||||
#ifndef MINIMALISTIC
|
||||
static int testunitready(struct cam_device *device, int retry_count,
|
||||
int timeout, int quiet);
|
||||
static int scsistart(struct cam_device *device, int startstop, int loadeject,
|
||||
@ -303,8 +305,11 @@ getdevtree(void)
|
||||
return(1);
|
||||
}
|
||||
|
||||
bzero(&(&ccb.ccb_h)[1],
|
||||
sizeof(struct ccb_dev_match) - sizeof(struct ccb_hdr));
|
||||
bzero(&ccb, sizeof(union ccb));
|
||||
|
||||
ccb.ccb_h.path_id = CAM_XPT_PATH_ID;
|
||||
ccb.ccb_h.target_id = CAM_TARGET_WILDCARD;
|
||||
ccb.ccb_h.target_lun = CAM_LUN_WILDCARD;
|
||||
|
||||
ccb.ccb_h.func_code = XPT_DEV_MATCH;
|
||||
bufsize = sizeof(struct dev_match_result) * 100;
|
||||
@ -3380,6 +3385,11 @@ main(int argc, char **argv)
|
||||
errx(1, "numeric device specification must "
|
||||
"be either bus:target, or "
|
||||
"bus:target:lun");
|
||||
/* default to 0 if lun was not specified */
|
||||
if ((arglist & CAM_ARG_LUN) == 0) {
|
||||
lun = 0;
|
||||
arglist |= CAM_ARG_LUN;
|
||||
}
|
||||
optstart++;
|
||||
} else {
|
||||
if (cam_get_device(argv[2], name, sizeof name, &unit)
|
||||
|
Loading…
Reference in New Issue
Block a user