Skip to content

Commit

Permalink
lapi: Split ficlone fallbacks from fs.h
Browse files Browse the repository at this point in the history
In the end splitting the ficlone fallbacks from fs.h is the easiest
solution we can do.

Link: https://lore.kernel.org/ltp/[email protected]/
Fixes: 3acc96d ("Add fallback definitions for lapi/fs.h")
Reviewed-by: Petr Vorel <[email protected]>
Signed-off-by: Cyril Hrubis <[email protected]>
  • Loading branch information
metan-ucw authored and pevik committed Jul 25, 2024
1 parent 21c70e6 commit d072715
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 23 deletions.
35 changes: 35 additions & 0 deletions include/lapi/ficlone.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2024 Andrea Cervesato <[email protected]>
* Copyright (C) 2024 Cyril Hrubis <[email protected]>
*/

#ifndef LAPI_FICLONE_H__
#define LAPI_FICLONE_H__

#include "config.h"

#ifdef HAVE_LINUX_FS_H
# include <linux/fs.h>
#endif

#include <stdint.h>

#ifndef HAVE_STRUCT_FILE_CLONE_RANGE
struct file_clone_range {
int64_t src_fd;
uint64_t src_offset;
uint64_t src_length;
uint64_t dest_offset;
};
#endif

#ifndef FICLONE
# define FICLONE _IOW(0x94, 9, int)
#endif

#ifndef FICLONERANGE
# define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
#endif

#endif /* LAPI_FICLONE_H__ */
18 changes: 0 additions & 18 deletions include/lapi/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,8 @@

#include <sys/user.h>
#include <limits.h>
#include <stdint.h>
#include "lapi/abisize.h"

#ifndef HAVE_STRUCT_FILE_CLONE_RANGE
struct file_clone_range {
int64_t src_fd;
uint64_t src_offset;
uint64_t src_length;
uint64_t dest_offset;
};
#endif

#ifndef FS_IOC_GETFLAGS
# define FS_IOC_GETFLAGS _IOR('f', 1, long)
#endif
Expand Down Expand Up @@ -58,14 +48,6 @@ struct file_clone_range {
# define FS_VERITY_FL 0x00100000 /* Verity protected inode */
#endif

#ifndef FICLONE
# define FICLONE _IOW(0x94, 9, int)
#endif

#ifndef FICLONERANGE
# define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
#endif

/*
* Helper function to get MAX_LFS_FILESIZE.
* Missing PAGE_SHIFT on some libc prevents defining MAX_LFS_FILESIZE.
Expand Down
2 changes: 1 addition & 1 deletion testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

#include "tst_test.h"
#include "lapi/fs.h"
#include "lapi/ficlone.h"

#define MNTPOINT "mnt"
#define SRCPATH MNTPOINT "/file0"
Expand Down
2 changes: 1 addition & 1 deletion testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

#include "tst_test.h"
#include "lapi/fs.h"
#include "lapi/ficlone.h"

#define MNTPOINT "mnt"
#define SRCPATH MNTPOINT "/file0"
Expand Down
2 changes: 1 addition & 1 deletion testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

#include "tst_test.h"
#include "lapi/fs.h"
#include "lapi/ficlone.h"

#define MNTPOINT "mnt"

Expand Down
2 changes: 1 addition & 1 deletion testcases/kernel/syscalls/ioctl/ioctl_ficlonerange01.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

#include "tst_test.h"
#include "lapi/fs.h"
#include "lapi/ficlone.h"

#define MNTPOINT "mnt"
#define SRCPATH MNTPOINT "/file0"
Expand Down
2 changes: 1 addition & 1 deletion testcases/kernel/syscalls/ioctl/ioctl_ficlonerange02.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

#include "tst_test.h"
#include "lapi/fs.h"
#include "lapi/ficlone.h"

#define MNTPOINT "mnt"
#define SRCPATH MNTPOINT "/file0"
Expand Down

0 comments on commit d072715

Please sign in to comment.