All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bryan Brattlof <hello@bryanbrattlof.com>
To: Krish Jain <krishjain02939@gmail.com>
Cc: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
	gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Declare the file_operations struct as const
Date: Fri, 27 Aug 2021 23:38:43 +0000	[thread overview]
Message-ID: <20210827233835.px4az5hyqks2n4o5@h510> (raw)
In-Reply-To: <CAPGkw+zyj4e-m19KdrHpAN_vHksNDy=k_cPPAftSN-hNoph0=w@mail.gmail.com>

Hi Krish!

I'm sure someone has said something by now, however "top posting", where
you reply to emails by writing on the top can make things hard to read
on the mailing lists. The conversation is upside down when reading.

   https://en.wikipedia.org/wiki/Posting_style#Top-posting

Next time try writing underneath the text your referring to like this:
Don't worry we're all learning here :)

On this day, August 27, 2021 thus sayeth Krish Jain:
> I unfortunately forgot to add Greg to this thread. Doing so now. I
> apologize for the confusion, if any. This patch was regarding the
> staging tree's file android/ashmem.c and declaring the file_operations
> struct as const as done elsewhere in the kernel, because there are no
> modifications to its fields.
>
> Warm Regards
>

Things can be a little deceiving in the kernel. That's why testing your
changes before you submit them can be helpful.

But don't worry too much if you break something, there are countless
bots trying to break the kernel every day. It usually means you're
learning when you break something.

>
> On Fri, Aug 27, 2021 at 8:38 PM Krish Jain <krishjain02939@gmail.com> wrote:
> >
> > So what do you think I can do?
> >
> > Best Regards
> >

That's a tough one as it really depends on your situation. When I first
started programming I had a *really* old (even for that time) laptop
that couldn't do much.  It wasn't ideal but I found I could connect
through ssh to a virtual machine my university lent me to "learn to
code".

I have no idea what your situation is like. Though having a second
computer to compile code while I wrote worked for me.

> >
> > On Fri, Aug 27, 2021 at 10:50 AM Krish Jain <krishjain02939@gmail.com> wrote:
> > >
> > > Hi, yes, this is my first time programming at this low level. And yes,
> > > I read both docs now. Furthermore the issue is that my current
> > > hardware can't handle building the kernel, it barely managed to
> > > survive the first build after 2 hours so I don't know how I can. If I
> > > change it to static const would it fix the issue and build
> > > successfully?  If not what would be the error message, then I can
> > > debug. Thanks
> > >

As for your patch, I built the driver using:

  $ make CCFLAGS=-Werror W=1 M=drivers/staging/android

Which produced the following error:


drivers/staging/android/ashmem.c: In function ‘ashmem_mmap’:
drivers/staging/android/ashmem.c:380:2: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
  380 |  const static struct file_operations vmfile_fops;
      |  ^~~~~
drivers/staging/android/ashmem.c:431:16: error: assignment of read-only variable ‘vmfile_fops’
  431 |    vmfile_fops = *vmfile->f_op;
      |                ^
drivers/staging/android/ashmem.c:432:21: error: assignment of member ‘mmap’ in read-only object
  432 |    vmfile_fops.mmap = ashmem_vmfile_mmap;
      |                     ^
drivers/staging/android/ashmem.c:433:34: error: assignment of member ‘get_unmapped_area’ in read-only object
  433 |    vmfile_fops.get_unmapped_area =
      |                                  ^
make[1]: *** [scripts/Makefile.build:271: drivers/staging/android/ashmem.o] Error 1
make: *** [Makefile:1851: drivers/staging/android] Error 2


You shouldn't need to compile the entire kernel. That may be why your
computer is having a hard time?

Hope this helps :) and it was nice to meet you Krish
~Bryan


  reply	other threads:[~2021-08-27 23:38 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27  1:59 [PATCH] Declare the file_operations struct as const Krish Jain
2021-08-27  6:49 ` Fabio M. De Francesco
2021-08-27  7:48   ` Fabio M. De Francesco
2021-08-27  8:50     ` Krish Jain
2021-08-27 18:38       ` Krish Jain
2021-08-27 19:46         ` Krish Jain
2021-08-27 23:38           ` Bryan Brattlof [this message]
2021-08-28  9:37             ` Krish Jain
2021-08-28  9:46               ` Greg KH
2021-08-28  9:52                 ` Krish Jain
2021-08-28 11:13                   ` Fabio M. De Francesco
2021-08-29  2:13             ` Krish Jain
2021-08-29  2:16               ` Krish Jain
2021-08-29  6:16               ` Greg KH
2021-08-29  9:39                 ` Krish Jain
2021-08-27  6:52 ` Greg KH
2021-08-27  2:19 Krish Jain
2021-08-29 14:45 Bryan Brattlof
2021-08-29 16:20 ` Krish Jain
2021-08-29 16:20   ` Krish Jain
2021-08-29 16:34   ` Krish Jain
2021-08-29 16:34     ` Krish Jain
2021-08-29 16:49   ` Bryan Brattlof
2021-08-29 16:56     ` Krish Jain
2021-08-29 16:56       ` Krish Jain
2021-08-29 18:28       ` Krish Jain
2021-08-29 18:28         ` Krish Jain
2021-08-29 18:46         ` Krish Jain
2021-08-29 18:46           ` Krish Jain
2021-08-29 21:00           ` Bryan Brattlof
2021-08-29 22:11             ` Krish Jain
2021-08-29 22:11               ` Krish Jain
2021-08-30 12:40               ` Krish Jain
2021-08-30 12:40                 ` Krish Jain
2021-08-30 13:01                 ` Krish Jain
2021-08-30 13:01                   ` Krish Jain
2021-08-31  0:42                   ` Krish Jain
2021-08-31  0:42                     ` Krish Jain
2021-08-31 13:35                     ` Bryan Brattlof
2021-08-31 14:00                       ` Fabio M. De Francesco
2021-08-31 23:00                         ` Bryan Brattlof
2021-09-01 15:20                           ` Krish Jain
2021-09-01 15:20                             ` Krish Jain
2021-09-01 15:30                             ` Greg KH
2021-09-01 15:34                               ` Krish Jain
2021-09-01 15:34                                 ` Krish Jain
2021-09-01 16:51                                 ` Greg KH
2021-09-01 17:34                                   ` Bryan Brattlof
2021-09-01 18:04                                     ` Krish Jain
2021-09-01 18:04                                       ` Krish Jain
2021-09-01 20:29                                       ` Bryan Brattlof

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=20210827233835.px4az5hyqks2n4o5@h510 \
    --to=hello@bryanbrattlof.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=krishjain02939@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.