summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol/modeedit.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/modeedit.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/modeedit.c')
-rw-r--r--sbin/camcontrol/modeedit.c45
1 files changed, 21 insertions, 24 deletions
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)
OpenPOWER on IntegriCloud