]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/quota-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
8 /* Wrapper around the QCMD() macro of linux/quota.h that removes some undefined behaviour. A typical quota
9 * command such as QCMD(Q_GETQUOTA, USRQUOTA) cannot be resolved on platforms where "int" is 32bit, as it is
10 * larger than INT_MAX. Yikes, because that are basically all platforms Linux supports. Let's add a wrapper
11 * that explicitly takes its arguments as unsigned 32bit, and then converts the shift result explicitly to
12 * int, acknowledging the undefined behaviour of the kernel headers. This doesn't remove the undefined
13 * behaviour, but it stops ubsan from complaining about it. */
14 static inline int QCMD_FIXED(uint32_t cmd
, uint32_t type
) {
15 return (int) QCMD(cmd
, type
);
18 int quotactl_devno(int cmd
, dev_t devno
, int id
, void *addr
);
19 int quotactl_path(int cmd
, const char *path
, int id
, void *addr
);