aboutsummaryrefslogtreecommitdiffstats
path: root/testing/partclone-utils/20-u_int-to-uint.patch
blob: 659646507780a0642406ffd5eb1eb8713cf059bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
Author: Sean McAvoy <seanmcavoy@gmail.com>
Summary: fixes for musl, use uint instead of u_int
----
diff --git a/src/cfdump.c b/src/cfdump.c
index ff33ad6..993702a 100644
--- a/src/cfdump.c
+++ b/src/cfdump.c
@@ -19,18 +19,18 @@ dump_header(char *n, cf_header_t *h) {
 }
 
 static int crcinitdone = 0;
-static u_int32_t xcrc_tab32[CRC_TABLE_LEN];
-static inline u_int32_t
-xcrc32(u_int32_t crc, unsigned char *buf, u_int64_t size)
+static uint32_t xcrc_tab32[CRC_TABLE_LEN];
+static inline uint32_t
+xcrc32(uint32_t crc, unsigned char *buf, uint64_t size)
 {
     int i;
-    u_int64_t s;
-    u_int32_t tmp;
+    uint64_t s;
+    uint32_t tmp;
 
     if (!crcinitdone) {
 	for (i=0; i<CRC_TABLE_LEN; i++) {
 	    int j;
-	    u_int32_t init_crc = (u_int32_t) i;
+	    uint32_t init_crc = (uint32_t) i;
 	    for (j=0; j<CRC_UNIT_BITS; j++) {
 		init_crc = (init_crc & 0x00000001L) ?
 		    (init_crc >> 1) ^ 0xEDB88320L :
@@ -40,20 +40,20 @@ xcrc32(u_int32_t crc, unsigned char *buf, u_int64_t size)
 	}
     }
     for (s=0; s<size; s++) {
-	tmp = crc ^ (((u_int32_t) buf[s]) & 0x000000ffL);
+	tmp = crc ^ (((uint32_t) buf[s]) & 0x000000ffL);
 	crc = (crc >> 8) ^ xcrc_tab32[ tmp & 0xff ];
     }
     return(crc);
 }
 
 int
-verify_block(void *cf, u_int64_t offs, u_int64_t index, void *rbuffer, 
-	     u_int64_t bsize)
+verify_block(void *cf, uint64_t offs, uint64_t index, void *rbuffer, 
+	     uint64_t bsize)
 {
-    u_int64_t nread;
+    uint64_t nread;
     int error = 1;
     if (!(error = (*sysdep->sys_seek)(cf, offs, SYSDEP_SEEK_ABSOLUTE,
-				      (u_int64_t *) NULL))) {
+				      (uint64_t *) NULL))) {
 	if (!(error = (*sysdep->sys_read)(cf, rbuffer, bsize, &nread)) &&
 	    (nread == bsize)) {
 	    cf_block_trailer_t btrail;
@@ -76,10 +76,10 @@ verify_block(void *cf, u_int64_t offs, u_int64_t index, void *rbuffer,
 }
 
 void
-dump_blocks(cf_header_t *h, u_int64_t *bm, void *cf) {
-    u_int64_t bi, nread;
-    u_int64_t nfound = 0;
-    u_int64_t bsize = 0;
+dump_blocks(cf_header_t *h, uint64_t *bm, void *cf) {
+    uint64_t bi, nread;
+    uint64_t nfound = 0;
+    uint64_t bsize = 0;
     void *rbuffer = (void *) NULL;
     int error;
     for (bi=0; bi<h->cf_total_blocks; bi++) {
@@ -107,10 +107,10 @@ dump_blocks(cf_header_t *h, u_int64_t *bm, void *cf) {
 	    }
 	    printf("%s\n", (good) ? "ok" : "INVALID");
 	    if (bsize && rbuffer) {
-		u_int64_t boff;
+		uint64_t boff;
 		for (boff = 0; boff < bsize; boff += 16) {
-		    u_int64_t soff;
-		    printf("0x%04x: ", (u_int16_t) boff);
+		    uint64_t soff;
+		    printf("0x%04x: ", (uint16_t) boff);
 		    for (soff = 0; soff < 16; soff++) {
 			printf("%02x ", ((unsigned char *) rbuffer)[boff+soff]);
 		    }
@@ -141,16 +141,16 @@ main(int argc, char *argv[])
     for (i=1; i<argc; i++) {
 	if ((error = (*sysdep->sys_open)(&cfp, argv[i], SYSDEP_OPEN_RO)) == 0) {
 	    cf_header_t header;
-	    u_int64_t nread;
+	    uint64_t nread;
 	    (void) (*sysdep->sys_seek)(cfp, 0, SYSDEP_SEEK_ABSOLUTE,
-				       (u_int64_t *) NULL);
+				       (uint64_t *) NULL);
 	    if ((error = (*sysdep->sys_read)(cfp, &header, sizeof(header),
 					     &nread)) == 0) {
 		if ((header.cf_magic == CF_MAGIC_1) &&
 		    (header.cf_magic2 == CF_MAGIC_2)) {
-		    u_int64_t bmsize = header.cf_total_blocks *
-			sizeof(u_int64_t);
-		    u_int64_t *blockmap;
+		    uint64_t bmsize = header.cf_total_blocks *
+			sizeof(uint64_t);
+		    uint64_t *blockmap;
 		    
 		    if ((error = (*sysdep->sys_malloc)(&blockmap, bmsize))
 			== 0) {
@@ -158,7 +158,7 @@ main(int argc, char *argv[])
 			(void) (*sysdep->sys_seek)(cfp, 
 						   header.cf_blockmap_offset,
 						   SYSDEP_SEEK_ABSOLUTE,
-						   (u_int64_t *) NULL);
+						   (uint64_t *) NULL);
 			if ((error = (*sysdep->sys_read)(cfp, blockmap,
 							 bmsize, &nread))
 			    == 0) {
diff --git a/src/changefileint.h b/src/changefileint.h
index 237b5a8..30ae1d9 100644
--- a/src/changefileint.h
+++ b/src/changefileint.h
@@ -25,29 +25,29 @@
 #define	CF_VERSION_1	1
 #define	CF_HEADER_DIRTY	1
 typedef struct change_file_header {
-    u_int32_t	cf_magic;		/* 0x00 - magic */
-    u_int16_t	cf_version;		/* 0x04 - version */
-    u_int16_t	cf_flags;		/* 0x06 - flags */
-    u_int64_t	cf_total_blocks;	/* 0x08 - total blocks */
-    u_int64_t	cf_used_blocks;		/* 0x10 - used blocks */
-    u_int32_t	cf_blockmap_offset;	/* 0x18 - blockmap offset */
-    u_int32_t	cf_magic2;		/* 0x1c - magic2 */
+    uint32_t	cf_magic;		/* 0x00 - magic */
+    uint16_t	cf_version;		/* 0x04 - version */
+    uint16_t	cf_flags;		/* 0x06 - flags */
+    uint64_t	cf_total_blocks;	/* 0x08 - total blocks */
+    uint64_t	cf_used_blocks;		/* 0x10 - used blocks */
+    uint32_t	cf_blockmap_offset;	/* 0x18 - blockmap offset */
+    uint32_t	cf_magic2;		/* 0x1c - magic2 */
 } cf_header_t;				/* 0x20 - total size */
 
 typedef struct change_file_context {
     cf_header_t	cfc_header;
     const sysdep_dispatch_t *cfc_sysdep;
     void	*cfc_fd;
-    u_int64_t	*cfc_blockmap;
-    u_int64_t	cfc_blocksize;
-    u_int64_t	cfc_blockcount;
-    u_int64_t	cfc_curpos;
-    u_int32_t	cfc_crc_tab32[CRC_TABLE_LEN];
+    uint64_t	*cfc_blockmap;
+    uint64_t	cfc_blocksize;
+    uint64_t	cfc_blockcount;
+    uint64_t	cfc_curpos;
+    uint32_t	cfc_crc_tab32[CRC_TABLE_LEN];
 } cf_context_t;
 
 typedef struct change_file_block_trailer {
-    u_int64_t	cfb_curblock;
-    u_int32_t	cfb_crc;
-    u_int32_t	cfb_magic;
+    uint64_t	cfb_curblock;
+    uint32_t	cfb_crc;
+    uint32_t	cfb_magic;
 } cf_block_trailer_t;
 #endif	/* _CHANGEFILEINT_H_ */
diff --git a/src/sysdep_int.h b/src/sysdep_int.h
index f7a037c..0b9fad9 100644
--- a/src/sysdep_int.h
+++ b/src/sysdep_int.h
@@ -73,7 +73,7 @@ typedef struct sysdep_dispatch {
      *	error	- Otherwise.
      */
     int		(*sys_seek)(void *rh, int64_t offset, sysdep_whence_t whence,
-			    u_int64_t *resoffp);
+			    uint64_t *resoffp);
     /*
      * sys_read		- Read data from the current offset.
      * 
@@ -88,7 +88,7 @@ typedef struct sysdep_dispatch {
      *	EINVAL	- Invalid file handle.
      *	error	- Otherwise.
      */
-    int		(*sys_read)(void *rh, void *buf, u_int64_t len, u_int64_t *nr);
+    int		(*sys_read)(void *rh, void *buf, uint64_t len, uint64_t *nr);
     /*
      * sys_write	- Write data at the current offset.
      * 
@@ -103,7 +103,7 @@ typedef struct sysdep_dispatch {
      *	EINVAL	- Invalid file handle.
      *	error	- Otherwise.
      */
-    int		(*sys_write)(void *rh, void *buf, u_int64_t len, u_int64_t *nw);
+    int		(*sys_write)(void *rh, void *buf, uint64_t len, uint64_t *nw);
     /*
      * sys_malloc	- Allocate dynamic memory.
      *
@@ -116,7 +116,7 @@ typedef struct sysdep_dispatch {
      *	EINVAL	- Invalid nmpp
      *	ENOMEM	- No memory available
      */
-    int		(*sys_malloc)(void *nmpp, u_int64_t nbytes);
+    int		(*sys_malloc)(void *nmpp, uint64_t nbytes);
     /*
      * sys_free		- Free dynamic memory.
      *
@@ -135,6 +135,6 @@ typedef struct sysdep_dispatch {
      *  rh	- Open file handle.
      *  nbytes	- File size.
      */
-    int		(*sys_file_size)(void *rh, u_int64_t *nbytes);
+    int		(*sys_file_size)(void *rh, uint64_t *nbytes);
 } sysdep_dispatch_t;
 #endif	/* _SYSDEP_INT_H_ */