- /**
- * 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 *, const unsigned int []);
-
- /**
- * For quota client, set over quota flag for specifed uid/gid
- */
- int (*quota_setdq) (struct client_obd *, const unsigned int [],
- obd_flag, obd_flag);
-
- /**
- * For adjusting qunit size b=10600
- */
- int (*quota_adjust_qunit) (struct obd_export *exp,
- struct quota_adjust_qunit *oqaq,
- struct lustre_quota_ctxt *qctxt);
-
-} 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_check(quota_interface_t *interface,
- struct obd_device *obd,
- struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, check);
- rc = QUOTA_OP(interface, check)(obd, exp, oqctl);
- RETURN(rc);
-}
-
-static inline int lquota_ctl(quota_interface_t *interface,
- struct obd_device *obd,
- struct obd_quotactl *oqctl)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, ctl);
- rc = QUOTA_OP(interface, ctl)(obd, NULL, oqctl);
- RETURN(rc);
-}
-
-static inline int lquota_adjust(quota_interface_t *interface,
- struct obd_device *obd,
- const unsigned int qcids[],
- const 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, const unsigned int qid[])
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, chkdq);
- rc = QUOTA_OP(interface, chkdq)(cli, qid);
- RETURN(rc);
-}
-
-static inline int lquota_setdq(quota_interface_t *interface,
- struct client_obd *cli, const unsigned int qid[],
- obd_flag valid, obd_flag flags)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, setdq);
- rc = QUOTA_OP(interface, setdq)(cli, qid, 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_device *obd,
- void *data)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, setinfo);
- rc = QUOTA_OP(interface, setinfo)(obd, data);
- RETURN(rc);
-}
-
-static inline int lquota_clearinfo(quota_interface_t *interface,
- struct obd_export *exp,
- struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, clearinfo);
- rc = QUOTA_OP(interface, clearinfo)(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);
-}
-
-#ifdef __KERNEL__
-static inline int lquota_chkquota(quota_interface_t *interface,
- struct obd_device *obd,
- struct obd_export *exp,
- const unsigned int id[], int pending[],
- int count, struct obd_trans_info *oti,
- int isblk, void *data, int frags)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, chkquota);
- QUOTA_CHECK_OP(interface, acquire);
- rc = QUOTA_OP(interface, chkquota)(obd, exp, id, pending, count,
- QUOTA_OP(interface, acquire), oti,
- isblk, (struct inode *)data, frags);
- RETURN(rc);
-}
-
-static inline int lquota_pending_commit(quota_interface_t *interface,
- struct obd_device *obd,
- const unsigned int id[],
- int pending[], int isblk)
-{
- int rc;
- ENTRY;
-
- QUOTA_CHECK_OP(interface, pending_commit);
- rc = QUOTA_OP(interface, pending_commit)(obd, id, pending, isblk);
- RETURN(rc);
-}
-#endif