Re: [PATCH 1/3] make sparse keep its promise about context tracking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Philipp Reisner wrote:
> The sematics of what I implemented is:
> You simply use the __attribute__((context(ctx,in,out))) to
> annotate the context changes of functions.
> 
> to annotate a variable, struct/union member or a function that
> a certain locking primitive is required for accessing it, you
> do it by 
> 
> __attribute__((require_context(ctx,min,max,"type")))
> 
> ctx ... the expression that describes the locking primitive
> min ... the minimum of locks required of that locking primitive
> max ... the maximum allowed of locks of that locking primitive.
> type .. read, write, rdwr or call for the access type.
> 
> So you can express you need to hold this and that locking 
> primitive to write to something. But an other locking
> primitive might be sufficient for reading that something.
> 
> The annotation for a variable foo protected by a recursive lock
> bar would be:
> 
> int foo __attribute__((require_context(bar,1,99999,"rdwr")))

I would *love* to see this work applied on top of the patches I
applied from Johannes.  I really want the ability to mark a variable
or struct field as requiring a context to access.

I would probably call this new attribute something like
"data_context".  Also, I'd prefer an explicit way of saying "no
maximum context", rather than the hack of using a large number.

I hestiate to introduce a third semantic for a pair of numbers
describing a context.  The context attribute uses in and out contexts,
__context__ uses a delta and a required minimum, and this proposed
attribute uses a minimum and a maximum.

Similar to GCC's format attribute using the identifier printf rather
than the string "printf", I think I'd prefer the last argument as an
identifier.  Also, a minor nit: could you please use "readwrite"
rather than "rdwr"?

- Josh Triplett

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux