Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
System Manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
system
System Manager
Commits
222a1884
Verified
Commit
222a1884
authored
10 months ago
by
Vivek Dutta
Committed by
IOPSYS Dev
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Mark fwbank output valid, if one bank has valid data
parent
db11128c
No related branches found
No related tags found
1 merge request
!16
Mark fwbank output valid, if one bank has valid data
Pipeline
#187858
passed
10 months ago
Stage: static_code_analysis
Changes
3
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+3
-2
3 additions, 2 deletions
.gitignore
gitlab-ci/shared.sh
+2
-2
2 additions, 2 deletions
gitlab-ci/shared.sh
src/fwbank.c
+12
-10
12 additions, 10 deletions
src/fwbank.c
with
17 additions
and
14 deletions
.gitignore
+
3
−
2
View file @
222a1884
src/sysmngr
src/sysmngr
src/
*.o
*.o
src/
*.so
*.so
*.swp
*.swp
*.swo
*.swo
/compile_commands.json
This diff is collapsed.
Click to expand it.
gitlab-ci/shared.sh
+
2
−
2
View file @
222a1884
...
@@ -22,6 +22,6 @@ function install_bbfdm()
...
@@ -22,6 +22,6 @@ function install_bbfdm()
fi
fi
cd
/opt/dev/bbfdm
cd
/opt/dev/bbfdm
./gitlab-ci/install-dependencies.sh
install
./gitlab-ci/install-dependencies.sh
./gitlab-ci/setup.sh
install
./gitlab-ci/setup.sh
}
}
This diff is collapsed.
Click to expand it.
src/fwbank.c
+
12
−
10
View file @
222a1884
...
@@ -70,7 +70,6 @@ struct blobmsg_policy sysmngr_bank_policy[] = {
...
@@ -70,7 +70,6 @@ struct blobmsg_policy sysmngr_bank_policy[] = {
{
"upgrade"
,
BLOBMSG_TYPE_BOOL
},
{
"upgrade"
,
BLOBMSG_TYPE_BOOL
},
{
"fwver"
,
BLOBMSG_TYPE_STRING
},
{
"fwver"
,
BLOBMSG_TYPE_STRING
},
{
"swver"
,
BLOBMSG_TYPE_STRING
},
{
"swver"
,
BLOBMSG_TYPE_STRING
},
{
"omci_swver"
,
BLOBMSG_TYPE_STRING
},
{
"status"
,
BLOBMSG_TYPE_STRING
}
{
"status"
,
BLOBMSG_TYPE_STRING
}
};
};
...
@@ -246,22 +245,25 @@ static int validate_global_fwbank_dump(struct blob_buf *fwbank_dump_bb)
...
@@ -246,22 +245,25 @@ static int validate_global_fwbank_dump(struct blob_buf *fwbank_dump_bb)
}
}
struct
blob_attr
*
entry
=
NULL
;
struct
blob_attr
*
entry
=
NULL
;
int
rem
=
0
;
int
rem
=
0
,
valid
=
-
1
;
blobmsg_for_each_attr
(
entry
,
tb
[
0
],
rem
)
{
// parse bank array
blobmsg_for_each_attr
(
entry
,
tb
[
0
],
rem
)
{
// parse bank array
struct
blob_attr
*
t
[
9
]
=
{
0
};
struct
blob_attr
*
t
[
8
]
=
{
0
};
if
(
blobmsg_parse
(
sysmngr_bank_policy
,
9
,
t
,
blobmsg_data
(
entry
),
blobmsg_len
(
entry
)))
{
if
(
blobmsg_parse
(
sysmngr_bank_policy
,
ARRAY_SIZE
(
sysmngr_bank_policy
)
,
t
,
blobmsg_data
(
entry
),
blobmsg_len
(
entry
)))
{
BBF_ERR
(
"Failed to parse bank entry"
);
BBF_ERR
(
"Failed to parse bank entry"
);
return
-
1
;
continue
;
}
}
if
(
!
t
[
0
]
||
!
t
[
1
]
||
!
t
[
2
]
||
!
t
[
3
]
||
!
t
[
4
]
||
!
t
[
5
]
||
!
t
[
6
]
||
!
t
[
7
]
||
!
t
[
8
])
// mark the valid flag, if one bank has valid data
return
-
1
;
if
(
t
[
0
]
&&
t
[
1
]
&&
t
[
2
]
&&
t
[
3
]
&&
t
[
4
]
&&
t
[
5
]
&&
t
[
6
]
&&
t
[
7
])
{
valid
=
0
;
break
;
}
}
}
BBF_DEBUG
(
"Global fwbank dump validation passed"
);
BBF_DEBUG
(
"Global fwbank dump validation passed"
);
return
0
;
return
valid
;
}
}
static
void
fwbank_dump_finish_callback
(
struct
ubus_context
*
ctx
,
struct
ubus_request_data
*
req
,
int
*
pipe_fds
,
uint32_t
bank_id
)
static
void
fwbank_dump_finish_callback
(
struct
ubus_context
*
ctx
,
struct
ubus_request_data
*
req
,
int
*
pipe_fds
,
uint32_t
bank_id
)
...
@@ -338,7 +340,7 @@ static int init_global_fwbank_dump(void)
...
@@ -338,7 +340,7 @@ static int init_global_fwbank_dump(void)
{
{
BBF_DEBUG
(
"Initializing global fwbank dump"
);
BBF_DEBUG
(
"Initializing global fwbank dump"
);
int
res
=
sysmngr_task_fork
(
fwbank_dump_finish_callback
,
FWBANK_DUMP_CMD
,
10
,
NULL
,
0
);
int
res
=
sysmngr_task_fork
(
fwbank_dump_finish_callback
,
FWBANK_DUMP_CMD
,
1
2
0
,
NULL
,
0
);
if
(
res
)
{
if
(
res
)
{
BBF_ERR
(
"Failed to start task for fwbank dump command"
);
BBF_ERR
(
"Failed to start task for fwbank dump command"
);
return
-
1
;
return
-
1
;
...
@@ -541,7 +543,7 @@ int sysmngr_fwbank_set_bootbank(uint32_t bank_id, struct ubus_request_data *req)
...
@@ -541,7 +543,7 @@ int sysmngr_fwbank_set_bootbank(uint32_t bank_id, struct ubus_request_data *req)
snprintf
(
cmd
,
sizeof
(
cmd
),
"echo '{
\"
bank
\"
:%u}' | %s 2>/dev/null"
,
bank_id
,
FWBANK_SET_BOOTBANK_CMD
);
snprintf
(
cmd
,
sizeof
(
cmd
),
"echo '{
\"
bank
\"
:%u}' | %s 2>/dev/null"
,
bank_id
,
FWBANK_SET_BOOTBANK_CMD
);
int
res
=
sysmngr_task_fork
(
fwbank_set_bootbank_finish_callback
,
cmd
,
5
,
req
,
0
);
int
res
=
sysmngr_task_fork
(
fwbank_set_bootbank_finish_callback
,
cmd
,
10
,
req
,
0
);
if
(
res
)
{
if
(
res
)
{
BBF_ERR
(
"Failed to start task for fwbank set bootbank command"
);
BBF_ERR
(
"Failed to start task for fwbank set bootbank command"
);
return
-
1
;
return
-
1
;
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment