~ubuntu-branches/ubuntu/vivid/aufs/vivid

« back to all changes in this revision

Viewing changes to sample/uloop/include/linux/uloop.h

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2007-12-15 23:32:51 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071215233251-2vgs2lmg8mai5d9e
Tags: 0+20071211-1ubuntu1
* Merge from debian unstable (LP: #175705), remaining changes:
  - Fix for Ubuntu Kernels (updated)
* patches/01_vserver.dpatch: Removed
* patches/06_ubuntu.dpatch: Added (update of ubuntu patch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * aufs sample -- ULOOP driver
 
3
 *
 
4
 * Copyright (C) 2007 Junjiro Okajima
 
5
 *
 
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.
 
10
 *
 
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.
 
15
 *
 
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
 
19
 */
 
20
 
 
21
/* $Id: uloop.h,v 1.2 2007/11/26 01:35:40 sfjro Exp $ */
 
22
 
 
23
#ifndef __ULOOP_H__
 
24
#define __ULOOP_H__
 
25
 
 
26
#include <linux/ioctl.h>
 
27
#include <linux/loop.h>
 
28
//#include <linux/unistd.h>
 
29
#ifndef __KERNEL__
 
30
#include <sys/types.h>
 
31
#endif
 
32
 
 
33
#define ULOOP_NAME      "uloop"
 
34
#define ULOOP_VERSION   "20071126"
 
35
 
 
36
/* loop filter variation */
 
37
#define LOOP_FILTER_ULOOP       (MAX_LO_CRYPT - 1)
 
38
 
 
39
/* ioctl */
 
40
#ifndef LOOP_CHANGE_FD
 
41
#define LOOP_CHANGE_FD  0x4C06
 
42
#endif
 
43
enum {UloCtlErr, UloCtlErr_Last};
 
44
enum {
 
45
        /* LOOP_CHANGE_FD is the last number in loop ioctl */
 
46
        UloCtl_Begin = (LOOP_CHANGE_FD & 0x0ff),
 
47
        UloCtl_SETBMP,
 
48
        UloCtl_READY,
 
49
        UloCtl_RCVREQ,
 
50
        UloCtl_SNDRES
 
51
};
 
52
 
 
53
struct ulo_ctl_setbmp {
 
54
        int     fd;
 
55
        int     pagesize;
 
56
};
 
57
 
 
58
struct ulo_ctl_ready {
 
59
        int     signum;
 
60
        pid_t   pid;
 
61
};
 
62
 
 
63
struct ulo_ctl_rcvreq {
 
64
        unsigned long long      start;
 
65
        int                     size;
 
66
};
 
67
 
 
68
struct ulo_ctl_sndres {
 
69
        unsigned long long      start;
 
70
        int                     size;
 
71
};
 
72
 
 
73
union ulo_ctl {
 
74
        struct ulo_ctl_setbmp   setbmp;
 
75
        struct ulo_ctl_ready    ready;
 
76
        struct ulo_ctl_rcvreq   rcvreq;
 
77
        struct ulo_ctl_sndres   sndres;
 
78
};
 
79
 
 
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)
 
85
 
 
86
/* ---------------------------------------------------------------------- */
 
87
 
 
88
/* user library API */
 
89
#ifndef __KERNEL__
 
90
enum {ULO_DEV, ULO_CACHE, ULO_BITMAP, ULO_Last};
 
91
struct uloop {
 
92
        int fd[ULO_Last];
 
93
        int pagesize;
 
94
        unsigned long long tgt_size, cache_size;
 
95
};
 
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]; })
 
100
 
 
101
struct ulo_init {
 
102
        char *path[ULO_Last];
 
103
        int dev_flags;
 
104
        unsigned long long size;
 
105
};
 
106
 
 
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);
 
110
#endif
 
111
 
 
112
#endif /* __ULOOP_H__ */