#ifndef _LINUX_SNUMBDCALLUSER_H
#define _LINUX_SNUMBDCALLUSER_H
/* snumbd.h
Copyright (C) Acronis, 2004
Written by Vladimir Simonov
$Id: snumbd.h 1262030 2018-01-11 12:33:11Z marina $
*/
#ifdef __linux__
#include <linux/types.h>
#include <linux/ioctl.h>
#endif
#include "sn_huge_ptr.h"
#define SNUMBD_NAME "snumbd"
#define SNUMBDCTL_NAME "snumbdctl"
#define SNUMBDCTLTYPE '*'
#define SNUMBD_VMAJOR 0
#define SNUMBD_VMINOR 8
#define SNUMBD_VSUBMINOR 20
#define SNUMBD_COMMON_MOD_VERSION "0.8.20"
#define SNUMBD_COMMON_MOD_EXT_VERSION "(Release)"
#pragma pack(1)
struct snumbdctl_init {
unsigned long long scount; /* sectors count (sector = 512) */
int dev_ro; /* read-only mode */
};
struct snumbdctl_init_v2 {
unsigned long long scount; /* sectors count */
unsigned int sector_size; /* sector size */
int dev_ro; /* read-only mode */
};
struct snumbd_req { /* to user level */
unsigned int cmd;
unsigned int offset;
unsigned long long sno; /* sector no */
unsigned int len;
#define READ_DATA 0
#define WRITE_DATA 1
#define STOP 2
#define ERROR_FLAG (1<<(sizeof(unsigned int)*8 - 1))
};
struct snumbdctl_req { /* to user level */
SN_HUGE_PTR(struct snumbd_req *req); /* user-level buffer */
unsigned int size; /* size of user buf */
};
struct snumbdctl_dataready {
SN_HUGE_PTR(const struct snumbd_req *req);/* user-level buffer */
unsigned int size;
};
struct snumbd_state {
unsigned int version;
unsigned int major;
unsigned int minor;
unsigned int state; /* session state */
unsigned int hpid; /* usermode host pid */
unsigned long long scount; /* sectors count (sector = 512) */
int mmapsize; /* mmap max size in bytes */
/* current values */
unsigned int sessions; /* total number of sessions */
unsigned int gpages; /* got pages */
unsigned int ppages; /* put pages */
unsigned int ioctlcnt;
int users;
/* session states */
#define SNUM_NOTINITED 0
#define SNUM_ININIT 1
#define SNUM_INITED 2
#define SNUM_WAKEUP_REQ 3
#define SNUM_REQ_RECV 4
#define SNUM_DATA_READY 5
#define SNUM_ACTIVATING_ERR (1 << 8)
#define SNUM_SESSION_ERR (2 << 8)
#define SNUM_DEADLOCK_ERR (3 << 8)
#define IS_ERROR_STATE(x) ((x) >= SNUM_ACTIVATING_ERR)
};
struct snumbdctl_state { /* current session state */
SN_HUGE_PTR(struct snumbd_state *state);/* user-level buffer */
unsigned int size; /* size of user buf */
};
struct snumbdctl_states { /* all sessions states */
SN_HUGE_PTR(struct snumbd_state *state);/* user-level buffer */
unsigned int size; /* size of user buf */
};
struct snumbdctl_pgrp { /* Allowed PGRP */
pid_t allowed_pgrp;
};
#define SNUMBDCTL_INIT _IO(SNUMBDCTLTYPE, 0)
#define SNUMBDCTL_STOP _IO(SNUMBDCTLTYPE, 1)
#define SNUMBDCTL_REQ _IOW(SNUMBDCTLTYPE, 2, \
struct snumbdctl_req)
#define SNUMBDCTL_DATAREADY _IOW(SNUMBDCTLTYPE, 3, \
struct snumbdctl_dataready)
#define SNUMBDCTL_STATE _IOW(SNUMBDCTLTYPE, 4, \
struct snumbdctl_state)
#define SNUMBDCTL_STATES _IOW(SNUMBDCTLTYPE, 5, \
struct snumbdctl_state)
#define SNUMBDCTL_INIT_V2 _IO(SNUMBDCTLTYPE, 6)
#define SNUMBDCTL_PGRP _IOW(SNUMBDCTLTYPE, 7, \
struct snumbdctl_pgrp)
#pragma pack()
#endif /* _LINUX_SNUMBDCALLUSER_H */
|