summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol/camcontrol.c
diff options
context:
space:
mode:
authorjohan <johan@FreeBSD.org>2003-08-05 09:19:07 +0000
committerjohan <johan@FreeBSD.org>2003-08-05 09:19:07 +0000
commit058c938f4b892b98c001722198b1e819e18af1d4 (patch)
tree5f009a8be2fda0bf2a6970701dc01c1ff9ee4acb /sbin/camcontrol/camcontrol.c
parent2722e0638f8c072f57ae45c6be7bf0d9e6e57b2b (diff)
downloadFreeBSD-src-058c938f4b892b98c001722198b1e819e18af1d4.zip
FreeBSD-src-058c938f4b892b98c001722198b1e819e18af1d4.tar.gz
Make this WARNS=6 clean by:
1: add 'const' to char * where needed; 2: mark unused variables with __unused; 3: remove double prototypes for mode_edit and mode_list. 4: moves the global variables 'bus', 'target', and 'lun' into the main function and protect them with #ifndef MINIMALISTIC, 5: renames 3 variable in order not to shadow other things index -> indx -- in modepage_dump since index is a function from <strings.h.> arglist -> arglst -- in the function parse_btl since arglist is also a global variable convertend -> convertend2 -- in the function editentry_set since that name is used two times within the function. 6: cast 0xffffffff in the macro RESOLUTION_MAX(size) to (int) since it is unsigned otherwise. Tested by: make universe Approved by: ken
Diffstat (limited to 'sbin/camcontrol/camcontrol.c')
-rw-r--r--sbin/camcontrol/camcontrol.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 54e6d1b..3b4889e 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -107,7 +107,7 @@ typedef enum {
} cam_argmask;
struct camcontrol_opts {
- char *optname;
+ const char *optname;
cam_cmdmask cmdnum;
cam_argmask argnum;
const char *subopt;
@@ -160,11 +160,10 @@ typedef enum {
cam_cmdmask cmdlist;
cam_argmask arglist;
-int bus, target, lun;
camcontrol_optret getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum,
- char **subopt);
+ const char **subopt);
#ifndef MINIMALISTIC
static int getdevlist(struct cam_device *device);
static int getdevtree(void);
@@ -179,7 +178,7 @@ static int scsiserial(struct cam_device *device, int retry_count, int timeout);
static int scsixferrate(struct cam_device *device);
#endif /* MINIMALISTIC */
static int parse_btl(char *tstr, int *bus, int *target, int *lun,
- cam_argmask *arglist);
+ cam_argmask *arglst);
static int dorescan_or_reset(int argc, char **argv, int rescan);
static int rescan_or_reset_bus(int bus, int rescan);
static int scanlun_or_reset_dev(int bus, int target, int lun, int scan);
@@ -205,7 +204,8 @@ static int scsiformat(struct cam_device *device, int argc, char **argv,
#endif /* MINIMALISTIC */
camcontrol_optret
-getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum, char **subopt)
+getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum,
+ const char **subopt)
{
struct camcontrol_opts *opts;
int num_matches = 0;
@@ -215,7 +215,7 @@ getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum, char **subopt)
if (strncmp(opts->optname, arg, strlen(arg)) == 0) {
*cmdnum = opts->cmdnum;
*argnum = opts->argnum;
- *subopt = (char *)opts->subopt;
+ *subopt = opts->subopt;
if (++num_matches > 1)
return(CC_OR_AMBIGUOUS);
}
@@ -952,7 +952,7 @@ xferrate_bailout:
* Returns the number of parsed components, or 0.
*/
static int
-parse_btl(char *tstr, int *bus, int *target, int *lun, cam_argmask *arglist)
+parse_btl(char *tstr, int *bus, int *target, int *lun, cam_argmask *arglst)
{
char *tmpstr;
int convs = 0;
@@ -963,17 +963,17 @@ parse_btl(char *tstr, int *bus, int *target, int *lun, cam_argmask *arglist)
tmpstr = (char *)strtok(tstr, ":");
if ((tmpstr != NULL) && (*tmpstr != '\0')) {
*bus = strtol(tmpstr, NULL, 0);
- *arglist |= CAM_ARG_BUS;
+ *arglst |= CAM_ARG_BUS;
convs++;
tmpstr = (char *)strtok(NULL, ":");
if ((tmpstr != NULL) && (*tmpstr != '\0')) {
*target = strtol(tmpstr, NULL, 0);
- *arglist |= CAM_ARG_TARGET;
+ *arglst |= CAM_ARG_TARGET;
convs++;
tmpstr = (char *)strtok(NULL, ":");
if ((tmpstr != NULL) && (*tmpstr != '\0')) {
*lun = strtol(tmpstr, NULL, 0);
- *arglist |= CAM_ARG_LUN;
+ *arglst |= CAM_ARG_LUN;
convs++;
}
}
@@ -2349,7 +2349,7 @@ cpi_print(struct ccb_pathinq *cpi)
cpi->version_num);
for (i = 1; i < 0xff; i = i << 1) {
- char *str;
+ const char *str;
if ((i & cpi->hba_inquiry) == 0)
continue;
@@ -2386,7 +2386,7 @@ cpi_print(struct ccb_pathinq *cpi)
}
for (i = 1; i < 0xff; i = i << 1) {
- char *str;
+ const char *str;
if ((i & cpi->hba_misc) == 0)
continue;
@@ -2415,7 +2415,7 @@ cpi_print(struct ccb_pathinq *cpi)
}
for (i = 1; i < 0xff; i = i << 1) {
- char *str;
+ const char *str;
if ((i & cpi->target_sprt) == 0)
continue;
@@ -3264,11 +3264,14 @@ main(int argc, char **argv)
int timeout = 0, retry_count = 1;
camcontrol_optret optreturn;
char *tstr;
- char *mainopt = "C:En:t:u:v";
- char *subopt = NULL;
+ const char *mainopt = "C:En:t:u:v";
+ const char *subopt = NULL;
char combinedopt[256];
int error = 0, optstart = 2;
int devopen = 1;
+#ifndef MINIMALISTIC
+ int bus, target, lun;
+#endif /* MINIMALISTIC */
cmdlist = CAM_CMD_NONE;
arglist = CAM_ARG_NONE;
OpenPOWER on IntegriCloud