OCF Cleanup
**ocf_env**: deleting unused functions from main file Signed-off-by: Slawomir_Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
5
env/posix/ocf_env.c
vendored
5
env/posix/ocf_env.c
vendored
@@ -110,11 +110,6 @@ void env_allocator_destroy(env_allocator *allocator)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t env_allocator_item_count(env_allocator *allocator)
|
||||
{
|
||||
return env_atomic_read(&allocator->count);
|
||||
}
|
||||
|
||||
/* *** DEBUGING *** */
|
||||
|
||||
#define ENV_TRACE_DEPTH 16
|
||||
|
101
env/posix/ocf_env.h
vendored
101
env/posix/ocf_env.h
vendored
@@ -169,8 +169,6 @@ void *env_allocator_new(env_allocator *allocator);
|
||||
|
||||
void env_allocator_del(env_allocator *allocator, void *item);
|
||||
|
||||
uint32_t env_allocator_item_count(env_allocator *allocator);
|
||||
|
||||
/* *** MUTEX *** */
|
||||
|
||||
typedef struct {
|
||||
@@ -198,28 +196,11 @@ static inline int env_mutex_lock_interruptible(env_mutex *mutex)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int env_mutex_trylock(env_mutex *mutex)
|
||||
{
|
||||
return pthread_mutex_trylock(&mutex->m) ? -OCF_ERR_NO_LOCK : 0;
|
||||
}
|
||||
|
||||
static inline void env_mutex_unlock(env_mutex *mutex)
|
||||
{
|
||||
ENV_BUG_ON(pthread_mutex_unlock(&mutex->m));
|
||||
}
|
||||
|
||||
static inline int env_mutex_is_locked(env_mutex *mutex)
|
||||
{
|
||||
if (env_mutex_trylock(mutex) == 0) {
|
||||
env_mutex_unlock(mutex);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* *** RECURSIVE MUTEX *** */
|
||||
|
||||
typedef env_mutex env_rmutex;
|
||||
|
||||
static inline int env_rmutex_init(env_rmutex *rmutex)
|
||||
@@ -243,21 +224,11 @@ static inline int env_rmutex_lock_interruptible(env_rmutex *rmutex)
|
||||
return env_mutex_lock_interruptible(rmutex);
|
||||
}
|
||||
|
||||
static inline int env_rmutex_trylock(env_rmutex *rmutex)
|
||||
{
|
||||
return env_mutex_trylock(rmutex);
|
||||
}
|
||||
|
||||
static inline void env_rmutex_unlock(env_rmutex *rmutex)
|
||||
{
|
||||
env_mutex_unlock(rmutex);
|
||||
}
|
||||
|
||||
static inline int env_rmutex_is_locked(env_rmutex *rmutex)
|
||||
{
|
||||
return env_mutex_is_locked(rmutex);
|
||||
}
|
||||
|
||||
/* *** RW SEMAPHORE *** */
|
||||
typedef struct {
|
||||
pthread_rwlock_t lock;
|
||||
@@ -298,28 +269,6 @@ static inline int env_rwsem_down_write_trylock(env_rwsem *s)
|
||||
return pthread_rwlock_trywrlock(&s->lock) ? -OCF_ERR_NO_LOCK : 0;
|
||||
}
|
||||
|
||||
static inline int env_rwsem_is_locked(env_rwsem *s)
|
||||
{
|
||||
if (env_rwsem_down_read_trylock(s) == 0) {
|
||||
env_rwsem_up_read(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int env_rwsem_down_write_interruptible(env_rwsem *s)
|
||||
{
|
||||
env_rwsem_down_write(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int env_rwsem_down_read_interruptible(env_rwsem *s)
|
||||
{
|
||||
env_rwsem_down_read(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* *** COMPLETION *** */
|
||||
struct completion {
|
||||
sem_t sem;
|
||||
@@ -342,12 +291,6 @@ static inline void env_completion_complete(env_completion *completion)
|
||||
sem_post(&completion->sem);
|
||||
}
|
||||
|
||||
static inline void env_completion_complete_and_exit(
|
||||
env_completion *completion, int ret)
|
||||
{
|
||||
env_completion_complete(completion); /* TODO */
|
||||
}
|
||||
|
||||
/* *** ATOMIC VARIABLES *** */
|
||||
|
||||
typedef struct {
|
||||
@@ -378,11 +321,6 @@ static inline void env_atomic_sub(int i, env_atomic *a)
|
||||
__sync_sub_and_fetch(&a->counter, i);
|
||||
}
|
||||
|
||||
static inline bool env_atomic_sub_and_test(int i, env_atomic *a)
|
||||
{
|
||||
return __sync_sub_and_fetch(&a->counter, i) == 0;
|
||||
}
|
||||
|
||||
static inline void env_atomic_inc(env_atomic *a)
|
||||
{
|
||||
env_atomic_add(1, a);
|
||||
@@ -398,11 +336,6 @@ static inline bool env_atomic_dec_and_test(env_atomic *a)
|
||||
return __sync_sub_and_fetch(&a->counter, 1) == 0;
|
||||
}
|
||||
|
||||
static inline bool env_atomic_inc_and_test(env_atomic *a)
|
||||
{
|
||||
return __sync_add_and_fetch(&a->counter, 1) == 0;
|
||||
}
|
||||
|
||||
static inline int env_atomic_add_return(int i, env_atomic *a)
|
||||
{
|
||||
return __sync_add_and_fetch(&a->counter, i);
|
||||
@@ -504,16 +437,6 @@ static inline void env_spinlock_unlock(env_spinlock *l)
|
||||
ENV_BUG_ON(pthread_spin_unlock(&l->lock));
|
||||
}
|
||||
|
||||
static inline void env_spinlock_lock_irq(env_spinlock *l)
|
||||
{
|
||||
env_spinlock_lock(l);
|
||||
}
|
||||
|
||||
static inline void env_spinlock_unlock_irq(env_spinlock *l)
|
||||
{
|
||||
env_spinlock_unlock(l);
|
||||
}
|
||||
|
||||
#define env_spinlock_lock_irqsave(l, flags) \
|
||||
(void)flags; \
|
||||
env_spinlock_lock(l)
|
||||
@@ -559,16 +482,6 @@ typedef struct {
|
||||
sem_t sem;
|
||||
} env_waitqueue;
|
||||
|
||||
static inline void env_waitqueue_init(env_waitqueue *w)
|
||||
{
|
||||
sem_init(&w->sem, 0, 0);
|
||||
}
|
||||
|
||||
static inline void env_waitqueue_wake_up(env_waitqueue *w)
|
||||
{
|
||||
sem_post(&w->sem);
|
||||
}
|
||||
|
||||
#define env_waitqueue_wait(w, condition) \
|
||||
({ \
|
||||
int __ret = 0; \
|
||||
@@ -604,12 +517,6 @@ static inline bool env_bit_test(int nr, const volatile unsigned long *addr)
|
||||
return !!(*byte & mask);
|
||||
}
|
||||
|
||||
/* *** SCHEDULING *** */
|
||||
static inline void env_schedule(void)
|
||||
{
|
||||
sched_yield();
|
||||
}
|
||||
|
||||
static inline int env_in_interrupt(void)
|
||||
{
|
||||
return 0;
|
||||
@@ -689,14 +596,6 @@ struct env_timeval {
|
||||
uint64_t sec, usec;
|
||||
};
|
||||
|
||||
static inline void env_gettimeofday(struct env_timeval *tv)
|
||||
{
|
||||
struct timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
tv->sec = t.tv_sec;
|
||||
tv->usec = t.tv_usec;
|
||||
}
|
||||
|
||||
uint32_t env_crc32(uint32_t crc, uint8_t const *data, size_t len);
|
||||
|
||||
#define ENV_PRIu64 "lu"
|
||||
|
Reference in New Issue
Block a user