MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / um / include / ubd_user.h
blob9bac59c4c9df4ab4e1f5a89ecbafbd342f3fd6d4
1 /*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Copyright (C) 2001 RidgeRun, Inc (glonnon@ridgerun.com)
4 * Licensed under the GPL
5 */
7 #ifndef __UM_UBD_USER_H
8 #define __UM_UBD_USER_H
10 #include "os.h"
12 enum ubd_req { UBD_READ, UBD_WRITE, UBD_MMAP };
14 struct io_thread_req {
15 enum ubd_req op;
16 int fds[2];
17 unsigned long offsets[2];
18 unsigned long long offset;
19 unsigned long length;
20 char *buffer;
21 int sectorsize;
22 unsigned long sector_mask;
23 unsigned long long cow_offset;
24 unsigned long bitmap_words[2];
25 int map_fd;
26 unsigned long long map_offset;
27 int error;
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,
33 int *create_cow_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)
47 __u64 n;
48 int bits, off;
50 bits = sizeof(data[0]) * 8;
51 n = bit / bits;
52 off = bit % bits;
53 return((data[n] & (1 << off)) != 0);
56 static inline void ubd_set_bit(__u64 bit, unsigned char *data)
58 __u64 n;
59 int bits, off;
61 bits = sizeof(data[0]) * 8;
62 n = bit / bits;
63 off = bit % bits;
64 data[n] |= (1 << off);
68 #endif
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
74 * of the file.
75 * ---------------------------------------------------------------------------
76 * Local variables:
77 * c-file-style: "linux"
78 * End: