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]
Message-Id: <20070108132817.5c9a30d6.akpm@osdl.org>
Date:	Mon, 8 Jan 2007 13:28:17 -0800
From:	Andrew Morton <akpm@...l.org>
To:	"Josef 'Jeff' Sipek" <jsipek@...sunysb.edu>
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	hch@...radead.org, viro@....linux.org.uk, torvalds@...l.org,
	mhalcrow@...ibm.com, David Quigley <dquigley@....cs.sunysb.edu>,
	Erez Zadok <ezk@...sunysb.edu>
Subject: Re: [PATCH 19/24] Unionfs: Helper macros/inlines

On Sun,  7 Jan 2007 23:13:11 -0500
"Josef 'Jeff' Sipek" <jsipek@...sunysb.edu> wrote:

> From: Josef "Jeff" Sipek <jsipek@...sunysb.edu>
> 
> This patch contains many macros and inline functions used thoughout Unionfs.
> 
> ..
>
> +#define ibstart(ino) (UNIONFS_I(ino)->bstart)
> +#define ibend(ino) (UNIONFS_I(ino)->bend)
> +
> +/* Superblock to private data */
> +#define UNIONFS_SB(super) ((struct unionfs_sb_info *)(super)->s_fs_info)
> +#define sbstart(sb) 0
> +#define sbend(sb) (UNIONFS_SB(sb)->bend)
> +#define sbmax(sb) (UNIONFS_SB(sb)->bend + 1)
> +
> +/* File to private Data */
> +#define UNIONFS_F(file) ((struct unionfs_file_info *)((file)->private_data))
> +#define fbstart(file) (UNIONFS_F(file)->bstart)
> +#define fbend(file) (UNIONFS_F(file)->bend)
>
> ...
>
> +#define dbstart(dent) (UNIONFS_D(dent)->bstart)
> +#define set_dbstart(dent, val) do { UNIONFS_D(dent)->bstart = val; } while(0)
> +#define dbend(dent) (UNIONFS_D(dent)->bend)
> +#define set_dbend(dent, val) do { UNIONFS_D(dent)->bend = val; } while(0)
> +#define dbopaque(dent) (UNIONFS_D(dent)->bopaque)
> +#define set_dbopaque(dent, val) do { UNIONFS_D(dent)->bopaque = val; } while (0)

Please prefer to use inlined C fucntions.  Macros should only be used if
there is some reason why an inlined fucntion will not work.

> +#define lock_dentry(d)		down(&UNIONFS_D(d)->sem)
> +#define unlock_dentry(d)	up(&UNIONFS_D(d)->sem)
> +#define verify_locked(d)

Ditto.

Please use mutexes where possible.  Semaphores should only be used when
their counting feature is employed.  And, arguably, in situations where a
lock is locked and unlocked from different threads, because this presently
triggers mutex debugging warnings, although we should find a way of fixing
this in the mutex code.

I can't say I like the name "lock_dentry" much.  It sounds like a VFS
function and we may well gain a generic lock_dentry() at some time in the
future.  unionfs_lock_dentry() would be a better choice.
-
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