2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Copyright (C) 2001 RidgeRun, Inc (glonnon@ridgerun.com)
4 * Licensed under the GPL
7 #ifndef __UM_UBD_USER_H
8 #define __UM_UBD_USER_H
12 enum ubd_req
{ UBD_READ
, UBD_WRITE
, UBD_MMAP
};
14 struct io_thread_req
{
17 unsigned long offsets
[2];
18 unsigned long long offset
;
22 unsigned long sector_mask
;
23 unsigned long long cow_offset
;
24 unsigned long bitmap_words
[2];
26 unsigned long long map_offset
;
30 extern int open_ubd_file(char *file
, struct openflags
*openflags
,
31 char **backing_file_out
, int *bitmap_offset_out
,
32 unsigned long *bitmap_len_out
, int *data_offset_out
,
34 extern int create_cow_file(char *cow_file
, char *backing_file
,
35 struct openflags flags
, int sectorsize
,
36 int alignment
, int *bitmap_offset_out
,
37 unsigned long *bitmap_len_out
,
38 int *data_offset_out
);
39 extern int read_cow_bitmap(int fd
, void *buf
, int offset
, int len
);
40 extern int read_ubd_fs(int fd
, void *buffer
, int len
);
41 extern int write_ubd_fs(int fd
, char *buffer
, int len
);
42 extern int start_io_thread(unsigned long sp
, int *fds_out
);
43 extern void do_io(struct io_thread_req
*req
);
45 static inline int ubd_test_bit(__u64 bit
, unsigned char *data
)
50 bits
= sizeof(data
[0]) * 8;
53 return((data
[n
] & (1 << off
)) != 0);
56 static inline void ubd_set_bit(__u64 bit
, unsigned char *data
)
61 bits
= sizeof(data
[0]) * 8;
64 data
[n
] |= (1 << off
);
71 * Overrides for Emacs so that we follow Linus's tabbing style.
72 * Emacs will notice this stuff at the end of the file and automatically
73 * adjust the settings for this buffer only. This must remain at the end
75 * ---------------------------------------------------------------------------
77 * c-file-style: "linux"