tools: env: Pass through indent
Pass tools/env/fw_env.c through indent to correct style violations. This commit consists of only one non-whitespace change: tools/env/fw_env.c:549: error: do not use assignment in if condition Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
This commit is contained in:
parent
5c643db4cc
commit
c7f52c4b6e
1 changed files with 170 additions and 176 deletions
58
tools/env/fw_env.c
vendored
58
tools/env/fw_env.c
vendored
|
@ -64,14 +64,14 @@ struct envdev_s {
|
|||
int is_ubi; /* set if we use UBI volume */
|
||||
};
|
||||
|
||||
static struct envdev_s envdevices[2] =
|
||||
{
|
||||
static struct envdev_s envdevices[2] = {
|
||||
{
|
||||
.mtd_type = MTD_ABSENT,
|
||||
}, {
|
||||
.mtd_type = MTD_ABSENT,
|
||||
},
|
||||
};
|
||||
|
||||
static int dev_current;
|
||||
|
||||
#define DEVNAME(i) envdevices[(i)].devname
|
||||
|
@ -515,15 +515,13 @@ int fw_env_flush(struct env_opts *opts)
|
|||
|
||||
/* write environment back to flash */
|
||||
if (flash_io(O_RDWR)) {
|
||||
fprintf(stderr,
|
||||
"Error: can't write fw_env to flash\n");
|
||||
fprintf(stderr, "Error: can't write fw_env to flash\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set/Clear a single variable in the environment.
|
||||
* This is called in sequence to update the environment
|
||||
|
@ -548,7 +546,8 @@ int fw_env_write(char *name, char *value)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
if ((oldval = envmatch (name, env)) != NULL)
|
||||
oldval = envmatch(name, env);
|
||||
if (oldval)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -615,7 +614,8 @@ int fw_env_write(char *name, char *value)
|
|||
/*
|
||||
* Append new definition at the end
|
||||
*/
|
||||
for (env = environment.data; *env || *(env + 1); ++env);
|
||||
for (env = environment.data; *env || *(env + 1); ++env)
|
||||
;
|
||||
if (env > environment.data)
|
||||
++env;
|
||||
/*
|
||||
|
@ -628,8 +628,7 @@ int fw_env_write(char *name, char *value)
|
|||
|
||||
if (len > (&environment.data[ENV_SIZE] - env)) {
|
||||
fprintf(stderr,
|
||||
"Error: environment overflow, \"%s\" deleted\n",
|
||||
name);
|
||||
"Error: environment overflow, \"%s\" deleted\n", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -807,7 +806,6 @@ int fw_parse_script(char *fname, struct env_opts *opts)
|
|||
else
|
||||
val = NULL;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Setting %s : %s\n",
|
||||
name, val ? val : " removed");
|
||||
|
@ -928,8 +926,7 @@ static int flash_read_buf (int dev, int fd, void *buf, size_t count,
|
|||
|
||||
if (blockstart + block_seek + readlen > environment_end(dev)) {
|
||||
/* End of range is reached */
|
||||
fprintf (stderr,
|
||||
"Too few good blocks within range\n");
|
||||
fprintf(stderr, "Too few good blocks within range\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1109,7 +1106,6 @@ static int flash_write_buf(int dev, int fd, void *buf, size_t count)
|
|||
DEVNAME(dev), strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Write 0x%llx bytes at 0x%llx\n",
|
||||
(unsigned long long)erasesize,
|
||||
|
@ -1251,8 +1247,7 @@ static int flash_io (int mode)
|
|||
if (fd_target < 0) {
|
||||
fprintf(stderr,
|
||||
"Can't open %s: %s\n",
|
||||
DEVNAME (dev_target),
|
||||
strerror (errno));
|
||||
DEVNAME(dev_target), strerror(errno));
|
||||
rc = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
@ -1263,8 +1258,7 @@ static int flash_io (int mode)
|
|||
|
||||
rc = flash_write(fd_current, fd_target, dev_target);
|
||||
|
||||
if (fsync(fd_current) &&
|
||||
!(errno == EINVAL || errno == EROFS)) {
|
||||
if (fsync(fd_current) && !(errno == EINVAL || errno == EROFS)) {
|
||||
fprintf(stderr,
|
||||
"fsync failed on %s: %s\n",
|
||||
DEVNAME(dev_current), strerror(errno));
|
||||
|
@ -1281,8 +1275,7 @@ static int flash_io (int mode)
|
|||
if (close(fd_target)) {
|
||||
fprintf(stderr,
|
||||
"I/O error on %s: %s\n",
|
||||
DEVNAME (dev_target),
|
||||
strerror (errno));
|
||||
DEVNAME(dev_target), strerror(errno));
|
||||
rc = -1;
|
||||
}
|
||||
}
|
||||
|
@ -1362,7 +1355,8 @@ int fw_env_open(struct env_opts *opts)
|
|||
if (!crc0_ok) {
|
||||
fprintf(stderr,
|
||||
"Warning: Bad CRC, using default environment\n");
|
||||
memcpy(environment.data, default_environment, sizeof default_environment);
|
||||
memcpy(environment.data, default_environment,
|
||||
sizeof(default_environment));
|
||||
}
|
||||
} else {
|
||||
flag0 = *environment.flags;
|
||||
|
@ -1424,7 +1418,7 @@ int fw_env_open(struct env_opts *opts)
|
|||
fprintf(stderr,
|
||||
"Warning: Bad CRC, using default environment\n");
|
||||
memcpy(environment.data, default_environment,
|
||||
sizeof default_environment);
|
||||
sizeof(default_environment));
|
||||
dev_current = 0;
|
||||
} else {
|
||||
switch (environment.flag_scheme) {
|
||||
|
@ -1518,15 +1512,13 @@ static int check_device_config(int dev)
|
|||
fd = open(DEVNAME(dev), O_RDONLY);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr,
|
||||
"Cannot open %s: %s\n",
|
||||
DEVNAME(dev), strerror(errno));
|
||||
"Cannot open %s: %s\n", DEVNAME(dev), strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = fstat(fd, &st);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "Cannot stat the file %s\n",
|
||||
DEVNAME(dev));
|
||||
fprintf(stderr, "Cannot stat the file %s\n", DEVNAME(dev));
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -1571,14 +1563,16 @@ static int check_device_config(int dev)
|
|||
if (DEVOFFSET(dev) < 0) {
|
||||
rc = ioctl(fd, BLKGETSIZE64, &size);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "Could not get block device size on %s\n",
|
||||
fprintf(stderr,
|
||||
"Could not get block device size on %s\n",
|
||||
DEVNAME(dev));
|
||||
goto err;
|
||||
}
|
||||
|
||||
DEVOFFSET(dev) = DEVOFFSET(dev) + size;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Calculated device offset 0x%llx on %s\n",
|
||||
fprintf(stderr,
|
||||
"Calculated device offset 0x%llx on %s\n",
|
||||
DEVOFFSET(dev), DEVNAME(dev));
|
||||
#endif
|
||||
}
|
||||
|
@ -1589,13 +1583,15 @@ static int check_device_config(int dev)
|
|||
ENVSECTORS(dev) = DIV_ROUND_UP(ENVSIZE(dev), DEVESIZE(dev));
|
||||
|
||||
if (DEVOFFSET(dev) % DEVESIZE(dev) != 0) {
|
||||
fprintf(stderr, "Environment does not start on (erase) block boundary\n");
|
||||
fprintf(stderr,
|
||||
"Environment does not start on (erase) block boundary\n");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ENVSIZE(dev) > ENVSECTORS(dev) * DEVESIZE(dev)) {
|
||||
fprintf(stderr, "Environment does not fit into available sectors\n");
|
||||
fprintf(stderr,
|
||||
"Environment does not fit into available sectors\n");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1695,9 +1691,7 @@ static int get_config (char *fname)
|
|||
rc = sscanf(dump, "%ms %lli %lx %lx %lx",
|
||||
&devname,
|
||||
&DEVOFFSET(i),
|
||||
&ENVSIZE(i),
|
||||
&DEVESIZE(i),
|
||||
&ENVSECTORS(i));
|
||||
&ENVSIZE(i), &DEVESIZE(i), &ENVSECTORS(i));
|
||||
|
||||
if (rc < 3)
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue