cvs commit: src/sys/fs/devfs devfs_int.h devfs_vnops.c src/sys/kern kern_conf.c kern_descrip.c src/sys/sys conf.h file.h proc.h

Konstantin Belousov kib at FreeBSD.org
Wed May 21 09:31:45 UTC 2008


kib         2008-05-21 09:31:44 UTC

  FreeBSD src repository

  Modified files:
    sys/fs/devfs         devfs_int.h devfs_vnops.c 
    sys/kern             kern_conf.c kern_descrip.c 
    sys/sys              conf.h file.h proc.h 
  Log:
  Implement the per-open file data for the cdev.
  
  The patch does not change the cdevsw KBI. Management of the data is
  provided by the functions
  int     devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr);
  int     devfs_get_cdevpriv(void **datap);
  void    devfs_clear_cdevpriv(void);
  All of the functions are supposed to be called from the cdevsw method
  contexts.
  
  - devfs_set_cdevpriv assigns the priv as private data for the file
    descriptor which is used to initiate currently performed driver
    operation. dtr is the function that will be called when either the
    last refernce to the file goes away, the device is destroyed  or
    devfs_clear_cdevpriv is called.
  - devfs_get_cdevpriv is the obvious accessor.
  - devfs_clear_cdevpriv allows to clear the private data for the still
    open file.
  
  Implementation keeps the driver-supplied pointers in the struct
  cdev_privdata, that is referenced both from the struct file and struct
  cdev, and cannot outlive any of the referee.
  
  Man pages will be provided after the KPI stabilizes.
  
  Reviewed by:    jhb
  Useful suggestions from:        jeff, antoine
  Debugging help and tested by:   pho
  MFC after:      1 month
  
  Revision  Changes    Path
  1.5       +11 -0     src/sys/fs/devfs/devfs_int.h
  1.158     +109 -1    src/sys/fs/devfs/devfs_vnops.c
  1.213     +9 -2      src/sys/kern/kern_conf.c
  1.332     +6 -0      src/sys/kern/kern_descrip.c
  1.237     +6 -0      src/sys/sys/conf.h
  1.77      +2 -0      src/sys/sys/file.h
  1.515     +1 -0      src/sys/sys/proc.h


More information about the cvs-src mailing list