Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4452806

Browse files
Merge #3291
3291: Rename appid and app_id to processid r=bradjc a=alexandruradovici ### Pull Request Overview This pull request renames the usage of `appid` and `app_id` of type `ProcessId` to `processid`. This is now useful as the `AppID` pull request was merged and the AppID now has a different meaning now from the ProcessId. Most usages of `appid` and `app_id` actually are referring `ProcessId`. ### Testing Strategy N/A ### TODO or Help Wanted N/A ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Alexandru RADOVICI <[email protected]>
2 parents 850bc02 + 692c8f7 commit 4452806

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+554
-502
lines changed

arch/cortex-m/src/mpu.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,16 +754,16 @@ impl<const NUM_REGIONS: usize, const MIN_REGION_SIZE: usize> mpu::MPU
754754
Ok(())
755755
}
756756

757-
fn configure_mpu(&self, config: &Self::MpuConfig, app_id: &ProcessId) {
757+
fn configure_mpu(&self, config: &Self::MpuConfig, processid: &ProcessId) {
758758
// If the hardware is already configured for this app and the app's MPU
759759
// configuration has not changed, then skip the hardware update.
760-
if !self.hardware_is_configured_for.contains(app_id) || config.is_dirty.get() {
760+
if !self.hardware_is_configured_for.contains(processid) || config.is_dirty.get() {
761761
// Set MPU regions
762762
for region in config.regions.iter() {
763763
self.registers.rbar.write(region.base_address());
764764
self.registers.rasr.write(region.attributes());
765765
}
766-
self.hardware_is_configured_for.set(*app_id);
766+
self.hardware_is_configured_for.set(*processid);
767767
config.is_dirty.set(false);
768768
}
769769
}

arch/rv32i/src/epmp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,11 @@ impl<const MAX_AVAILABLE_REGIONS_OVER_TWO: usize> kernel::platform::mpu::MPU
741741
Ok(())
742742
}
743743

744-
fn configure_mpu(&self, config: &Self::MpuConfig, app_id: &ProcessId) {
744+
fn configure_mpu(&self, config: &Self::MpuConfig, processid: &ProcessId) {
745745
// Is the PMP already configured for this app?
746746
let last_configured_for_this_app = self
747747
.last_configured_for
748-
.map_or(false, |last_app_id| last_app_id == app_id);
748+
.map_or(false, |last_processid| last_processid == processid);
749749

750750
if !last_configured_for_this_app || config.is_dirty.get() {
751751
for (x, region) in config.regions.iter().enumerate() {
@@ -807,7 +807,7 @@ impl<const MAX_AVAILABLE_REGIONS_OVER_TWO: usize> kernel::platform::mpu::MPU
807807
}
808808

809809
config.is_dirty.set(false);
810-
self.last_configured_for.put(*app_id);
810+
self.last_configured_for.put(*processid);
811811
}
812812
}
813813

arch/rv32i/src/pmp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,11 @@ impl<const MAX_AVAILABLE_REGIONS_OVER_TWO: usize> kernel::platform::mpu::MPU
507507
Ok(())
508508
}
509509

510-
fn configure_mpu(&self, config: &Self::MpuConfig, app_id: &ProcessId) {
510+
fn configure_mpu(&self, config: &Self::MpuConfig, processid: &ProcessId) {
511511
// Is the PMP already configured for this app?
512512
let last_configured_for_this_app = self
513513
.last_configured_for
514-
.map_or(false, |last_app_id| last_app_id == app_id);
514+
.map_or(false, |last_processid| last_processid == processid);
515515

516516
// Skip PMP configuration if it is already configured for this app and the MPU
517517
// configuration of this app has not changed.
@@ -545,7 +545,7 @@ impl<const MAX_AVAILABLE_REGIONS_OVER_TWO: usize> kernel::platform::mpu::MPU
545545
};
546546
}
547547
config.is_dirty.set(false);
548-
self.last_configured_for.put(*app_id);
548+
self.last_configured_for.put(*processid);
549549
}
550550
}
551551
}

capsules/src/adc.rs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub struct AdcDedicated<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> {
8888

8989
// App state
9090
apps: Grant<App, UpcallCount<1>, AllowRoCount<0>, AllowRwCount<2>>,
91-
appid: OptionalCell<ProcessId>,
91+
processid: OptionalCell<ProcessId>,
9292
channel: Cell<usize>,
9393

9494
// ADC buffers
@@ -179,7 +179,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
179179

180180
// App state
181181
apps: grant,
182-
appid: OptionalCell::empty(),
182+
processid: OptionalCell::empty(),
183183
channel: Cell::new(0),
184184

185185
// ADC buffers
@@ -332,7 +332,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
332332

333333
// cannot sample a buffer without a buffer to sample into
334334
let mut app_buf_length = 0;
335-
let exists = self.appid.map_or(false, |id| {
335+
let exists = self.processid.map_or(false, |id| {
336336
self.apps
337337
.enter(*id, |_, kernel_data| {
338338
app_buf_length = kernel_data
@@ -345,7 +345,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
345345
if err == kernel::process::Error::NoSuchApp
346346
|| err == kernel::process::Error::InactiveApp
347347
{
348-
self.appid.clear();
348+
self.processid.clear();
349349
}
350350
})
351351
.unwrap_or(false)
@@ -357,7 +357,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
357357
// save state for callback
358358
self.active.set(true);
359359
self.mode.set(AdcMode::SingleBuffer);
360-
let ret = self.appid.map_or(Err(ErrorCode::NOMEM), |id| {
360+
let ret = self.processid.map_or(Err(ErrorCode::NOMEM), |id| {
361361
self.apps
362362
.enter(*id, |app, _| {
363363
app.app_buf_offset.set(0);
@@ -405,7 +405,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
405405
if err == kernel::process::Error::NoSuchApp
406406
|| err == kernel::process::Error::InactiveApp
407407
{
408-
self.appid.clear();
408+
self.processid.clear();
409409
}
410410
})
411411
.unwrap_or(Err(ErrorCode::NOMEM))
@@ -414,7 +414,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
414414
// failure, clear state
415415
self.active.set(false);
416416
self.mode.set(AdcMode::NoMode);
417-
self.appid.map(|id| {
417+
self.processid.map(|id| {
418418
self.apps
419419
.enter(*id, |app, _| {
420420
app.samples_remaining.set(0);
@@ -424,7 +424,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
424424
if err == kernel::process::Error::NoSuchApp
425425
|| err == kernel::process::Error::InactiveApp
426426
{
427-
self.appid.clear();
427+
self.processid.clear();
428428
}
429429
})
430430
});
@@ -455,7 +455,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
455455
// cannot continuously sample without two buffers
456456
let mut app_buf_length = 0;
457457
let mut next_app_buf_length = 0;
458-
let exists = self.appid.map_or(false, |id| {
458+
let exists = self.processid.map_or(false, |id| {
459459
self.apps
460460
.enter(*id, |_, kernel_data| {
461461
app_buf_length = kernel_data
@@ -472,7 +472,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
472472
if err == kernel::process::Error::NoSuchApp
473473
|| err == kernel::process::Error::InactiveApp
474474
{
475-
self.appid.clear();
475+
self.processid.clear();
476476
}
477477
})
478478
.unwrap_or(false)
@@ -485,7 +485,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
485485
self.active.set(true);
486486
self.mode.set(AdcMode::ContinuousBuffer);
487487

488-
let ret = self.appid.map_or(Err(ErrorCode::NOMEM), |id| {
488+
let ret = self.processid.map_or(Err(ErrorCode::NOMEM), |id| {
489489
self.apps
490490
.enter(*id, |app, _| {
491491
app.app_buf_offset.set(0);
@@ -546,7 +546,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
546546
if err == kernel::process::Error::NoSuchApp
547547
|| err == kernel::process::Error::InactiveApp
548548
{
549-
self.appid.clear();
549+
self.processid.clear();
550550
}
551551
})
552552
.unwrap_or(Err(ErrorCode::NOMEM))
@@ -555,7 +555,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
555555
// failure, clear state
556556
self.active.set(false);
557557
self.mode.set(AdcMode::NoMode);
558-
self.appid.map(|id| {
558+
self.processid.map(|id| {
559559
self.apps
560560
.enter(*id, |app, _| {
561561
app.samples_remaining.set(0);
@@ -565,7 +565,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
565565
if err == kernel::process::Error::NoSuchApp
566566
|| err == kernel::process::Error::InactiveApp
567567
{
568-
self.appid.clear();
568+
self.processid.clear();
569569
}
570570
})
571571
});
@@ -584,7 +584,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
584584
}
585585

586586
// clean up state
587-
self.appid.map_or(Err(ErrorCode::FAIL), |id| {
587+
self.processid.map_or(Err(ErrorCode::FAIL), |id| {
588588
self.apps
589589
.enter(*id, |app, _| {
590590
self.active.set(false);
@@ -615,7 +615,7 @@ impl<'a, A: hil::adc::Adc + hil::adc::AdcHighSpeed> AdcDedicated<'a, A> {
615615
if err == kernel::process::Error::NoSuchApp
616616
|| err == kernel::process::Error::InactiveApp
617617
{
618-
self.appid.clear();
618+
self.processid.clear();
619619
}
620620
})
621621
.unwrap_or(Err(ErrorCode::FAIL))
@@ -652,13 +652,13 @@ impl<'a> AdcVirtualized<'a> {
652652
&self,
653653
command: Operation,
654654
channel: usize,
655-
appid: ProcessId,
655+
processid: ProcessId,
656656
) -> Result<(), ErrorCode> {
657657
if channel < self.drivers.len() {
658658
self.apps
659-
.enter(appid, |app, _| {
659+
.enter(processid, |app, _| {
660660
if self.current_app.is_none() {
661-
self.current_app.set(appid);
661+
self.current_app.set(processid);
662662
let value = self.call_driver(command, channel);
663663
if value != Ok(()) {
664664
self.current_app.clear();
@@ -705,7 +705,7 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> hil::adc::Client for AdcDedicate
705705

706706
// perform callback
707707

708-
self.appid.map(|id| {
708+
self.processid.map(|id| {
709709
self.apps
710710
.enter(*id, |_app, upcalls| {
711711
calledback = true;
@@ -724,15 +724,15 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> hil::adc::Client for AdcDedicate
724724
if err == kernel::process::Error::NoSuchApp
725725
|| err == kernel::process::Error::InactiveApp
726726
{
727-
self.appid.clear();
727+
self.processid.clear();
728728
}
729729
})
730730
});
731731
} else if self.active.get() && self.mode.get() == AdcMode::ContinuousSample {
732732
// sample ready in continuous sampling operation, keep state
733733

734734
// perform callback
735-
self.appid.map(|id| {
735+
self.processid.map(|id| {
736736
self.apps
737737
.enter(*id, |_app, upcalls| {
738738
calledback = true;
@@ -751,7 +751,7 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> hil::adc::Client for AdcDedicate
751751
if err == kernel::process::Error::NoSuchApp
752752
|| err == kernel::process::Error::InactiveApp
753753
{
754-
self.appid.clear();
754+
self.processid.clear();
755755
}
756756
})
757757
});
@@ -795,7 +795,7 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> hil::adc::HighSpeedClient for Ad
795795
|| self.mode.get() == AdcMode::ContinuousBuffer)
796796
{
797797
// we did expect a buffer. Determine the current application state
798-
self.appid.map(|id| {
798+
self.processid.map(|id| {
799799
self.apps
800800
.enter(*id, |app, kernel_data| {
801801
// Get both buffers, this shouldn't ever fail since the grant was created
@@ -1056,7 +1056,7 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> hil::adc::HighSpeedClient for Ad
10561056
if err == kernel::process::Error::NoSuchApp
10571057
|| err == kernel::process::Error::InactiveApp
10581058
{
1059-
self.appid.clear();
1059+
self.processid.clear();
10601060
unexpected_state = true;
10611061
}
10621062
})
@@ -1070,7 +1070,7 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> hil::adc::HighSpeedClient for Ad
10701070
// state is consistent. No callback.
10711071
self.active.set(false);
10721072
self.mode.set(AdcMode::NoMode);
1073-
self.appid.map(|id| {
1073+
self.processid.map(|id| {
10741074
self.apps
10751075
.enter(*id, |app, _| {
10761076
app.app_buf_offset.set(0);
@@ -1079,7 +1079,7 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> hil::adc::HighSpeedClient for Ad
10791079
if err == kernel::process::Error::NoSuchApp
10801080
|| err == kernel::process::Error::InactiveApp
10811081
{
1082-
self.appid.clear();
1082+
self.processid.clear();
10831083
}
10841084
})
10851085
});
@@ -1107,18 +1107,18 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> SyscallDriver for AdcDedicated<'
11071107
///
11081108
/// - `command_num` - which command call this is
11091109
/// - `data` - value sent by the application, varying uses
1110-
/// - `_appid` - application identifier, unused
1110+
/// - `_processid` - application identifier, unused
11111111
fn command(
11121112
&self,
11131113
command_num: usize,
11141114
channel: usize,
11151115
frequency: usize,
1116-
appid: ProcessId,
1116+
processid: ProcessId,
11171117
) -> CommandReturn {
11181118
// Return true if this app already owns the ADC capsule, if no app owns
11191119
// the ADC capsule, or if the app that is marked as owning the ADC
11201120
// capsule no longer exists.
1121-
let match_or_empty_or_nonexistant = self.appid.map_or(true, |owning_app| {
1121+
let match_or_empty_or_nonexistant = self.processid.map_or(true, |owning_app| {
11221122
// We have recorded that an app has ownership of the ADC.
11231123

11241124
// If the ADC is still active, then we need to wait for the operation
@@ -1127,7 +1127,7 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> SyscallDriver for AdcDedicated<'
11271127
// we need to verify that that application still exists, and remove
11281128
// it as owner if not.
11291129
if self.active.get() {
1130-
owning_app == &appid
1130+
owning_app == &processid
11311131
} else {
11321132
// Check the app still exists.
11331133
//
@@ -1137,12 +1137,12 @@ impl<A: hil::adc::Adc + hil::adc::AdcHighSpeed> SyscallDriver for AdcDedicated<'
11371137
// longer exists and we return `true` to signify the
11381138
// "or_nonexistant" case.
11391139
self.apps
1140-
.enter(*owning_app, |_, _| owning_app == &appid)
1140+
.enter(*owning_app, |_, _| owning_app == &processid)
11411141
.unwrap_or(true)
11421142
}
11431143
});
11441144
if match_or_empty_or_nonexistant {
1145-
self.appid.set(appid);
1145+
self.processid.set(processid);
11461146
} else {
11471147
return CommandReturn::failure(ErrorCode::NOMEM);
11481148
}
@@ -1228,21 +1228,21 @@ impl SyscallDriver for AdcVirtualized<'_> {
12281228
/// - `command_num` - which command call this is
12291229
/// - `channel` - requested channel value
12301230
/// - `_` - value sent by the application, unused
1231-
/// - `appid` - application identifier
1231+
/// - `processid` - application identifier
12321232
fn command(
12331233
&self,
12341234
command_num: usize,
12351235
channel: usize,
12361236
_: usize,
1237-
appid: ProcessId,
1237+
processid: ProcessId,
12381238
) -> CommandReturn {
12391239
match command_num {
12401240
// This driver exists and return the number of channels
12411241
0 => CommandReturn::success_u32(self.drivers.len() as u32),
12421242

12431243
// Single sample.
12441244
1 => {
1245-
let res = self.enqueue_command(Operation::OneSample, channel, appid);
1245+
let res = self.enqueue_command(Operation::OneSample, channel, processid);
12461246
if res == Ok(()) {
12471247
CommandReturn::success()
12481248
} else {
@@ -1286,8 +1286,8 @@ impl SyscallDriver for AdcVirtualized<'_> {
12861286

12871287
impl<'a> hil::adc::Client for AdcVirtualized<'a> {
12881288
fn sample_ready(&self, sample: u16) {
1289-
self.current_app.take().map(|appid| {
1290-
let _ = self.apps.enter(appid, |app, upcalls| {
1289+
self.current_app.take().map(|processid| {
1290+
let _ = self.apps.enter(processid, |app, upcalls| {
12911291
app.pending_command = false;
12921292
let channel = app.channel;
12931293
upcalls

0 commit comments

Comments
 (0)