Commit 31a203df9c109480fc6d48ba0a68763e89199acb
1 parent
9501e4c48e
Exists in
master
and in
7 other branches
take coda-private headers out of include/linux
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 17 changed files with 199 additions and 206 deletions Side-by-side Diff
- Documentation/magic-number.txt
- fs/coda/cache.c
- fs/coda/cnode.c
- fs/coda/coda_cache.h
- fs/coda/coda_fs_i.h
- fs/coda/coda_linux.c
- fs/coda/coda_linux.h
- fs/coda/dir.c
- fs/coda/file.c
- fs/coda/inode.c
- fs/coda/pioctl.c
- fs/coda/psdev.c
- fs/coda/symlink.c
- fs/coda/upcall.c
- include/linux/coda_cache.h
- include/linux/coda_fs_i.h
- include/linux/coda_linux.h
Documentation/magic-number.txt
| ... | ... | @@ -150,7 +150,7 @@ |
| 150 | 150 | STL_BOARDMAGIC 0xa2267f52 stlbrd include/linux/stallion.h |
| 151 | 151 | ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h |
| 152 | 152 | SCI_MAGIC 0xbabeface gs_port drivers/char/sh-sci.h |
| 153 | -CODA_MAGIC 0xC0DAC0DA coda_file_info include/linux/coda_fs_i.h | |
| 153 | +CODA_MAGIC 0xC0DAC0DA coda_file_info fs/coda/coda_fs_i.h | |
| 154 | 154 | DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h |
| 155 | 155 | STLI_PORTMAGIC 0xe671c7a1 stliport include/linux/istallion.h |
| 156 | 156 | YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c |
fs/coda/cache.c
| ... | ... | @@ -20,10 +20,9 @@ |
| 20 | 20 | #include <linux/spinlock.h> |
| 21 | 21 | |
| 22 | 22 | #include <linux/coda.h> |
| 23 | -#include <linux/coda_linux.h> | |
| 24 | 23 | #include <linux/coda_psdev.h> |
| 25 | -#include <linux/coda_fs_i.h> | |
| 26 | -#include <linux/coda_cache.h> | |
| 24 | +#include "coda_linux.h" | |
| 25 | +#include "coda_cache.h" | |
| 27 | 26 | |
| 28 | 27 | static atomic_t permission_epoch = ATOMIC_INIT(0); |
| 29 | 28 |
fs/coda/cnode.c
| ... | ... | @@ -7,9 +7,8 @@ |
| 7 | 7 | #include <linux/time.h> |
| 8 | 8 | |
| 9 | 9 | #include <linux/coda.h> |
| 10 | -#include <linux/coda_linux.h> | |
| 11 | -#include <linux/coda_fs_i.h> | |
| 12 | 10 | #include <linux/coda_psdev.h> |
| 11 | +#include "coda_linux.h" | |
| 13 | 12 | |
| 14 | 13 | static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2) |
| 15 | 14 | { |
fs/coda/coda_cache.h
| 1 | +/* Coda filesystem -- Linux Minicache | |
| 2 | + * | |
| 3 | + * Copyright (C) 1989 - 1997 Carnegie Mellon University | |
| 4 | + * | |
| 5 | + * Carnegie Mellon University encourages users of this software to | |
| 6 | + * contribute improvements to the Coda project. Contact Peter Braam | |
| 7 | + * <coda@cs.cmu.edu> | |
| 8 | + */ | |
| 9 | + | |
| 10 | +#ifndef _CFSNC_HEADER_ | |
| 11 | +#define _CFSNC_HEADER_ | |
| 12 | + | |
| 13 | +/* credential cache */ | |
| 14 | +void coda_cache_enter(struct inode *inode, int mask); | |
| 15 | +void coda_cache_clear_inode(struct inode *); | |
| 16 | +void coda_cache_clear_all(struct super_block *sb); | |
| 17 | +int coda_cache_check(struct inode *inode, int mask); | |
| 18 | + | |
| 19 | +/* for downcalls and attributes and lookups */ | |
| 20 | +void coda_flag_inode_children(struct inode *inode, int flag); | |
| 21 | + | |
| 22 | +#endif /* _CFSNC_HEADER_ */ |
fs/coda/coda_fs_i.h
| 1 | +/* | |
| 2 | + * coda_fs_i.h | |
| 3 | + * | |
| 4 | + * Copyright (C) 1998 Carnegie Mellon University | |
| 5 | + * | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef _LINUX_CODA_FS_I | |
| 9 | +#define _LINUX_CODA_FS_I | |
| 10 | + | |
| 11 | +#include <linux/types.h> | |
| 12 | +#include <linux/list.h> | |
| 13 | +#include <linux/spinlock.h> | |
| 14 | +#include <linux/coda.h> | |
| 15 | + | |
| 16 | +/* | |
| 17 | + * coda fs inode data | |
| 18 | + * c_lock protects accesses to c_flags, c_mapcount, c_cached_epoch, c_uid and | |
| 19 | + * c_cached_perm. | |
| 20 | + * vfs_inode is set only when the inode is created and never changes. | |
| 21 | + * c_fid is set when the inode is created and should be considered immutable. | |
| 22 | + */ | |
| 23 | +struct coda_inode_info { | |
| 24 | + struct CodaFid c_fid; /* Coda identifier */ | |
| 25 | + u_short c_flags; /* flags (see below) */ | |
| 26 | + unsigned int c_mapcount; /* nr of times this inode is mapped */ | |
| 27 | + unsigned int c_cached_epoch; /* epoch for cached permissions */ | |
| 28 | + vuid_t c_uid; /* fsuid for cached permissions */ | |
| 29 | + unsigned int c_cached_perm; /* cached access permissions */ | |
| 30 | + spinlock_t c_lock; | |
| 31 | + struct inode vfs_inode; | |
| 32 | +}; | |
| 33 | + | |
| 34 | +/* | |
| 35 | + * coda fs file private data | |
| 36 | + */ | |
| 37 | +#define CODA_MAGIC 0xC0DAC0DA | |
| 38 | +struct coda_file_info { | |
| 39 | + int cfi_magic; /* magic number */ | |
| 40 | + struct file *cfi_container; /* container file for this cnode */ | |
| 41 | + unsigned int cfi_mapcount; /* nr of times this file is mapped */ | |
| 42 | +}; | |
| 43 | + | |
| 44 | +#define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data)) | |
| 45 | + | |
| 46 | +/* flags */ | |
| 47 | +#define C_VATTR 0x1 /* Validity of vattr in inode */ | |
| 48 | +#define C_FLUSH 0x2 /* used after a flush */ | |
| 49 | +#define C_DYING 0x4 /* from venus (which died) */ | |
| 50 | +#define C_PURGE 0x8 | |
| 51 | + | |
| 52 | +int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *); | |
| 53 | +struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); | |
| 54 | +int coda_cnode_makectl(struct inode **inode, struct super_block *sb); | |
| 55 | +struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); | |
| 56 | +void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); | |
| 57 | + | |
| 58 | +#endif |
fs/coda/coda_linux.c
| ... | ... | @@ -17,9 +17,8 @@ |
| 17 | 17 | #include <linux/string.h> |
| 18 | 18 | |
| 19 | 19 | #include <linux/coda.h> |
| 20 | -#include <linux/coda_linux.h> | |
| 21 | 20 | #include <linux/coda_psdev.h> |
| 22 | -#include <linux/coda_fs_i.h> | |
| 21 | +#include "coda_linux.h" | |
| 23 | 22 | |
| 24 | 23 | /* initialize the debugging variables */ |
| 25 | 24 | int coda_fake_statfs; |
fs/coda/coda_linux.h
| 1 | +/* | |
| 2 | + * Coda File System, Linux Kernel module | |
| 3 | + * | |
| 4 | + * Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University | |
| 5 | + * Linux modifications (C) 1996, Peter J. Braam | |
| 6 | + * Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University | |
| 7 | + * | |
| 8 | + * Carnegie Mellon University encourages users of this software to | |
| 9 | + * contribute improvements to the Coda project. | |
| 10 | + */ | |
| 11 | + | |
| 12 | +#ifndef _LINUX_CODA_FS | |
| 13 | +#define _LINUX_CODA_FS | |
| 14 | + | |
| 15 | +#include <linux/kernel.h> | |
| 16 | +#include <linux/param.h> | |
| 17 | +#include <linux/mm.h> | |
| 18 | +#include <linux/vmalloc.h> | |
| 19 | +#include <linux/slab.h> | |
| 20 | +#include <linux/wait.h> | |
| 21 | +#include <linux/types.h> | |
| 22 | +#include <linux/fs.h> | |
| 23 | +#include "coda_fs_i.h" | |
| 24 | + | |
| 25 | +/* operations */ | |
| 26 | +extern const struct inode_operations coda_dir_inode_operations; | |
| 27 | +extern const struct inode_operations coda_file_inode_operations; | |
| 28 | +extern const struct inode_operations coda_ioctl_inode_operations; | |
| 29 | + | |
| 30 | +extern const struct dentry_operations coda_dentry_operations; | |
| 31 | + | |
| 32 | +extern const struct address_space_operations coda_file_aops; | |
| 33 | +extern const struct address_space_operations coda_symlink_aops; | |
| 34 | + | |
| 35 | +extern const struct file_operations coda_dir_operations; | |
| 36 | +extern const struct file_operations coda_file_operations; | |
| 37 | +extern const struct file_operations coda_ioctl_operations; | |
| 38 | + | |
| 39 | +/* operations shared over more than one file */ | |
| 40 | +int coda_open(struct inode *i, struct file *f); | |
| 41 | +int coda_release(struct inode *i, struct file *f); | |
| 42 | +int coda_permission(struct inode *inode, int mask, unsigned int flags); | |
| 43 | +int coda_revalidate_inode(struct dentry *); | |
| 44 | +int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); | |
| 45 | +int coda_setattr(struct dentry *, struct iattr *); | |
| 46 | + | |
| 47 | +/* this file: heloers */ | |
| 48 | +char *coda_f2s(struct CodaFid *f); | |
| 49 | +int coda_isroot(struct inode *i); | |
| 50 | +int coda_iscontrol(const char *name, size_t length); | |
| 51 | + | |
| 52 | +void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); | |
| 53 | +void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *); | |
| 54 | +unsigned short coda_flags_to_cflags(unsigned short); | |
| 55 | + | |
| 56 | +/* sysctl.h */ | |
| 57 | +void coda_sysctl_init(void); | |
| 58 | +void coda_sysctl_clean(void); | |
| 59 | + | |
| 60 | +#define CODA_ALLOC(ptr, cast, size) do { \ | |
| 61 | + if (size < PAGE_SIZE) \ | |
| 62 | + ptr = kmalloc((unsigned long) size, GFP_KERNEL); \ | |
| 63 | + else \ | |
| 64 | + ptr = (cast)vmalloc((unsigned long) size); \ | |
| 65 | + if (!ptr) \ | |
| 66 | + printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ | |
| 67 | + else memset( ptr, 0, size ); \ | |
| 68 | +} while (0) | |
| 69 | + | |
| 70 | + | |
| 71 | +#define CODA_FREE(ptr,size) \ | |
| 72 | + do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0) | |
| 73 | + | |
| 74 | +/* inode to cnode access functions */ | |
| 75 | + | |
| 76 | +static inline struct coda_inode_info *ITOC(struct inode *inode) | |
| 77 | +{ | |
| 78 | + return list_entry(inode, struct coda_inode_info, vfs_inode); | |
| 79 | +} | |
| 80 | + | |
| 81 | +static __inline__ struct CodaFid *coda_i2f(struct inode *inode) | |
| 82 | +{ | |
| 83 | + return &(ITOC(inode)->c_fid); | |
| 84 | +} | |
| 85 | + | |
| 86 | +static __inline__ char *coda_i2s(struct inode *inode) | |
| 87 | +{ | |
| 88 | + return coda_f2s(&(ITOC(inode)->c_fid)); | |
| 89 | +} | |
| 90 | + | |
| 91 | +/* this will not zap the inode away */ | |
| 92 | +static __inline__ void coda_flag_inode(struct inode *inode, int flag) | |
| 93 | +{ | |
| 94 | + struct coda_inode_info *cii = ITOC(inode); | |
| 95 | + | |
| 96 | + spin_lock(&cii->c_lock); | |
| 97 | + cii->c_flags |= flag; | |
| 98 | + spin_unlock(&cii->c_lock); | |
| 99 | +} | |
| 100 | + | |
| 101 | +#endif |
fs/coda/dir.c
| ... | ... | @@ -23,10 +23,9 @@ |
| 23 | 23 | #include <asm/uaccess.h> |
| 24 | 24 | |
| 25 | 25 | #include <linux/coda.h> |
| 26 | -#include <linux/coda_linux.h> | |
| 27 | 26 | #include <linux/coda_psdev.h> |
| 28 | -#include <linux/coda_fs_i.h> | |
| 29 | -#include <linux/coda_cache.h> | |
| 27 | +#include "coda_linux.h" | |
| 28 | +#include "coda_cache.h" | |
| 30 | 29 | |
| 31 | 30 | #include "coda_int.h" |
| 32 | 31 |
fs/coda/file.c
fs/coda/inode.c
| ... | ... | @@ -28,10 +28,9 @@ |
| 28 | 28 | #include <linux/vmalloc.h> |
| 29 | 29 | |
| 30 | 30 | #include <linux/coda.h> |
| 31 | -#include <linux/coda_linux.h> | |
| 32 | 31 | #include <linux/coda_psdev.h> |
| 33 | -#include <linux/coda_fs_i.h> | |
| 34 | -#include <linux/coda_cache.h> | |
| 32 | +#include "coda_linux.h" | |
| 33 | +#include "coda_cache.h" | |
| 35 | 34 | |
| 36 | 35 | #include "coda_int.h" |
| 37 | 36 |
fs/coda/pioctl.c
| ... | ... | @@ -19,9 +19,9 @@ |
| 19 | 19 | #include <asm/uaccess.h> |
| 20 | 20 | |
| 21 | 21 | #include <linux/coda.h> |
| 22 | -#include <linux/coda_linux.h> | |
| 23 | -#include <linux/coda_fs_i.h> | |
| 24 | 22 | #include <linux/coda_psdev.h> |
| 23 | + | |
| 24 | +#include "coda_linux.h" | |
| 25 | 25 | |
| 26 | 26 | /* pioctl ops */ |
| 27 | 27 | static int coda_ioctl_permission(struct inode *inode, int mask, unsigned int flags); |
fs/coda/psdev.c
fs/coda/symlink.c
| ... | ... | @@ -16,9 +16,9 @@ |
| 16 | 16 | #include <linux/pagemap.h> |
| 17 | 17 | |
| 18 | 18 | #include <linux/coda.h> |
| 19 | -#include <linux/coda_linux.h> | |
| 20 | 19 | #include <linux/coda_psdev.h> |
| 21 | -#include <linux/coda_fs_i.h> | |
| 20 | + | |
| 21 | +#include "coda_linux.h" | |
| 22 | 22 | |
| 23 | 23 | static int coda_symlink_filler(struct file *file, struct page *page) |
| 24 | 24 | { |
fs/coda/upcall.c
| ... | ... | @@ -33,10 +33,9 @@ |
| 33 | 33 | #include <linux/vfs.h> |
| 34 | 34 | |
| 35 | 35 | #include <linux/coda.h> |
| 36 | -#include <linux/coda_linux.h> | |
| 37 | 36 | #include <linux/coda_psdev.h> |
| 38 | -#include <linux/coda_fs_i.h> | |
| 39 | -#include <linux/coda_cache.h> | |
| 37 | +#include "coda_linux.h" | |
| 38 | +#include "coda_cache.h" | |
| 40 | 39 | |
| 41 | 40 | #include "coda_int.h" |
| 42 | 41 |
include/linux/coda_cache.h
| 1 | -/* Coda filesystem -- Linux Minicache | |
| 2 | - * | |
| 3 | - * Copyright (C) 1989 - 1997 Carnegie Mellon University | |
| 4 | - * | |
| 5 | - * Carnegie Mellon University encourages users of this software to | |
| 6 | - * contribute improvements to the Coda project. Contact Peter Braam | |
| 7 | - * <coda@cs.cmu.edu> | |
| 8 | - */ | |
| 9 | - | |
| 10 | -#ifndef _CFSNC_HEADER_ | |
| 11 | -#define _CFSNC_HEADER_ | |
| 12 | - | |
| 13 | -/* credential cache */ | |
| 14 | -void coda_cache_enter(struct inode *inode, int mask); | |
| 15 | -void coda_cache_clear_inode(struct inode *); | |
| 16 | -void coda_cache_clear_all(struct super_block *sb); | |
| 17 | -int coda_cache_check(struct inode *inode, int mask); | |
| 18 | - | |
| 19 | -/* for downcalls and attributes and lookups */ | |
| 20 | -void coda_flag_inode_children(struct inode *inode, int flag); | |
| 21 | - | |
| 22 | -#endif /* _CFSNC_HEADER_ */ |
include/linux/coda_fs_i.h
| 1 | -/* | |
| 2 | - * coda_fs_i.h | |
| 3 | - * | |
| 4 | - * Copyright (C) 1998 Carnegie Mellon University | |
| 5 | - * | |
| 6 | - */ | |
| 7 | - | |
| 8 | -#ifndef _LINUX_CODA_FS_I | |
| 9 | -#define _LINUX_CODA_FS_I | |
| 10 | - | |
| 11 | -#include <linux/types.h> | |
| 12 | -#include <linux/list.h> | |
| 13 | -#include <linux/spinlock.h> | |
| 14 | -#include <linux/coda.h> | |
| 15 | - | |
| 16 | -/* | |
| 17 | - * coda fs inode data | |
| 18 | - * c_lock protects accesses to c_flags, c_mapcount, c_cached_epoch, c_uid and | |
| 19 | - * c_cached_perm. | |
| 20 | - * vfs_inode is set only when the inode is created and never changes. | |
| 21 | - * c_fid is set when the inode is created and should be considered immutable. | |
| 22 | - */ | |
| 23 | -struct coda_inode_info { | |
| 24 | - struct CodaFid c_fid; /* Coda identifier */ | |
| 25 | - u_short c_flags; /* flags (see below) */ | |
| 26 | - unsigned int c_mapcount; /* nr of times this inode is mapped */ | |
| 27 | - unsigned int c_cached_epoch; /* epoch for cached permissions */ | |
| 28 | - vuid_t c_uid; /* fsuid for cached permissions */ | |
| 29 | - unsigned int c_cached_perm; /* cached access permissions */ | |
| 30 | - spinlock_t c_lock; | |
| 31 | - struct inode vfs_inode; | |
| 32 | -}; | |
| 33 | - | |
| 34 | -/* | |
| 35 | - * coda fs file private data | |
| 36 | - */ | |
| 37 | -#define CODA_MAGIC 0xC0DAC0DA | |
| 38 | -struct coda_file_info { | |
| 39 | - int cfi_magic; /* magic number */ | |
| 40 | - struct file *cfi_container; /* container file for this cnode */ | |
| 41 | - unsigned int cfi_mapcount; /* nr of times this file is mapped */ | |
| 42 | -}; | |
| 43 | - | |
| 44 | -#define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data)) | |
| 45 | - | |
| 46 | -/* flags */ | |
| 47 | -#define C_VATTR 0x1 /* Validity of vattr in inode */ | |
| 48 | -#define C_FLUSH 0x2 /* used after a flush */ | |
| 49 | -#define C_DYING 0x4 /* from venus (which died) */ | |
| 50 | -#define C_PURGE 0x8 | |
| 51 | - | |
| 52 | -int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *); | |
| 53 | -struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); | |
| 54 | -int coda_cnode_makectl(struct inode **inode, struct super_block *sb); | |
| 55 | -struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); | |
| 56 | -void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); | |
| 57 | - | |
| 58 | -#endif |
include/linux/coda_linux.h
| 1 | -/* | |
| 2 | - * Coda File System, Linux Kernel module | |
| 3 | - * | |
| 4 | - * Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University | |
| 5 | - * Linux modifications (C) 1996, Peter J. Braam | |
| 6 | - * Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University | |
| 7 | - * | |
| 8 | - * Carnegie Mellon University encourages users of this software to | |
| 9 | - * contribute improvements to the Coda project. | |
| 10 | - */ | |
| 11 | - | |
| 12 | -#ifndef _LINUX_CODA_FS | |
| 13 | -#define _LINUX_CODA_FS | |
| 14 | - | |
| 15 | -#include <linux/kernel.h> | |
| 16 | -#include <linux/param.h> | |
| 17 | -#include <linux/mm.h> | |
| 18 | -#include <linux/vmalloc.h> | |
| 19 | -#include <linux/slab.h> | |
| 20 | -#include <linux/wait.h> | |
| 21 | -#include <linux/types.h> | |
| 22 | -#include <linux/fs.h> | |
| 23 | -#include <linux/coda_fs_i.h> | |
| 24 | - | |
| 25 | -/* operations */ | |
| 26 | -extern const struct inode_operations coda_dir_inode_operations; | |
| 27 | -extern const struct inode_operations coda_file_inode_operations; | |
| 28 | -extern const struct inode_operations coda_ioctl_inode_operations; | |
| 29 | - | |
| 30 | -extern const struct dentry_operations coda_dentry_operations; | |
| 31 | - | |
| 32 | -extern const struct address_space_operations coda_file_aops; | |
| 33 | -extern const struct address_space_operations coda_symlink_aops; | |
| 34 | - | |
| 35 | -extern const struct file_operations coda_dir_operations; | |
| 36 | -extern const struct file_operations coda_file_operations; | |
| 37 | -extern const struct file_operations coda_ioctl_operations; | |
| 38 | - | |
| 39 | -/* operations shared over more than one file */ | |
| 40 | -int coda_open(struct inode *i, struct file *f); | |
| 41 | -int coda_release(struct inode *i, struct file *f); | |
| 42 | -int coda_permission(struct inode *inode, int mask, unsigned int flags); | |
| 43 | -int coda_revalidate_inode(struct dentry *); | |
| 44 | -int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); | |
| 45 | -int coda_setattr(struct dentry *, struct iattr *); | |
| 46 | - | |
| 47 | -/* this file: heloers */ | |
| 48 | -char *coda_f2s(struct CodaFid *f); | |
| 49 | -int coda_isroot(struct inode *i); | |
| 50 | -int coda_iscontrol(const char *name, size_t length); | |
| 51 | - | |
| 52 | -void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); | |
| 53 | -void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *); | |
| 54 | -unsigned short coda_flags_to_cflags(unsigned short); | |
| 55 | - | |
| 56 | -/* sysctl.h */ | |
| 57 | -void coda_sysctl_init(void); | |
| 58 | -void coda_sysctl_clean(void); | |
| 59 | - | |
| 60 | -#define CODA_ALLOC(ptr, cast, size) do { \ | |
| 61 | - if (size < PAGE_SIZE) \ | |
| 62 | - ptr = kmalloc((unsigned long) size, GFP_KERNEL); \ | |
| 63 | - else \ | |
| 64 | - ptr = (cast)vmalloc((unsigned long) size); \ | |
| 65 | - if (!ptr) \ | |
| 66 | - printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ | |
| 67 | - else memset( ptr, 0, size ); \ | |
| 68 | -} while (0) | |
| 69 | - | |
| 70 | - | |
| 71 | -#define CODA_FREE(ptr,size) \ | |
| 72 | - do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0) | |
| 73 | - | |
| 74 | -/* inode to cnode access functions */ | |
| 75 | - | |
| 76 | -static inline struct coda_inode_info *ITOC(struct inode *inode) | |
| 77 | -{ | |
| 78 | - return list_entry(inode, struct coda_inode_info, vfs_inode); | |
| 79 | -} | |
| 80 | - | |
| 81 | -static __inline__ struct CodaFid *coda_i2f(struct inode *inode) | |
| 82 | -{ | |
| 83 | - return &(ITOC(inode)->c_fid); | |
| 84 | -} | |
| 85 | - | |
| 86 | -static __inline__ char *coda_i2s(struct inode *inode) | |
| 87 | -{ | |
| 88 | - return coda_f2s(&(ITOC(inode)->c_fid)); | |
| 89 | -} | |
| 90 | - | |
| 91 | -/* this will not zap the inode away */ | |
| 92 | -static __inline__ void coda_flag_inode(struct inode *inode, int flag) | |
| 93 | -{ | |
| 94 | - struct coda_inode_info *cii = ITOC(inode); | |
| 95 | - | |
| 96 | - spin_lock(&cii->c_lock); | |
| 97 | - cii->c_flags |= flag; | |
| 98 | - spin_unlock(&cii->c_lock); | |
| 99 | -} | |
| 100 | - | |
| 101 | -#endif |