-typedef struct {
- int (*quota_init) (void);
- int (*quota_exit) (void);
- int (*quota_setup) (struct obd_device *);
- int (*quota_cleanup) (struct obd_device *);
- /* For quota master, close admin quota files */
- int (*quota_fs_cleanup) (struct obd_device *);
- int (*quota_ctl) (struct obd_export *, struct obd_quotactl *);
- int (*quota_check) (struct obd_export *, struct obd_quotactl *);
- int (*quota_recovery) (struct obd_device *);
-
- /* For quota master/slave, adjust quota limit after fs operation */
- int (*quota_adjust) (struct obd_device *, unsigned int[],
- unsigned int[], int, int);
-
- /* For quota slave, set import, trigger quota recovery */
- int (*quota_setinfo) (struct obd_export *, struct obd_device *);
-
- /* For quota slave, set proper thread resoure capability */
- int (*quota_enforce) (struct obd_device *, unsigned int);
-
- /* For quota slave, check whether specified uid/gid is over quota */
- int (*quota_getflag) (struct obd_device *, struct obdo *);
-
- /* For quota slave, acquire/release quota from master if needed */
- int (*quota_acquire) (struct obd_device *, unsigned int, unsigned int);
-
- /* For quota slave, check whether specified uid/gid's remaining quota
- * can finish a write rpc */
- int (*quota_chkquota) (struct obd_device *, unsigned int, unsigned int,
- int);
-
- /* For quota client, poll if the quota check done */
- int (*quota_poll_check) (struct obd_export *, struct if_quotacheck *);
-
- /* For quota client, check whether specified uid/gid is over quota */
- int (*quota_chkdq) (struct client_obd *, unsigned int, unsigned int);
-
- /* For quota client, set over quota flag for specifed uid/gid */
- int (*quota_setdq) (struct client_obd *, unsigned int, unsigned int,
- obd_flag, obd_flag);
-} quota_interface_t;
-
-#define Q_COPY(out, in, member) (out)->member = (in)->member
-
-#define QUOTA_OP(interface, op) interface->quota_ ## op
-
-#define QUOTA_CHECK_OP(interface, op) \
-do { \
- if (!interface) \
- RETURN(0); \
- if (!QUOTA_OP(interface, op)) { \
- CERROR("no quota operation: " #op "\n"); \
- RETURN(-EOPNOTSUPP); \
- } \
-} while(0)
-
-static inline int lquota_init(quota_interface_t *interface)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, init);
- rc = QUOTA_OP(interface, init)();
- RETURN(rc);
-}
-
-static inline int lquota_exit(quota_interface_t *interface)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, exit);
- rc = QUOTA_OP(interface, exit)();
- RETURN(rc);
-}
-
-static inline int lquota_setup(quota_interface_t *interface,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, setup);
- rc = QUOTA_OP(interface, setup)(obd);
- RETURN(rc);
-}
-
-static inline int lquota_cleanup(quota_interface_t *interface,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, cleanup);
- rc = QUOTA_OP(interface, cleanup)(obd);
- RETURN(rc);
-}
-
-static inline int lquota_fs_cleanup(quota_interface_t *interface,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, fs_cleanup);
- rc = QUOTA_OP(interface, fs_cleanup)(obd);
- RETURN(rc);
-}
-
-static inline int lquota_recovery(quota_interface_t *interface,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, recovery);
- rc = QUOTA_OP(interface, recovery)(obd);
- RETURN(rc);
-}
-
-static inline int lquota_adjust(quota_interface_t *interface,
- struct obd_device *obd,
- unsigned int qcids[],
- unsigned int qpids[],
- int rc, int opc)
-{
- int ret;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, adjust);
- ret = QUOTA_OP(interface, adjust)(obd, qcids, qpids, rc, opc);
- RETURN(ret);
-}
-
-static inline int lquota_chkdq(quota_interface_t *interface,
- struct client_obd *cli,
- unsigned int uid, unsigned int gid)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, chkdq);
- rc = QUOTA_OP(interface, chkdq)(cli, uid, gid);
- RETURN(rc);
-}
-
-static inline int lquota_setdq(quota_interface_t *interface,
- struct client_obd *cli,
- unsigned int uid, unsigned int gid,
- obd_flag valid, obd_flag flags)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, setdq);
- rc = QUOTA_OP(interface, setdq)(cli, uid, gid, valid, flags);
- RETURN(rc);
-}
-
-static inline int lquota_poll_check(quota_interface_t *interface,
- struct obd_export *exp,
- struct if_quotacheck *qchk)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, poll_check);
- rc = QUOTA_OP(interface, poll_check)(exp, qchk);
- RETURN(rc);
-}
-
-
-static inline int lquota_setinfo(quota_interface_t *interface,
- struct obd_export *exp,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, setinfo);
- rc = QUOTA_OP(interface, setinfo)(exp, obd);
- RETURN(rc);
-}
-
-static inline int lquota_enforce(quota_interface_t *interface,
- struct obd_device *obd,
- unsigned int ignore)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, enforce);
- rc = QUOTA_OP(interface, enforce)(obd, ignore);
- RETURN(rc);
-}
-
-static inline int lquota_getflag(quota_interface_t *interface,
- struct obd_device *obd, struct obdo *oa)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, getflag);
- rc = QUOTA_OP(interface, getflag)(obd, oa);
- RETURN(rc);
-}
-
-static inline int lquota_acquire(quota_interface_t *interface,
- struct obd_device *obd,
- unsigned int uid, unsigned int gid)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, acquire);
- rc = QUOTA_OP(interface, acquire)(obd, uid, gid);
- RETURN(rc);
-}
-
-static inline int lquota_chkquota(quota_interface_t *interface,
- struct obd_device *obd,
- unsigned int uid, unsigned int gid,
- int npage)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, chkquota);
- rc = QUOTA_OP(interface, chkquota)(obd, uid, gid, npage);
- RETURN(rc);
-}
-
-int lprocfs_rd_bunit(char *page, char **start, off_t off, int count,
- int *eof, void *data);
-int lprocfs_rd_iunit(char *page, char **start, off_t off, int count,
- int *eof, void *data);
-int lprocfs_wr_bunit(struct file *file, const char *buffer,
- unsigned long count, void *data);
-int lprocfs_wr_iunit(struct file *file, const char *buffer,
- unsigned long count, void *data);
-int lprocfs_rd_btune(char *page, char **start, off_t off, int count,
- int *eof, void *data);
-int lprocfs_rd_itune(char *page, char **start, off_t off, int count,
- int *eof, void *data);
-int lprocfs_wr_btune(struct file *file, const char *buffer,
- unsigned long count, void *data);
-int lprocfs_wr_itune(struct file *file, const char *buffer,
- unsigned long count, void *data);
-int lprocfs_rd_type(char *page, char **start, off_t off, int count,
- int *eof, void *data);
-int lprocfs_wr_type(struct file *file, const char *buffer,
- unsigned long count, void *data);
-
-#ifndef __KERNEL__
-extern quota_interface_t osc_quota_interface;
-extern quota_interface_t mdc_quota_interface;
-extern quota_interface_t lov_quota_interface;
-#endif