Re: [PATCH 1/4 v2] e2fsprogs: Add rbtree library

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

 



On Thu, 17 Mar 2011, Andreas Dilger wrote:

> On 2011-03-17, at 12:50 PM, Lukas Czerner wrote:
> > +#undef offsetof
> > +#ifdef __compiler_offsetof
> > +#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
> > +#else
> > +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
> > +#endif
> 
> This may as well go into a more common header like lib/ext2fs/ext2fs.h, since I see offsetof() is #defined 5 separate times in the e2fsprogs code already.
> 
> > +#define container_of(ptr, type, member) ({			\
> > +	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
> > +	(type *)( (char *)__mptr - offsetof(type,member) );})
> 
> Same.
> 
> > +#define rb_parent(r)   ((struct rb_node *)((r)->rb_parent_color & ~3))
> > +#define rb_color(r)   ((r)->rb_parent_color & 1)
> > +#define rb_is_red(r)   (!rb_color(r))
> > +#define rb_is_black(r) rb_color(r)
> > +#define rb_set_red(r)  do { (r)->rb_parent_color &= ~1; } while (0)
> > +#define rb_set_black(r)  do { (r)->rb_parent_color |= 1; } while (0)
> > +
> > +#define RB_ROOT	(struct rb_root) { NULL, }
> > +#define	rb_entry(ptr, type, member) container_of(ptr, type, member)
> 
> The indenting here is a bit broken, but I see it is the same in the upstream kernel code, so it probably shouldn't be changed just for e2fsprogs.
> 
> 
> Cheers, Andreas
> 

Hi Andreas,

thank you for the review! You're right I'll move those macros into
lib/ext2fs/ext2fs.h

Thanks!
-Lukas
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux