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

TOMOYO Linux Cross Reference
Linux/fs/quota/kqid.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/quota/kqid.c (Version linux-6.12-rc7) and /fs/quota/kqid.c (Version linux-3.10.108)


  1 // SPDX-License-Identifier: GPL-2.0            << 
  2 #include <linux/fs.h>                               1 #include <linux/fs.h>
  3 #include <linux/quota.h>                            2 #include <linux/quota.h>
  4 #include <linux/export.h>                           3 #include <linux/export.h>
  5                                                     4 
  6 /**                                                 5 /**
  7  *      qid_eq - Test to see if to kquid value      6  *      qid_eq - Test to see if to kquid values are the same
  8  *      @left: A qid value                          7  *      @left: A qid value
  9  *      @right: Another quid value                  8  *      @right: Another quid value
 10  *                                                  9  *
 11  *      Return true if the two qid values are      10  *      Return true if the two qid values are equal and false otherwise.
 12  */                                                11  */
 13 bool qid_eq(struct kqid left, struct kqid righ     12 bool qid_eq(struct kqid left, struct kqid right)
 14 {                                                  13 {
 15         if (left.type != right.type)               14         if (left.type != right.type)
 16                 return false;                      15                 return false;
 17         switch(left.type) {                        16         switch(left.type) {
 18         case USRQUOTA:                             17         case USRQUOTA:
 19                 return uid_eq(left.uid, right.     18                 return uid_eq(left.uid, right.uid);
 20         case GRPQUOTA:                             19         case GRPQUOTA:
 21                 return gid_eq(left.gid, right.     20                 return gid_eq(left.gid, right.gid);
 22         case PRJQUOTA:                             21         case PRJQUOTA:
 23                 return projid_eq(left.projid,      22                 return projid_eq(left.projid, right.projid);
 24         default:                                   23         default:
 25                 BUG();                             24                 BUG();
 26         }                                          25         }
 27 }                                                  26 }
 28 EXPORT_SYMBOL(qid_eq);                             27 EXPORT_SYMBOL(qid_eq);
 29                                                    28 
 30 /**                                                29 /**
 31  *      qid_lt - Test to see if one qid value      30  *      qid_lt - Test to see if one qid value is less than another
 32  *      @left: The possibly lesser qid value       31  *      @left: The possibly lesser qid value
 33  *      @right: The possibly greater qid value     32  *      @right: The possibly greater qid value
 34  *                                                 33  *
 35  *      Return true if left is less than right     34  *      Return true if left is less than right and false otherwise.
 36  */                                                35  */
 37 bool qid_lt(struct kqid left, struct kqid righ     36 bool qid_lt(struct kqid left, struct kqid right)
 38 {                                                  37 {
 39         if (left.type < right.type)                38         if (left.type < right.type)
 40                 return true;                       39                 return true;
 41         if (left.type > right.type)                40         if (left.type > right.type)
 42                 return false;                      41                 return false;
 43         switch (left.type) {                       42         switch (left.type) {
 44         case USRQUOTA:                             43         case USRQUOTA:
 45                 return uid_lt(left.uid, right.     44                 return uid_lt(left.uid, right.uid);
 46         case GRPQUOTA:                             45         case GRPQUOTA:
 47                 return gid_lt(left.gid, right.     46                 return gid_lt(left.gid, right.gid);
 48         case PRJQUOTA:                             47         case PRJQUOTA:
 49                 return projid_lt(left.projid,      48                 return projid_lt(left.projid, right.projid);
 50         default:                                   49         default:
 51                 BUG();                             50                 BUG();
 52         }                                          51         }
 53 }                                                  52 }
 54 EXPORT_SYMBOL(qid_lt);                             53 EXPORT_SYMBOL(qid_lt);
 55                                                    54 
 56 /**                                                55 /**
 57  *      from_kqid - Create a qid from a kqid u     56  *      from_kqid - Create a qid from a kqid user-namespace pair.
 58  *      @targ: The user namespace we want a qi     57  *      @targ: The user namespace we want a qid in.
 59  *      @kqid: The kernel internal quota ident !!  58  *      @kuid: The kernel internal quota identifier to start with.
 60  *                                                 59  *
 61  *      Map @kqid into the user-namespace spec     60  *      Map @kqid into the user-namespace specified by @targ and
 62  *      return the resulting qid.                  61  *      return the resulting qid.
 63  *                                                 62  *
 64  *      There is always a mapping into the ini     63  *      There is always a mapping into the initial user_namespace.
 65  *                                                 64  *
 66  *      If @kqid has no mapping in @targ (qid_     65  *      If @kqid has no mapping in @targ (qid_t)-1 is returned.
 67  */                                                66  */
 68 qid_t from_kqid(struct user_namespace *targ, s     67 qid_t from_kqid(struct user_namespace *targ, struct kqid kqid)
 69 {                                                  68 {
 70         switch (kqid.type) {                       69         switch (kqid.type) {
 71         case USRQUOTA:                             70         case USRQUOTA:
 72                 return from_kuid(targ, kqid.ui     71                 return from_kuid(targ, kqid.uid);
 73         case GRPQUOTA:                             72         case GRPQUOTA:
 74                 return from_kgid(targ, kqid.gi     73                 return from_kgid(targ, kqid.gid);
 75         case PRJQUOTA:                             74         case PRJQUOTA:
 76                 return from_kprojid(targ, kqid     75                 return from_kprojid(targ, kqid.projid);
 77         default:                                   76         default:
 78                 BUG();                             77                 BUG();
 79         }                                          78         }
 80 }                                                  79 }
 81 EXPORT_SYMBOL(from_kqid);                          80 EXPORT_SYMBOL(from_kqid);
 82                                                    81 
 83 /**                                                82 /**
 84  *      from_kqid_munged - Create a qid from a     83  *      from_kqid_munged - Create a qid from a kqid user-namespace pair.
 85  *      @targ: The user namespace we want a qi     84  *      @targ: The user namespace we want a qid in.
 86  *      @kqid: The kernel internal quota ident     85  *      @kqid: The kernel internal quota identifier to start with.
 87  *                                                 86  *
 88  *      Map @kqid into the user-namespace spec     87  *      Map @kqid into the user-namespace specified by @targ and
 89  *      return the resulting qid.                  88  *      return the resulting qid.
 90  *                                                 89  *
 91  *      There is always a mapping into the ini     90  *      There is always a mapping into the initial user_namespace.
 92  *                                                 91  *
 93  *      Unlike from_kqid from_kqid_munged neve     92  *      Unlike from_kqid from_kqid_munged never fails and always
 94  *      returns a valid projid.  This makes fr     93  *      returns a valid projid.  This makes from_kqid_munged
 95  *      appropriate for use in places where fa     94  *      appropriate for use in places where failing to provide
 96  *      a qid_t is not a good option.              95  *      a qid_t is not a good option.
 97  *                                                 96  *
 98  *      If @kqid has no mapping in @targ the k     97  *      If @kqid has no mapping in @targ the kqid.type specific
 99  *      overflow identifier is returned.           98  *      overflow identifier is returned.
100  */                                                99  */
101 qid_t from_kqid_munged(struct user_namespace *    100 qid_t from_kqid_munged(struct user_namespace *targ, struct kqid kqid)
102 {                                                 101 {
103         switch (kqid.type) {                      102         switch (kqid.type) {
104         case USRQUOTA:                            103         case USRQUOTA:
105                 return from_kuid_munged(targ,     104                 return from_kuid_munged(targ, kqid.uid);
106         case GRPQUOTA:                            105         case GRPQUOTA:
107                 return from_kgid_munged(targ,     106                 return from_kgid_munged(targ, kqid.gid);
108         case PRJQUOTA:                            107         case PRJQUOTA:
109                 return from_kprojid_munged(tar    108                 return from_kprojid_munged(targ, kqid.projid);
110         default:                                  109         default:
111                 BUG();                            110                 BUG();
112         }                                         111         }
113 }                                                 112 }
114 EXPORT_SYMBOL(from_kqid_munged);                  113 EXPORT_SYMBOL(from_kqid_munged);
115                                                   114 
116 /**                                               115 /**
117  *      qid_valid - Report if a valid value is    116  *      qid_valid - Report if a valid value is stored in a kqid.
118  *      @qid: The kernel internal quota identi    117  *      @qid: The kernel internal quota identifier to test.
119  */                                               118  */
120 bool qid_valid(struct kqid qid)                   119 bool qid_valid(struct kqid qid)
121 {                                                 120 {
122         switch (qid.type) {                       121         switch (qid.type) {
123         case USRQUOTA:                            122         case USRQUOTA:
124                 return uid_valid(qid.uid);        123                 return uid_valid(qid.uid);
125         case GRPQUOTA:                            124         case GRPQUOTA:
126                 return gid_valid(qid.gid);        125                 return gid_valid(qid.gid);
127         case PRJQUOTA:                            126         case PRJQUOTA:
128                 return projid_valid(qid.projid    127                 return projid_valid(qid.projid);
129         default:                                  128         default:
130                 BUG();                            129                 BUG();
131         }                                         130         }
132 }                                                 131 }
133 EXPORT_SYMBOL(qid_valid);                         132 EXPORT_SYMBOL(qid_valid);
134                                                   133 

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

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php