Subject: UDF integration / syscall
To: None <tech-kern@netbsd.org>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-kern
Date: 06/08/2003 18:07:18
Dear folks and fellow developers,

As some of you might have read allready, i am working on implementing the
UDF filingsystem both as a userland tool and hopefully one day also as a
kernel filingsystem. The userland tool is getting near completion for
read-only and getting some infrastructure for writing support too. The
kernel part however still needs to be done from scratch. I hope to be able
to recycle as much from the userland tool as possible but i'll have to see.

Now my problem is that i also want to support multi-volume UDF discs. This
means that i need to tell the UDF part to add discs to its list to scout
for volumes. The sum of these discs then define a set of volumes to mount.


A session from userland perspective might look like :
	udfclient list /dev/cd0c /dev/cd1c /home/reinoud/udf_iso.iso
		<lists mountable entities from userland and other info>

	udfclient newfs -name "udf_backup@disc2@backups" -volume 2 /a.file.iso
		<creates a new UDF filingsystem in a file>

	udfctl open /dev/cd0c /dev/cd1c
		<`udf' adds the entities to the kernel>

	udfctl open /dev/cd2c /dev/sd0a /a.file.iso
		<`udf' adds the new entities>

	udfctl list
		<lists accumulated entities available for mounting, usage etc>

	mount -t udf -o ro volume1@volumeset2 /home2
		<'udf' mounts the volume (could be multiple discs) at /home2>

	udfctl close /dev/cd2c
	.....


Another userland option would be to use :
	udfclient list /dev/cd0c /dev/cd1c
		<lists>

	mount -t udf volume1@volumeset2 /dev/cd0c /dev/cd1c /a.file.iso /home2
		<`udf' mounts the volume from the cds and file>

	udfctl list
		<lists entities in use, statistics etc>
	.....

The second would also be feasable but having to pass multiple devices to 
mount is euhm... less handy. Esp. since /dev/cd1c could hold other 
mountable volumes as well and you can get silly mount commands that could 
confuse fstab etc. etc. And what to do about lists etc; i generally dont 
think that specifying multiple devices is either intuitive nor practical.

Communication with the UDF subsystem can be done in various ways; an
ioctl() on a `/dev/udfctl' can be used but its flawed IMHO since `udf' is a
filingsystem and not a device. Or add one or more syscall()'s. Since lfs
allready uses this i think the later would be preferable.

Now i dont know what the maximum number of syscalls abvailable is but its 
limit is now set to 512 as far as i can see in /usr/include/sys/sysctl.h 
and the last one used is 345. (Is it a bug that SYS_MAXSYSCALL is 354 ?).

One other thing i was trying to tackle is more kernel like stuff; what
happends when something is written on mounted media assuming its normally
writable say a harddisc. If mounted async then i guess i dont have to write
out stuff immediately but get notifications for sheduling i.e. the data and
inodes, but when accumulated enough i can start writing and leave out data
or inodes i'd like to write later.

Now for a harddisc this might not be a big challenge since you can write 
everything at any time you want but if i'm to include say CD or DVD writing 
support one day (pray pray, knock, knock) i need to be able to select 
information, shedule it and say delay inode writing to be the last before 
dismounting.

As you can see the kernel part is much much more a work in progress in its 
initial exploratory phase but feedback would be very much apreciated so i 
can make the right design decisions now instead of bumping into them later 
on....

Thanks in advance for any replies,
Reinoud