Date: Mon, 26 Jun 2000 14:24:28 -0700 From: Alfred Perlstein <bright@wintelcom.net> To: arch@freebsd.org Subject: dynamic filetypes. please comment. Message-ID: <20000626142428.A275@fw.wintelcom.net>
next in thread | raw e-mail | index | archive | help
In order to have a kld add a new filetype (DTYPE_VNODE, DTYPE_PIPE, etc.) it needs to generate a unique number. My inclination is to just add a DTYPE_MAX(*) and provide a function for the kld initializers to call "short getnewdtype(void)" which returns the next available number. This does limit us to about 32764 module driver loads before getnewdtype will return -1 (error). This idea leads us to a generic api for seqeunce number generation that we can use when a subsystem needs an increasing unique number, the api would look something like: (void)sequence_register("filetypes", starting_number); mynum = sequence_next("filetypes"); /* to be used for f_type */ The other option that I like is turning f_type into a (char *) so that sections of the kernel can compare them, the convention will be to assign them to various constant strings so comparisons can be made. A suggestion was made to extend the 'struct fileops' in struct file to be OOP enough to deal with various other syscalls, perhaps at a later time we can do this to allow for 'dma' in kernel space from one filetype to another where applicable, but for now I'd just like to be able to register my loadable filetype. Comments? (*) it's annoying how DTYPE aliases to disklabel.h constants as well. *sigh* -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000626142428.A275>