@@ -3298,7 +3298,7 @@ vchiq_set_service_option(unsigned int handle,
3298
3298
return status ;
3299
3299
}
3300
3300
3301
- static void
3301
+ static int
3302
3302
vchiq_dump_shared_state (void * dump_context , struct vchiq_state * state ,
3303
3303
struct vchiq_shared_state * shared , const char * label )
3304
3304
{
@@ -3318,16 +3318,21 @@ vchiq_dump_shared_state(void *dump_context, struct vchiq_state *state,
3318
3318
int i ;
3319
3319
char buf [80 ];
3320
3320
int len ;
3321
+ int err ;
3321
3322
3322
3323
len = scnprintf (buf , sizeof (buf ),
3323
3324
" %s: slots %d-%d tx_pos=%x recycle=%x" ,
3324
3325
label , shared -> slot_first , shared -> slot_last ,
3325
3326
shared -> tx_pos , shared -> slot_queue_recycle );
3326
- vchiq_dump (dump_context , buf , len + 1 );
3327
+ err = vchiq_dump (dump_context , buf , len + 1 );
3328
+ if (err )
3329
+ return err ;
3327
3330
3328
3331
len = scnprintf (buf , sizeof (buf ),
3329
3332
" Slots claimed:" );
3330
- vchiq_dump (dump_context , buf , len + 1 );
3333
+ err = vchiq_dump (dump_context , buf , len + 1 );
3334
+ if (err )
3335
+ return err ;
3331
3336
3332
3337
for (i = shared -> slot_first ; i <= shared -> slot_last ; i ++ ) {
3333
3338
struct vchiq_slot_info slot_info =
@@ -3336,48 +3341,61 @@ vchiq_dump_shared_state(void *dump_context, struct vchiq_state *state,
3336
3341
len = scnprintf (buf , sizeof (buf ),
3337
3342
" %d: %d/%d" , i , slot_info .use_count ,
3338
3343
slot_info .release_count );
3339
- vchiq_dump (dump_context , buf , len + 1 );
3344
+ err = vchiq_dump (dump_context , buf , len + 1 );
3345
+ if (err )
3346
+ return err ;
3340
3347
}
3341
3348
}
3342
3349
3343
3350
for (i = 1 ; i < shared -> debug [DEBUG_ENTRIES ]; i ++ ) {
3344
3351
len = scnprintf (buf , sizeof (buf ), " DEBUG: %s = %d(%x)" ,
3345
3352
debug_names [i ], shared -> debug [i ], shared -> debug [i ]);
3346
- vchiq_dump (dump_context , buf , len + 1 );
3353
+ err = vchiq_dump (dump_context , buf , len + 1 );
3354
+ if (err )
3355
+ return err ;
3347
3356
}
3357
+ return 0 ;
3348
3358
}
3349
3359
3350
- void
3351
- vchiq_dump_state (void * dump_context , struct vchiq_state * state )
3360
+ int vchiq_dump_state (void * dump_context , struct vchiq_state * state )
3352
3361
{
3353
3362
char buf [80 ];
3354
3363
int len ;
3355
3364
int i ;
3365
+ int err ;
3356
3366
3357
3367
len = scnprintf (buf , sizeof (buf ), "State %d: %s" , state -> id ,
3358
3368
conn_state_names [state -> conn_state ]);
3359
- vchiq_dump (dump_context , buf , len + 1 );
3369
+ err = vchiq_dump (dump_context , buf , len + 1 );
3370
+ if (err )
3371
+ return err ;
3360
3372
3361
3373
len = scnprintf (buf , sizeof (buf ),
3362
3374
" tx_pos=%x(@%pK), rx_pos=%x(@%pK)" ,
3363
3375
state -> local -> tx_pos ,
3364
3376
state -> tx_data + (state -> local_tx_pos & VCHIQ_SLOT_MASK ),
3365
3377
state -> rx_pos ,
3366
3378
state -> rx_data + (state -> rx_pos & VCHIQ_SLOT_MASK ));
3367
- vchiq_dump (dump_context , buf , len + 1 );
3379
+ err = vchiq_dump (dump_context , buf , len + 1 );
3380
+ if (err )
3381
+ return err ;
3368
3382
3369
3383
len = scnprintf (buf , sizeof (buf ),
3370
3384
" Version: %d (min %d)" ,
3371
3385
VCHIQ_VERSION , VCHIQ_VERSION_MIN );
3372
- vchiq_dump (dump_context , buf , len + 1 );
3386
+ err = vchiq_dump (dump_context , buf , len + 1 );
3387
+ if (err )
3388
+ return err ;
3373
3389
3374
3390
if (VCHIQ_ENABLE_STATS ) {
3375
3391
len = scnprintf (buf , sizeof (buf ),
3376
3392
" Stats: ctrl_tx_count=%d, ctrl_rx_count=%d, "
3377
3393
"error_count=%d" ,
3378
3394
state -> stats .ctrl_tx_count , state -> stats .ctrl_rx_count ,
3379
3395
state -> stats .error_count );
3380
- vchiq_dump (dump_context , buf , len + 1 );
3396
+ err = vchiq_dump (dump_context , buf , len + 1 );
3397
+ if (err )
3398
+ return err ;
3381
3399
}
3382
3400
3383
3401
len = scnprintf (buf , sizeof (buf ),
@@ -3388,30 +3406,49 @@ vchiq_dump_state(void *dump_context, struct vchiq_state *state)
3388
3406
state -> data_quota - state -> data_use_count ,
3389
3407
state -> local -> slot_queue_recycle - state -> slot_queue_available ,
3390
3408
state -> stats .slot_stalls , state -> stats .data_stalls );
3391
- vchiq_dump (dump_context , buf , len + 1 );
3392
-
3393
- vchiq_dump_platform_state (dump_context );
3394
-
3395
- vchiq_dump_shared_state (dump_context , state , state -> local , "Local" );
3396
- vchiq_dump_shared_state (dump_context , state , state -> remote , "Remote" );
3397
-
3398
- vchiq_dump_platform_instances (dump_context );
3409
+ err = vchiq_dump (dump_context , buf , len + 1 );
3410
+ if (err )
3411
+ return err ;
3412
+
3413
+ err = vchiq_dump_platform_state (dump_context );
3414
+ if (err )
3415
+ return err ;
3416
+
3417
+ err = vchiq_dump_shared_state (dump_context ,
3418
+ state ,
3419
+ state -> local ,
3420
+ "Local" );
3421
+ if (err )
3422
+ return err ;
3423
+ err = vchiq_dump_shared_state (dump_context ,
3424
+ state ,
3425
+ state -> remote ,
3426
+ "Remote" );
3427
+ if (err )
3428
+ return err ;
3429
+
3430
+ err = vchiq_dump_platform_instances (dump_context );
3431
+ if (err )
3432
+ return err ;
3399
3433
3400
3434
for (i = 0 ; i < state -> unused_service ; i ++ ) {
3401
3435
struct vchiq_service * service = find_service_by_port (state , i );
3402
3436
3403
3437
if (service ) {
3404
- vchiq_dump_service_state (dump_context , service );
3438
+ err = vchiq_dump_service_state (dump_context , service );
3405
3439
unlock_service (service );
3440
+ if (err )
3441
+ return err ;
3406
3442
}
3407
3443
}
3444
+ return 0 ;
3408
3445
}
3409
3446
3410
- void
3411
- vchiq_dump_service_state (void * dump_context , struct vchiq_service * service )
3447
+ int vchiq_dump_service_state (void * dump_context , struct vchiq_service * service )
3412
3448
{
3413
3449
char buf [80 ];
3414
3450
int len ;
3451
+ int err ;
3415
3452
3416
3453
len = scnprintf (buf , sizeof (buf ), "Service %u: %s (ref %u)" ,
3417
3454
service -> localport , srvstate_names [service -> srvstate ],
@@ -3444,7 +3481,9 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service)
3444
3481
service_quota -> slot_use_count ,
3445
3482
service_quota -> slot_quota );
3446
3483
3447
- vchiq_dump (dump_context , buf , len + 1 );
3484
+ err = vchiq_dump (dump_context , buf , len + 1 );
3485
+ if (err )
3486
+ return err ;
3448
3487
3449
3488
tx_pending = service -> bulk_tx .local_insert -
3450
3489
service -> bulk_tx .remote_insert ;
@@ -3463,7 +3502,9 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service)
3463
3502
BULK_INDEX (service -> bulk_rx .remove )].size : 0 );
3464
3503
3465
3504
if (VCHIQ_ENABLE_STATS ) {
3466
- vchiq_dump (dump_context , buf , len + 1 );
3505
+ err = vchiq_dump (dump_context , buf , len + 1 );
3506
+ if (err )
3507
+ return err ;
3467
3508
3468
3509
len = scnprintf (buf , sizeof (buf ),
3469
3510
" Ctrl: tx_count=%d, tx_bytes=%llu, "
@@ -3472,7 +3513,9 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service)
3472
3513
service -> stats .ctrl_tx_bytes ,
3473
3514
service -> stats .ctrl_rx_count ,
3474
3515
service -> stats .ctrl_rx_bytes );
3475
- vchiq_dump (dump_context , buf , len + 1 );
3516
+ err = vchiq_dump (dump_context , buf , len + 1 );
3517
+ if (err )
3518
+ return err ;
3476
3519
3477
3520
len = scnprintf (buf , sizeof (buf ),
3478
3521
" Bulk: tx_count=%d, tx_bytes=%llu, "
@@ -3481,7 +3524,9 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service)
3481
3524
service -> stats .bulk_tx_bytes ,
3482
3525
service -> stats .bulk_rx_count ,
3483
3526
service -> stats .bulk_rx_bytes );
3484
- vchiq_dump (dump_context , buf , len + 1 );
3527
+ err = vchiq_dump (dump_context , buf , len + 1 );
3528
+ if (err )
3529
+ return err ;
3485
3530
3486
3531
len = scnprintf (buf , sizeof (buf ),
3487
3532
" %d quota stalls, %d slot stalls, "
@@ -3494,10 +3539,13 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service)
3494
3539
}
3495
3540
}
3496
3541
3497
- vchiq_dump (dump_context , buf , len + 1 );
3542
+ err = vchiq_dump (dump_context , buf , len + 1 );
3543
+ if (err )
3544
+ return err ;
3498
3545
3499
3546
if (service -> srvstate != VCHIQ_SRVSTATE_FREE )
3500
- vchiq_dump_platform_service_state (dump_context , service );
3547
+ err = vchiq_dump_platform_service_state (dump_context , service );
3548
+ return err ;
3501
3549
}
3502
3550
3503
3551
void
0 commit comments