2003-02-18 22:55:36 +00:00
|
|
|
STRUCT_SPECIAL(termios)
|
|
|
|
|
|
|
|
STRUCT(winsize,
|
|
|
|
TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT)
|
|
|
|
|
|
|
|
STRUCT(serial_multiport_struct,
|
|
|
|
TYPE_INT, TYPE_INT, TYPE_CHAR, TYPE_CHAR, TYPE_INT, TYPE_CHAR, TYPE_CHAR,
|
2007-09-16 21:08:06 +00:00
|
|
|
TYPE_INT, TYPE_CHAR, TYPE_CHAR, TYPE_INT, TYPE_CHAR, TYPE_CHAR, TYPE_INT,
|
2003-02-18 22:55:36 +00:00
|
|
|
MK_ARRAY(TYPE_INT, 32))
|
|
|
|
|
|
|
|
STRUCT(serial_icounter_struct,
|
|
|
|
TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, MK_ARRAY(TYPE_INT, 16))
|
|
|
|
|
|
|
|
STRUCT(sockaddr,
|
|
|
|
TYPE_SHORT, MK_ARRAY(TYPE_CHAR, 14))
|
|
|
|
|
|
|
|
STRUCT(rtentry,
|
2007-09-16 21:08:06 +00:00
|
|
|
TYPE_ULONG, MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr),
|
|
|
|
TYPE_SHORT, TYPE_SHORT, TYPE_ULONG, TYPE_PTRVOID, TYPE_SHORT, TYPE_PTRVOID,
|
2003-02-18 22:55:36 +00:00
|
|
|
TYPE_ULONG, TYPE_ULONG, TYPE_SHORT)
|
|
|
|
|
|
|
|
STRUCT(ifmap,
|
2007-09-16 21:08:06 +00:00
|
|
|
TYPE_ULONG, TYPE_ULONG, TYPE_SHORT, TYPE_CHAR, TYPE_CHAR, TYPE_CHAR,
|
2003-02-18 22:55:36 +00:00
|
|
|
/* Spare 3 bytes */
|
|
|
|
TYPE_CHAR, TYPE_CHAR, TYPE_CHAR)
|
|
|
|
|
|
|
|
/* The *_ifreq_list arrays deal with the fact that struct ifreq has unions */
|
|
|
|
|
|
|
|
STRUCT(sockaddr_ifreq,
|
|
|
|
MK_ARRAY(TYPE_CHAR, IFNAMSIZ), MK_STRUCT(STRUCT_sockaddr))
|
2007-09-17 08:09:54 +00:00
|
|
|
|
2003-02-18 22:55:36 +00:00
|
|
|
STRUCT(short_ifreq,
|
|
|
|
MK_ARRAY(TYPE_CHAR, IFNAMSIZ), TYPE_SHORT)
|
|
|
|
|
|
|
|
STRUCT(int_ifreq,
|
|
|
|
MK_ARRAY(TYPE_CHAR, IFNAMSIZ), TYPE_INT)
|
|
|
|
|
|
|
|
STRUCT(ifmap_ifreq,
|
|
|
|
MK_ARRAY(TYPE_CHAR, IFNAMSIZ), MK_STRUCT(STRUCT_ifmap))
|
|
|
|
|
|
|
|
STRUCT(char_ifreq,
|
|
|
|
MK_ARRAY(TYPE_CHAR, IFNAMSIZ),
|
|
|
|
MK_ARRAY(TYPE_CHAR, IFNAMSIZ))
|
|
|
|
|
|
|
|
STRUCT(ptr_ifreq,
|
|
|
|
MK_ARRAY(TYPE_CHAR, IFNAMSIZ), TYPE_PTRVOID)
|
|
|
|
|
|
|
|
STRUCT(ifconf,
|
|
|
|
TYPE_INT, TYPE_PTRVOID)
|
|
|
|
|
|
|
|
STRUCT(arpreq,
|
2007-09-16 21:08:06 +00:00
|
|
|
MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), TYPE_INT, MK_STRUCT(STRUCT_sockaddr),
|
2003-02-18 22:55:36 +00:00
|
|
|
MK_ARRAY(TYPE_CHAR, 16))
|
|
|
|
|
|
|
|
STRUCT(arpreq_old,
|
|
|
|
MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), TYPE_INT, MK_STRUCT(STRUCT_sockaddr))
|
|
|
|
|
|
|
|
STRUCT(cdrom_read_audio,
|
|
|
|
TYPE_CHAR, TYPE_CHAR, TYPE_CHAR, TYPE_CHAR, TYPE_CHAR, TYPE_INT, TYPE_PTRVOID,
|
|
|
|
TYPE_NULL)
|
|
|
|
|
|
|
|
STRUCT(hd_geometry,
|
|
|
|
TYPE_CHAR, TYPE_CHAR, TYPE_SHORT, TYPE_ULONG)
|
2003-03-16 20:28:50 +00:00
|
|
|
|
|
|
|
STRUCT(dirent,
|
|
|
|
TYPE_LONG, TYPE_LONG, TYPE_SHORT, MK_ARRAY(TYPE_CHAR, 256))
|
2003-05-10 12:38:16 +00:00
|
|
|
|
|
|
|
STRUCT(kbentry,
|
|
|
|
TYPE_CHAR, TYPE_CHAR, TYPE_SHORT)
|
2003-06-15 19:58:13 +00:00
|
|
|
|
2006-03-25 19:31:22 +00:00
|
|
|
STRUCT(kbsentry,
|
|
|
|
TYPE_CHAR, MK_ARRAY(TYPE_CHAR, 512))
|
|
|
|
|
2003-06-15 19:58:13 +00:00
|
|
|
STRUCT(audio_buf_info,
|
|
|
|
TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT)
|
|
|
|
|
|
|
|
STRUCT(count_info,
|
|
|
|
TYPE_INT, TYPE_INT, TYPE_INT)
|
|
|
|
|
2012-07-23 08:06:15 +00:00
|
|
|
STRUCT(buffmem_desc,
|
|
|
|
TYPE_PTRVOID, TYPE_INT)
|
|
|
|
|
2003-06-15 19:58:13 +00:00
|
|
|
STRUCT(mixer_info,
|
|
|
|
MK_ARRAY(TYPE_CHAR, 16), MK_ARRAY(TYPE_CHAR, 32), TYPE_INT, MK_ARRAY(TYPE_INT, 10))
|
2008-04-26 14:44:49 +00:00
|
|
|
|
linux-user: Add support for getting alsa timer version and id
This patch implements functionalities of following ioctls:
SNDRV_TIMER_IOCTL_PVERSION - Getting the sound timer version
Read the sound timer version. The third ioctl's argument is
a pointer to an int in which the specified timers version
is returned.
SNDRV_TIMER_IOCTL_NEXT_DEVICE - Getting id information about next timer
Read id information about the next timer device from the sound timer
device list. The id infomration is returned in the following structure:
struct snd_timer_id {
int dev_class; /* timer device class number */
int dev_sclass; /* slave device class number (unused) */
int card; /* card number */
int device; /* device number */
int subdevice; /* sub-device number */
};
The devices in the sound timer device list are arranged by the fields
of this structure respectively (first by dev_class number, then by
card number, ...). A pointer to this structure should be passed as
the third ioctl's argument. Before calling the ioctl, the parameters
of this structure should be initialized in relation to the next timer
device which information is to be obtained. For example, if a wanted
timer device has the device class number equal to or bigger then 2,
the field dev_class should be initialized to 2. After the ioctl call,
the structure fields are filled with values from the next device in
the sound timer device list. If there is no next device in the list,
the structure is filled with "zero" id values (in that case all
fields are filled with value -1).
Implementation notes:
The ioctl 'SNDRV_TIMER_IOCTL_NEXT_DEVICE' has a pointer to a
'struct snd_timer_id' as its third argument. That is the reason why
corresponding definition is added in 'linux-user/syscall_types.h'.
Since all elements of this structure are of type 'int', the rest of
the implementation was straightforward.
The line '#include <linux/rtc.h>' was added to recognize
preprocessor definitions for these ioctls. This needs to be
done only once in this series of commits. Also, the content
of this file (with respect to ioctl definitions) remained
unchanged for a long time, therefore there is no need to
worry about supporting older Linux kernel version.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-8-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-01-15 19:36:41 +00:00
|
|
|
STRUCT(snd_timer_id,
|
|
|
|
TYPE_INT, /* dev_class */
|
|
|
|
TYPE_INT, /* dev_sclass */
|
|
|
|
TYPE_INT, /* card */
|
|
|
|
TYPE_INT, /* device */
|
|
|
|
TYPE_INT) /* subdevice */
|
|
|
|
|
linux-user: Add support for getting/setting specified alsa timer parameters using ioctls
This patch implements functionalities of following ioctls:
SNDRV_TIMER_IOCTL_GINFO - Getting information about specified timer
Read information about the specified timer. The information about the
timer is returned in the following structure:
struct snd_timer_ginfo {
struct snd_timer_id tid; /* requested timer ID */
unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
int card; /* card number */
unsigned char id[64]; /* timer identification */
unsigned char name[80]; /* timer name */
unsigned long reserved0; /* reserved for future use */
unsigned long resolution; /* average period resolution in ns */
unsigned long resolution_min; /* minimal period resolution in ns */
unsigned long resolution_max; /* maximal period resolution in ns */
unsigned int clients; /* active timer clients */
unsigned char reserved[32]; /* reserved */
};
A pointer to this structure should be passed as the third ioctl's argument.
Before calling the ioctl, the field "tid" should be initialized with the id
information for the timer which information is to be obtained. After the
ioctl call, the rest of the structure fields are filled with values from
the timer device with the specified id. If there is no device with the
specified id, the error ENODEV ("No such device") is returned.
SNDRV_TIMER_IOCTL_GPARAMS - Setting precise period duration
Sets timer precise period duration numerator and denominator in seconds. The
period duration is set in the following structure:
struct snd_timer_gparams {
struct snd_timer_id tid; /* requested timer ID */
unsigned long period_num; /* period duration - numerator */
unsigned long period_den; /* period duration - denominator */
unsigned char reserved[32]; /* reserved */
};
A pointer to this structure should be passed as the third ioctl's argument.
Before calling the ioctl, the field "tid" should be initialized with the id
information for the timer which period duration is to be set. Also, the
fileds "period_num" and "period_den" should be filled with the period
duration numerator and denominator values that are to be set respectively.
If there is no device with the specified id, the error ENODEV ("No such
device") is returned.
SNDRV_TIMER_IOCTL_GSTATUS - Getting current period resolution
Read timer current period resolution in nanoseconds and period resolution
numerator and denominator in seconds. The period resolution information is
returned in the following structure:
struct snd_timer_gstatus {
struct snd_timer_id tid; /* requested timer ID */
unsigned long resolution; /* current period resolution in ns */
unsigned long resolution_num; /* period resolution - numerator */
unsigned long resolution_den; /* period resolution - denominator */
unsigned char reserved[32]; /* reserved for future use */
};
A pointer to this structure should be passed as the third ioctl's argument.
Before calling the ioctl, the field "tid" should be initialized with the id
information for the timer which period resolution is to be obtained. After
the ioctl call, the rest of the structure fields are filled with values
from the timer device with the specified id. If there is no device with the
specified id, the error ENODEV ("No such device") is returned.
Implementation notes:
All ioctls in this patch have pointer to some kind of a structure as their
third argument. That is the reason why corresponding definitions were added
in 'linux-user/syscall_types.h'. All of these strcutures have some fields
that are of type 'unsigned long'. That is the reason why separate target
structures were defined in 'linux-user/syscall_defs.h'. Also, all of the
structures have a field with type 'struct snd_timer_id' which is the reason
why a separate target structure 'struct target_snd_timer_id' was also
defined. The rest of the implementation was straightforward.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-10-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-01-15 19:36:43 +00:00
|
|
|
STRUCT(snd_timer_ginfo,
|
|
|
|
MK_STRUCT(STRUCT_snd_timer_id), /* tid */
|
|
|
|
TYPE_INT, /* flags */
|
|
|
|
TYPE_INT, /* card */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 64), /* id */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 80), /* name */
|
|
|
|
TYPE_ULONG, /* reserved0 */
|
|
|
|
TYPE_ULONG, /* resolution */
|
|
|
|
TYPE_ULONG, /* resolution_min */
|
|
|
|
TYPE_ULONG, /* resolution_max */
|
|
|
|
TYPE_INT, /* clients */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
|
|
|
|
|
|
|
|
STRUCT(snd_timer_gparams,
|
|
|
|
MK_STRUCT(STRUCT_snd_timer_id), /* tid */
|
|
|
|
TYPE_ULONG, /* period_num */
|
|
|
|
TYPE_ULONG, /* period_den */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
|
|
|
|
|
|
|
|
STRUCT(snd_timer_gstatus,
|
|
|
|
MK_STRUCT(STRUCT_snd_timer_id), /* tid */
|
|
|
|
TYPE_ULONG, /* resolution */
|
|
|
|
TYPE_ULONG, /* resolution_num */
|
|
|
|
TYPE_ULONG, /* resolution_den */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
|
|
|
|
|
2020-01-15 19:36:44 +00:00
|
|
|
STRUCT(snd_timer_select,
|
|
|
|
MK_STRUCT(STRUCT_snd_timer_id), /* id */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
|
|
|
|
|
2020-01-15 19:36:45 +00:00
|
|
|
STRUCT(snd_timer_info,
|
|
|
|
TYPE_INT, /* flags */
|
|
|
|
TYPE_INT, /* card */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 64), /* id */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 80), /* name */
|
|
|
|
TYPE_ULONG, /* reserved0 */
|
|
|
|
TYPE_ULONG, /* resolution */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 64)) /* reserved */
|
|
|
|
|
|
|
|
STRUCT(snd_timer_params,
|
|
|
|
TYPE_INT, /* flags */
|
|
|
|
TYPE_INT, /* ticks */
|
|
|
|
TYPE_INT, /* queue_size */
|
|
|
|
TYPE_INT, /* reserved0 */
|
|
|
|
TYPE_INT, /* filter */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 60)) /* reserved */
|
|
|
|
|
2020-06-19 12:47:26 +00:00
|
|
|
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
|
|
|
|
STRUCT(timeval,
|
|
|
|
TYPE_LONG, /* tv_sec */
|
|
|
|
TYPE_INT) /* tv_usec */
|
|
|
|
|
|
|
|
STRUCT(_kernel_sock_timeval,
|
|
|
|
TYPE_LONG, /* tv_sec */
|
|
|
|
TYPE_INT) /* tv_usec */
|
|
|
|
#else
|
|
|
|
STRUCT(timeval,
|
|
|
|
TYPE_LONG, /* tv_sec */
|
|
|
|
TYPE_LONG) /* tv_usec */
|
|
|
|
|
|
|
|
STRUCT(_kernel_sock_timeval,
|
|
|
|
TYPE_LONGLONG, /* tv_sec */
|
|
|
|
TYPE_LONGLONG) /* tv_usec */
|
|
|
|
#endif
|
|
|
|
|
2020-01-15 19:36:45 +00:00
|
|
|
STRUCT(timespec,
|
|
|
|
TYPE_LONG, /* tv_sec */
|
|
|
|
TYPE_LONG) /* tv_nsec */
|
|
|
|
|
2020-06-19 12:47:26 +00:00
|
|
|
STRUCT(_kernel_timespec,
|
|
|
|
TYPE_LONGLONG, /* tv_sec */
|
|
|
|
TYPE_LONGLONG) /* tv_nsec */
|
|
|
|
|
2020-01-15 19:36:45 +00:00
|
|
|
STRUCT(snd_timer_status,
|
|
|
|
MK_STRUCT(STRUCT_timespec), /* tstamp */
|
|
|
|
TYPE_INT, /* resolution */
|
|
|
|
TYPE_INT, /* lost */
|
|
|
|
TYPE_INT, /* overrun */
|
|
|
|
TYPE_INT, /* queue */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 64)) /* reserved */
|
|
|
|
|
2008-04-26 14:44:49 +00:00
|
|
|
/* loop device ioctls */
|
|
|
|
STRUCT(loop_info,
|
|
|
|
TYPE_INT, /* lo_number */
|
2012-01-31 18:44:41 +00:00
|
|
|
TYPE_OLDDEVT, /* lo_device */
|
2008-04-26 14:44:49 +00:00
|
|
|
TYPE_ULONG, /* lo_inode */
|
2012-01-31 18:44:41 +00:00
|
|
|
TYPE_OLDDEVT, /* lo_rdevice */
|
2008-04-26 14:44:49 +00:00
|
|
|
TYPE_INT, /* lo_offset */
|
|
|
|
TYPE_INT, /* lo_encrypt_type */
|
|
|
|
TYPE_INT, /* lo_encrypt_key_size */
|
|
|
|
TYPE_INT, /* lo_flags */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 64), /* lo_name */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 32), /* lo_encrypt_key */
|
|
|
|
MK_ARRAY(TYPE_ULONG, 2), /* lo_init */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 4)) /* reserved */
|
|
|
|
|
|
|
|
STRUCT(loop_info64,
|
|
|
|
TYPE_ULONGLONG, /* lo_device */
|
|
|
|
TYPE_ULONGLONG, /* lo_inode */
|
|
|
|
TYPE_ULONGLONG, /* lo_rdevice */
|
|
|
|
TYPE_ULONGLONG, /* lo_offset */
|
2016-07-05 15:36:29 +00:00
|
|
|
TYPE_ULONGLONG, /* lo_sizelimit */
|
|
|
|
TYPE_INT, /* lo_number */
|
|
|
|
TYPE_INT, /* lo_encrypt_type */
|
|
|
|
TYPE_INT, /* lo_encrypt_key_size */
|
|
|
|
TYPE_INT, /* lo_flags */
|
2008-04-26 14:44:49 +00:00
|
|
|
MK_ARRAY(TYPE_CHAR, 64), /* lo_name */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 64), /* lo_crypt_name */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 32), /* lo_encrypt_key */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG, 2)) /* lo_init */
|
2008-09-20 03:03:09 +00:00
|
|
|
|
|
|
|
/* mag tape ioctls */
|
|
|
|
STRUCT(mtop, TYPE_SHORT, TYPE_INT)
|
|
|
|
STRUCT(mtget, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG,
|
|
|
|
TYPE_INT, TYPE_INT)
|
|
|
|
STRUCT(mtpos, TYPE_LONG)
|
2009-10-16 15:00:44 +00:00
|
|
|
|
|
|
|
STRUCT(fb_fix_screeninfo,
|
|
|
|
MK_ARRAY(TYPE_CHAR, 16), /* id */
|
|
|
|
TYPE_ULONG, /* smem_start */
|
|
|
|
TYPE_INT, /* smem_len */
|
|
|
|
TYPE_INT, /* type */
|
|
|
|
TYPE_INT, /* type_aux */
|
|
|
|
TYPE_INT, /* visual */
|
|
|
|
TYPE_SHORT, /* xpanstep */
|
|
|
|
TYPE_SHORT, /* ypanstep */
|
|
|
|
TYPE_SHORT, /* ywrapstep */
|
|
|
|
TYPE_INT, /* line_length */
|
|
|
|
TYPE_ULONG, /* mmio_start */
|
|
|
|
TYPE_INT, /* mmio_len */
|
|
|
|
TYPE_INT, /* accel */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 3)) /* reserved */
|
|
|
|
|
|
|
|
STRUCT(fb_var_screeninfo,
|
|
|
|
TYPE_INT, /* xres */
|
|
|
|
TYPE_INT, /* yres */
|
|
|
|
TYPE_INT, /* xres_virtual */
|
|
|
|
TYPE_INT, /* yres_virtual */
|
|
|
|
TYPE_INT, /* xoffset */
|
|
|
|
TYPE_INT, /* yoffset */
|
|
|
|
TYPE_INT, /* bits_per_pixel */
|
|
|
|
TYPE_INT, /* grayscale */
|
|
|
|
MK_ARRAY(TYPE_INT, 3), /* red */
|
|
|
|
MK_ARRAY(TYPE_INT, 3), /* green */
|
|
|
|
MK_ARRAY(TYPE_INT, 3), /* blue */
|
|
|
|
MK_ARRAY(TYPE_INT, 3), /* transp */
|
|
|
|
TYPE_INT, /* nonstd */
|
|
|
|
TYPE_INT, /* activate */
|
|
|
|
TYPE_INT, /* height */
|
|
|
|
TYPE_INT, /* width */
|
|
|
|
TYPE_INT, /* accel_flags */
|
|
|
|
TYPE_INT, /* pixclock */
|
|
|
|
TYPE_INT, /* left_margin */
|
|
|
|
TYPE_INT, /* right_margin */
|
|
|
|
TYPE_INT, /* upper_margin */
|
|
|
|
TYPE_INT, /* lower_margin */
|
|
|
|
TYPE_INT, /* hsync_len */
|
|
|
|
TYPE_INT, /* vsync_len */
|
|
|
|
TYPE_INT, /* sync */
|
|
|
|
TYPE_INT, /* vmode */
|
|
|
|
TYPE_INT, /* rotate */
|
|
|
|
MK_ARRAY(TYPE_INT, 5)) /* reserved */
|
|
|
|
|
2011-06-29 13:09:11 +00:00
|
|
|
STRUCT(fb_cmap,
|
|
|
|
TYPE_INT, /* start */
|
|
|
|
TYPE_INT, /* len */
|
|
|
|
TYPE_PTRVOID, /* red */
|
|
|
|
TYPE_PTRVOID, /* green */
|
|
|
|
TYPE_PTRVOID, /* blue */
|
|
|
|
TYPE_PTRVOID) /* transp */
|
|
|
|
|
|
|
|
STRUCT(fb_con2fbmap,
|
|
|
|
TYPE_INT, /* console */
|
|
|
|
TYPE_INT) /* framebuffer */
|
|
|
|
|
|
|
|
|
2009-10-16 15:00:44 +00:00
|
|
|
STRUCT(vt_stat,
|
|
|
|
TYPE_SHORT, /* v_active */
|
|
|
|
TYPE_SHORT, /* v_signal */
|
|
|
|
TYPE_SHORT) /* v_state */
|
2011-01-06 15:04:18 +00:00
|
|
|
|
2011-06-29 13:09:10 +00:00
|
|
|
STRUCT(vt_mode,
|
|
|
|
TYPE_CHAR, /* mode */
|
|
|
|
TYPE_CHAR, /* waitv */
|
|
|
|
TYPE_SHORT, /* relsig */
|
|
|
|
TYPE_SHORT, /* acqsig */
|
|
|
|
TYPE_SHORT) /* frsig */
|
|
|
|
|
2012-01-31 17:42:06 +00:00
|
|
|
STRUCT(dm_ioctl,
|
|
|
|
MK_ARRAY(TYPE_INT, 3), /* version */
|
|
|
|
TYPE_INT, /* data_size */
|
|
|
|
TYPE_INT, /* data_start */
|
|
|
|
TYPE_INT, /* target_count*/
|
|
|
|
TYPE_INT, /* open_count */
|
|
|
|
TYPE_INT, /* flags */
|
|
|
|
TYPE_INT, /* event_nr */
|
|
|
|
TYPE_INT, /* padding */
|
|
|
|
TYPE_ULONGLONG, /* dev */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 128), /* name */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 129), /* uuid */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 7)) /* data */
|
|
|
|
|
|
|
|
STRUCT(dm_target_spec,
|
|
|
|
TYPE_ULONGLONG, /* sector_start */
|
|
|
|
TYPE_ULONGLONG, /* length */
|
|
|
|
TYPE_INT, /* status */
|
|
|
|
TYPE_INT, /* next */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 16)) /* target_type */
|
|
|
|
|
|
|
|
STRUCT(dm_target_deps,
|
|
|
|
TYPE_INT, /* count */
|
|
|
|
TYPE_INT) /* padding */
|
|
|
|
|
|
|
|
STRUCT(dm_name_list,
|
|
|
|
TYPE_ULONGLONG, /* dev */
|
|
|
|
TYPE_INT) /* next */
|
|
|
|
|
|
|
|
STRUCT(dm_target_versions,
|
|
|
|
TYPE_INT, /* next */
|
|
|
|
MK_ARRAY(TYPE_INT, 3)) /* version*/
|
|
|
|
|
|
|
|
STRUCT(dm_target_msg,
|
|
|
|
TYPE_ULONGLONG) /* sector */
|
|
|
|
|
2020-06-05 01:32:21 +00:00
|
|
|
STRUCT(drm_version,
|
|
|
|
TYPE_INT, /* version_major */
|
|
|
|
TYPE_INT, /* version_minor */
|
|
|
|
TYPE_INT, /* version_patchlevel */
|
|
|
|
TYPE_ULONG, /* name_len */
|
|
|
|
TYPE_PTRVOID, /* name */
|
|
|
|
TYPE_ULONG, /* date_len */
|
|
|
|
TYPE_PTRVOID, /* date */
|
|
|
|
TYPE_ULONG, /* desc_len */
|
|
|
|
TYPE_PTRVOID) /* desc */
|
|
|
|
|
2020-08-02 13:39:38 +00:00
|
|
|
STRUCT(drm_i915_getparam,
|
|
|
|
TYPE_INT, /* param */
|
|
|
|
TYPE_PTRVOID) /* value */
|
|
|
|
|
2017-02-11 22:26:02 +00:00
|
|
|
STRUCT(file_clone_range,
|
|
|
|
TYPE_LONGLONG, /* src_fd */
|
|
|
|
TYPE_ULONGLONG, /* src_offset */
|
|
|
|
TYPE_ULONGLONG, /* src_length */
|
|
|
|
TYPE_ULONGLONG) /* dest_offset */
|
|
|
|
|
2011-01-06 15:04:18 +00:00
|
|
|
STRUCT(fiemap_extent,
|
|
|
|
TYPE_ULONGLONG, /* fe_logical */
|
|
|
|
TYPE_ULONGLONG, /* fe_physical */
|
|
|
|
TYPE_ULONGLONG, /* fe_length */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG, 2), /* fe_reserved64[2] */
|
|
|
|
TYPE_INT, /* fe_flags */
|
|
|
|
MK_ARRAY(TYPE_INT, 3)) /* fe_reserved[3] */
|
|
|
|
|
|
|
|
STRUCT(fiemap,
|
|
|
|
TYPE_ULONGLONG, /* fm_start */
|
|
|
|
TYPE_ULONGLONG, /* fm_length */
|
|
|
|
TYPE_INT, /* fm_flags */
|
|
|
|
TYPE_INT, /* fm_mapped_extents */
|
|
|
|
TYPE_INT, /* fm_extent_count */
|
|
|
|
TYPE_INT) /* fm_reserved */
|
2014-01-18 06:38:30 +00:00
|
|
|
|
|
|
|
STRUCT(blkpg_partition,
|
|
|
|
TYPE_LONGLONG, /* start */
|
|
|
|
TYPE_LONGLONG, /* length */
|
|
|
|
TYPE_INT, /* pno */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BLKPG_DEVNAMELTH), /* devname */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BLKPG_VOLNAMELTH)) /* volname */
|
|
|
|
|
2020-08-23 19:50:08 +00:00
|
|
|
#if defined(BTRFS_IOC_SUBVOL_CREATE) || defined(BTRFS_IOC_SNAP_CREATE) || \
|
linux-user: Add support for btrfs ioctls used to manipulate with devices
This patch implements functionality for following ioctls:
BTRFS_IOC_SCAN_DEV - Scanning device for a btrfs filesystem
Scan a device for a btrfs filesystem. The device that is to
be scanned is passed in the ioctl's third argument which
represents a pointer to a 'struct ioc_vol_args' (which was
mentioned in a previous patch). Before calling this ioctl,
the name field of this structure should be filled with the
aproppriate name value which represents a path for the device.
If the device contains a btrfs filesystem, the ioctl returns 0,
otherwise a negative value is returned.
BTRFS_IOC_ADD_DEV - Adding a device to a btrfs filesystem
Add a device to a btrfs filesystem. The device that is to be
added is passed in the ioctl's third argument which represents
a pointer to a 'struct ioc_vol_args' (which was mentioned in
a previous patch). Before calling this ioctl, the name field of
this structure should be filled with the aproppriate name value
which represents a path for the device.
BTRFS_IOC_RM_DEV - Removing a device from a btrfs filesystem
Remove a device from a btrfs filesystem. The device that is to be
removed is passed in the ioctl's third argument which represents
a pointer to a 'struct ioc_vol_args' (which was mentioned in
a previous patch). Before calling this ioctl, the name field of
this structure should be filled with the aproppriate name value
which represents a path for the device.
BTRFS_IOC_DEV_INFO - Getting information about a device
Obtain information for device in a btrfs filesystem. The information
is gathered in the ioctl's third argument which represents a pointer
to a following structure type:
struct btrfs_ioctl_dev_info_args {
__u64 devid; /* in/out */
__u8 uuid[BTRFS_UUID_SIZE]; /* in/out */
__u64 bytes_used; /* out */
__u64 total_bytes; /* out */
__u64 unused[379]; /* pad to 4k */
__u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */
};
Before calling this ioctl, field "devid" should be set with the id value
for the device for which the information is to be obtained. If this field
is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_GET_DEV_STATS - Getting device statistics
Obtain stats informatin for device in a btrfs filesystem. The information
is gathered in the ioctl's third argument which represents a pointer to
a following structure type:
struct btrfs_ioctl_get_dev_stats {
__u64 devid; /* in */
__u64 nr_items; /* in/out */
__u64 flags; /* in/out */
/* out values: */
__u64 values[BTRFS_DEV_STAT_VALUES_MAX];
/*
* This pads the struct to 1032 bytes. It was originally meant to pad to
* 1024 bytes, but when adding the flags field, the padding calculation
* was not adjusted.
*/
__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
};
Before calling this ioctl, field "devid" should be set with the id value
for the device for which the information is to be obtained. If this field
is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_FORGET_DEV - Remove unmounted devices
Search and remove all stale devices (devices which are not mounted).
The third ioctl argument is a pointer to a 'struct btrfs_ioctl_vol_args'.
The ioctl call will release all unmounted devices which match the path
which is specified in the "name" field of the structure. If an empty
path ("") is specified, all unmounted devices will be released.
Implementation notes:
Ioctls BTRFS_IOC_DEV_INFO and BTRFS_IOC_GET_DEV_STATS use types
'struct btrfs_ioctl_dev_info_args' and ' struct btrfs_ioctl_get_dev_stats'
as third argument types. That is the reason why corresponding structure
definitions were added in file 'linux-user/syscall_types.h'.
Since the thunk type for 'struct ioc_vol_args' was already added in a
previous patch, the rest of the implementation was straightforward.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-4-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-08-23 19:50:09 +00:00
|
|
|
defined(BTRFS_IOC_SNAP_DESTROY) || defined(BTRFS_IOC_SCAN_DEV) || \
|
|
|
|
defined(BTRFS_IOC_FORGET_DEV) || defined(BTRFS_IOC_ADD_DEV) || \
|
|
|
|
defined(BTRFS_IOC_RM_DEV) || defined(BTRFS_IOC_DEV_INFO)
|
2020-08-23 19:50:07 +00:00
|
|
|
STRUCT(btrfs_ioctl_vol_args,
|
|
|
|
TYPE_LONGLONG, /* fd */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_PATH_NAME_MAX + 1)) /* name */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BTRFS_IOC_GET_SUBVOL_INFO
|
|
|
|
STRUCT(btrfs_ioctl_timespec,
|
|
|
|
TYPE_ULONGLONG, /* sec */
|
|
|
|
TYPE_INT) /* nsec */
|
|
|
|
|
|
|
|
STRUCT(btrfs_ioctl_get_subvol_info_args,
|
|
|
|
TYPE_ULONGLONG, /* treeid */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_VOL_NAME_MAX + 1),
|
|
|
|
TYPE_ULONGLONG, /* parentid */
|
|
|
|
TYPE_ULONGLONG, /* dirid */
|
|
|
|
TYPE_ULONGLONG, /* generation */
|
|
|
|
TYPE_ULONGLONG, /* flags */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_UUID_SIZE), /* uuid */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_UUID_SIZE), /* parent_uuid */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_UUID_SIZE), /* received_uuid */
|
|
|
|
TYPE_ULONGLONG, /* ctransid */
|
|
|
|
TYPE_ULONGLONG, /* otransid */
|
|
|
|
TYPE_ULONGLONG, /* stransid */
|
|
|
|
TYPE_ULONGLONG, /* rtransid */
|
|
|
|
MK_STRUCT(STRUCT_btrfs_ioctl_timespec), /* ctime */
|
|
|
|
MK_STRUCT(STRUCT_btrfs_ioctl_timespec), /* otime */
|
|
|
|
MK_STRUCT(STRUCT_btrfs_ioctl_timespec), /* stime */
|
|
|
|
MK_STRUCT(STRUCT_btrfs_ioctl_timespec), /* rtime */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG, 8)) /* reserved */
|
|
|
|
#endif
|
|
|
|
|
linux-user: Add support for a group of btrfs inode ioctls
This patch implements functionality of following ioctls:
BTRFS_IOC_INO_LOOKUP - Reading tree root id and path
Read tree root id and path for a given file or directory.
The name and tree root id are returned in an ioctl's third
argument that represents a pointer to a following type:
struct btrfs_ioctl_ino_lookup_args {
__u64 treeid;
__u64 objectid;
char name[BTRFS_INO_LOOKUP_PATH_MAX];
};
Before calling this ioctl, field 'objectid' should be filled
with the object id value for which the tree id and path are
to be read. Value 'BTRFS_FIRST_FREE_OBJECTID' represents the
object id for the first available btrfs object (directory or
file).
BTRFS_IOC_INO_PATHS - Reading paths to all files
Read path to all files with a certain inode number. The paths
are returned in the ioctl's third argument which represents
a pointer to a following type:
struct btrfs_ioctl_ino_path_args {
__u64 inum; /* in */
__u64 size; /* in */
__u64 reserved[4];
/* struct btrfs_data_container *fspath; out */
__u64 fspath; /* out */
};
Before calling this ioctl, the 'inum' and 'size' field should
be filled with the aproppriate inode number and size of the
directory where file paths should be looked for. For now, the
paths are returned in an '__u64' (unsigned long long) value
'fspath'.
BTRFS_IOC_LOGICAL_INO - Reading inode numbers
Read inode numbers for files on a certain logical adress. The
inode numbers are returned in the ioctl's third argument which
represents a pointer to a following type:
struct btrfs_ioctl_logical_ino_args {
__u64 logical; /* in */
__u64 size; /* in */
__u64 reserved[3]; /* must be 0 for now */
__u64 flags; /* in, v2 only */
/* struct btrfs_data_container *inodes; out */
__u64 inodes;
};
Before calling this ioctl, the 'logical' and 'size' field should
be filled with the aproppriate logical adress and size of where
the inode numbers of files should be looked for. For now, the
inode numbers are returned in an '__u64' (unsigned long long)
value 'inodes'.
BTRFS_IOC_LOGICAL_INO_V2 - Reading inode numbers
Same as the above mentioned ioctl except that it allows passing
a flags 'BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET'.
BTRFS_IOC_INO_LOOKUP_USER - Reading subvolume name and path
Read name and path of a subvolume. The tree root id and
path are read in an ioctl's third argument which represents a
pointer to a following type:
struct btrfs_ioctl_ino_lookup_user_args {
/* in, inode number containing the subvolume of 'subvolid' */
__u64 dirid;
/* in */
__u64 treeid;
/* out, name of the subvolume of 'treeid' */
char name[BTRFS_VOL_NAME_MAX + 1];
/*
* out, constructed path from the directory with which the ioctl is
* called to dirid
*/
char path[BTRFS_INO_LOOKUP_USER_PATH_MAX];
};
Before calling this ioctl, the 'dirid' and 'treeid' field should
be filled with aproppriate values which represent the inode number
of the directory that contains the subvolume and treeid of the
subvolume.
Implementation notes:
All of the ioctls in this patch use structure types as third arguments.
That is the reason why aproppriate thunk definitions were added in file
'syscall_types.h'.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-6-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-08-23 19:50:11 +00:00
|
|
|
#ifdef BTRFS_IOC_INO_LOOKUP
|
|
|
|
STRUCT(btrfs_ioctl_ino_lookup_args,
|
|
|
|
TYPE_ULONGLONG, /* treeid */
|
|
|
|
TYPE_ULONGLONG, /* objectid */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_INO_LOOKUP_PATH_MAX)) /* name */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BTRFS_IOC_INO_PATHS
|
|
|
|
STRUCT(btrfs_ioctl_ino_path_args,
|
|
|
|
TYPE_ULONGLONG, /* inum */
|
|
|
|
TYPE_ULONGLONG, /* size */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG, 4), /* reserved */
|
|
|
|
TYPE_ULONGLONG) /* fspath */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(BTRFS_IOC_LOGICAL_INO) || defined(BTRFS_IOC_LOGICAL_INO_V2)
|
|
|
|
STRUCT(btrfs_ioctl_logical_ino_args,
|
|
|
|
TYPE_ULONGLONG, /* logical */
|
|
|
|
TYPE_ULONGLONG, /* size */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG, 3), /* reserved */
|
|
|
|
TYPE_ULONGLONG, /* flags */
|
|
|
|
TYPE_ULONGLONG) /* inodes */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BTRFS_IOC_INO_LOOKUP_USER
|
|
|
|
STRUCT(btrfs_ioctl_ino_lookup_user_args,
|
|
|
|
TYPE_ULONGLONG, /* dirid */
|
|
|
|
TYPE_ULONGLONG, /* treeid */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_VOL_NAME_MAX + 1), /* name */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_INO_LOOKUP_USER_PATH_MAX)) /* path */
|
|
|
|
#endif
|
|
|
|
|
2020-08-23 19:50:14 +00:00
|
|
|
#if defined(BTRFS_IOC_SCRUB) || defined(BTRFS_IOC_SCRUB_PROGRESS)
|
|
|
|
STRUCT(btrfs_scrub_progress,
|
|
|
|
TYPE_ULONGLONG, /* data_extents_scrubbed */
|
|
|
|
TYPE_ULONGLONG, /* tree_extents_scrubbed */
|
|
|
|
TYPE_ULONGLONG, /* data_bytes_scrubbed */
|
|
|
|
TYPE_ULONGLONG, /* tree_bytes_scrubbed */
|
|
|
|
TYPE_ULONGLONG, /* read_errors */
|
|
|
|
TYPE_ULONGLONG, /* csum_errors */
|
|
|
|
TYPE_ULONGLONG, /* verify_errors */
|
|
|
|
TYPE_ULONGLONG, /* no_csum */
|
|
|
|
TYPE_ULONGLONG, /* csum_discards */
|
|
|
|
TYPE_ULONGLONG, /* super_errors */
|
|
|
|
TYPE_ULONGLONG, /* malloc_errors */
|
|
|
|
TYPE_ULONGLONG, /* uncorrectable_errors */
|
|
|
|
TYPE_ULONGLONG, /* corrected_er */
|
|
|
|
TYPE_ULONGLONG, /* last_physical */
|
|
|
|
TYPE_ULONGLONG) /* unverified_errors */
|
|
|
|
|
|
|
|
STRUCT(btrfs_ioctl_scrub_args,
|
|
|
|
TYPE_ULONGLONG, /* devid */
|
|
|
|
TYPE_ULONGLONG, /* start */
|
|
|
|
TYPE_ULONGLONG, /* end */
|
|
|
|
TYPE_ULONGLONG, /* flags */
|
|
|
|
MK_STRUCT(STRUCT_btrfs_scrub_progress), /* progress */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG,
|
|
|
|
(1024 - 32 -
|
|
|
|
sizeof(struct btrfs_scrub_progress)) / 8)) /* unused */
|
|
|
|
#endif
|
|
|
|
|
linux-user: Add support for btrfs ioctls used to manipulate with devices
This patch implements functionality for following ioctls:
BTRFS_IOC_SCAN_DEV - Scanning device for a btrfs filesystem
Scan a device for a btrfs filesystem. The device that is to
be scanned is passed in the ioctl's third argument which
represents a pointer to a 'struct ioc_vol_args' (which was
mentioned in a previous patch). Before calling this ioctl,
the name field of this structure should be filled with the
aproppriate name value which represents a path for the device.
If the device contains a btrfs filesystem, the ioctl returns 0,
otherwise a negative value is returned.
BTRFS_IOC_ADD_DEV - Adding a device to a btrfs filesystem
Add a device to a btrfs filesystem. The device that is to be
added is passed in the ioctl's third argument which represents
a pointer to a 'struct ioc_vol_args' (which was mentioned in
a previous patch). Before calling this ioctl, the name field of
this structure should be filled with the aproppriate name value
which represents a path for the device.
BTRFS_IOC_RM_DEV - Removing a device from a btrfs filesystem
Remove a device from a btrfs filesystem. The device that is to be
removed is passed in the ioctl's third argument which represents
a pointer to a 'struct ioc_vol_args' (which was mentioned in
a previous patch). Before calling this ioctl, the name field of
this structure should be filled with the aproppriate name value
which represents a path for the device.
BTRFS_IOC_DEV_INFO - Getting information about a device
Obtain information for device in a btrfs filesystem. The information
is gathered in the ioctl's third argument which represents a pointer
to a following structure type:
struct btrfs_ioctl_dev_info_args {
__u64 devid; /* in/out */
__u8 uuid[BTRFS_UUID_SIZE]; /* in/out */
__u64 bytes_used; /* out */
__u64 total_bytes; /* out */
__u64 unused[379]; /* pad to 4k */
__u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */
};
Before calling this ioctl, field "devid" should be set with the id value
for the device for which the information is to be obtained. If this field
is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_GET_DEV_STATS - Getting device statistics
Obtain stats informatin for device in a btrfs filesystem. The information
is gathered in the ioctl's third argument which represents a pointer to
a following structure type:
struct btrfs_ioctl_get_dev_stats {
__u64 devid; /* in */
__u64 nr_items; /* in/out */
__u64 flags; /* in/out */
/* out values: */
__u64 values[BTRFS_DEV_STAT_VALUES_MAX];
/*
* This pads the struct to 1032 bytes. It was originally meant to pad to
* 1024 bytes, but when adding the flags field, the padding calculation
* was not adjusted.
*/
__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
};
Before calling this ioctl, field "devid" should be set with the id value
for the device for which the information is to be obtained. If this field
is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_FORGET_DEV - Remove unmounted devices
Search and remove all stale devices (devices which are not mounted).
The third ioctl argument is a pointer to a 'struct btrfs_ioctl_vol_args'.
The ioctl call will release all unmounted devices which match the path
which is specified in the "name" field of the structure. If an empty
path ("") is specified, all unmounted devices will be released.
Implementation notes:
Ioctls BTRFS_IOC_DEV_INFO and BTRFS_IOC_GET_DEV_STATS use types
'struct btrfs_ioctl_dev_info_args' and ' struct btrfs_ioctl_get_dev_stats'
as third argument types. That is the reason why corresponding structure
definitions were added in file 'linux-user/syscall_types.h'.
Since the thunk type for 'struct ioc_vol_args' was already added in a
previous patch, the rest of the implementation was straightforward.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-4-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-08-23 19:50:09 +00:00
|
|
|
#ifdef BTRFS_IOC_DEV_INFO
|
|
|
|
STRUCT(btrfs_ioctl_dev_info_args,
|
|
|
|
TYPE_ULONGLONG, /* devid */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_UUID_SIZE), /* uuid */
|
|
|
|
TYPE_ULONGLONG, /* bytes_used */
|
|
|
|
TYPE_ULONGLONG, /* total_bytes */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG, 379), /* unused */
|
|
|
|
MK_ARRAY(TYPE_CHAR, BTRFS_DEVICE_PATH_NAME_MAX)) /* path */
|
|
|
|
#endif
|
|
|
|
|
2020-08-23 19:50:12 +00:00
|
|
|
#ifdef BTRFS_IOC_GET_SUBVOL_ROOTREF
|
|
|
|
STRUCT(rootref,
|
|
|
|
TYPE_ULONGLONG, /* treeid */
|
|
|
|
TYPE_ULONGLONG) /* dirid */
|
|
|
|
|
|
|
|
STRUCT(btrfs_ioctl_get_subvol_rootref_args,
|
|
|
|
TYPE_ULONGLONG, /* min_treeid */
|
|
|
|
MK_ARRAY(MK_STRUCT(STRUCT_rootref),
|
|
|
|
BTRFS_MAX_ROOTREF_BUFFER_NUM), /* rootref */
|
|
|
|
TYPE_CHAR, /* num_items */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 7)) /* align */
|
|
|
|
#endif
|
|
|
|
|
linux-user: Add support for btrfs ioctls used to manipulate with devices
This patch implements functionality for following ioctls:
BTRFS_IOC_SCAN_DEV - Scanning device for a btrfs filesystem
Scan a device for a btrfs filesystem. The device that is to
be scanned is passed in the ioctl's third argument which
represents a pointer to a 'struct ioc_vol_args' (which was
mentioned in a previous patch). Before calling this ioctl,
the name field of this structure should be filled with the
aproppriate name value which represents a path for the device.
If the device contains a btrfs filesystem, the ioctl returns 0,
otherwise a negative value is returned.
BTRFS_IOC_ADD_DEV - Adding a device to a btrfs filesystem
Add a device to a btrfs filesystem. The device that is to be
added is passed in the ioctl's third argument which represents
a pointer to a 'struct ioc_vol_args' (which was mentioned in
a previous patch). Before calling this ioctl, the name field of
this structure should be filled with the aproppriate name value
which represents a path for the device.
BTRFS_IOC_RM_DEV - Removing a device from a btrfs filesystem
Remove a device from a btrfs filesystem. The device that is to be
removed is passed in the ioctl's third argument which represents
a pointer to a 'struct ioc_vol_args' (which was mentioned in
a previous patch). Before calling this ioctl, the name field of
this structure should be filled with the aproppriate name value
which represents a path for the device.
BTRFS_IOC_DEV_INFO - Getting information about a device
Obtain information for device in a btrfs filesystem. The information
is gathered in the ioctl's third argument which represents a pointer
to a following structure type:
struct btrfs_ioctl_dev_info_args {
__u64 devid; /* in/out */
__u8 uuid[BTRFS_UUID_SIZE]; /* in/out */
__u64 bytes_used; /* out */
__u64 total_bytes; /* out */
__u64 unused[379]; /* pad to 4k */
__u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */
};
Before calling this ioctl, field "devid" should be set with the id value
for the device for which the information is to be obtained. If this field
is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_GET_DEV_STATS - Getting device statistics
Obtain stats informatin for device in a btrfs filesystem. The information
is gathered in the ioctl's third argument which represents a pointer to
a following structure type:
struct btrfs_ioctl_get_dev_stats {
__u64 devid; /* in */
__u64 nr_items; /* in/out */
__u64 flags; /* in/out */
/* out values: */
__u64 values[BTRFS_DEV_STAT_VALUES_MAX];
/*
* This pads the struct to 1032 bytes. It was originally meant to pad to
* 1024 bytes, but when adding the flags field, the padding calculation
* was not adjusted.
*/
__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
};
Before calling this ioctl, field "devid" should be set with the id value
for the device for which the information is to be obtained. If this field
is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_FORGET_DEV - Remove unmounted devices
Search and remove all stale devices (devices which are not mounted).
The third ioctl argument is a pointer to a 'struct btrfs_ioctl_vol_args'.
The ioctl call will release all unmounted devices which match the path
which is specified in the "name" field of the structure. If an empty
path ("") is specified, all unmounted devices will be released.
Implementation notes:
Ioctls BTRFS_IOC_DEV_INFO and BTRFS_IOC_GET_DEV_STATS use types
'struct btrfs_ioctl_dev_info_args' and ' struct btrfs_ioctl_get_dev_stats'
as third argument types. That is the reason why corresponding structure
definitions were added in file 'linux-user/syscall_types.h'.
Since the thunk type for 'struct ioc_vol_args' was already added in a
previous patch, the rest of the implementation was straightforward.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-4-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-08-23 19:50:09 +00:00
|
|
|
#ifdef BTRFS_IOC_GET_DEV_STATS
|
|
|
|
STRUCT(btrfs_ioctl_get_dev_stats,
|
|
|
|
TYPE_ULONGLONG, /* devid */
|
|
|
|
TYPE_ULONGLONG, /* nr_items */
|
|
|
|
TYPE_ULONGLONG, /* flags */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG, BTRFS_DEV_STAT_VALUES_MAX), /* values */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG,
|
|
|
|
128 - 2 - BTRFS_DEV_STAT_VALUES_MAX)) /* unused */
|
|
|
|
#endif
|
|
|
|
|
linux-user: Add support for btrfs ioctls used to manage quota
This patch implements functionality for following ioctls:
BTRFS_IOC_QUOTA_CTL - Enabling/Disabling quota support
Enable or disable quota support for a btrfs filesystem. Quota
support is enabled or disabled using the ioctls third argument
which represents a pointer to a following type:
struct btrfs_ioctl_quota_ctl_args {
__u64 cmd;
__u64 status;
};
Before calling this ioctl, the 'cmd' field should be filled
with one of the values 'BTRFS_QUOTA_CTL_ENABLE' (enabling quota)
'BTRFS_QUOTA_CTL_DISABLE' (disabling quota).
BTRFS_IOC_QGROUP_CREATE - Creating/Removing a subvolume quota group
Create or remove a subvolume quota group. The subvolume quota
group is created or removed using the ioctl's third argument which
represents a pointer to a following type:
struct btrfs_ioctl_qgroup_create_args {
__u64 create;
__u64 qgroupid;
};
Before calling this ioctl, the 'create' field should be filled
with the aproppriate value depending on if the user wants to
create or remove a quota group (0 for removing, everything else
for creating). Also, the 'qgroupid' field should be filled with
the value for the quota group id that is to be created.
BTRFS_IOC_QGROUP_ASSIGN - Asigning or removing a quota group as child group
Asign or remove a quota group as child quota group of another
group in the btrfs filesystem. The asignment is done using the
ioctl's third argument which represents a pointert to a following type:
struct btrfs_ioctl_qgroup_assign_args {
__u64 assign;
__u64 src;
__u64 dst;
};
Before calling this ioctl, the 'assign' field should be filled with
the aproppriate value depending on if the user wants to asign or remove
a quota group as a child quota group of another group (0 for removing,
everythin else for asigning). Also, the 'src' and 'dst' fields should
be filled with the aproppriate quota group id values depending on which
quota group needs to asigned or removed as child quota group of another
group ('src' gets asigned or removed as child group of 'dst').
BTRFS_IOC_QGROUP_LIMIT - Limiting the size of a quota group
Limit the size of a quota group. The size of the quota group is limited
with the ioctls third argument which represents a pointer to a following
type:
struct btrfs_ioctl_qgroup_limit_args {
__u64 qgroupid;
struct btrfs_qgroup_limit lim;
};
Before calling this ioctl, the 'qgroup' id field should be filled with
aproppriate value of the quota group id for which the size is to be
limited. The second field is of following type:
struct btrfs_qgroup_limit {
__u64 flags;
__u64 max_rfer;
__u64 max_excl;
__u64 rsv_rfer;
__u64 rsv_excl;
};
The 'max_rfer' field should be filled with the size to which the quota
group should be limited. The 'flags' field can be used for passing
additional options and can have values which can be found on:
https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/btrfs.h#L67
BTRFS_IOC_QUOTA_RESCAN_STATUS - Checking status of running rescan operation
Check status of a running rescan operation. The status is checked using
the ioctl's third argument which represents a pointer to a following type:
struct btrfs_ioctl_quota_rescan_args {
__u64 flags;
__u64 progress;
__u64 reserved[6];
};
If there is a rescan operation running, 'flags' field is set to 1, and
'progress' field is set to aproppriate value which represents the progress
of the operation.
BTRFS_IOC_QUOTA_RESCAN - Starting a rescan operation
Start ar rescan operation to Trash all quota groups and scan the metadata
again with the current config. Before calling this ioctl,
BTRFS_IOC_QUOTA_RESCAN_STATUS sould be run to check if there is already a
rescan operation runing. After that ioctl call, the received
'struct btrfs_ioctl_quota_rescan_args' should be than passed as this ioctls
third argument.
BTRFS_IOC_QUOTA_RESCAN_WAIT - Waiting for a rescan operation to finish
Wait until a rescan operation is finished (if there is a rescan operation
running). The third ioctls argument is ignored.
Implementation notes:
Almost all of the ioctls in this patch use structure types as third arguments.
That is the reason why aproppriate thunk definitions were added in file
'syscall_types.h'.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-8-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-08-23 19:50:13 +00:00
|
|
|
STRUCT(btrfs_ioctl_quota_ctl_args,
|
|
|
|
TYPE_ULONGLONG, /* cmd */
|
|
|
|
TYPE_ULONGLONG) /* status */
|
|
|
|
|
|
|
|
STRUCT(btrfs_ioctl_quota_rescan_args,
|
|
|
|
TYPE_ULONGLONG, /* flags */
|
|
|
|
TYPE_ULONGLONG, /* progress */
|
|
|
|
MK_ARRAY(TYPE_ULONGLONG, 6)) /* reserved */
|
|
|
|
|
|
|
|
STRUCT(btrfs_ioctl_qgroup_assign_args,
|
|
|
|
TYPE_ULONGLONG, /* assign */
|
|
|
|
TYPE_ULONGLONG, /* src */
|
|
|
|
TYPE_ULONGLONG) /* dst */
|
|
|
|
|
|
|
|
STRUCT(btrfs_ioctl_qgroup_create_args,
|
|
|
|
TYPE_ULONGLONG, /* create */
|
|
|
|
TYPE_ULONGLONG) /* qgroupid */
|
|
|
|
|
|
|
|
STRUCT(btrfs_qgroup_limit,
|
|
|
|
TYPE_ULONGLONG, /* flags */
|
|
|
|
TYPE_ULONGLONG, /* max_rfer */
|
|
|
|
TYPE_ULONGLONG, /* max_excl */
|
|
|
|
TYPE_ULONGLONG, /* rsv_rfer */
|
|
|
|
TYPE_ULONGLONG) /* rsv_excl */
|
|
|
|
|
|
|
|
STRUCT(btrfs_ioctl_qgroup_limit_args,
|
|
|
|
TYPE_ULONGLONG, /* qgroupid */
|
|
|
|
MK_STRUCT(STRUCT_btrfs_qgroup_limit)) /* lim */
|
|
|
|
|
2020-08-23 19:50:10 +00:00
|
|
|
STRUCT(btrfs_ioctl_feature_flags,
|
|
|
|
TYPE_ULONGLONG, /* compat_flags */
|
|
|
|
TYPE_ULONGLONG, /* compat_ro_flags */
|
|
|
|
TYPE_ULONGLONG) /* incompat_flags */
|
|
|
|
|
2020-01-15 19:36:36 +00:00
|
|
|
STRUCT(rtc_time,
|
|
|
|
TYPE_INT, /* tm_sec */
|
|
|
|
TYPE_INT, /* tm_min */
|
|
|
|
TYPE_INT, /* tm_hour */
|
|
|
|
TYPE_INT, /* tm_mday */
|
|
|
|
TYPE_INT, /* tm_mon */
|
|
|
|
TYPE_INT, /* tm_year */
|
|
|
|
TYPE_INT, /* tm_wday */
|
|
|
|
TYPE_INT, /* tm_yday */
|
|
|
|
TYPE_INT) /* tm_isdst */
|
|
|
|
|
2020-01-15 19:36:38 +00:00
|
|
|
STRUCT(rtc_wkalrm,
|
|
|
|
TYPE_CHAR, /* enabled */
|
|
|
|
TYPE_CHAR, /* pending */
|
|
|
|
MK_STRUCT(STRUCT_rtc_time)) /* time */
|
|
|
|
|
2020-01-15 19:36:39 +00:00
|
|
|
STRUCT(rtc_pll_info,
|
|
|
|
TYPE_INT, /* pll_ctrl */
|
|
|
|
TYPE_INT, /* pll_value */
|
|
|
|
TYPE_INT, /* pll_max */
|
|
|
|
TYPE_INT, /* pll_min */
|
|
|
|
TYPE_INT, /* pll_posmult */
|
|
|
|
TYPE_INT, /* pll_negmult */
|
|
|
|
TYPE_LONG) /* pll_clock */
|
|
|
|
|
2014-01-18 06:38:30 +00:00
|
|
|
STRUCT(blkpg_ioctl_arg,
|
|
|
|
TYPE_INT, /* op */
|
|
|
|
TYPE_INT, /* flags */
|
|
|
|
TYPE_INT, /* datalen */
|
2014-08-22 11:15:50 +00:00
|
|
|
TYPE_PTRVOID) /* data */
|
2018-10-08 16:35:20 +00:00
|
|
|
|
2020-01-16 22:49:47 +00:00
|
|
|
STRUCT(format_descr,
|
|
|
|
TYPE_INT, /* device */
|
|
|
|
TYPE_INT, /* head */
|
|
|
|
TYPE_INT) /* track */
|
|
|
|
|
2020-01-16 22:49:46 +00:00
|
|
|
STRUCT(floppy_max_errors,
|
|
|
|
TYPE_INT, /* abort */
|
|
|
|
TYPE_INT, /* read_track */
|
|
|
|
TYPE_INT, /* reset */
|
|
|
|
TYPE_INT, /* recal */
|
|
|
|
TYPE_INT) /* reporting */
|
|
|
|
|
2018-10-08 16:35:20 +00:00
|
|
|
#if defined(CONFIG_USBFS)
|
|
|
|
/* usb device ioctls */
|
|
|
|
STRUCT(usbdevfs_ctrltransfer,
|
|
|
|
TYPE_CHAR, /* bRequestType */
|
|
|
|
TYPE_CHAR, /* bRequest */
|
|
|
|
TYPE_SHORT, /* wValue */
|
|
|
|
TYPE_SHORT, /* wIndex */
|
|
|
|
TYPE_SHORT, /* wLength */
|
|
|
|
TYPE_INT, /* timeout */
|
|
|
|
TYPE_PTRVOID) /* data */
|
|
|
|
|
|
|
|
STRUCT(usbdevfs_bulktransfer,
|
|
|
|
TYPE_INT, /* ep */
|
|
|
|
TYPE_INT, /* len */
|
|
|
|
TYPE_INT, /* timeout */
|
|
|
|
TYPE_PTRVOID) /* data */
|
|
|
|
|
|
|
|
STRUCT(usbdevfs_setinterface,
|
|
|
|
TYPE_INT, /* interface */
|
|
|
|
TYPE_INT) /* altsetting */
|
|
|
|
|
|
|
|
STRUCT(usbdevfs_disconnectsignal,
|
|
|
|
TYPE_INT, /* signr */
|
|
|
|
TYPE_PTRVOID) /* context */
|
|
|
|
|
|
|
|
STRUCT(usbdevfs_getdriver,
|
|
|
|
TYPE_INT, /* interface */
|
|
|
|
MK_ARRAY(TYPE_CHAR, USBDEVFS_MAXDRIVERNAME + 1)) /* driver */
|
|
|
|
|
|
|
|
STRUCT(usbdevfs_connectinfo,
|
|
|
|
TYPE_INT, /* devnum */
|
|
|
|
TYPE_CHAR) /* slow */
|
|
|
|
|
2018-10-08 16:35:21 +00:00
|
|
|
STRUCT(usbdevfs_iso_packet_desc,
|
|
|
|
TYPE_INT, /* length */
|
|
|
|
TYPE_INT, /* actual_length */
|
|
|
|
TYPE_INT) /* status */
|
|
|
|
|
|
|
|
STRUCT(usbdevfs_urb,
|
|
|
|
TYPE_CHAR, /* type */
|
|
|
|
TYPE_CHAR, /* endpoint */
|
|
|
|
TYPE_INT, /* status */
|
|
|
|
TYPE_INT, /* flags */
|
|
|
|
TYPE_PTRVOID, /* buffer */
|
|
|
|
TYPE_INT, /* buffer_length */
|
|
|
|
TYPE_INT, /* actual_length */
|
|
|
|
TYPE_INT, /* start_frame */
|
|
|
|
TYPE_INT, /* union number_of_packets stream_id */
|
|
|
|
TYPE_INT, /* error_count */
|
|
|
|
TYPE_INT, /* signr */
|
|
|
|
TYPE_PTRVOID, /* usercontext */
|
|
|
|
MK_ARRAY(MK_STRUCT(STRUCT_usbdevfs_iso_packet_desc), 0)) /* desc */
|
|
|
|
|
2018-10-08 16:35:20 +00:00
|
|
|
STRUCT(usbdevfs_ioctl,
|
|
|
|
TYPE_INT, /* ifno */
|
|
|
|
TYPE_INT, /* ioctl_code */
|
|
|
|
TYPE_PTRVOID) /* data */
|
|
|
|
|
|
|
|
STRUCT(usbdevfs_hub_portinfo,
|
|
|
|
TYPE_CHAR, /* nports */
|
|
|
|
MK_ARRAY(TYPE_CHAR, 127)) /* port */
|
|
|
|
|
|
|
|
STRUCT(usbdevfs_disconnect_claim,
|
|
|
|
TYPE_INT, /* interface */
|
|
|
|
TYPE_INT, /* flags */
|
|
|
|
MK_ARRAY(TYPE_CHAR, USBDEVFS_MAXDRIVERNAME + 1)) /* driver */
|
|
|
|
#endif /* CONFIG_USBFS */
|