kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: john@jjdev.com (John de la Garza)
To: kernelnewbies@lists.kernelnewbies.org
Subject: naming conventions
Date: Sat, 22 Jul 2017 20:29:40 -0700	[thread overview]
Message-ID: <20170723032937.GA14608@crux> (raw)

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))

                 reply	other threads:[~2017-07-23  3:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170723032937.GA14608@crux \
    --to=john@jjdev.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).