From mboxrd@z Thu Jan 1 00:00:00 1970 From: der.herr@hofr.at (Nicholas Mc Guire) Date: Thu, 13 Sep 2018 06:07:10 +0000 Subject: regarding const variables/structures In-Reply-To: References: <20180912070838.GA7684@osadl.at> Message-ID: <20180913060710.GA22373@osadl.at> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Thu, Sep 13, 2018 at 09:12:32AM +0530, inventsekar wrote: > >>> A brute force grep in the kernel shows that there are 130493 " const " > in there > Hi Hofrat, > 1. may i know the command to do this above grep please.. $ grep -cre " const " * | more will give you the " const " count per file - and then put a shell loop around it $ SUM=0 ; for N in `grep -cre " const " * | cut -f 2 -d ":" ` ; do let SUM=$SUM+$N ; done ; echo $SUM ...as noted "brute force" > 2. (and the opposite) may i know the command to grep other type of > variables/structures well if you want to know how to do that then you do need to look at basics if regular expressions are not clear then you might want to look at those first. And grep really is not the right tool to search for specific structures and their use use something like cscope. Try to focus on doing work you understand including the tools and processes around it - if you just are looking for a fast way of getting X patches into the kernel you are wasting your time. What the work from Bhumika Goyal shows is that its not about the complexity of the change but about the systematic approach based on using understanding a problem class, translating it to an abstract representation amenable to tools (coccinelle in this case) and documenting her understanding in the commit messages to each patch. thx! hofrat