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

[RFC] translators



Hi,

Having written several translators myself, I find that the hardest
part is discovering the functions that I need to override and the
correct prototypes.  To solve this (other than better documentation),
I believe that rather than leaving the linker to do the function
overriding, the hurd should be more device driver'ish whereby the main
function makes a register file operations type call, for instance:

   register_translator(fops)

where fops is a structure of functions just like the linux fops structure.

struct trivial_translator_ops
{
  int (*read)(struct inode *, struct file *, off_t, int);
  ...
}

Then we have:

#include <trivfs.h>

struct trivial_translator_ops trivial_translator_ops = {
  read : read,
};

int main(int argc, char **argv)
{
  register_trivial_translator(&trivial_translator_ops);
  ...
  ports_manage_port_operations_multithread (fsys->pi.bucket,
                                            trivfs_demuxer, ...);
  return 0;
}

Comments?
-Neal

-- 
----------------------------------------------------------------------------
Neal Walfield                                              neal@walfield.org
UMass Lowell - Fox 1512                                  Phone: 978-934-5347
                                                           Fax: 603-415-3645
Love is the triumph of imagination over intelligence.
                -- H. L. Mencken



Reply to: