Accessor macros vs reference counting

From: Matthew Wilcox
Date: Sat Feb 23 2008 - 04:06:55 EST


On Sat, Feb 23, 2008 at 04:14:08PM +0800, WANG Cong wrote:
> Use get_personality() macro instead of explicit reference
> for parisc code.
> - if (personality(current->personality) == PER_LINUX32
> + if (personality(get_personality()) == PER_LINUX32

Hm. We have an interesting clash of conventions here.

On the one hand, we have the java-style accessor convention.
get_personality()/set_personality().

On the other hand, we have reference counting. get_cpu()/put_cpu().

When I first saw this patch, I assumed the latter (and went looking for
the missing put_), but _personality is of the former style. I have one
suggestion (that nobody is going to like), which is that we suffix
reference-counting functions with _ref, ie:

get_cpu_ref()
put_cpu_ref()
pci_get_device_ref()
pci_put_device_ref()
pci_dev_get_ref()
pci_dev_put_ref()

(PCI is actually a good example here; it has "get" referring both to
refcounting and to accessors)

--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/