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

XATTR structure for biosfs entries



printf("Hello world!\n");

  As the subject line says, I want to bring the topic of each "file" in the
bios device directory /dev having ownership, filemodes and c/m/a-time fields,
say, a complete XATTR structure, "on stage". It would look like this:

struct bios_file {
	char	name[BNAME_MAX+1];	/* device name */
	DEVDRV	*device;		/* device driver for device */
	short	private;		/* extra info for device driver */
	ushort	flags;			/* flags for device open */
	struct tty *tty;		/* tty structure (if appropriate) */
	struct bios_file *next;
	short	lockpid;		/* owner of the lock */
	XATTR	xattr;			/* guess what... */
};

  I've myself given it such an extention for MiNT 1.04 and 1.08 and now would
like to redo it - perhaps better - for 1.09 and offer it through this channel.

  Now what I want to discuss is one small/big (depends on from which side you
see it :-) problem. Changes inside the biosfs.c are all quite easily done and
not at all the problem (so why hasn't anybody already done it?). The problem
are the extra device drivers, weather they're installed by Dcntl() or as a XDD
driver doesn't matter.

  The problem is how to change mtime/atime for these drivers? Obviously the
change is best made in the read/write calls, but the biosfs can't do it since
it's not touched when an extra device driver does I/O. On the other hand side
the device driver has only _direct_ access to the filepointer...

typedef struct fileptr {
	short	links;		/* number of copies of this descriptor */
	ushort	flags;		/* file open mode and other file flags */
	long	pos;		/* position in file */
	long	devinfo;	/* device driver specific info */
	fcookie	fc;		/* file system cookie for this file */
	struct devdrv *dev;	/* device driver that knows how to deal with this */
	struct fileptr *next;	/* link to next fileptr for this file */
} FILEPTR;

  So I've thought about the following ideas:

1) Change the f_read/f_write code in dosfile.c so that bios devices are
recognized and a seperate time-field update is done. Does this sound good?

2) Use the pos or devinfo field from the filepointer as a pointer to the
XATTR structure so that the driver can access it and thereby modify it. But
what happens if one driver likes to use them for his own purpose?

3) Use the way (struct bios_file *)fileptr->fc.index to gain access over the
the biosfs internal data, and automatically, the XATTR structure. Well, that's
the way it'll be done inside the biosfs.c, but for external device drivers
it may be a bad idea if they're running on an older version of MiNT without
these extention.

4) Add a pointer to a XATTR structure to the fileptr definition. Wouldn't
necessarily involve great changes in other parts, and sounds quite compatible,
but you could then also use idea 3.

  In any case, except 1, the installation part of the device driver must
check the current version of MiNT running in order to decide if it can do
these updates or not, while older ones may choose to ignore it. Seen from
that point of view, something like idea 1 might perhaps do well.

  Or has anybody out there a better idea? Maybe I couldn't see the forest
for the trees ones again... ;-)

bye,
TeSche
-- 
PS: If the above written looks weird, than that's because it probably IS.
WhoDunnIt: Torsten Scherer (Schiller, TeSche...)
Technical Faculty, University of Bielefeld, Germany (52'5"N 8'35"E)
EMail: itschere@techfak.uni-bielefeld.de / tesche@dave.hrz.uni-bielefeld.de