--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
+
--- /dev/null
+#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 */