[PATCH] lib/tdb: locking cleanup

tridge at samba.org tridge at samba.org
Thu Aug 27 21:55:47 MDT 2009


Hi Rusty,

 > -int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset, 
 > -	       int rw_type, int lck_type, int probe, size_t len)
 > +int tdb_brlock(struct tdb_context *tdb,
 > +	       int rw_type, tdb_off_t offset, size_t len,
 > +	       enum tdb_lock_flags flags)
 >  {
 > -	struct flock fl;
 >  	int ret;
 >  
 >  	if (tdb->flags & TDB_NOLOCK) {
 >  		return 0;
 >  	}
 >  
 > +	if (flags & TDB_LOCK_MARK_ONLY) {
 > +		return 0;
 > +	}

Using an enum as a bitmask seems a bit strange. It's valid C, but
anyone reading it will think that the enum takes on the set of values
listed in the enum declaration, and may do something like a switch
statement with the various cases. Why use an enum when you mean it to
be masked like this?

btw, the only user I know of the 'mark' locks is ctdb. Have you or
Ronnie tested this patch with ctdb?

Cheers, Tridge


More information about the samba-technical mailing list