kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* naming conventions
@ 2017-07-23  3:29 John de la Garza
  0 siblings, 0 replies; only message in thread
From: John de la Garza @ 2017-07-23  3:29 UTC (permalink / raw)
  To: kernelnewbies

Are there naming conventions that are preferred for functions?  I'm seeing
somethings named foo_free, free_foo, foo_init, init_foo, etc.

Consistency provides names that are easy to guess/learn.

examples from: linux/kernel/fork.c
####################################
static void free_thread_stack(struct task_struct *tsk)
{
        kmem_cache_free(thread_stack_cache, tsk->stack);                              
}

void thread_stack_cache_init(void)
{
        thread_stack_cache = kmem_cache_create("thread_stack", THREAD_SIZE,
                                              THREAD_SIZE, 0, NULL);                  
        BUG_ON(thread_stack_cache == NULL);                                           
}

if (init_new_context(p, mm))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-07-23  3:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-23  3:29 naming conventions John de la Garza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).