Skip to content
Snippets Groups Projects
  1. Jan 01, 2014
    • Nadav Har'El's avatar
      file: reduce boiler-plate code in special files · 9478a14d
      Nadav Har'El authored
      
      Each implementation of "struct file" needs to implement 8 different file
      operations. Most special file implementations, such as pipe, socketpair,
      epoll and timerfd, don't support many of these operations. We had in
      unsupported.h functions that can be reused for the unsupported operation,
      but this resulted in a lot of ugly boiler-plate code.
      
      Instead, this patch switches to a cleaner, more C++-like, method:
      It defines a new "file" subclass, called "special_file", which implements
      all file operations except close(), with a default implementation identical
      to the old unsupported.h implementations.
      
      The files of pipe(), socketpair(), timerfd() and epoll_create() now inherit
      from special_file, and only override the file operations they really want
      to implement.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      9478a14d
  2. Sep 15, 2013
    • Nadav Har'El's avatar
      Add copyright statement to files in fs subdirectory · bc213b60
      Nadav Har'El authored
      Added Cloudius copyright statement to source files in fs/ which are our
      own code (and not from Prex or FreeBSD). Also added our copyright statement
      in addition to the original one when I thought we made non-trivial changes
      to the original.
      bc213b60
  3. Jun 19, 2013
  4. May 30, 2013
    • Nadav Har'El's avatar
      Move unsupported fileops to fs/unsupported.c · 5062ff4f
      Nadav Har'El authored
      Previously, we re-implemented "unsupported" file operations (e.g., chmod
      for a pipe on which fchmod makes no sense) several times - there was
      an implementation only for chmod in kern_descrip.c, used in sys_socket.c,
      and af_local.cc had its own. As we add more file descriptor type (e.g.,
      create_epoll()) we'll have even more copies of these silly functions, so
      let's do it once in fs/unsupported.c - with the fs/unsupported.h header
      file.
      
      This also gives us a central place to document (and argue) whether an
      unimplemented ioctl() should return ENOTTY or EBADF (I think the former).
      5062ff4f
Loading