next up previous
Next: About this document ... Up: File system IDLs Previous: CORBA bindings to Kernel


CORBA bindings for User-space filesystem implementations

// -----------------------------------------------------------------------------
// KernelImplementationAPI Module - Implement Kernel functionality in Korba
// -----------------------------------------------------------------------------
//
// Main source of information: 
//    http://www.cse.unsw.edu.au/~neilb/oss/linux-commentary/vfs.html
//
module KernelImplementationAPI {
  interface FileOps;
  interface InodeOps;
  interface DEntry;
  interface DEntryOps;
  interface SuperBlock;
  interface SuperBlockOps;
  interface FileSystem;

  interface File {};   // struct file
  interface Inode{};   // struct inode

  interface InodeOps {  // struct inode_operations
    FileOps getDefaultFileOps();
    long    create (in Inode i, in DEntry d, in long flags);
    DEntry  lookup (in Inode i, in DEntry Parent);
    long    link   (in DEntry d, in Inode i, in DEntry d2);
    long    unlink (in Inode i, in DEntry d);
    long    symlink(in Inode i, in DEntry d, in string name);
    long    mkdir  (in Inode i, in DEntry d, in long flags);
    long    rmdir  (in Inode i, in DEntry d);
    long    mknod  (inout Inode i, in DEntry d, in long major, in long minor);
    long    rename (inout Inode i, in DEntry d, in Inode i2, in DEntry d2);
    string readlink(in DEntry D);
    DEntry followlink(in DEntry d1, in DEntry d2, in long flags);
    
    // get_block, readpage, writepage, flushpage, truncate, permission
    // smap, revalidate
  };

  interface DEntryOps { // struct dentry_operations
    long revalidate(inout DEntry d);
    long hash(in DEntry d);
    long compare(in DEntry d, in string a, in string b);
    void delete(in DEntry d);
    void release(in DEntry d);
    void inodePut(in DEntry d, in Inode I);
  };

  interface DEntry {    // struct dentry
    long       getDCount();
    Inode      getInode();
    DEntry     getParent();
    DEntry     getMounts();
    DEntry     getMountPoint();
    long       getDTime();
    DEntryOps  getDEntryOps();
    SuperBlock getSuperBlock();
  };

  interface FileOps {  // struct file_operations
    enum SeekDirection { FromStart, FromCurrent, FromEnd };

    long llseek(inout File f, in long offset, in SeekDirection Direction);
    string read(inout File f, in long size);
    void write(inout File f, in string buffer);
    void readdir(inout File f, inout string buffer);
    long flush(inout File file);
    long release(in Inode inode, in File file);
    long fsync(in File f, in DEntry dentry);

    // poll, mmap, check_media_change, revalidate, lock, fasync
  };

  interface SuperBlockOps {  // struct super_operations
    void readInode(inout Inode WhichOne);
    void writeInode(inout Inode WhichOne);
    void putInode(inout Inode WhichOne);
    void deleteInode(inout Inode WhichOne);
    void clearInode(in Inode WhichOne);

    void notifyChanged(in DEntry d);
    void putSuper(in SuperBlock SB);
    void writeSuper(in SuperBlock SB);
    void umountBegin(in SuperBlock SB);
  };

  interface SuperBlock {  // struct super_block
    long getBlockSize();
    FileSystem     getFileSystemType();
    SuperBlockOps  getSuperBlockOps();
    //DiskQuotaOps   getDiskQuotaOps();
  };

  interface FileSystem {  // struct file_system_type
    string getName();
    long getFlags();
    SuperBlock ReadSuperBlock();
  };
};