~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/linux/quotaops.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Definitions for diskquota-operations. When diskquota is configured these
  3  * macros expand to the right source-code.
  4  *
  5  * Author:  Marco van Wieringen <mvw@planets.elm.net>
  6  *
  7  * Version: $Id: quotaops.h,v 1.2 1998/01/15 16:22:26 ecd Exp $
  8  *
  9  */
 10 #ifndef _LINUX_QUOTAOPS_
 11 #define _LINUX_QUOTAOPS_
 12 
 13 #include <linux/config.h>
 14 
 15 #if defined(CONFIG_QUOTA)
 16 
 17 #include <linux/smp_lock.h>
 18 
 19 /*
 20  * declaration of quota_function calls in kernel.
 21  */
 22 extern void dquot_initialize(struct inode *inode, short type);
 23 extern void dquot_drop(struct inode *inode);
 24 extern void invalidate_dquots(kdev_t dev, short type);
 25 extern int  quota_off(struct super_block *sb, short type);
 26 extern int  sync_dquots(kdev_t dev, short type);
 27 
 28 extern int  dquot_alloc_block(const struct inode *inode, unsigned long number, char prealloc);
 29 extern int  dquot_alloc_inode(const struct inode *inode, unsigned long number);
 30 
 31 extern void dquot_free_block(const struct inode *inode, unsigned long number);
 32 extern void dquot_free_inode(const struct inode *inode, unsigned long number);
 33 
 34 extern int  dquot_transfer(struct dentry *dentry, struct iattr *iattr);
 35 
 36 /*
 37  * Operations supported for diskquotas.
 38  */
 39 extern __inline__ void DQUOT_INIT(struct inode *inode)
 40 {
 41         if (inode->i_sb && inode->i_sb->dq_op)
 42                 inode->i_sb->dq_op->initialize(inode, -1);
 43 }
 44 
 45 extern __inline__ void DQUOT_DROP(struct inode *inode)
 46 {
 47         if (IS_QUOTAINIT(inode)) {
 48                 if (inode->i_sb && inode->i_sb->dq_op)
 49                         inode->i_sb->dq_op->drop(inode);
 50         }
 51 }
 52 
 53 extern __inline__ int DQUOT_PREALLOC_BLOCK(struct super_block *sb, const struct inode *inode, int nr)
 54 {
 55         if (sb->dq_op) {
 56                 if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), 1) == NO_QUOTA)
 57                         return 1;
 58         }
 59         return 0;
 60 }
 61 
 62 extern __inline__ int DQUOT_ALLOC_BLOCK(struct super_block *sb, const struct inode *inode, int nr)
 63 {
 64         if (sb->dq_op) {
 65                 if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), 0) == NO_QUOTA)
 66                         return 1;
 67         }
 68         return 0;
 69 }
 70 
 71 extern __inline__ int DQUOT_ALLOC_INODE(struct super_block *sb, struct inode *inode)
 72 {
 73         if (sb->dq_op) {
 74                 sb->dq_op->initialize (inode, -1);
 75                 if (sb->dq_op->alloc_inode (inode, 1))
 76                         return 1;
 77         }
 78         inode->i_flags |= S_QUOTA;
 79         return 0;
 80 }
 81 
 82 extern __inline__ void DQUOT_FREE_BLOCK(struct super_block *sb, const struct inode *inode, int nr)
 83 {
 84         if (sb->dq_op)
 85                 sb->dq_op->free_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize));
 86 }
 87 
 88 extern __inline__ void DQUOT_FREE_INODE(struct super_block *sb, struct inode *inode)
 89 {
 90         if (sb->dq_op)
 91                 sb->dq_op->free_inode(inode, 1);
 92 }
 93 
 94 extern __inline__ int DQUOT_TRANSFER(struct dentry *dentry, struct iattr *iattr)
 95 {
 96         int error = -EDQUOT;
 97 
 98         if (dentry->d_inode->i_sb->dq_op) {
 99                 dentry->d_inode->i_sb->dq_op->initialize(dentry->d_inode, -1);
100                 error = dentry->d_inode->i_sb->dq_op->transfer(dentry, iattr);
101         } else {
102                 error = notify_change(dentry, iattr);
103         }
104         return error;
105 }
106 
107 #define DQUOT_SYNC(dev) sync_dquots(dev, -1)
108 #define DQUOT_OFF(sb)   quota_off(sb, -1)
109 
110 #else
111 
112 /*
113  * NO-OP when quota not configured.
114  */
115 #define DQUOT_INIT(inode)                       do { } while(0)
116 #define DQUOT_DROP(inode)                       do { } while(0)
117 #define DQUOT_PREALLOC_BLOCK(sb, inode, nr)     (0)
118 #define DQUOT_ALLOC_BLOCK(sb, inode, nr)        (0)
119 #define DQUOT_ALLOC_INODE(sb, inode)            (0)
120 #define DQUOT_FREE_BLOCK(sb, inode, nr)         do { } while(0)
121 #define DQUOT_FREE_INODE(sb, inode)             do { } while(0)
122 #define DQUOT_SYNC(dev)                         do { } while(0)
123 #define DQUOT_OFF(sb)                           do { } while(0)
124 
125 /*
126  * Special case expands to a simple notify_change.
127  */
128 #define DQUOT_TRANSFER(dentry, iattr) notify_change(dentry, iattr)
129 
130 #endif /* CONFIG_QUOTA */
131 #endif /* _LINUX_QUOTAOPS_ */
132 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.