CamelCase the Clock structs

This commit is contained in:
Nils O. Selåsdal
2013-03-02 20:31:26 +01:00
parent 9f22f7153b
commit 42269a8a91
3 changed files with 34 additions and 33 deletions
+16 -15
View File
@@ -7,37 +7,37 @@
#define UNUSED
#endif
static void ucore_timeofday_now(struct ucore_clock *clock UNUSED, struct timeval *tv)
static void ucore_timeofday_now(struct UCoreClock *clock UNUSED, struct timeval *tv)
{
gettimeofday(tv, NULL);
}
static void ucore_time_now(struct ucore_clock *clock UNUSED, struct timeval *tv)
static void ucore_time_now(struct UCoreClock *clock UNUSED, struct timeval *tv)
{
tv->tv_sec = time(NULL);
tv->tv_usec = 0;
}
struct ucore_clock ucore_timeofday_clock = {
struct UCoreClock ucore_timeofday_clock = {
.name = "gettimeofday",
.now = ucore_timeofday_now,
};
struct ucore_clock ucore_time_clock = {
struct UCoreClock ucore_time_clock = {
.name = "time",
.now = ucore_time_now,
};
static void ucore_cached_clock_now(struct ucore_clock *uclock UNUSED,
static void ucore_cached_clock_now(struct UCoreClock *uclock UNUSED,
struct timeval *tv)
{
struct ucore_cached_clock *cached_clock;
cached_clock = CONTAINER_OF(uclock, struct ucore_cached_clock, clock),
struct UCoreCachedClock *cached_clock;
cached_clock = CONTAINER_OF(uclock, struct UCoreCachedClock, clock),
*tv = cached_clock->cache;
}
void ucore_cached_clock_init(struct ucore_cached_clock *uclock, struct ucore_clock *real_clock)
void ucore_cached_clock_init(struct UCoreCachedClock *uclock, struct UCoreClock *real_clock)
{
uclock->clock.name = "cached clock";
uclock->clock.now = ucore_cached_clock_now;
@@ -47,20 +47,20 @@ void ucore_cached_clock_init(struct ucore_cached_clock *uclock, struct ucore_clo
ucore_cached_clock_update(uclock);
}
void ucore_cached_clock_update(struct ucore_cached_clock *uclock)
void ucore_cached_clock_update(struct UCoreCachedClock *uclock)
{
uclock->real_clock->now(&uclock->clock, &uclock->cache);
}
static void ucore_settable_clock_now(struct ucore_clock *uclock, struct timeval *tv)
static void ucore_settable_clock_now(struct UCoreClock *uclock, struct timeval *tv)
{
struct ucore_settable_clock *cached_clock;
cached_clock = CONTAINER_OF(uclock, struct ucore_settable_clock, clock),
struct UCoreSettableClock *cached_clock;
cached_clock = CONTAINER_OF(uclock, struct UCoreSettableClock, clock),
*tv = cached_clock->now;
}
void ucore_settable_clock_init(struct ucore_settable_clock *uclock)
void ucore_settable_clock_init(struct UCoreSettableClock *uclock)
{
uclock->clock.name = "settable clock";
uclock->clock.now = ucore_settable_clock_now;
@@ -69,13 +69,14 @@ void ucore_settable_clock_init(struct ucore_settable_clock *uclock)
uclock->now.tv_usec = 0;
}
void ucore_settable_clock_set_tv(struct ucore_settable_clock *uclock, const struct timeval *tv)
void ucore_settable_clock_set_tv(struct UCoreSettableClock *uclock, const struct timeval *tv)
{
uclock->now = *tv;
}
void ucore_settable_clock_set(struct ucore_settable_clock *uclock, time_t secs, suseconds_t usecs)
void ucore_settable_clock_set(struct UCoreSettableClock *uclock, time_t secs, suseconds_t usecs)
{
uclock->now.tv_sec = secs;
uclock->now.tv_usec = usecs;
}