Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bsdisks
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
This instance will be upgraded to Heptapod 17.7.0rc1 on 2025-01-23 between 18:00 and 19:00 UTC+2
Show more breadcrumbs
bsdutils
bsdisks
Commits
6c7c24aad721
Commit
6c7c24aad721
authored
4 years ago
by
Gleb Popov
Browse files
Options
Downloads
Patches
Plain Diff
Wrap the duplicated checking code into a macro.
parent
b1ff813e2d0f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
objectmanager.cpp
+11
-18
11 additions, 18 deletions
objectmanager.cpp
with
11 additions
and
18 deletions
objectmanager.cpp
+
11
−
18
View file @
6c7c24aa
...
...
@@ -8,6 +8,11 @@
#include
"camcontrolprober.h"
#include
"zfsprober.h"
// We have to run this check whenever a probe is finished, because the object
// being probed may be deleted meanwhile.
#define GET_BLOCK_OR_RETURN_IF_GONE(name) Block* b = m_blockObjects.value(name, nullptr); \
if(!b) return;
DBUSManagerStruct
ObjectManager
::
GetManagedObjects
()
{
DBUSManagerStruct
ret
;
...
...
@@ -391,9 +396,7 @@
QObject
::
connect
(
prober
,
&
FilesystemProber
::
finished
,
this
,
[
this
,
devName
](
QString
fs
)
{
Block
*
b
=
m_blockObjects
.
value
(
devName
);
if
(
!
b
)
return
;
GET_BLOCK_OR_RETURN_IF_GONE
(
devName
);
qDebug
()
<<
"Finished FS probe on "
<<
b
->
name
;
if
(
!
fs
.
isEmpty
())
...
...
@@ -420,12 +423,10 @@
QObject
::
connect
(
prober
,
&
GeomProber
::
gotLabels
,
this
,
[
this
,
devName
](
QStringList
labels
)
{
Block
*
b
=
m_blockObjects
.
value
(
devName
);
if
(
!
b
)
return
;
GET_BLOCK_OR_RETURN_IF_GONE
(
devName
);
b
->
labels
=
labels
;
});
QObject
::
connect
(
prober
,
&
GeomProber
::
gotDisk
,
this
,
[
this
,
devName
](
DiskInfo
di
)
{
...
...
@@ -426,12 +427,10 @@
b
->
labels
=
labels
;
});
QObject
::
connect
(
prober
,
&
GeomProber
::
gotDisk
,
this
,
[
this
,
devName
](
DiskInfo
di
)
{
Block
*
b
=
m_blockObjects
.
value
(
devName
);
if
(
!
b
)
return
;
GET_BLOCK_OR_RETURN_IF_GONE
(
devName
);
b
->
size
=
di
.
mediaSize
();
b
->
description
=
di
.
descr
();
...
...
@@ -440,9 +439,7 @@
QObject
::
connect
(
prober
,
&
GeomProber
::
gotPartTable
,
this
,
[
this
,
devName
](
PartTableInfo
pi
)
{
Block
*
b
=
m_blockObjects
.
value
(
devName
);
if
(
!
b
)
return
;
GET_BLOCK_OR_RETURN_IF_GONE
(
devName
);
// do not create BlockPartTable when called from updateBlock()
if
(
!
b
->
bPartTable
)
...
...
@@ -456,12 +453,10 @@
QObject
::
connect
(
prober
,
&
GeomProber
::
gotPart
,
this
,
[
this
,
devName
](
QString
tableBlockName
,
Part
partInfo
)
{
Block
*
b
=
m_blockObjects
.
value
(
devName
);
if
(
!
b
)
return
;
GET_BLOCK_OR_RETURN_IF_GONE
(
devName
);
addPartition
(
b
,
tableBlockName
,
partInfo
);
});
QObject
::
connect
(
prober
,
&
GeomProber
::
finished
,
this
,
[
this
,
devName
]()
{
...
...
@@ -462,12 +457,10 @@
addPartition
(
b
,
tableBlockName
,
partInfo
);
});
QObject
::
connect
(
prober
,
&
GeomProber
::
finished
,
this
,
[
this
,
devName
]()
{
Block
*
b
=
m_blockObjects
.
value
(
devName
);
if
(
!
b
)
return
;
GET_BLOCK_OR_RETURN_IF_GONE
(
devName
);
b
->
probesDone
.
set
(
GEOM_PROBE
);
qDebug
()
<<
"Finished GEOM probe on "
<<
b
->
name
;
...
...
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
register
or
sign in
to comment