tree-wide: replace cg_{fd,path}_get_cgroupid() with {fd,path}_to_handle_u64()
This commit is contained in:
@@ -47,9 +47,6 @@ typedef union {
|
||||
.file_handle.handle_type = FILEID_KERNFS, \
|
||||
}
|
||||
|
||||
/* The .f_handle field is not aligned to 64bit on some archs, hence read it via an unaligned accessor */
|
||||
#define CG_FILE_HANDLE_CGROUPID(fh) unaligned_read_ne64(fh.file_handle.f_handle)
|
||||
|
||||
int cg_is_available(void) {
|
||||
struct statfs fs;
|
||||
|
||||
@@ -112,24 +109,6 @@ int cg_path_from_cgroupid(int cgroupfs_fd, uint64_t id, char **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cg_get_cgroupid_at(int dfd, const char *path, uint64_t *ret) {
|
||||
cg_file_handle fh = CG_FILE_HANDLE_INIT;
|
||||
int mnt_id;
|
||||
|
||||
assert(dfd >= 0 || (dfd == AT_FDCWD && path_is_absolute(path)));
|
||||
assert(ret);
|
||||
|
||||
/* This is cgroupfs so we know the size of the handle, thus no need to loop around like
|
||||
* name_to_handle_at_loop() does in mountpoint-util.c */
|
||||
if (name_to_handle_at(dfd, strempty(path), &fh.file_handle, &mnt_id, isempty(path) ? AT_EMPTY_PATH : 0) < 0) {
|
||||
assert(errno != EOVERFLOW);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
*ret = CG_FILE_HANDLE_CGROUPID(fh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cg_enumerate_processes(const char *path, FILE **ret) {
|
||||
_cleanup_free_ char *fs = NULL;
|
||||
FILE *f;
|
||||
|
||||
@@ -125,13 +125,6 @@ int cg_path_open(const char *path);
|
||||
int cg_cgroupid_open(int cgroupfs_fd, uint64_t id);
|
||||
|
||||
int cg_path_from_cgroupid(int cgroupfs_fd, uint64_t id, char **ret);
|
||||
int cg_get_cgroupid_at(int dfd, const char *path, uint64_t *ret);
|
||||
static inline int cg_path_get_cgroupid(const char *path, uint64_t *ret) {
|
||||
return cg_get_cgroupid_at(AT_FDCWD, path, ret);
|
||||
}
|
||||
static inline int cg_fd_get_cgroupid(int fd, uint64_t *ret) {
|
||||
return cg_get_cgroupid_at(fd, NULL, ret);
|
||||
}
|
||||
|
||||
typedef enum CGroupFlags {
|
||||
CGROUP_SIGCONT = 1 << 0,
|
||||
|
||||
Reference in New Issue
Block a user