@@ -1227,9 +1227,9 @@ BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name,
1227
1227
1228
1228
ret = bdrv_open_driver (bs , drv , node_name , bs -> options , flags , errp );
1229
1229
if (ret < 0 ) {
1230
- QDECREF (bs -> explicit_options );
1230
+ qobject_unref (bs -> explicit_options );
1231
1231
bs -> explicit_options = NULL ;
1232
- QDECREF (bs -> options );
1232
+ qobject_unref (bs -> options );
1233
1233
bs -> options = NULL ;
1234
1234
bdrv_unref (bs );
1235
1235
return NULL ;
@@ -1460,7 +1460,7 @@ static QDict *parse_json_filename(const char *filename, Error **errp)
1460
1460
1461
1461
options = qobject_to (QDict , options_obj );
1462
1462
if (!options ) {
1463
- qobject_decref (options_obj );
1463
+ qobject_unref (options_obj );
1464
1464
error_setg (errp , "Invalid JSON object given" );
1465
1465
return NULL ;
1466
1466
}
@@ -1490,7 +1490,7 @@ static void parse_json_protocol(QDict *options, const char **pfilename,
1490
1490
/* Options given in the filename have lower priority than options
1491
1491
* specified directly */
1492
1492
qdict_join (options , json_options , false);
1493
- QDECREF (json_options );
1493
+ qobject_unref (json_options );
1494
1494
* pfilename = NULL ;
1495
1495
}
1496
1496
@@ -2273,23 +2273,23 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
2273
2273
if (reference || qdict_haskey (options , "file.filename" )) {
2274
2274
backing_filename [0 ] = '\0' ;
2275
2275
} else if (bs -> backing_file [0 ] == '\0' && qdict_size (options ) == 0 ) {
2276
- QDECREF (options );
2276
+ qobject_unref (options );
2277
2277
goto free_exit ;
2278
2278
} else {
2279
2279
bdrv_get_full_backing_filename (bs , backing_filename , PATH_MAX ,
2280
2280
& local_err );
2281
2281
if (local_err ) {
2282
2282
ret = - EINVAL ;
2283
2283
error_propagate (errp , local_err );
2284
- QDECREF (options );
2284
+ qobject_unref (options );
2285
2285
goto free_exit ;
2286
2286
}
2287
2287
}
2288
2288
2289
2289
if (!bs -> drv || !bs -> drv -> supports_backing ) {
2290
2290
ret = - EINVAL ;
2291
2291
error_setg (errp , "Driver doesn't support backing files" );
2292
- QDECREF (options );
2292
+ qobject_unref (options );
2293
2293
goto free_exit ;
2294
2294
}
2295
2295
@@ -2323,7 +2323,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
2323
2323
2324
2324
free_exit :
2325
2325
g_free (backing_filename );
2326
- QDECREF (tmp_parent_options );
2326
+ qobject_unref (tmp_parent_options );
2327
2327
return ret ;
2328
2328
}
2329
2329
@@ -2356,7 +2356,7 @@ bdrv_open_child_bs(const char *filename, QDict *options, const char *bdref_key,
2356
2356
error_setg (errp , "A block device must be specified for \"%s\"" ,
2357
2357
bdref_key );
2358
2358
}
2359
- QDECREF (image_options );
2359
+ qobject_unref (image_options );
2360
2360
goto done ;
2361
2361
}
2362
2362
@@ -2449,7 +2449,7 @@ BlockDriverState *bdrv_open_blockdev_ref(BlockdevRef *ref, Error **errp)
2449
2449
obj = NULL ;
2450
2450
2451
2451
fail :
2452
- qobject_decref (obj );
2452
+ qobject_unref (obj );
2453
2453
visit_free (v );
2454
2454
return bs ;
2455
2455
}
@@ -2519,7 +2519,7 @@ static BlockDriverState *bdrv_append_temp_snapshot(BlockDriverState *bs,
2519
2519
}
2520
2520
2521
2521
out :
2522
- QDECREF (snapshot_options );
2522
+ qobject_unref (snapshot_options );
2523
2523
g_free (tmp_filename );
2524
2524
return bs_snapshot ;
2525
2525
}
@@ -2530,7 +2530,7 @@ static BlockDriverState *bdrv_append_temp_snapshot(BlockDriverState *bs,
2530
2530
* options is a QDict of options to pass to the block drivers, or NULL for an
2531
2531
* empty set of options. The reference to the QDict belongs to the block layer
2532
2532
* after the call (even on failure), so if the caller intends to reuse the
2533
- * dictionary, it needs to use QINCREF () before calling bdrv_open.
2533
+ * dictionary, it needs to use qobject_ref () before calling bdrv_open.
2534
2534
*
2535
2535
* If *pbs is NULL, a new BDS will be created with a pointer to it stored there.
2536
2536
* If it is not NULL, the referenced BDS will be reused.
@@ -2561,7 +2561,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
2561
2561
2562
2562
if (reference ) {
2563
2563
bool options_non_empty = options ? qdict_size (options ) : false;
2564
- QDECREF (options );
2564
+ qobject_unref (options );
2565
2565
2566
2566
if (filename || options_non_empty ) {
2567
2567
error_setg (errp , "Cannot reference an existing block device with "
@@ -2752,7 +2752,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
2752
2752
2753
2753
bdrv_parent_cb_change_media (bs , true);
2754
2754
2755
- QDECREF (options );
2755
+ qobject_unref (options );
2756
2756
2757
2757
/* For snapshot=on, create a temporary qcow2 overlay. bs points to the
2758
2758
* temporary snapshot afterwards. */
@@ -2776,10 +2776,10 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
2776
2776
2777
2777
fail :
2778
2778
blk_unref (file );
2779
- QDECREF (snapshot_options );
2780
- QDECREF (bs -> explicit_options );
2781
- QDECREF (bs -> options );
2782
- QDECREF (options );
2779
+ qobject_unref (snapshot_options );
2780
+ qobject_unref (bs -> explicit_options );
2781
+ qobject_unref (bs -> options );
2782
+ qobject_unref (options );
2783
2783
bs -> options = NULL ;
2784
2784
bs -> explicit_options = NULL ;
2785
2785
bdrv_unref (bs );
@@ -2788,8 +2788,8 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
2788
2788
2789
2789
close_and_fail :
2790
2790
bdrv_unref (bs );
2791
- QDECREF (snapshot_options );
2792
- QDECREF (options );
2791
+ qobject_unref (snapshot_options );
2792
+ qobject_unref (options );
2793
2793
error_propagate (errp , local_err );
2794
2794
return NULL ;
2795
2795
}
@@ -2884,7 +2884,7 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
2884
2884
old_options = qdict_clone_shallow (bs -> explicit_options );
2885
2885
}
2886
2886
bdrv_join_options (bs , options , old_options );
2887
- QDECREF (old_options );
2887
+ qobject_unref (old_options );
2888
2888
2889
2889
explicit_options = qdict_clone_shallow (options );
2890
2890
@@ -2899,13 +2899,13 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
2899
2899
qemu_opts_absorb_qdict (opts , options_copy , NULL );
2900
2900
update_flags_from_options (& flags , opts );
2901
2901
qemu_opts_del (opts );
2902
- QDECREF (options_copy );
2902
+ qobject_unref (options_copy );
2903
2903
}
2904
2904
2905
2905
/* Old values are used for options that aren't set yet */
2906
2906
old_options = qdict_clone_shallow (bs -> options );
2907
2907
bdrv_join_options (bs , options , old_options );
2908
- QDECREF (old_options );
2908
+ qobject_unref (old_options );
2909
2909
2910
2910
/* bdrv_open_inherit() sets and clears some additional flags internally */
2911
2911
flags &= ~BDRV_O_PROTOCOL ;
@@ -2917,8 +2917,8 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
2917
2917
bs_entry = g_new0 (BlockReopenQueueEntry , 1 );
2918
2918
QSIMPLEQ_INSERT_TAIL (bs_queue , bs_entry , entry );
2919
2919
} else {
2920
- QDECREF (bs_entry -> state .options );
2921
- QDECREF (bs_entry -> state .explicit_options );
2920
+ qobject_unref (bs_entry -> state .options );
2921
+ qobject_unref (bs_entry -> state .explicit_options );
2922
2922
}
2923
2923
2924
2924
bs_entry -> state .bs = bs ;
@@ -3008,9 +3008,9 @@ int bdrv_reopen_multiple(AioContext *ctx, BlockReopenQueue *bs_queue, Error **er
3008
3008
if (ret && bs_entry -> prepared ) {
3009
3009
bdrv_reopen_abort (& bs_entry -> state );
3010
3010
} else if (ret ) {
3011
- QDECREF (bs_entry -> state .explicit_options );
3011
+ qobject_unref (bs_entry -> state .explicit_options );
3012
3012
}
3013
- QDECREF (bs_entry -> state .options );
3013
+ qobject_unref (bs_entry -> state .options );
3014
3014
g_free (bs_entry );
3015
3015
}
3016
3016
g_free (bs_queue );
@@ -3253,7 +3253,7 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_state)
3253
3253
}
3254
3254
3255
3255
/* set BDS specific flags now */
3256
- QDECREF (bs -> explicit_options );
3256
+ qobject_unref (bs -> explicit_options );
3257
3257
3258
3258
bs -> explicit_options = reopen_state -> explicit_options ;
3259
3259
bs -> open_flags = reopen_state -> flags ;
@@ -3296,7 +3296,7 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
3296
3296
drv -> bdrv_reopen_abort (reopen_state );
3297
3297
}
3298
3298
3299
- QDECREF (reopen_state -> explicit_options );
3299
+ qobject_unref (reopen_state -> explicit_options );
3300
3300
3301
3301
bdrv_abort_perm_update (reopen_state -> bs );
3302
3302
}
@@ -3343,11 +3343,11 @@ static void bdrv_close(BlockDriverState *bs)
3343
3343
bs -> total_sectors = 0 ;
3344
3344
bs -> encrypted = false;
3345
3345
bs -> sg = false;
3346
- QDECREF (bs -> options );
3347
- QDECREF (bs -> explicit_options );
3346
+ qobject_unref (bs -> options );
3347
+ qobject_unref (bs -> explicit_options );
3348
3348
bs -> options = NULL ;
3349
3349
bs -> explicit_options = NULL ;
3350
- QDECREF (bs -> full_open_options );
3350
+ qobject_unref (bs -> full_open_options );
3351
3351
bs -> full_open_options = NULL ;
3352
3352
3353
3353
bdrv_release_named_dirty_bitmaps (bs );
@@ -5134,7 +5134,7 @@ static bool append_open_options(QDict *d, BlockDriverState *bs)
5134
5134
continue ;
5135
5135
}
5136
5136
5137
- qobject_incref (qdict_entry_value (entry ));
5137
+ qobject_ref (qdict_entry_value (entry ));
5138
5138
qdict_put_obj (d , qdict_entry_key (entry ), qdict_entry_value (entry ));
5139
5139
found_any = true;
5140
5140
}
@@ -5174,21 +5174,21 @@ void bdrv_refresh_filename(BlockDriverState *bs)
5174
5174
* information before refreshing it */
5175
5175
bs -> exact_filename [0 ] = '\0' ;
5176
5176
if (bs -> full_open_options ) {
5177
- QDECREF (bs -> full_open_options );
5177
+ qobject_unref (bs -> full_open_options );
5178
5178
bs -> full_open_options = NULL ;
5179
5179
}
5180
5180
5181
5181
opts = qdict_new ();
5182
5182
append_open_options (opts , bs );
5183
5183
drv -> bdrv_refresh_filename (bs , opts );
5184
- QDECREF (opts );
5184
+ qobject_unref (opts );
5185
5185
} else if (bs -> file ) {
5186
5186
/* Try to reconstruct valid information from the underlying file */
5187
5187
bool has_open_options ;
5188
5188
5189
5189
bs -> exact_filename [0 ] = '\0' ;
5190
5190
if (bs -> full_open_options ) {
5191
- QDECREF (bs -> full_open_options );
5191
+ qobject_unref (bs -> full_open_options );
5192
5192
bs -> full_open_options = NULL ;
5193
5193
}
5194
5194
@@ -5207,12 +5207,12 @@ void bdrv_refresh_filename(BlockDriverState *bs)
5207
5207
* suffices without querying the (exact_)filename of this BDS. */
5208
5208
if (bs -> file -> bs -> full_open_options ) {
5209
5209
qdict_put_str (opts , "driver" , drv -> format_name );
5210
- QINCREF (bs -> file -> bs -> full_open_options );
5210
+ qobject_ref (bs -> file -> bs -> full_open_options );
5211
5211
qdict_put (opts , "file" , bs -> file -> bs -> full_open_options );
5212
5212
5213
5213
bs -> full_open_options = opts ;
5214
5214
} else {
5215
- QDECREF (opts );
5215
+ qobject_unref (opts );
5216
5216
}
5217
5217
} else if (!bs -> full_open_options && qdict_size (bs -> options )) {
5218
5218
/* There is no underlying file BDS (at least referenced by BDS.file),
@@ -5246,7 +5246,7 @@ void bdrv_refresh_filename(BlockDriverState *bs)
5246
5246
QString * json = qobject_to_json (QOBJECT (bs -> full_open_options ));
5247
5247
snprintf (bs -> filename , sizeof (bs -> filename ), "json:%s" ,
5248
5248
qstring_get_str (json ));
5249
- QDECREF (json );
5249
+ qobject_unref (json );
5250
5250
}
5251
5251
}
5252
5252
0 commit comments