Whamcloud - gitweb
foo 0.0.0
authorpschwan <pschwan>
Thu, 3 Jun 1999 01:34:05 +0000 (01:34 +0000)
committerpschwan <pschwan>
Thu, 3 Jun 1999 01:34:05 +0000 (01:34 +0000)
lustre/include/linux/obd_psdev.h [new file with mode: 0755]
lustre/include/linux/presto.h [new file with mode: 0755]
lustre/include/linux/presto_upcall.h [new file with mode: 0755]
lustre/include/linux/sym_obd.h [new file with mode: 0755]

diff --git a/lustre/include/linux/obd_psdev.h b/lustre/include/linux/obd_psdev.h
new file mode 100755 (executable)
index 0000000..15bcd42
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __LINUX_OBD_PSDEV_H
+#define __LINUX_OBD_PSDEV_H
+
+#define OBD_PSDEV_MAJOR 120
+
+#define ISLENTO (current->pid == psdev_vcomm.vc_pid)
+
+/* communication pending & processing queues */
+struct vcomm {
+       unsigned int        vc_seq;
+       struct wait_queue  *vc_waitq;     /* Lento wait queue */
+       struct list_head    vc_pending;
+       struct list_head    vc_processing;
+       int                 vc_inuse;
+       int                 vc_pid;       /* Lento's pid */
+};
+
+extern void obd_psdev_detach(int unit);
+extern int  init_obd_psdev(void);
+struct vcomm psdev_vcomm;
+
+/* messages between presto filesystem in kernel and Venus */
+extern int presto_hard;
+extern unsigned long presto_timeout;
+
+#define REQ_READ   1
+#define REQ_WRITE  2
+#define REQ_ASYNC  4
+
+struct upc_req {
+       struct list_head   rq_chain;
+       caddr_t            rq_data;
+       u_short            rq_flags;
+       u_short            rq_read_size;  /* Size is at most 5000 bytes */
+       u_short            rq_rep_size;
+       u_short            rq_opcode;  /* copied from data to save lookup */
+       int                rq_unique;
+       struct wait_queue  *rq_sleep;   /* process' wait queue */
+       unsigned long      rq_posttime;
+};
+
+#endif /* __LINUX_OBD_PSDEV_H */
diff --git a/lustre/include/linux/presto.h b/lustre/include/linux/presto.h
new file mode 100755 (executable)
index 0000000..a6ead3d
--- /dev/null
@@ -0,0 +1,162 @@
+#ifndef __PRESTO_H_
+#define __PRESTO_H_ 1
+
+/* super.c */
+#if 0
+extern struct super_block * ext2_read_super (struct super_block * sb, 
+                                            void * data,
+                                            int silent);
+#endif
+extern struct file_system_type presto_fs_type;
+extern int init_presto_fs(void);
+
+int presto_ispresto(struct inode *);
+
+struct bottomfs {
+       struct super_operations *bottom_sops;
+
+       struct inode_operations *bottom_dir_iops;
+       struct inode_operations *bottom_file_iops;
+       struct inode_operations *bottom_sym_iops;
+
+       struct file_operations *bottom_dir_fops;
+       struct file_operations *bottom_file_fops;
+       struct file_operations *bottom_sym_fops;
+       kdev_t bottom_dev;
+};
+extern struct bottomfs *the_bottom;
+
+/* inode.c */
+void presto_read_inode(struct inode *inode);
+int presto_notify_change(struct dentry *de, struct iattr *iattr);
+
+/* dcache.c */
+extern struct dentry_operations presto_dentry_operations;
+
+/* dir.c */
+extern struct inode_operations presto_dir_iops;
+extern struct inode_operations presto_file_iops;
+extern struct inode_operations presto_sym_iops;
+extern struct file_operations presto_dir_fops;
+extern struct file_operations presto_file_fops;
+extern struct file_operations presto_sym_fops;
+
+void presto_setup_file_ops(struct inode *);
+void presto_setup_symlink_ops(struct inode *);
+
+int presto_lookup(struct inode * dir, struct dentry *dentry);
+int presto_dir_open(struct inode *inode, struct file *file);
+int presto_file_open(struct inode *inode, struct file *file);
+int presto_file_release(struct inode *inode, struct file *file);
+
+int presto_mkdir(struct inode *inode, struct dentry *, int mode);
+int presto_create(struct inode *inode, struct dentry *, int mode);
+int presto_unlink(struct inode *inode, struct dentry *);
+int presto_rmdir(struct inode *inode, struct dentry *);
+int presto_symlink(struct inode *, struct dentry *, const char *);
+int presto_rename(struct inode *old_dir, struct dentry *old_dentry,
+                 struct inode *new_dir, struct dentry *new_dentry);
+
+int lento_journal(char *page);
+
+/* intermezzo.c */
+#define PRESTO_ATTR            0x00000001 /* attributes cached */
+#define PRESTO_DATA            0x00000002 /* data cached */
+#define PRESTO_VOLROOT          0x00000004 /* this dentry is root of volume */
+#define PRESTO_HASPERMIT        0x00000008 /* we have a permit to WB */
+
+#define EISVOLROOT              0x2001
+
+int presto_chk(struct dentry *dentry, int flag);
+void presto_set(struct dentry *dentry, int flag);
+void presto_permit(struct inode *);
+int presto_mark_dentry(const char *path, int and_bits, int or_bits);
+
+/* journal.c */
+
+#define JOURNAL_PAGE  PAGE_SIZE
+
+
+#define PRESTO_CREATE  1
+#define PRESTO_MKDIR   2
+#define PRESTO_UNLINK  3
+#define PRESTO_RMDIR   4
+#define PRESTO_CLOSE   5
+#define PRESTO_SYMLINK 6
+#define PRESTO_RENAME  7
+#define PRESTO_SETATTR 8
+#define PRESTO_LINK    9
+
+void journal_create(struct inode *dirinode, struct inode *fileinode, int len, const char *name, int mode);
+void journal_symlink(struct inode *inode, int len, const char *name, const char *target);
+void journal_mkdir(struct inode *inode, int len, const char *name, int mode);
+void journal_unlink(struct inode *inode, int len, const char *name);
+void journal_rmdir(struct inode *inode, int len, const char *name);
+void journal_rename(struct inode *old_dir, struct inode *old_file,
+                   struct inode *new_dir, int new_len, const char *new_name);
+void journal_setattr(struct inode *, int uid, int gid, int fsize, int atime,
+                    int mtime, int ctime, int mode, unsigned int flags,
+                    unsigned int valid);
+void journal_close(struct inode *inode);
+void journal_link(struct inode *src, struct inode *tpdiri, 
+                 struct inode *ti, int len, const char *name);
+void journal_fetch(void);
+
+/* sysctl.c */
+void presto_sysctl_init(void);
+void presto_sysctl_clean(void);
+
+/* global variables */
+extern int presto_debug;
+extern int presto_print_entry;
+
+/* debugging masks */
+#define D_SUPER     1   /* print results returned by Venus */ 
+#define D_INODE     2   /* print entry and exit into procedure */
+#define D_FILE      4   
+#define D_CACHE     8   /* cache debugging */
+#define D_MALLOC    16  /* print malloc, de-alloc information */
+#define D_JOURNAL   32
+#define D_UPCALL    64  /* up and downcall debugging */
+#define D_PSDEV    128  
+#define D_PIOCTL   256
+#define D_SPECIAL  512
+#define D_TIMING  1024
+#define D_DOWNCALL 2048
+#if 0
+#define CDEBUG(mask, format, a...)                                \
+  do {                                                            \
+  if (presto_debug & mask) {                                        \
+    printk("(%s,l. %d): ",  __FUNCTION__, __LINE__);              \
+    printk(format, ## a); }                                       \
+} while (0) ;                            
+#else
+#define CDEBUG(mask, format, a...) ;
+#endif
+
+#define ENTRY    \
+    if(presto_print_entry) printk("Process %d entered %s\n",current->pid,__FUNCTION__)
+
+#define EXIT    \
+    if(presto_print_entry) printk("Process %d leaving %s\n",current->pid,__FUNCTION__)
+
+
+#define PRESTO_ALLOC(ptr, cast, size)                                       \
+do {                                                                      \
+    if (size <= 4096) {                                                    \
+        ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL);            \
+                CDEBUG(D_MALLOC, "kmalloced: %x at %x.\n", (int) size, (int) ptr);\
+     }  else {                                                             \
+        ptr = (cast)vmalloc((unsigned long) size);                        \
+       CDEBUG(D_MALLOC, "vmalloced: %x at %x.\n", (int) size, (int) ptr);}\
+    if (ptr == 0) {                                                       \
+        printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__);  \
+    }                                                                     \
+    memset( ptr, 0, size );                                                   \
+} while (0)
+
+
+#define PRESTO_FREE(ptr,size) do {if (size <= 4096) { kfree_s((ptr), (size)); CDEBUG(D_MALLOC, "kfreed: %x at %x.\n", (int) size, (int) ptr); } else { vfree((ptr)); CDEBUG(D_MALLOC, "vfreed: %x at %x.\n", (int) size, (int) ptr);} } while (0)
+
+#endif
diff --git a/lustre/include/linux/presto_upcall.h b/lustre/include/linux/presto_upcall.h
new file mode 100755 (executable)
index 0000000..50e9144
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Based on cfs.h from Coda, but revamped for increased simplicity.
+ * Linux modifications by Peter Braam, Aug 1996
+ * Rewritten for InterMezzo
+ */
+
+#ifndef _PRESTO_HEADER_
+#define _PRESTO_HEADER_
+
+
+/* upcall.c */
+#define SYNCHRONOUS 0
+#define ASYNCHRONOUS 1
+
+int lento_permit(ino_t ino);
+int lento_opendir(ino_t ino, int async);
+int lento_open(ino_t ino);
+int lento_journal(char *page);
+
+
+
+/*
+ * Kernel <--> Lento communications.
+ */
+
+/* downcalls */
+#define LENTO_PERMIT    1
+#define LENTO_JOURNAL   2
+#define LENTO_OPENDIR  3
+#define LENTO_OPEN     4
+#define LENTO_SIGNAL    5
+
+/* upcalls */
+#define PRESTO_RELEASE_JOURNAL 51
+#define PRESTO_MARK            52
+
+#define LENTO_DOWNCALL(opcode) (opcode <= PRESTO_MARK && opcode >= PRESTO_RELEASE_JOURNAL)
+
+/*         Lento <-> Presto  RPC arguments       */
+struct lento_up_hdr {
+       unsigned int opcode;
+       unsigned int unique;    /* Keep multiple outstanding msgs distinct */
+       u_short pid;            /* Common to all */
+       u_short uid;
+};
+
+/* This structure _must_ sit at the beginning of the buffer */
+struct lento_down_hdr {
+    unsigned int opcode;
+    unsigned int unique;       
+    unsigned int result;
+};
+
+/* lento_permit: */
+struct lento_permit_in {
+       struct lento_up_hdr uh;
+       ino_t ino;
+};
+struct lento_permit_out {
+    struct lento_down_hdr dh;
+};
+
+
+/* lento_opendir: */
+struct lento_opendir_in {
+       struct lento_up_hdr uh;
+       ino_t ino;
+       int   async;
+};
+struct lento_opendir_out {
+    struct lento_down_hdr dh;
+};
+
+
+/* lento_open: */
+struct lento_open_in {
+    struct lento_up_hdr uh;
+    ino_t ino;
+};
+struct lento_open_out {
+    struct lento_down_hdr dh;
+};
+
+/* lento_mark_dentry */
+struct lento_mark_dentry {  
+       struct lento_down_hdr dh;
+       int    and_flag;
+       int    or_flag;
+       char   path[0];
+};
+
+/* NB: every struct below begins with an up_hdr */
+union up_args {
+    struct lento_up_hdr uh;            
+    struct lento_permit_in lento_permit;
+    struct lento_open_in lento_open;
+    struct lento_opendir_in lento_opendir;
+};
+
+union down_args {
+    struct lento_down_hdr dh;
+    struct lento_permit_out lento_permit;
+    struct lento_open_out lento_open;
+    struct lento_opendir_out lento_opendir;
+};    
+
+union lento_downcalls {
+       struct lento_down_hdr        dch;
+       struct lento_mark_dentry     mark;
+};
+
+int lento_upcall(int read_size, int *rep_size, 
+                union up_args *buffer, int async);
+#endif 
+
diff --git a/lustre/include/linux/sym_obd.h b/lustre/include/linux/sym_obd.h
new file mode 100755 (executable)
index 0000000..10f2b53
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef __LINUX_SYM_OBD_H
+#define __LINUX_SYM_OBD_H
+
+#include <linux/fs.h>
+#include <linux/ext2_fs.h>
+
+#define SYM_OBD_DEBUG
+
+/*
+ * Debug code
+ */
+#ifdef SYM_OBD_DEBUG
+#      define obd_debug(f, a...)       { \
+                                       printk ("SYM OBD DEBUG (%s, %d): %s:", \
+                                               __FILE__, __LINE__, __FUNCTION__); \
+                                       printk (f, ## a); \
+                                       }
+#else
+#      define obd_debug(f, a...)       /**/
+#endif
+
+/*
+ * ioctl commands
+ */
+#define OBD_IOC_CREATE                 _IOR('f', 3, long)
+#define OBD_IOC_SETUP                  _IOW('f', 4, long)
+#define OBD_IOC_SYNC                   _IOR('f', 5, long)
+
+/* balloc.c */
+int obd_new_block (const struct inode * inode, unsigned long goal,
+                   u32 * prealloc_count, u32 * prealloc_block, int * err);
+void obd_free_blocks (const struct inode * inode, unsigned long block,
+                      unsigned long count);
+unsigned long obd_count_free_blocks (struct super_block * sb);
+int ext2_group_sparse(int group);
+
+/* fsync.c */
+int obd_sync_file(struct file * file, struct dentry *dentry);
+
+/* inode.c */
+void obd_read_inode (struct inode * inode);
+void obd_write_inode (struct inode * inode);
+void obd_put_inode (struct inode * inode);
+void obd_delete_inode (struct inode * inode);
+void obd_discard_prealloc_blocks (struct inode * inode);
+int obd_sync_inode (struct inode *inode);
+struct buffer_head * obd_bread (struct inode * inode, int block, 
+                                int create, int *err);
+struct buffer_head * obd_getblk (struct inode * inode, long block,
+                                 int create, int * err);
+
+/* interface.c */
+extern struct inode * obd_inode_new (int inode_hint, int * err);
+extern void obd_inode_destroy (struct inode * inode);
+extern unsigned long obd_count_free_inodes (struct super_block * sb);
+extern void obd_check_inodes_bitmap (struct super_block * sb);
+unsigned long obd_count_free_inodes (struct super_block * sb);
+
+/* ioctl.c */
+int obd_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
+              unsigned long arg);
+
+/* super.c */
+#define obd_error obd_warning
+#define obd_panic obd_warning
+extern void obd_warning (struct super_block *, const char *, const char *, ...)
+       __attribute__ ((format (printf, 3, 4)));
+int obd_remount (struct super_block * sb, int * flags, char * data);
+struct super_block * obd_read_super (struct super_block * sb, void * data,
+                                    int silent);
+
+/* truncate.c */
+void obd_truncate (struct inode * inode);
+
+/* operations */
+/* dir.c */
+extern struct inode_operations obd_dir_inode_operations;
+
+/* file.c */
+extern struct inode_operations obd_file_inode_operations;
+
+#endif /* __LINUX_SYM_OBD_H */