Hello, Jan. I agree with your comments except for the one below. Why do you think these macros don't do the right thing? How can they fail? I can't agree with you that introducing separate functions for id/time and duplicating code in disk2memdqblk and mem2diskdqblk is more nice than using several uniform macros(why aren't the latter nice, btw?). Wasn't that you who told me that code duplication is no good? ;) Thank you for your patience. Andrew. On Monday 10 March 2008 19:26:09 Jan Kara wrote: > > +#define DQ2MQ(v) (sizeof(v) == sizeof(__u64) ? \ > > + (qsize_t)le64_to_cpu(v) : \ > > + (qsize_t)le32_to_cpu(v)) > > + > > +#define MQ2DQ(v, newv) (sizeof(v) == sizeof(__u64) ? \ > > + (v = cpu_to_le64((__u64)newv)) : \ > > + (v = cpu_to_le32((__u32)newv))) > > + > > +#define DQF_GET(var, rev, field) (rev == 0 ? \ > > + DQ2MQ((var)->disk_dqblk_r0.field) : \ > > + DQ2MQ((var)->disk_dqblk_r1.field)) > > + > > +#define DQF_PUT(var, rev, field, val) (rev == 0 ? \ > > + MQ2DQ((var)->disk_dqblk_r0.field, val) : \ > > + MQ2DQ((var)->disk_dqblk_r1.field, val)) > Actually, these macros will do the right thing for dqb_id only be sheer > luck and they won't work for dqb_curspace, dqb_itime and dqb_btime. > Please just get rid of them, they aren't very nice anyway. In disk2memdqb() > and mem2diskdqb() just do > > if (rev == 0) { > conversions.. > } > else if (ret == 1) { > conversions.. > } > else { > BUG(); > } > > And for fields dqb_id and dqb_itime we use at other places introduce > functions get_dqb_id() and get/set_dqb_itime(). > -- 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