lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 23 Feb 2008 02:06:13 -0700
From:	Matthew Wilcox <matthew@....cx>
To:	WANG Cong <xiyou.wangcong@...il.com>
Cc:	Andrew Morton <akpm@...l.org>, LKML <linux-kernel@...r.kernel.org>,
	Kyle McMartin <kyle@...isc-linux.org>
Subject: Accessor macros vs reference counting

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ