Make more OS internal names consistent

1. Internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions

    # clock_systimer -> clock_systime_tick
    # clock_systimespec -> clock_systime_timespec
    sched_oneshot_extclk -> nxsched_oneshot_extclk
    sched_period_extclk -> nxsched_period_extclk
    # nxsem_setprotocol -> nxsem_set_protocol
    # nxsem_getprotocol -> nxsem_get_protocol
    # nxsem_getvalue -> nxsem_get_value
    nxsem_initholders -> nxsem_initialize_holders
    nxsem_addholder -> nxsem_add_holder
    nxsem_addholder_tcb -> nxsem_add_holder_tcb
    nxsem_boostpriority -> nxsem_boost_priority
    nxsem_releaseholder -> nxsem_release_holder
    nxsem_restorebaseprio -> nxsem_restore_baseprio

Some planned name changed were skipped for now because they effect too many files (and would require many hours of coding style fixups).
This commit is contained in:
Gregory Nutt
2020-05-10 07:13:21 -06:00
committed by Xiang Xiao
parent fbbf1dffaf
commit 153eee6de2
10 changed files with 139 additions and 223 deletions
+23 -23
View File
@@ -235,7 +235,7 @@ static inline void nxsem_findandfreeholder(sem_t *sem,
FAR struct semholder_s *pholder = nxsem_findholder(sem, htcb);
/* When no more counts are held, remove the holder from the list. The
* count was decremented in nxsem_releaseholder.
* count was decremented in nxsem_release_holder.
*/
if (pholder != NULL && pholder->counts <= 0)
@@ -685,7 +685,7 @@ static int nxsem_restoreholderprio_self(FAR struct semholder_s *pholder,
}
/****************************************************************************
* Name: nxsem_restorebaseprio_irq
* Name: nxsem_restore_baseprio_irq
*
* Description:
* This function is called after an interrupt handler posts a count on
@@ -716,8 +716,8 @@ static int nxsem_restoreholderprio_self(FAR struct semholder_s *pholder,
*
****************************************************************************/
static inline void nxsem_restorebaseprio_irq(FAR struct tcb_s *stcb,
FAR sem_t *sem)
static inline void nxsem_restore_baseprio_irq(FAR struct tcb_s *stcb,
FAR sem_t *sem)
{
/* Perform the following actions only if a new thread was given a count.
* The thread that received the count should be the highest priority
@@ -746,7 +746,7 @@ static inline void nxsem_restorebaseprio_irq(FAR struct tcb_s *stcb,
}
/****************************************************************************
* Name: nxsem_restorebaseprio_task
* Name: nxsem_restore_baseprio_task
*
* Description:
* This function is called after the current running task releases a
@@ -777,8 +777,8 @@ static inline void nxsem_restorebaseprio_irq(FAR struct tcb_s *stcb,
*
****************************************************************************/
static inline void nxsem_restorebaseprio_task(FAR struct tcb_s *stcb,
FAR sem_t *sem)
static inline void nxsem_restore_baseprio_task(FAR struct tcb_s *stcb,
FAR sem_t *sem)
{
FAR struct tcb_s *rtcb = this_task();
@@ -831,7 +831,7 @@ static inline void nxsem_restorebaseprio_task(FAR struct tcb_s *stcb,
****************************************************************************/
/****************************************************************************
* Name: nxsem_initholders
* Name: nxsem_initialize_holders
*
* Description:
* Called from nxsem_initialize() to set up semaphore holder information.
@@ -846,7 +846,7 @@ static inline void nxsem_restorebaseprio_task(FAR struct tcb_s *stcb,
*
****************************************************************************/
void nxsem_initholders(void)
void nxsem_initialize_holders(void)
{
#if CONFIG_SEM_PREALLOCHOLDERS > 0
int i;
@@ -920,7 +920,7 @@ void nxsem_destroyholder(FAR sem_t *sem)
}
/****************************************************************************
* Name: nxsem_addholder_tcb
* Name: nxsem_add_holder_tcb
*
* Description:
* Called from nxsem_wait() when the calling thread obtains the semaphore;
@@ -938,7 +938,7 @@ void nxsem_destroyholder(FAR sem_t *sem)
*
****************************************************************************/
void nxsem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem)
void nxsem_add_holder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem)
{
FAR struct semholder_s *pholder;
@@ -965,7 +965,7 @@ void nxsem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem)
}
/****************************************************************************
* Name: nxsem_addholder
* Name: nxsem_add_holder
*
* Description:
* Called from nxsem_wait() when the calling thread obtains the semaphore
@@ -981,13 +981,13 @@ void nxsem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem)
*
****************************************************************************/
void nxsem_addholder(FAR sem_t *sem)
void nxsem_add_holder(FAR sem_t *sem)
{
nxsem_addholder_tcb(this_task(), sem);
nxsem_add_holder_tcb(this_task(), sem);
}
/****************************************************************************
* Name: void nxsem_boostpriority(sem_t *sem)
* Name: void nxsem_boost_priority(sem_t *sem)
*
* Description:
*
@@ -1002,7 +1002,7 @@ void nxsem_addholder(FAR sem_t *sem)
*
****************************************************************************/
void nxsem_boostpriority(FAR sem_t *sem)
void nxsem_boost_priority(FAR sem_t *sem)
{
FAR struct tcb_s *rtcb = this_task();
@@ -1015,7 +1015,7 @@ void nxsem_boostpriority(FAR sem_t *sem)
}
/****************************************************************************
* Name: nxsem_releaseholder
* Name: nxsem_release_holder
*
* Description:
* Called from sem_post() after a thread releases one count on the
@@ -1031,7 +1031,7 @@ void nxsem_boostpriority(FAR sem_t *sem)
*
****************************************************************************/
void nxsem_releaseholder(FAR sem_t *sem)
void nxsem_release_holder(FAR sem_t *sem)
{
FAR struct tcb_s *rtcb = this_task();
FAR struct semholder_s *pholder;
@@ -1042,7 +1042,7 @@ void nxsem_releaseholder(FAR sem_t *sem)
if (pholder != NULL && pholder->counts > 0)
{
/* Decrement the counts on this holder -- the holder will be freed
* later in nxsem_restorebaseprio.
* later in nxsem_restore_baseprio.
*/
pholder->counts--;
@@ -1050,7 +1050,7 @@ void nxsem_releaseholder(FAR sem_t *sem)
}
/****************************************************************************
* Name: nxsem_restorebaseprio
* Name: nxsem_restore_baseprio
*
* Description:
* This function is called after the current running task releases a
@@ -1082,7 +1082,7 @@ void nxsem_releaseholder(FAR sem_t *sem)
*
****************************************************************************/
void nxsem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem)
void nxsem_restore_baseprio(FAR struct tcb_s *stcb, FAR sem_t *sem)
{
#if 0 /* DSA: sometimes crashes when Telnet calls external cmd (i.e. 'i2c') */
/* Check our assumptions */
@@ -1101,11 +1101,11 @@ void nxsem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem)
if (up_interrupt_context())
{
nxsem_restorebaseprio_irq(stcb, sem);
nxsem_restore_baseprio_irq(stcb, sem);
}
else
{
nxsem_restorebaseprio_task(stcb, sem);
nxsem_restore_baseprio_task(stcb, sem);
}
}
+13 -28
View File
@@ -1,35 +1,20 @@
/****************************************************************************
* sched/semaphore/sem_initialize.c
*
* Copyright (C) 2007, 2009, 2012, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -71,7 +56,7 @@ void nxsem_initialize(void)
{
/* Initialize holder structures needed to support priority inheritance */
nxsem_initholders();
nxsem_initialize_holders();
}
#endif /* CONFIG_PRIORITY_INHERITANCE */
+16 -32
View File
@@ -1,36 +1,20 @@
/****************************************************************************
* sched/semaphore/sem_post.c
*
* Copyright (C) 2007-2009, 2012-2013, 2016-2017 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -113,7 +97,7 @@ int nxsem_post(FAR sem_t *sem)
*
* NOTE: When semaphores are used for signaling purposes, the holder
* of the semaphore may not be this thread! In this case,
* nxsem_releaseholder() will do nothing.
* nxsem_release_holder() will do nothing.
*
* In the case of a mutex this could be simply resolved since there is
* only one holder but for the case of counting semaphores, there may
@@ -125,7 +109,7 @@ int nxsem_post(FAR sem_t *sem)
* initialized if the semaphore is to used for signaling purposes.
*/
nxsem_releaseholder(sem);
nxsem_release_holder(sem);
sem->semcount++;
#ifdef CONFIG_PRIORITY_INHERITANCE
@@ -161,7 +145,7 @@ int nxsem_post(FAR sem_t *sem)
* it is awakened.
*/
nxsem_addholder_tcb(stcb, sem);
nxsem_add_holder_tcb(stcb, sem);
/* It is, let the task take the semaphore */
@@ -187,7 +171,7 @@ int nxsem_post(FAR sem_t *sem)
*/
#ifdef CONFIG_PRIORITY_INHERITANCE
nxsem_restorebaseprio(stcb, sem);
nxsem_restore_baseprio(stcb, sem);
sched_unlock();
#endif
ret = OK;
+3 -3
View File
@@ -95,7 +95,7 @@ int nxsem_wait(FAR sem_t *sem)
/* It is, let the task take the semaphore. */
sem->semcount--;
nxsem_addholder(sem);
nxsem_add_holder(sem);
rtcb->waitsem = NULL;
ret = OK;
}
@@ -135,7 +135,7 @@ int nxsem_wait(FAR sem_t *sem)
* semaphore.
*/
nxsem_boostpriority(sem);
nxsem_boost_priority(sem);
#endif
/* Set the errno value to zero (preserving the original errno)
* value). We reuse the per-thread errno to pass information
@@ -178,7 +178,7 @@ int nxsem_wait(FAR sem_t *sem)
* sem_timedwait().
*
* If we were not awakened by a signal or a timeout, then
* nxsem_addholder() was called by logic in sem_wait() fore this
* nxsem_add_holder() was called by logic in sem_wait() fore this
* thread was restarted.
*/
+24 -39
View File
@@ -1,35 +1,20 @@
/****************************************************************************
* sched/semaphore/semaphore.h
*
* Copyright (C) 2007, 2009-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -86,22 +71,22 @@ void nxsem_recover(FAR struct tcb_s *tcb);
*/
#ifdef CONFIG_PRIORITY_INHERITANCE
void nxsem_initholders(void);
void nxsem_initialize_holders(void);
void nxsem_destroyholder(FAR sem_t *sem);
void nxsem_addholder(FAR sem_t *sem);
void nxsem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem);
void nxsem_boostpriority(FAR sem_t *sem);
void nxsem_releaseholder(FAR sem_t *sem);
void nxsem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem);
void nxsem_add_holder(FAR sem_t *sem);
void nxsem_add_holder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem);
void nxsem_boost_priority(FAR sem_t *sem);
void nxsem_release_holder(FAR sem_t *sem);
void nxsem_restore_baseprio(FAR struct tcb_s *stcb, FAR sem_t *sem);
void nxsem_canceled(FAR struct tcb_s *stcb, FAR sem_t *sem);
#else
# define nxsem_initholders()
# define nxsem_initialize_holders()
# define nxsem_destroyholder(sem)
# define nxsem_addholder(sem)
# define nxsem_addholder_tcb(htcb,sem)
# define nxsem_boostpriority(sem)
# define nxsem_releaseholder(sem)
# define nxsem_restorebaseprio(stcb,sem)
# define nxsem_add_holder(sem)
# define nxsem_add_holder_tcb(htcb,sem)
# define nxsem_boost_priority(sem)
# define nxsem_release_holder(sem)
# define nxsem_restore_baseprio(stcb,sem)
# define nxsem_canceled(stcb,sem)
#endif