On Sun, 7 Jan 2007 23:13:11 -0500 "Josef 'Jeff' Sipek" <jsipek@xxxxxxxxxxxxx> wrote: > From: Josef "Jeff" Sipek <jsipek@xxxxxxxxxxxxx> > > 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-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html