aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/rfs.c
diff options
context:
space:
mode:
authorPaulK <contact@paulk.fr>2012-02-21 20:43:04 +0100
committerPaulK <contact@paulk.fr>2012-02-01 04:48:09 +0100
commit9b827bdb9c147c77c0d32cd3f4c41768818d8eaa (patch)
tree0414f1ca623689f0ea6a7025f08823d189367093 /samsung-ipc/rfs.c
parentb7e7b7701358836bdfe3042f427236bb047fd28b (diff)
downloadexternal_libsamsung-ipc-9b827bdb9c147c77c0d32cd3f4c41768818d8eaa.zip
external_libsamsung-ipc-9b827bdb9c147c77c0d32cd3f4c41768818d8eaa.tar.gz
external_libsamsung-ipc-9b827bdb9c147c77c0d32cd3f4c41768818d8eaa.tar.bz2
Fixed coding style: space after if, for, while, etc
Diffstat (limited to 'samsung-ipc/rfs.c')
-rw-r--r--samsung-ipc/rfs.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/samsung-ipc/rfs.c b/samsung-ipc/rfs.c
index 4d24e48..b4804a0 100644
--- a/samsung-ipc/rfs.c
+++ b/samsung-ipc/rfs.c
@@ -37,10 +37,10 @@ void md5hash2string(char *out, uint8_t *in)
{
int i;
- for(i=0 ; i < MD5_DIGEST_LENGTH ; i++)
+ for (i=0 ; i < MD5_DIGEST_LENGTH ; i++)
{
/* After the first iteration, we override \0. */
- if(*in < 0x10)
+ if (*in < 0x10)
sprintf(out, "0%x", *in);
else
sprintf(out, "%x", *in);
@@ -94,7 +94,7 @@ void nv_data_md5_generate(struct ipc_client *client)
/* Write the MD5 hash in nv_data.bin.md5. */
fd = open("/efs/nv_data.bin.md5", O_RDWR | O_CREAT | O_TRUNC, 0644);
- if(fd < 0)
+ if (fd < 0)
{
ipc_client_log(client, "nv_data_md5_generate: fd open failed\n");
goto exit;
@@ -127,20 +127,20 @@ void nv_data_backup_create(struct ipc_client *client)
ipc_client_log(client, "nv_data_backup_create: enter\n");
- if(stat("/efs/nv_data.bin", &nv_stat) < 0)
+ if (stat("/efs/nv_data.bin", &nv_stat) < 0)
{
ipc_client_log(client, "nv_data_backup_create: nv_data.bin missing\n");
nv_data_generate(client);
}
- if(nv_stat.st_size != NV_DATA_SIZE)
+ if (nv_stat.st_size != NV_DATA_SIZE)
{
ipc_client_log(client, "nv_data_backup_create: wrong nv_data.bin size\n");
nv_data_generate(client);
return;
}
- if(stat("/efs/nv_data.bin.md5", &nv_stat) < 0)
+ if (stat("/efs/nv_data.bin.md5", &nv_stat) < 0)
{
ipc_client_log(client, "nv_data_backup_create: nv_data.bin.md5 missing\n");
nv_data_generate(client);
@@ -172,7 +172,7 @@ void nv_data_backup_create(struct ipc_client *client)
ipc_client_log(client, "nv_data_backup_create: backup file computed MD5: %s read MD5: %s\n",
nv_data_md5_hash_string, nv_data_md5_hash_read);
- if(strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
+ if (strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
{
ipc_client_log(client, "nv_data_backup_create: MD5 hash mismatch on backup file\n");
ipc_client_log(client, "nv_data_backup_create: Consider the computed one as correct\n");
@@ -193,12 +193,12 @@ void nv_data_backup_create(struct ipc_client *client)
memset(nv_data_md5_hash_string, 0, MD5_STRING_SIZE);
nv_data_backup_create_write:
- while(nv_data_write_tries < 5)
+ while (nv_data_write_tries < 5)
{
ipc_client_log(client, "nv_data_backup_create: .nv_data.bak write try #%d\n", nv_data_write_tries + 1);
fd=open("/efs/.nv_data.bak", O_RDWR | O_CREAT | O_TRUNC, 0644);
- if(fd < 0)
+ if (fd < 0)
{
ipc_client_log(client, "nv_data_backup_create: negative fd while opening /efs/.nv_data.bak, error: %s\n", strerror(errno));
nv_data_write_tries++;
@@ -206,7 +206,7 @@ nv_data_backup_create_write:
}
rc = write(fd, nv_data_p, NV_DATA_SIZE);
- if(rc < NV_DATA_SIZE)
+ if (rc < NV_DATA_SIZE)
{
ipc_client_log(client, "nv_data_backup_create: wrote less (%d) than what we expected (%d) on /efs/.nv_data.bak, error: %s\n", strerror(errno));
close(fd);
@@ -218,7 +218,7 @@ nv_data_backup_create_write:
break;
}
- if(nv_data_write_tries == 5)
+ if (nv_data_write_tries == 5)
{
ipc_client_log(client, "nv_data_backup_create: writing nv_data.bin to .nv_data.bak failed too many times\n");
unlink("/efs/.nv_data.bak");
@@ -238,7 +238,7 @@ nv_data_backup_create_write:
nv_data_md5_hash_string, nv_data_md5_hash_read);
/* Make sure both hashes are the same. */
- if(strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
+ if (strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
{
ipc_client_log(client, "nv_data_backup_create: MD5 hash mismatch on written file\n");
ipc_client_log(client, "nv_data_backup_create: Writing again\n");
@@ -283,7 +283,7 @@ void nv_data_backup_restore(struct ipc_client *client)
ipc_client_log(client, "nv_data_backup_restore: enter\n");
- if(stat("/efs/.nv_data.bak", &nv_stat) < 0)
+ if (stat("/efs/.nv_data.bak", &nv_stat) < 0)
{
ipc_client_log(client, "nv_data_backup_restore: .nv_data.bak missing\n");
nv_data_generate(client);
@@ -291,7 +291,7 @@ void nv_data_backup_restore(struct ipc_client *client)
return;
}
- if(nv_stat.st_size != NV_DATA_SIZE)
+ if (nv_stat.st_size != NV_DATA_SIZE)
{
ipc_client_log(client, "nv_data_backup_restore: wrong .nv_data.bak size\n");
nv_data_generate(client);
@@ -299,7 +299,7 @@ void nv_data_backup_restore(struct ipc_client *client)
return;
}
- if(stat("/efs/.nv_data.bak.md5", &nv_stat) < 0)
+ if (stat("/efs/.nv_data.bak.md5", &nv_stat) < 0)
{
ipc_client_log(client, "nv_data_backup_restore: .nv_data.bak.md5 missing\n");
nv_data_generate(client);
@@ -332,7 +332,7 @@ void nv_data_backup_restore(struct ipc_client *client)
ipc_client_log(client, "nv_data_backup_restore: backup file computed MD5: %s read MD5: %s\n",
nv_data_md5_hash_string, nv_data_md5_hash_read);
- if(strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
+ if (strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
{
ipc_client_log(client, "nv_data_backup_restore: MD5 hash mismatch on backup file\n");
ipc_client_log(client, "nv_data_backup_restore: Consider the computed one as correct\n");
@@ -353,12 +353,12 @@ void nv_data_backup_restore(struct ipc_client *client)
memset(nv_data_md5_hash_string, 0, MD5_STRING_SIZE);
nv_data_backup_restore_write:
- while(nv_data_write_tries < 5)
+ while (nv_data_write_tries < 5)
{
ipc_client_log(client, "nv_data_backup_restore: nv_data.bin write try #%d\n", nv_data_write_tries + 1);
fd=open("/efs/nv_data.bin", O_RDWR | O_CREAT | O_TRUNC, 0644);
- if(fd < 0)
+ if (fd < 0)
{
ipc_client_log(client, "nv_data_backup_restore: negative fd while opening /efs/nv_data.bin, error: %s\n", strerror(errno));
nv_data_write_tries++;
@@ -366,7 +366,7 @@ nv_data_backup_restore_write:
}
rc = write(fd, nv_data_bak_p, NV_DATA_SIZE);
- if(rc < NV_DATA_SIZE)
+ if (rc < NV_DATA_SIZE)
{
ipc_client_log(client, "nv_data_backup_restore: wrote less (%d) than what we expected (%d) on /efs/nv_data.bin, error: %s\n", strerror(errno));
close(fd);
@@ -378,7 +378,7 @@ nv_data_backup_restore_write:
break;
}
- if(nv_data_write_tries == 5)
+ if (nv_data_write_tries == 5)
{
ipc_client_log(client, "nv_data_backup_restore: writing the backup to nv_data.bin failed too many times\n");
unlink("/efs/nv_data.bin");
@@ -399,7 +399,7 @@ nv_data_backup_restore_write:
nv_data_md5_hash_string, nv_data_md5_hash_read);
/* Make sure both hashes are the same. */
- if(strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
+ if (strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
{
ipc_client_log(client, "nv_data_backup_restore: MD5 hash mismatch on written file\n");
ipc_client_log(client, "nv_data_backup_restore: Writing again\n");
@@ -434,26 +434,26 @@ void nv_data_check(struct ipc_client *client)
ipc_client_log(client, "nv_data_check: enter\n");
- if(stat("/efs/nv_data.bin", &nv_stat) < 0)
+ if (stat("/efs/nv_data.bin", &nv_stat) < 0)
{
ipc_client_log(client, "nv_data_check: nv_data.bin missing\n");
nv_data_backup_restore(client);
stat("/efs/nv_data.bin", &nv_stat);
}
- if(nv_stat.st_size != NV_DATA_SIZE)
+ if (nv_stat.st_size != NV_DATA_SIZE)
{
ipc_client_log(client, "nv_data_check: wrong nv_data.bin size\n");
nv_data_backup_restore(client);
}
- if(stat("/efs/nv_data.bin.md5", &nv_stat) < 0)
+ if (stat("/efs/nv_data.bin.md5", &nv_stat) < 0)
{
ipc_client_log(client, "nv_data_check: nv_data.bin.md5 missing\n");
nv_data_backup_restore(client);
}
- if(stat("/efs/.nv_data.bak", &nv_stat) < 0 || stat("/efs/.nv_data.bak.md5", &nv_stat) < 0)
+ if (stat("/efs/.nv_data.bak", &nv_stat) < 0 || stat("/efs/.nv_data.bak.md5", &nv_stat) < 0)
{
ipc_client_log(client, "nv_data_check: .nv_data.bak or .nv_data.bak.md5 missing\n");
nv_data_backup_create(client);
@@ -461,7 +461,7 @@ void nv_data_check(struct ipc_client *client)
nv_state_fd=open("/efs/.nv_state", O_RDONLY);
- if(nv_state_fd < 0 || fstat(nv_state_fd, &nv_stat) < 0)
+ if (nv_state_fd < 0 || fstat(nv_state_fd, &nv_stat) < 0)
{
ipc_client_log(client, "nv_data_check: .nv_state missing\n");
nv_data_backup_restore(client);
@@ -471,7 +471,7 @@ void nv_data_check(struct ipc_client *client)
close(nv_state_fd);
- if(nv_state != '1')
+ if (nv_state != '1')
{
ipc_client_log(client, "nv_data_check: bad nv_state\n");
nv_data_backup_restore(client);
@@ -520,7 +520,7 @@ void nv_data_md5_check(struct ipc_client *client)
ipc_client_log(client, "nv_data_md5_check: computed MD5: %s read MD5: %s\n",
nv_data_md5_hash_string, nv_data_md5_hash_read);
- if(strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
+ if (strcmp(nv_data_md5_hash_string, nv_data_md5_hash_read) != 0)
{
ipc_client_log(client, "nv_data_md5_check: MD5 hash mismatch\n");
nv_data_backup_restore(client);
@@ -539,12 +539,12 @@ int nv_data_read(struct ipc_client *client, int offset, int length, char *buf)
ipc_client_log(client, "nv_data_read: enter\n");
- if(offset <= 0 || length <= 0) {
+ if (offset <= 0 || length <= 0) {
ipc_client_log(client, "nv_data_read: offset or length <= 0\n");
return -1;
}
- if(buf == NULL) {
+ if (buf == NULL) {
ipc_client_log(client, "nv_data_read: provided output buf is NULL\n");
return -1;
}
@@ -553,7 +553,7 @@ int nv_data_read(struct ipc_client *client, int offset, int length, char *buf)
fd = open("/efs/nv_data.bin", O_RDONLY);
- if(fd < 0) {
+ if (fd < 0) {
ipc_client_log(client, "nv_data_read: nv_data file fd is negative\n");
return -1;
}
@@ -562,7 +562,7 @@ int nv_data_read(struct ipc_client *client, int offset, int length, char *buf)
rc = read(fd, buf, length);
- if(rc < length) {
+ if (rc < length) {
ipc_client_log(client, "nv_data_read: read less than what we expected\n");
return -1;
}
@@ -579,12 +579,12 @@ int nv_data_write(struct ipc_client *client, int offset, int length, char *buf)
ipc_client_log(client, "nv_data_write: enter\n");
- if(offset <= 0 || length <= 0) {
+ if (offset <= 0 || length <= 0) {
ipc_client_log(client, "nv_data_write: offset or length <= 0\n");
return -1;
}
- if(buf == NULL) {
+ if (buf == NULL) {
ipc_client_log(client, "nv_data_write: provided input buf is NULL\n");
return -1;
}
@@ -593,7 +593,7 @@ int nv_data_write(struct ipc_client *client, int offset, int length, char *buf)
fd = open("/efs/nv_data.bin", O_WRONLY);
- if(fd < 0) {
+ if (fd < 0) {
ipc_client_log(client, "nv_data_write: nv_data file fd is negative\n");
return -1;
}
@@ -604,7 +604,7 @@ int nv_data_write(struct ipc_client *client, int offset, int length, char *buf)
close(fd);
- if(rc < length) {
+ if (rc < length) {
ipc_client_log(client, "nv_data_write: wrote less (%d) than what we expected (%d), error: %s, restoring backup\n", rc, length, strerror(errno));
nv_data_backup_restore(client);
return -1;
@@ -625,7 +625,7 @@ void ipc_rfs_send_io_confirm_for_nv_read_item(struct ipc_client *client, struct
void *rfs_data;
int rc;
- if(rfs_io == NULL)
+ if (rfs_io == NULL)
{
ipc_client_log(client, "ERROR: Request message is invalid: aseq = %i", info->aseq);
return NULL;