2
* aufs sample -- ULOOP driver
4
* Copyright (C) 2007 Junjiro Okajima
6
* This program, aufs is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
/* $Id: uloop.h,v 1.2 2007/11/26 01:35:40 sfjro Exp $ */
26
#include <linux/ioctl.h>
27
#include <linux/loop.h>
28
//#include <linux/unistd.h>
30
#include <sys/types.h>
33
#define ULOOP_NAME "uloop"
34
#define ULOOP_VERSION "20071126"
36
/* loop filter variation */
37
#define LOOP_FILTER_ULOOP (MAX_LO_CRYPT - 1)
40
#ifndef LOOP_CHANGE_FD
41
#define LOOP_CHANGE_FD 0x4C06
43
enum {UloCtlErr, UloCtlErr_Last};
45
/* LOOP_CHANGE_FD is the last number in loop ioctl */
46
UloCtl_Begin = (LOOP_CHANGE_FD & 0x0ff),
53
struct ulo_ctl_setbmp {
58
struct ulo_ctl_ready {
63
struct ulo_ctl_rcvreq {
64
unsigned long long start;
68
struct ulo_ctl_sndres {
69
unsigned long long start;
74
struct ulo_ctl_setbmp setbmp;
75
struct ulo_ctl_ready ready;
76
struct ulo_ctl_rcvreq rcvreq;
77
struct ulo_ctl_sndres sndres;
80
#define ULOCTL_Type 'L'
81
#define ULOCTL_SETBMP _IOW(ULOCTL_Type, UloCtl_SETBMP, union ulo_ctl)
82
#define ULOCTL_READY _IOR(ULOCTL_Type, UloCtl_READY, union ulo_ctl)
83
#define ULOCTL_RCVREQ _IOR(ULOCTL_Type, UloCtl_RCVREQ, union ulo_ctl)
84
#define ULOCTL_SNDRES _IOW(ULOCTL_Type, UloCtl_SNDRES, union ulo_ctl)
86
/* ---------------------------------------------------------------------- */
88
/* user library API */
90
enum {ULO_DEV, ULO_CACHE, ULO_BITMAP, ULO_Last};
94
unsigned long long tgt_size, cache_size;
96
extern const struct uloop *uloop;
97
#define ulo_dev_fd ({ uloop->fd[ULO_DEV]; })
98
#define ulo_cache_fd ({ uloop->fd[ULO_CACHE]; })
99
#define ulo_bitmap_fd ({ uloop->fd[ULO_BITMAP]; })
102
char *path[ULO_Last];
104
unsigned long long size;
107
int ulo_init(struct ulo_init *init);
108
typedef int (*ulo_cb_t)(unsigned long long start, int size, void *arg);
109
int ulo_loop(int sig, ulo_cb_t store, void *arg);
112
#endif /* __ULOOP_H__ */