Blame view

fs/coda/coda_linux.h 2.93 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  /* 
   * Coda File System, Linux Kernel module
   * 
   * Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University
   * Linux modifications (C) 1996, Peter J. Braam
   * Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University
   *
   * Carnegie Mellon University encourages users of this software to
   * contribute improvements to the Coda project.
   */
  
  #ifndef _LINUX_CODA_FS
  #define _LINUX_CODA_FS
  
  #include <linux/kernel.h>
  #include <linux/param.h>
  #include <linux/mm.h>
  #include <linux/vmalloc.h>
  #include <linux/slab.h>
  #include <linux/wait.h>		
  #include <linux/types.h>
  #include <linux/fs.h>
31a203df9   Al Viro   take coda-private...
23
  #include "coda_fs_i.h"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
25
  
  /* operations */
c5ef1c42c   Arjan van de Ven   [PATCH] mark stru...
26
27
28
  extern const struct inode_operations coda_dir_inode_operations;
  extern const struct inode_operations coda_file_inode_operations;
  extern const struct inode_operations coda_ioctl_inode_operations;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29

9501e4c48   Al Viro   switch coda
30
  extern const struct dentry_operations coda_dentry_operations;
f5e54d6e5   Christoph Hellwig   [PATCH] mark addr...
31
32
  extern const struct address_space_operations coda_file_aops;
  extern const struct address_space_operations coda_symlink_aops;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33

4b6f5d20b   Arjan van de Ven   [PATCH] Make most...
34
35
36
  extern const struct file_operations coda_dir_operations;
  extern const struct file_operations coda_file_operations;
  extern const struct file_operations coda_ioctl_operations;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
38
39
  
  /* operations shared over more than one file */
  int coda_open(struct inode *i, struct file *f);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
40
  int coda_release(struct inode *i, struct file *f);
10556cb21   Al Viro   ->permission() sa...
41
  int coda_permission(struct inode *inode, int mask);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
42
43
44
  int coda_revalidate_inode(struct dentry *);
  int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
  int coda_setattr(struct dentry *, struct iattr *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
  /* this file:  heloers */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  char *coda_f2s(struct CodaFid *f);
  int coda_isroot(struct inode *i);
  int coda_iscontrol(const char *name, size_t length);
  
  void coda_vattr_to_iattr(struct inode *, struct coda_vattr *);
  void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *);
  unsigned short coda_flags_to_cflags(unsigned short);
  
  /* sysctl.h */
  void coda_sysctl_init(void);
  void coda_sysctl_clean(void);
  
  #define CODA_ALLOC(ptr, cast, size) do { \
      if (size < PAGE_SIZE) \
558feb081   Joe Perches   fs: Convert vmall...
60
          ptr = kzalloc((unsigned long) size, GFP_KERNEL); \
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
      else \
558feb081   Joe Perches   fs: Convert vmall...
62
          ptr = (cast)vzalloc((unsigned long) size); \
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
63
64
65
      if (!ptr) \
          printk("kernel malloc returns 0 at %s:%d
  ", __FILE__, __LINE__); \
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  } while (0)
  
  
  #define CODA_FREE(ptr,size) \
      do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0)
  
  /* inode to cnode access functions */
  
  static inline struct coda_inode_info *ITOC(struct inode *inode)
  {
  	return list_entry(inode, struct coda_inode_info, vfs_inode);
  }
  
  static __inline__ struct CodaFid *coda_i2f(struct inode *inode)
  {
  	return &(ITOC(inode)->c_fid);
  }
  
  static __inline__ char *coda_i2s(struct inode *inode)
  {
  	return coda_f2s(&(ITOC(inode)->c_fid));
  }
  
  /* this will not zap the inode away */
  static __inline__ void coda_flag_inode(struct inode *inode, int flag)
  {
b5ce1d83a   Yoshihisa Abe   Coda: add spin lo...
92
93
94
95
96
  	struct coda_inode_info *cii = ITOC(inode);
  
  	spin_lock(&cii->c_lock);
  	cii->c_flags |= flag;
  	spin_unlock(&cii->c_lock);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
97
98
99
  }		
  
  #endif