summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/camcontrol')
-rw-r--r--sbin/camcontrol/Makefile2
-rw-r--r--sbin/camcontrol/camcontrol.c33
-rw-r--r--sbin/camcontrol/modeedit.c45
-rw-r--r--sbin/camcontrol/util.c2
4 files changed, 41 insertions, 41 deletions
diff --git a/sbin/camcontrol/Makefile b/sbin/camcontrol/Makefile
index 54b8680..ebc56dd 100644
--- a/sbin/camcontrol/Makefile
+++ b/sbin/camcontrol/Makefile
@@ -7,7 +7,7 @@ SRCS+= modeedit.c
.else
CFLAGS+= -DMINIMALISTIC
.endif
-WARNS= 1
+WARNS?= 6
DPADD= ${LIBCAM} ${LIBSBUF}
LDADD= -lcam -lsbuf
MAN= camcontrol.8
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;
diff --git a/sbin/camcontrol/modeedit.c b/sbin/camcontrol/modeedit.c
index 88ed1b7..8c41b38 100644
--- a/sbin/camcontrol/modeedit.c
+++ b/sbin/camcontrol/modeedit.c
@@ -116,7 +116,7 @@ static void editlist_save(struct cam_device *device, int modepage,
int timeout);
static void nameentry_create(int pagenum, char *name);
static struct pagename *nameentry_lookup(int pagenum);
-static int load_format(char *pagedb_path, int page);
+static int load_format(const char *pagedb_path, int page);
static int modepage_write(FILE *file, int editonly);
static int modepage_read(FILE *file);
static void modepage_edit(void);
@@ -124,11 +124,6 @@ static void modepage_dump(struct cam_device *device, int page,
int page_control, int dbd, int retries,
int timeout);
static void cleanup_editfile(void);
-void mode_edit(struct cam_device *device, int page,
- int page_control, int dbd, int edit,
- int binary, int retry_count, int timeout);
-void mode_list(struct cam_device *device, int page_control,
- int dbd, int retry_count, int timeout);
#define returnerr(code) do { \
@@ -145,7 +140,8 @@ void mode_list(struct cam_device *device, int page_control,
static void
-editentry_create(void *hook, int letter, void *arg, int count, char *name)
+editentry_create(void *hook __unused, int letter, void *arg, int count,
+ char *name)
{
struct editentry *newentry; /* Buffer to hold new entry. */
@@ -166,7 +162,8 @@ editentry_create(void *hook, int letter, void *arg, int count, char *name)
}
static void
-editentry_update(void *hook, int letter, void *arg, int count, char *name)
+editentry_update(void *hook __unused, int letter, void *arg, int count,
+ char *name)
{
struct editentry *dest; /* Buffer to hold entry to update. */
@@ -193,7 +190,7 @@ editentry_update(void *hook, int letter, void *arg, int count, char *name)
}
static int
-editentry_save(void *hook, char *name)
+editentry_save(void *hook __unused, char *name)
{
struct editentry *src; /* Entry value to save. */
@@ -251,7 +248,7 @@ editentry_set(char *name, char *newvalue, int editonly)
* currently workaround it (even for int64's), so we have to kludge it.
*/
#define RESOLUTION_MAX(size) ((resolution * (size) == 32)? \
- 0xffffffff: (1 << (resolution * (size))) - 1)
+ (int)0xffffffff: (1 << (resolution * (size))) - 1)
assert(newvalue != NULL);
if (*newvalue == '\0')
@@ -290,13 +287,13 @@ editentry_set(char *name, char *newvalue, int editonly)
strncpy(cval, newvalue, dest->size);
if (dest->type == 'z') {
/* Convert trailing spaces to nulls. */
- char *convertend;
+ char *convertend2;
- for (convertend = cval + dest->size;
- convertend >= cval; convertend--) {
- if (*convertend == ' ')
- *convertend = '\0';
- else if (*convertend != '\0')
+ for (convertend2 = cval + dest->size;
+ convertend2 >= cval; convertend2--) {
+ if (*convertend2 == ' ')
+ *convertend2 = '\0';
+ else if (*convertend2 != '\0')
break;
}
}
@@ -355,7 +352,7 @@ nameentry_lookup(int pagenum) {
}
static int
-load_format(char *pagedb_path, int page)
+load_format(const char *pagedb_path, int page)
{
FILE *pagedb;
char str_pagenum[MAX_PAGENUM_LEN];
@@ -717,7 +714,7 @@ modepage_read(FILE *file)
static void
modepage_edit(void)
{
- char *editor;
+ const char *editor;
char *commandline;
int fd;
int written;
@@ -784,7 +781,7 @@ modepage_dump(struct cam_device *device, int page, int page_control, int dbd,
u_int8_t *mode_pars; /* Pointer to modepage params. */
struct scsi_mode_header_6 *mh; /* Location of mode header. */
struct scsi_mode_page_header *mph;
- int index; /* Index for scanning mode params. */
+ int indx; /* Index for scanning mode params. */
mode_sense(device, page, page_control, dbd, retries, timeout, data,
sizeof(data));
@@ -794,9 +791,9 @@ modepage_dump(struct cam_device *device, int page, int page_control, int dbd,
mode_pars = MODE_PAGE_DATA(mph);
/* Print the raw mode page data with newlines each 8 bytes. */
- for (index = 0; index < mph->page_length; index++) {
- printf("%02x%c",mode_pars[index],
- (((index + 1) % 8) == 0) ? '\n' : ' ');
+ for (indx = 0; indx < mph->page_length; indx++) {
+ printf("%02x%c",mode_pars[indx],
+ (((indx + 1) % 8) == 0) ? '\n' : ' ');
}
putchar('\n');
}
@@ -815,7 +812,7 @@ void
mode_edit(struct cam_device *device, int page, int page_control, int dbd,
int edit, int binary, int retry_count, int timeout)
{
- char *pagedb_path; /* Path to modepage database. */
+ const char *pagedb_path; /* Path to modepage database. */
if (edit && binary)
errx(EX_USAGE, "cannot edit in binary mode.");
@@ -873,7 +870,7 @@ mode_list(struct cam_device *device, int page_control, int dbd,
struct scsi_mode_header_6 *mh; /* Location of mode header. */
struct scsi_mode_page_header *mph;
struct pagename *nameentry;
- char *pagedb_path;
+ const char *pagedb_path;
int len;
if ((pagedb_path = getenv("SCSI_MODES")) == NULL)
diff --git a/sbin/camcontrol/util.c b/sbin/camcontrol/util.c
index 9f0a752..67f4e4f 100644
--- a/sbin/camcontrol/util.c
+++ b/sbin/camcontrol/util.c
@@ -107,7 +107,7 @@ cget(void *hook, char *name)
/* arg_put: "put argument" callback
*/
void
-arg_put(void *hook, int letter, void *arg, int count, char *name)
+arg_put(void *hook __unused, int letter, void *arg, int count, char *name)
{
if (verbose && name && *name)
printf("%s: ", name);
OpenPOWER on IntegriCloud