Re: [PATCH] s390: Hypervisor File System

From: Kyle Moffett
Date: Sat Apr 29 2006 - 04:47:16 EST


On Apr 29, 2006, at 03:53:11, Greg KH wrote:
The update process is triggered when writing 'something' into the 'update' file at the top level hypfs directory. You can do this e.g. with 'echo 1 > update'. During the update the whole directory structure is deleted and built up again.

This sounds a lot like configfs. Why not use that instead?

Is there a reason that sysfs can't be used for a lot of these things too?

We already have the different cpus in sysfs, why put things in a different location than that?

It sounds like a lot of things need some kind of shell-scriptable transaction interface for sysfs files. You don't want to have more than one value per file, but reading or writing of some values must be done together for consistency reasons. Is there any way to implement something like this? This would work for the framebuffer people and solve the needs of a lot of the people who still want ioctls or some other atomic-multivalued transfer that would otherwise be a great sysfs candidate.

# Start a transaction
exec 3</sys/hypervisor/s390/transaction

# Add another reference to the transaction
exec 4<&3

# List CPUs and info
cd /sys/hypervisor/s390/cpus
for i in *; do
echo "CPU $i: type=`cat type` mgmtime=`cat mgmtime`"
done

# Transaction does *not* end here
exec 3<&-

# List CPUs again a different way
ls /sys/hypervisor/s390/cpus

# Transaction does end here
exec 4<&-

A process that doesn't care about the transaction (Like a user inspecting from a shell), could just cd in and cat random files, and it would run a transaction for each file opened, and end the transaction when the file is closed. Obviously that's inefficient, but it's obviously correct and works. Otherwise, from opening the transaction filehandle for the first time till closing the last open FD to it, the process would get a consistent view of the data, read when the "transaction" file is first opened opened. Perhaps any modifications would be synced and written at the close of that filehandle.

I don't know if that's something doable given the FD model, but if it is, then that's trivial to use for the admin, in shell scripts, perl scripts, C programs, etc. It also works with the one-value-per-file sysfs model.

Cheers,
Kyle Moffett

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/