Re: LSMEXAMPLE.C(.GZ)

From: jmjonesat_private
Date: Fri May 18 2001 - 11:33:53 PDT

  • Next message: Stephen Smalley: "Re: Some feedback on the hooks"

    On Fri, 18 May 2001, Greg KH wrote:
    
    > On Fri, May 18, 2001 at 10:35:47AM -0400, jmjonesat_private wrote:
    > > It's still crude, but it does compile, install, and remove correctly.
    > > I submit it here for ridicule and/or use by anybody who may wish to 
    > > hack at it.
    > 
    > Some minor suggestions:
    > 	- read Documentation/CodingStyle and modify the file to match
    > 	  the recomendataions found in there.
    
    In process.  Sorry, reverted to my old "userspace" style, not being 
    a Kernel Hacker.  That document is MOST enlightening and counters some
    of my own objections to certain style elements.  I'm coding in kernel 
    space (sort of) now, so "when in Rome..."  Sorry I'm too shortsighted 
    to have seen it before.
    
    One issue ... "overcommenting"... imho, there's NO SUCH THING (spoken by
    somebody who's spent TOO MUCH of his life trying to unwind code that was 
    "obvious" to the coder)
     
    unless you fall prey to:
    
    "
    
    /*
    **  Now printk(thisthing);
    */
    
    printk(thisthing);
    
    "
    
    ... which does get redundant ...  the more the better!
    
    
    > 	- you are going to get confused very quickly using hard coded
    > 	  numbers for the CounterIndex variable.  I suggest using
    > 	  #defines for the numbers.  That way it will be easier to add
    > 	  and subtract elements in the future.
    
    Wow, lots and lots of defines, but a good point.  Trying to code a 
    rewriter to handle it for me now.
    
    > 	- what is the magic number 8192 doing in the lsmstats_read
    > 	  function?  Shouldn't you be checking the buffer_length
    > 	  parameter instead?
    > 
    
    I don't return the assigned buffer, I return my own static buffer
    which is stored in the function and has a "magic" fixed size based on
    my tests of "cat".  I guess I should look at this more carefully.
    Thanks.  What I DON'T want to allow is partial reads of the report, 
    or we'll get "data ripping."
    
    > Other than that looks real nice.  Good work.
    > 
    
    Thanks, that means a lot to me.  I want to understand this monster 
    deeply enough to provide a "UserSpace/Admin" perspective.
    
    > greg k-h
    > 
    
    J. Melvin Jones
    
    |>------------------------------------------------------
    ||  J. MELVIN JONES            jmjonesat_private 
    |>------------------------------------------------------
    ||  Microcomputer Systems Consultant  
    ||  Software Developer
    ||  Web Site Design, Hosting, and Administration
    ||  Network and Systems Administration
    |>------------------------------------------------------
    ||  http://www.jmjones.com/
    |>------------------------------------------------------
    
    
    
    _______________________________________________
    linux-security-module mailing list
    linux-security-moduleat_private
    http://mail.wirex.com/mailman/listinfo/linux-security-module
    



    This archive was generated by hypermail 2b30 : Fri May 18 2001 - 11:35:29 PDT