kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: luis@other.computer (Luis de Bethencourt)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Importance of kobject
Date: Wed, 17 May 2017 11:36:56 -0700	[thread overview]
Message-ID: <1495046216.491555.979961632.54DFF4DC@webmail.messagingengine.com> (raw)
In-Reply-To: <20170517115046.GA17832@kroah.com>

On Wed, May 17, 2017, at 04:50 AM, Greg KH wrote:
> On Wed, May 17, 2017 at 12:34:28PM +0100, Okash Khawaja wrote:
> > Hi,
> > 
> > On Wed, May 17, 2017 at 8:08 AM, Madhu K <madhu.sk89@gmail.com> wrote:
> > > Hi All,
> > >
> > > I am kernel newbie, I want to know the importance of kobject, can anybody
> > > explain the importance of kobject with an example.
> > 
> > To state a not-so-popular analogy, kobjects can also be viewed as root
> > object in object oriented programming. So a bit like java.lang.Object.
> > Of course it is not a root object and indeed C is not OO, but this
> > view helps in thinking about it.
> 
> Well, it _is_ a "root object", and you can write OO code in C, which is
> what we did for kobjects (and struct device, and struct class, and kref,
> and other things like that.)
> 
> So it is a "popular" analogy, as this is exactly what the authors of the
> code were intending for people to see.
> 
> thanks,
> 
> greg k-h
> 

Hi,

You also have GObject proving that you can do OOP in C.
Use kobject like you would a base class.

Luis

      reply	other threads:[~2017-05-17 18:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17  7:08 Importance of kobject Madhu K
     [not found] ` <CAJ1xhMUghEO1NLOhmq_O02KHz7YioTWyu=TNLTcQP8aRxAgV8A@mail.gmail.com>
2017-05-17  7:21   ` Fwd: " Alexander Kapshuk
2017-05-17  9:18     ` Rami Rosen
2017-05-17 10:56 ` Bjørn Mork
2017-05-17 11:34 ` Okash Khawaja
2017-05-17 11:50   ` Greg KH
2017-05-17 18:36     ` Luis de Bethencourt [this message]

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=1495046216.491555.979961632.54DFF4DC@webmail.messagingengine.com \
    --to=luis@other.computer \
    --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).