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 };
14 struct io_thread_req {
17 unsigned long offsets[2];
18 unsigned long long offset;
22 unsigned long sector_mask;
23 unsigned long cow_offset;
24 unsigned long bitmap_words[2];
28 extern int open_ubd_file(char *file, struct openflags *openflags,
29 char **backing_file_out, int *bitmap_offset_out,
30 unsigned long *bitmap_len_out, int *data_offset_out,
32 extern int create_cow_file(char *cow_file, char *backing_file,
33 struct openflags flags, int sectorsize,
34 int *bitmap_offset_out,
35 unsigned long *bitmap_len_out,
36 int *data_offset_out);
37 extern int read_cow_bitmap(int fd, void *buf, int offset, int len);
38 extern int read_ubd_fs(int fd, void *buffer, int len);
39 extern int write_ubd_fs(int fd, char *buffer, int len);
40 extern int start_io_thread(unsigned long sp, int *fds_out);
41 extern void do_io(struct io_thread_req *req);
42 extern int ubd_is_dir(char *file);
44 static inline int ubd_test_bit(__u64 bit, unsigned char *data)
49 bits = sizeof(data[0]) * 8;
52 return((data[n] & (1 << off)) != 0);
55 static inline void ubd_set_bit(__u64 bit, unsigned char *data)
60 bits = sizeof(data[0]) * 8;
63 data[n] |= (1 << off);
70 * Overrides for Emacs so that we follow Linus's tabbing style.
71 * Emacs will notice this stuff at the end of the file and automatically
72 * adjust the settings for this buffer only. This must remain at the end
74 * ---------------------------------------------------------------------------
76 * c-file-style: "linux"