]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/quota-util.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
5 #include "alloc-util.h"
6 #include "blockdev-util.h"
7 #include "quota-util.h"
10 int quotactl_devno(int cmd
, dev_t devno
, int id
, void *addr
) {
11 _cleanup_free_
char *devnode
= NULL
;
14 /* Like quotactl() but takes a dev_t instead of a path to a device node, and fixes caddr_t → void*,
15 * like we should, today */
17 r
= device_path_make_major_minor(S_IFBLK
, devno
, &devnode
);
21 if (quotactl(cmd
, devnode
, id
, addr
) < 0)
27 int quotactl_path(int cmd
, const char *path
, int id
, void *addr
) {
31 /* Like quotactl() but takes a path to some fs object, and changes the backing file system. I.e. the
32 * argument shouldn't be a block device but a regular file system object */
34 r
= get_block_device(path
, &devno
);
37 if (devno
== 0) /* Doesn't have a block device */
40 return quotactl_devno(cmd
, devno
, id
, addr
);