Lines Matching full:sb

27 static int check_quotactl_permission(struct super_block *sb, int type, int cmd,  in check_quotactl_permission()  argument
51 return security_quotactl(cmd, type, id, sb); in check_quotactl_permission()
54 static void quota_sync_one(struct super_block *sb, void *arg) in quota_sync_one() argument
58 if (sb->s_qcop && sb->s_qcop->quota_sync && in quota_sync_one()
59 (sb->s_quota_types & (1 << type))) in quota_sync_one()
60 sb->s_qcop->quota_sync(sb, type); in quota_sync_one()
86 static int quota_quotaon(struct super_block *sb, int type, qid_t id, in quota_quotaon() argument
89 if (!sb->s_qcop->quota_on && !sb->s_qcop->quota_enable) in quota_quotaon()
91 if (sb->s_qcop->quota_enable) in quota_quotaon()
92 return sb->s_qcop->quota_enable(sb, qtype_enforce_flag(type)); in quota_quotaon()
95 return sb->s_qcop->quota_on(sb, type, id, path); in quota_quotaon()
98 static int quota_quotaoff(struct super_block *sb, int type) in quota_quotaoff() argument
100 if (!sb->s_qcop->quota_off && !sb->s_qcop->quota_disable) in quota_quotaoff()
102 if (sb->s_qcop->quota_disable) in quota_quotaoff()
103 return sb->s_qcop->quota_disable(sb, qtype_enforce_flag(type)); in quota_quotaoff()
104 return sb->s_qcop->quota_off(sb, type); in quota_quotaoff()
107 static int quota_getfmt(struct super_block *sb, int type, void __user *addr) in quota_getfmt() argument
111 if (!sb_has_quota_active(sb, type)) in quota_getfmt()
113 fmt = sb_dqopt(sb)->info[type].dqi_format->qf_fmt_id; in quota_getfmt()
119 static int quota_getinfo(struct super_block *sb, int type, void __user *addr) in quota_getinfo() argument
126 if (!sb->s_qcop->get_state) in quota_getinfo()
128 ret = sb->s_qcop->get_state(sb, &state); in quota_getinfo()
147 static int quota_setinfo(struct super_block *sb, int type, void __user *addr) in quota_setinfo() argument
154 if (!sb->s_qcop->set_info) in quota_setinfo()
174 return sb->s_qcop->set_info(sb, type, &qinfo); in quota_setinfo()
201 static int quota_getquota(struct super_block *sb, int type, qid_t id, in quota_getquota() argument
209 if (!sb->s_qcop->get_dqblk) in quota_getquota()
212 if (!qid_has_mapping(sb->s_user_ns, qid)) in quota_getquota()
214 ret = sb->s_qcop->get_dqblk(sb, qid, &fdq); in quota_getquota()
237 static int quota_getnextquota(struct super_block *sb, int type, qid_t id, in quota_getnextquota() argument
245 if (!sb->s_qcop->get_nextdqblk) in quota_getnextquota()
248 if (!qid_has_mapping(sb->s_user_ns, qid)) in quota_getnextquota()
250 ret = sb->s_qcop->get_nextdqblk(sb, &qid, &fdq); in quota_getnextquota()
287 static int quota_setquota(struct super_block *sb, int type, qid_t id, in quota_setquota() argument
304 if (!sb->s_qcop->set_dqblk) in quota_setquota()
307 if (!qid_has_mapping(sb->s_user_ns, qid)) in quota_setquota()
310 return sb->s_qcop->set_dqblk(sb, qid, &fdq); in quota_setquota()
313 static int quota_enable(struct super_block *sb, void __user *addr) in quota_enable() argument
319 if (!sb->s_qcop->quota_enable) in quota_enable()
321 return sb->s_qcop->quota_enable(sb, flags); in quota_enable()
324 static int quota_disable(struct super_block *sb, void __user *addr) in quota_disable() argument
330 if (!sb->s_qcop->quota_disable) in quota_disable()
332 return sb->s_qcop->quota_disable(sb, flags); in quota_disable()
354 static int quota_getstate(struct super_block *sb, int type, in quota_getstate() argument
361 ret = sb->s_qcop->get_state(sb, &state); in quota_getstate()
434 static int quota_getxstate(struct super_block *sb, int type, void __user *addr) in quota_getxstate() argument
439 if (!sb->s_qcop->get_state) in quota_getxstate()
441 ret = quota_getstate(sb, type, &fqs); in quota_getxstate()
452 static int quota_getstatev(struct super_block *sb, int type, in quota_getstatev() argument
459 ret = sb->s_qcop->get_state(sb, &state); in quota_getstatev()
497 static int quota_getxstatev(struct super_block *sb, int type, void __user *addr) in quota_getxstatev() argument
502 if (!sb->s_qcop->get_state) in quota_getxstatev()
516 ret = quota_getstatev(sb, type, &fqs); in quota_getxstatev()
624 static int quota_setxquota(struct super_block *sb, int type, qid_t id, in quota_setxquota() argument
633 if (!sb->s_qcop->set_dqblk) in quota_setxquota()
636 if (!qid_has_mapping(sb->s_user_ns, qid)) in quota_setxquota()
639 if (from_kqid(sb->s_user_ns, qid) == 0 && in quota_setxquota()
644 if (!sb->s_qcop->set_info) in quota_setxquota()
647 ret = sb->s_qcop->set_info(sb, type, &qinfo); in quota_setxquota()
654 return sb->s_qcop->set_dqblk(sb, qid, &qdq); in quota_setxquota()
705 static int quota_getxquota(struct super_block *sb, int type, qid_t id, in quota_getxquota() argument
713 if (!sb->s_qcop->get_dqblk) in quota_getxquota()
716 if (!qid_has_mapping(sb->s_user_ns, qid)) in quota_getxquota()
718 ret = sb->s_qcop->get_dqblk(sb, qid, &qdq); in quota_getxquota()
731 static int quota_getnextxquota(struct super_block *sb, int type, qid_t id, in quota_getnextxquota() argument
740 if (!sb->s_qcop->get_nextdqblk) in quota_getnextxquota()
743 if (!qid_has_mapping(sb->s_user_ns, qid)) in quota_getnextxquota()
745 ret = sb->s_qcop->get_nextdqblk(sb, &qid, &qdq); in quota_getnextxquota()
755 static int quota_rmxquota(struct super_block *sb, void __user *addr) in quota_rmxquota() argument
761 if (!sb->s_qcop->rm_xquota) in quota_rmxquota()
763 return sb->s_qcop->rm_xquota(sb, flags); in quota_rmxquota()
767 static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, in do_quotactl() argument
777 if (!sb->s_qcop) in do_quotactl()
779 if (!(sb->s_quota_types & (1 << type))) in do_quotactl()
782 ret = check_quotactl_permission(sb, type, cmd, id); in do_quotactl()
788 return quota_quotaon(sb, type, id, path); in do_quotactl()
790 return quota_quotaoff(sb, type); in do_quotactl()
792 return quota_getfmt(sb, type, addr); in do_quotactl()
794 return quota_getinfo(sb, type, addr); in do_quotactl()
796 return quota_setinfo(sb, type, addr); in do_quotactl()
798 return quota_getquota(sb, type, id, addr); in do_quotactl()
800 return quota_getnextquota(sb, type, id, addr); in do_quotactl()
802 return quota_setquota(sb, type, id, addr); in do_quotactl()
804 if (!sb->s_qcop->quota_sync) in do_quotactl()
806 return sb->s_qcop->quota_sync(sb, type); in do_quotactl()
808 return quota_enable(sb, addr); in do_quotactl()
810 return quota_disable(sb, addr); in do_quotactl()
812 return quota_rmxquota(sb, addr); in do_quotactl()
814 return quota_getxstate(sb, type, addr); in do_quotactl()
816 return quota_getxstatev(sb, type, addr); in do_quotactl()
818 return quota_setxquota(sb, type, id, addr); in do_quotactl()
820 return quota_getxquota(sb, type, id, addr); in do_quotactl()
822 return quota_getnextxquota(sb, type, id, addr); in do_quotactl()
824 if (sb_rdonly(sb)) in do_quotactl()
869 struct super_block *sb; in quotactl_block() local
890 sb = user_get_super(dev, excl); in quotactl_block()
891 if (!sb) in quotactl_block()
893 if (thawed && sb->s_writers.frozen != SB_UNFROZEN) { in quotactl_block()
895 up_write(&sb->s_umount); in quotactl_block()
897 up_read(&sb->s_umount); in quotactl_block()
898 /* Wait for sb to unfreeze */ in quotactl_block()
899 sb_start_write(sb); in quotactl_block()
900 sb_end_write(sb); in quotactl_block()
901 put_super(sb); in quotactl_block()
904 return sb; in quotactl_block()
921 struct super_block *sb = NULL; in SYSCALL_DEFINE4() local
955 sb = quotactl_block(special, cmds); in SYSCALL_DEFINE4()
956 if (IS_ERR(sb)) { in SYSCALL_DEFINE4()
957 ret = PTR_ERR(sb); in SYSCALL_DEFINE4()
961 ret = do_quotactl(sb, type, cmds, id, addr, pathp); in SYSCALL_DEFINE4()
964 drop_super(sb); in SYSCALL_DEFINE4()
966 drop_super_exclusive(sb); in SYSCALL_DEFINE4()
976 struct super_block *sb; in SYSCALL_DEFINE4() local
994 sb = fd_file(f)->f_path.mnt->mnt_sb; in SYSCALL_DEFINE4()
996 down_write(&sb->s_umount); in SYSCALL_DEFINE4()
998 down_read(&sb->s_umount); in SYSCALL_DEFINE4()
1000 ret = do_quotactl(sb, type, cmds, id, addr, ERR_PTR(-EINVAL)); in SYSCALL_DEFINE4()
1003 up_write(&sb->s_umount); in SYSCALL_DEFINE4()
1005 up_read(&sb->s_umount); in SYSCALL_DEFINE4()