/*
* Copyright (c) 2009, 2010 Jeff Mahoney <jeffm@suse.com>
* Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "defs.h"
#include <linux/ioctl.h>
#include <linux/fs.h>
typedef struct {
int op;
int flags;
int datalen;
void *data;
} struct_blkpg_ioctl_arg;
#define BLKPG_DEVNAMELTH 64
#define BLKPG_VOLNAMELTH 64
typedef struct {
int64_t start; /* starting offset in bytes */
int64_t length; /* length in bytes */
int pno; /* partition number */
char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
to be used in kernel messages */
char volname[BLKPG_VOLNAMELTH]; /* volume label */
} struct_blkpg_partition;
#define BLKTRACE_BDEV_SIZE 32
typedef struct blk_user_trace_setup {
char name[BLKTRACE_BDEV_SIZE]; /* output */
uint16_t act_mask; /* input */
uint32_t buf_size; /* input */
uint32_t buf_nr; /* input */
uint64_t start_lba;
uint64_t end_lba;
uint32_t pid;
} struct_blk_user_trace_setup;
struct_blkpg_partition mpers_target_var;