TAILQ_* ambiguity in sys/sys/bio.h

Luigi Rizzo rizzo at icir.org
Wed Jul 20 15:39:44 GMT 2005


forgive me if i am wrong, but there appears to be a source of
ambiguity in the use of TAILQ* macros in sys/sys/bio.h

We have

	struct bio_queue_head {
		TAILQ_HEAD(bio_queue, bio) queue;
		off_t last_offset;
		struct  bio *insert_point;
	};

where the "bio_queue" name refers to a name of an internally declared
structure whose only instance is 'queue', and then we have

	struct bio {   
		...
		TAILQ_ENTRY(bio) bio_queue;     /* Disksort queue. */
		...
	}

where bio_queue is a field name.
An example where the confusion is evident is this line in
kern/subr_disk.c::bioq_remove()

		head->insert_point = TAILQ_PREV(bp, bio_queue, bio_queue);

where the former 'bio_queue' is a type name, and the second a field name.

Any objection to remove the ambiguity by renaming the type name in
struct bio_queue_head to something else ?
(ideally i'd rather not use a name at all, but apparently some of
the TAILQ_ macros do require a name for this struct even though
it's unambiguous once you know it's a TAILQ).

	cheers
	luigi


More information about the freebsd-current mailing list