From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <326865fdcb5340a60776125a503ec748@plan9.escet.urjc.es> To: 9fans@cse.psu.edu From: Fco.J.Ballesteros MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] got a new feature: learning of resources and switching among them Date: Fri, 24 Jan 2003 20:04:29 +0100 Topicbox-Message-UUID: 4694e1a6-eacb-11e9-9e20-41e7f4b1d025 Hi, I'm happy enough with the behaviour of this thing and would love to know what you think of it and any suggestion you may have. I'll put the code in sources soon (once that it has been exercised for some more time). It's a couple of programs, badsrv and redirfs. The first one runs a kind of discovery protocol using constraints/properties to determine which resources are of interest for you and which ones are not. The second one is a file server that permits the user to switch at run time between different file trees. It can be instructed by means of the first program to learn for alternate file trees for a resource. I have been using this to redirect audio output from one machine to another without even stopping the player, and also to switch to an alternate home directory if the current one is no longer available (without restarting acme). I'm sorry about the size of the mail, but here are the manual pages for the programs. Anyone would want to use such thing? Other comments? thanks a lot NAME redirfs - File server to redirect fids from one tree to another SYNOPSIS redirfs [ -abcdiCD ] [ -s srv ] [ -m mnt ] dir DESCRIPTION Redirfs is a server that mounts itself between an existing directory and the user. It learns of alternate trees for that directory and permits the user to change the one used. It can be used to dinamically redirect audio, failover from one file server to another, choose a cdrom depending on the ones available, and similar tasks. Redirfs works in combination with badsrv(8) because that program can learn by itself which resources are available and instruct redirfs about alternate trees. The user relies on the commands file serviced by redirfs to select the pre- ferred tree. It is suggested to use different redirfs instances for different resources because the current imple- mentation is not multithreaded and admits only a request at a time. EXAMPLE This exports the local audio device and discovers new audio devices of interest (as dictated by the configuration file of badsrv): redirfs -s audio '#A' badsrv & Once started, this permits the selection of a different audio device serviced by atlantis: con -C /srv/audio.cmd % Set audio!atlantis % SEE ALSO badsrv(8) SOURCE /sys/src/cmd/redirfs.c BUGS This is still experimental. This page does not show the options available nor the commands available in the console. NAME badsrv - Broadcast based advertising service for resources SYNOPSIS badsrv [ -v ] [ -c cfg ] [ -s srv ] DESCRIPTION Badsrv is a server that runs a broadcast based resource discovery protocol to inform redirfs(4) as resources come and go in the network. The protocol is very naive, but enough for a network of mod- erated size: It send a broadcast to announce local resources every few seconds. All servers receiving a broadcast reply to the sender to announce their own ones. If a resource announce is not seen in three rounds, it is garbage col- lected and declared as gone. For each resource that is either new or collected, an appro- priate message is sent to the control file of the redirfs in charge for the resource. The convention is that the same resource uses the same name both in redirfs and in badsrv. Option -v shows debug information. Option -c instructs badsrv to use cfg as its configuration file. By default the configuration is at file badconf.sysname. Option -s posts a file at srv(3) where more configuration commands can be sent at run time. The configuration file includes commands, one per line, that determine a resource to be announced or a resource wanted. Announces for unwanted resources are ignored. Each command has arguments using tab as a delimiter. For example, ad atlantis cdrom L126 #S/sdC1 announces a resource cdrom serviced by atlantis whose loca- tion is room 126. The file at atlantis for the cdrom is #S/sdC1. want - audio L126 tells the server to pay attention to any announce for the resource audio if its location is at room 126. The constraint (eg. L126) can be more complex like in Tcd!Dgsyc!L126. It is made of members separated by "!", where the first character refers to a property (type, domain, location, etc.) and the following ones identify the value for the property. The user can define any desired property/value pairs. If the properties wanted do not match the ones offered, the announce is ignored. SEE ALSO redirfs(4) SOURCE /sys/src/cmd/badsrv BUGS This is still experimental. User interface is missing.