Re: Must check what?

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

 



On Wednesday 04 October 2006 12:43, Andrew Morton wrote:
> > > It should have a slot for documenting caller-provided locking
> > > requirements too.  And for permissible calling-contexts.  They're all
> > > part of the caller-provided environment, and these two tend to be a
> > > heck of a lot more subtle than the function's formal arguments.
> >
> > Indeed.  And reference count assumptions.  It's almost like we want a
> > pre-condition assertion ...
>
> We have might_sleep(), assert_spin_locked(), BUG_ON(!irqs_disabled()), etc.
>
> I like assertions personally.  If we had something like:
>
> void foo(args)
> {
> 	locals;
>
> 	assert_irqs_enabled();
> 	assert_spin_locked(some_lock);
> 	assert_in_atomic();
> 	assert_mutex_locked(some_mutex);
>
> then we get documentation which is (optionally) checked at runtime - best
> of both worlds.  Better than doing it in kernel-doc.  Automatically
> self-updating (otherwise kernels go BUG).

Uhoh! How much is that going to hurt runtime? :) It actually seems to me like 
this should be doable by static code analysis tools without terribly much 
pain (in the relative sense of the term). Or am I wrong on this thought?

> And we still need to document those return values in English.

Definitely.

-- Vadim Lobanov
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux