Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _LINUX_CACHEFILES_H
0003 #define _LINUX_CACHEFILES_H
0004 
0005 #include <linux/types.h>
0006 #include <linux/ioctl.h>
0007 
0008 /*
0009  * Fscache ensures that the maximum length of cookie key is 255. The volume key
0010  * is controlled by netfs, and generally no bigger than 255.
0011  */
0012 #define CACHEFILES_MSG_MAX_SIZE 1024
0013 
0014 enum cachefiles_opcode {
0015     CACHEFILES_OP_OPEN,
0016     CACHEFILES_OP_CLOSE,
0017     CACHEFILES_OP_READ,
0018 };
0019 
0020 /*
0021  * Message Header
0022  *
0023  * @msg_id  a unique ID identifying this message
0024  * @opcode  message type, CACHEFILE_OP_*
0025  * @len     message length, including message header and following data
0026  * @object_id   a unique ID identifying a cache file
0027  * @data    message type specific payload
0028  */
0029 struct cachefiles_msg {
0030     __u32 msg_id;
0031     __u32 opcode;
0032     __u32 len;
0033     __u32 object_id;
0034     __u8  data[];
0035 };
0036 
0037 /*
0038  * @data contains the volume_key followed directly by the cookie_key. volume_key
0039  * is a NUL-terminated string; @volume_key_size indicates the size of the volume
0040  * key in bytes. cookie_key is binary data, which is netfs specific;
0041  * @cookie_key_size indicates the size of the cookie key in bytes.
0042  *
0043  * @fd identifies an anon_fd referring to the cache file.
0044  */
0045 struct cachefiles_open {
0046     __u32 volume_key_size;
0047     __u32 cookie_key_size;
0048     __u32 fd;
0049     __u32 flags;
0050     __u8  data[];
0051 };
0052 
0053 /*
0054  * @off     indicates the starting offset of the requested file range
0055  * @len     indicates the length of the requested file range
0056  */
0057 struct cachefiles_read {
0058     __u64 off;
0059     __u64 len;
0060 };
0061 
0062 /*
0063  * Reply for READ request
0064  * @arg for this ioctl is the @id field of READ request.
0065  */
0066 #define CACHEFILES_IOC_READ_COMPLETE    _IOW(0x98, 1, int)
0067 
0068 #endif