blob: 0ee9cc6cc4c79dfb4d78fd8fa15072294c62568f [file] [log] [blame]
Jeff Dikecb8fa612007-10-16 01:27:34 -07001/*
2 * Copyright (C) 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3 * Licensed under the GPL
4 */
5
6/*
7 * _XOPEN_SOURCE is needed for pread, but we define _GNU_SOURCE, which defines
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 * that.
9 */
10#include <unistd.h>
Jeff Dikecb8fa612007-10-16 01:27:34 -070011#include <errno.h>
12#include <string.h>
13#include <arpa/inet.h>
Al Virod824d062012-04-05 23:35:03 -040014#include <endian.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include "cow.h"
16#include "cow_sys.h"
17
18#define PATH_LEN_V1 256
19
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -070020typedef __u32 time32_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -070022struct cow_header_v1 {
23 __s32 magic;
24 __s32 version;
25 char backing_file[PATH_LEN_V1];
26 time32_t mtime;
27 __u64 size;
28 __s32 sectorsize;
29} __attribute__((packed));
30
Jeff Dikecb8fa612007-10-16 01:27:34 -070031/*
32 * Define PATH_LEN_V3 as the usual value of MAXPATHLEN, just hard-code it in
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -070033 * case other systems have different values for MAXPATHLEN.
34 *
35 * The same must hold for V2 - we want file format compatibility, not anything
36 * else.
37 */
38#define PATH_LEN_V3 4096
39#define PATH_LEN_V2 PATH_LEN_V3
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41struct cow_header_v2 {
42 __u32 magic;
43 __u32 version;
44 char backing_file[PATH_LEN_V2];
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -070045 time32_t mtime;
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 __u64 size;
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -070047 __s32 sectorsize;
48} __attribute__((packed));
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Jeff Dikecb8fa612007-10-16 01:27:34 -070050/*
51 * Changes from V2 -
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 * PATH_LEN_V3 as described above
53 * Explicitly specify field bit lengths for systems with different
54 * lengths for the usual C types. Not sure whether char or
55 * time_t should be changed, this can be changed later without
56 * breaking compatibility
57 * Add alignment field so that different alignments can be used for the
58 * bitmap and data
59 * Add cow_format field to allow for the possibility of different ways
60 * of specifying the COW blocks. For now, the only value is 0,
61 * for the traditional COW bitmap.
62 * Move the backing_file field to the end of the header. This allows
63 * for the possibility of expanding it into the padding required
64 * by the bitmap alignment.
65 * The bitmap and data portions of the file will be aligned as specified
66 * by the alignment field. This is to allow COW files to be
67 * put on devices with restrictions on access alignments, such as
68 * /dev/raw, with a 512 byte alignment restriction. This also
69 * allows the data to be more aligned more strictly than on
70 * sector boundaries. This is needed for ubd-mmap, which needs
71 * the data to be page aligned.
72 * Fixed (finally!) the rounding bug
73 */
74
Jeff Dikecb8fa612007-10-16 01:27:34 -070075/*
76 * Until Dec2005, __attribute__((packed)) was left out from the below
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -070077 * definition, leading on 64-bit systems to 4 bytes of padding after mtime, to
78 * align size to 8-byte alignment. This shifted all fields above (no padding
79 * was present on 32-bit, no other padding was added).
80 *
81 * However, this _can be detected_: it means that cow_format (always 0 until
82 * now) is shifted onto the first 4 bytes of backing_file, where it is otherwise
83 * impossible to find 4 zeros. -bb */
84
Linus Torvalds1da177e2005-04-16 15:20:36 -070085struct cow_header_v3 {
86 __u32 magic;
87 __u32 version;
88 __u32 mtime;
89 __u64 size;
90 __u32 sectorsize;
91 __u32 alignment;
92 __u32 cow_format;
93 char backing_file[PATH_LEN_V3];
Paolo 'Blaisorblade' Giarrussocda402b2006-04-10 22:53:29 -070094} __attribute__((packed));
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -070096/* This is the broken layout used by some 64-bit binaries. */
97struct cow_header_v3_broken {
98 __u32 magic;
99 __u32 version;
100 __s64 mtime;
101 __u64 size;
102 __u32 sectorsize;
103 __u32 alignment;
104 __u32 cow_format;
105 char backing_file[PATH_LEN_V3];
Paolo 'Blaisorblade' Giarrussob15fb6b2006-05-01 12:16:01 -0700106};
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700107
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108/* COW format definitions - for now, we have only the usual COW bitmap */
109#define COW_BITMAP 0
110
111union cow_header {
112 struct cow_header_v1 v1;
113 struct cow_header_v2 v2;
114 struct cow_header_v3 v3;
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700115 struct cow_header_v3_broken v3_b;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116};
117
118#define COW_MAGIC 0x4f4f4f4d /* MOOO */
119#define COW_VERSION 3
120
121#define DIV_ROUND(x, len) (((x) + (len) - 1) / (len))
122#define ROUND_UP(x, align) DIV_ROUND(x, align) * (align)
123
124void cow_sizes(int version, __u64 size, int sectorsize, int align,
125 int bitmap_offset, unsigned long *bitmap_len_out,
126 int *data_offset_out)
127{
Jeff Dikecb8fa612007-10-16 01:27:34 -0700128 if (version < 3) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 *bitmap_len_out = (size + sectorsize - 1) / (8 * sectorsize);
130
131 *data_offset_out = bitmap_offset + *bitmap_len_out;
132 *data_offset_out = (*data_offset_out + sectorsize - 1) /
133 sectorsize;
134 *data_offset_out *= sectorsize;
135 }
136 else {
137 *bitmap_len_out = DIV_ROUND(size, sectorsize);
138 *bitmap_len_out = DIV_ROUND(*bitmap_len_out, 8);
139
140 *data_offset_out = bitmap_offset + *bitmap_len_out;
141 *data_offset_out = ROUND_UP(*data_offset_out, align);
142 }
143}
144
145static int absolutize(char *to, int size, char *from)
146{
147 char save_cwd[256], *slash;
148 int remaining;
149
Jeff Dikecb8fa612007-10-16 01:27:34 -0700150 if (getcwd(save_cwd, sizeof(save_cwd)) == NULL) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 cow_printf("absolutize : unable to get cwd - errno = %d\n",
152 errno);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700153 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 }
155 slash = strrchr(from, '/');
Jeff Dikecb8fa612007-10-16 01:27:34 -0700156 if (slash != NULL) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 *slash = '\0';
Jeff Dikecb8fa612007-10-16 01:27:34 -0700158 if (chdir(from)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 *slash = '/';
160 cow_printf("absolutize : Can't cd to '%s' - "
161 "errno = %d\n", from, errno);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700162 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 }
164 *slash = '/';
Jeff Dikecb8fa612007-10-16 01:27:34 -0700165 if (getcwd(to, size) == NULL) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166 cow_printf("absolutize : unable to get cwd of '%s' - "
167 "errno = %d\n", from, errno);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700168 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 }
170 remaining = size - strlen(to);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700171 if (strlen(slash) + 1 > remaining) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 cow_printf("absolutize : unable to fit '%s' into %d "
173 "chars\n", from, size);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700174 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 }
176 strcat(to, slash);
177 }
178 else {
Jeff Dikecb8fa612007-10-16 01:27:34 -0700179 if (strlen(save_cwd) + 1 + strlen(from) + 1 > size) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180 cow_printf("absolutize : unable to fit '%s' into %d "
181 "chars\n", from, size);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700182 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 }
184 strcpy(to, save_cwd);
185 strcat(to, "/");
186 strcat(to, from);
187 }
Vitaliy Ivanov7a99ae72011-07-25 17:12:50 -0700188 if (chdir(save_cwd)) {
189 cow_printf("absolutize : Can't cd to '%s' - "
190 "errno = %d\n", save_cwd, errno);
191 return -1;
192 }
Jeff Dikecb8fa612007-10-16 01:27:34 -0700193 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194}
195
196int write_cow_header(char *cow_file, int fd, char *backing_file,
197 int sectorsize, int alignment, unsigned long long *size)
198{
199 struct cow_header_v3 *header;
200 unsigned long modtime;
201 int err;
202
203 err = cow_seek_file(fd, 0);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700204 if (err < 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205 cow_printf("write_cow_header - lseek failed, err = %d\n", -err);
206 goto out;
207 }
208
209 err = -ENOMEM;
210 header = cow_malloc(sizeof(*header));
Jeff Dikecb8fa612007-10-16 01:27:34 -0700211 if (header == NULL) {
212 cow_printf("write_cow_header - failed to allocate COW V3 "
213 "header\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 goto out;
215 }
Al Virod824d062012-04-05 23:35:03 -0400216 header->magic = htobe32(COW_MAGIC);
217 header->version = htobe32(COW_VERSION);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218
219 err = -EINVAL;
Jeff Dikecb8fa612007-10-16 01:27:34 -0700220 if (strlen(backing_file) > sizeof(header->backing_file) - 1) {
Paolo 'Blaisorblade' Giarrusso6dad2d32006-04-10 22:53:31 -0700221 /* Below, %zd is for a size_t value */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 cow_printf("Backing file name \"%s\" is too long - names are "
Paolo 'Blaisorblade' Giarrusso6dad2d32006-04-10 22:53:31 -0700223 "limited to %zd characters\n", backing_file,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 sizeof(header->backing_file) - 1);
225 goto out_free;
226 }
227
Jeff Dikecb8fa612007-10-16 01:27:34 -0700228 if (absolutize(header->backing_file, sizeof(header->backing_file),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 backing_file))
230 goto out_free;
231
232 err = os_file_modtime(header->backing_file, &modtime);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700233 if (err < 0) {
Paolo 'Blaisorblade' Giarrusso31bc5a32006-02-24 13:03:53 -0800234 cow_printf("write_cow_header - backing file '%s' mtime "
235 "request failed, err = %d\n", header->backing_file,
236 -err);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 goto out_free;
238 }
239
240 err = cow_file_size(header->backing_file, size);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700241 if (err < 0) {
Paolo 'Blaisorblade' Giarrusso31bc5a32006-02-24 13:03:53 -0800242 cow_printf("write_cow_header - couldn't get size of "
243 "backing file '%s', err = %d\n",
244 header->backing_file, -err);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 goto out_free;
246 }
247
Al Virod824d062012-04-05 23:35:03 -0400248 header->mtime = htobe32(modtime);
249 header->size = htobe64(*size);
250 header->sectorsize = htobe32(sectorsize);
251 header->alignment = htobe32(alignment);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 header->cow_format = COW_BITMAP;
253
Paolo 'Blaisorblade' Giarrusso31bc5a32006-02-24 13:03:53 -0800254 err = cow_write_file(fd, header, sizeof(*header));
Jeff Dikecb8fa612007-10-16 01:27:34 -0700255 if (err != sizeof(*header)) {
Paolo 'Blaisorblade' Giarrusso31bc5a32006-02-24 13:03:53 -0800256 cow_printf("write_cow_header - write of header to "
257 "new COW file '%s' failed, err = %d\n", cow_file,
258 -err);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259 goto out_free;
260 }
261 err = 0;
262 out_free:
263 cow_free(header);
264 out:
Jeff Dikecb8fa612007-10-16 01:27:34 -0700265 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266}
267
268int file_reader(__u64 offset, char *buf, int len, void *arg)
269{
270 int fd = *((int *) arg);
271
Jeff Dikecb8fa612007-10-16 01:27:34 -0700272 return pread(fd, buf, len, offset);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273}
274
275/* XXX Need to sanity-check the values read from the header */
276
277int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
278 __u32 *version_out, char **backing_file_out,
279 time_t *mtime_out, unsigned long long *size_out,
280 int *sectorsize_out, __u32 *align_out,
281 int *bitmap_offset_out)
282{
283 union cow_header *header;
284 char *file;
285 int err, n;
286 unsigned long version, magic;
287
288 header = cow_malloc(sizeof(*header));
Jeff Dikecb8fa612007-10-16 01:27:34 -0700289 if (header == NULL) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 cow_printf("read_cow_header - Failed to allocate header\n");
Jeff Dikecb8fa612007-10-16 01:27:34 -0700291 return -ENOMEM;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 }
293 err = -EINVAL;
294 n = (*reader)(0, (char *) header, sizeof(*header), arg);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700295 if (n < offsetof(typeof(header->v1), backing_file)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296 cow_printf("read_cow_header - short header\n");
297 goto out;
298 }
299
300 magic = header->v1.magic;
Jeff Dikecb8fa612007-10-16 01:27:34 -0700301 if (magic == COW_MAGIC)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302 version = header->v1.version;
Al Virod824d062012-04-05 23:35:03 -0400303 else if (magic == be32toh(COW_MAGIC))
304 version = be32toh(header->v1.version);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 /* No error printed because the non-COW case comes through here */
306 else goto out;
307
308 *version_out = version;
309
Jeff Dikecb8fa612007-10-16 01:27:34 -0700310 if (version == 1) {
311 if (n < sizeof(header->v1)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 cow_printf("read_cow_header - failed to read V1 "
313 "header\n");
314 goto out;
315 }
316 *mtime_out = header->v1.mtime;
317 *size_out = header->v1.size;
318 *sectorsize_out = header->v1.sectorsize;
319 *bitmap_offset_out = sizeof(header->v1);
320 *align_out = *sectorsize_out;
321 file = header->v1.backing_file;
322 }
Jeff Dikecb8fa612007-10-16 01:27:34 -0700323 else if (version == 2) {
324 if (n < sizeof(header->v2)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325 cow_printf("read_cow_header - failed to read V2 "
326 "header\n");
327 goto out;
328 }
Al Virod824d062012-04-05 23:35:03 -0400329 *mtime_out = be32toh(header->v2.mtime);
330 *size_out = be64toh(header->v2.size);
331 *sectorsize_out = be32toh(header->v2.sectorsize);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332 *bitmap_offset_out = sizeof(header->v2);
333 *align_out = *sectorsize_out;
334 file = header->v2.backing_file;
335 }
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700336 /* This is very subtle - see above at union cow_header definition */
Jeff Dikecb8fa612007-10-16 01:27:34 -0700337 else if (version == 3 && (*((int*)header->v3.backing_file) != 0)) {
338 if (n < sizeof(header->v3)) {
Paolo 'Blaisorblade' Giarrusso31bc5a32006-02-24 13:03:53 -0800339 cow_printf("read_cow_header - failed to read V3 "
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340 "header\n");
341 goto out;
342 }
Al Virod824d062012-04-05 23:35:03 -0400343 *mtime_out = be32toh(header->v3.mtime);
344 *size_out = be64toh(header->v3.size);
345 *sectorsize_out = be32toh(header->v3.sectorsize);
346 *align_out = be32toh(header->v3.alignment);
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700347 if (*align_out == 0) {
348 cow_printf("read_cow_header - invalid COW header, "
349 "align == 0\n");
350 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 *bitmap_offset_out = ROUND_UP(sizeof(header->v3), *align_out);
352 file = header->v3.backing_file;
353 }
Jeff Dikecb8fa612007-10-16 01:27:34 -0700354 else if (version == 3) {
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700355 cow_printf("read_cow_header - broken V3 file with"
356 " 64-bit layout - recovering content.\n");
357
Jeff Dikecb8fa612007-10-16 01:27:34 -0700358 if (n < sizeof(header->v3_b)) {
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700359 cow_printf("read_cow_header - failed to read V3 "
360 "header\n");
361 goto out;
362 }
363
Jeff Dikecb8fa612007-10-16 01:27:34 -0700364 /*
365 * this was used until Dec2005 - 64bits are needed to represent
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700366 * 2038+. I.e. we can safely do this truncating cast.
367 *
Al Virod824d062012-04-05 23:35:03 -0400368 * Additionally, we must use be32toh() instead of be64toh(), since
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700369 * the program used to use the former (tested - I got mtime
370 * mismatch "0 vs whatever").
371 *
372 * Ever heard about bug-to-bug-compatibility ? ;-) */
Al Virod824d062012-04-05 23:35:03 -0400373 *mtime_out = (time32_t) be32toh(header->v3_b.mtime);
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700374
Al Virod824d062012-04-05 23:35:03 -0400375 *size_out = be64toh(header->v3_b.size);
376 *sectorsize_out = be32toh(header->v3_b.sectorsize);
377 *align_out = be32toh(header->v3_b.alignment);
Paolo 'Blaisorblade' Giarrussof2ea3942006-04-10 22:53:30 -0700378 if (*align_out == 0) {
379 cow_printf("read_cow_header - invalid COW header, "
380 "align == 0\n");
381 }
382 *bitmap_offset_out = ROUND_UP(sizeof(header->v3_b), *align_out);
383 file = header->v3_b.backing_file;
384 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385 else {
386 cow_printf("read_cow_header - invalid COW version\n");
387 goto out;
388 }
389 err = -ENOMEM;
390 *backing_file_out = cow_strdup(file);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700391 if (*backing_file_out == NULL) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392 cow_printf("read_cow_header - failed to allocate backing "
393 "file\n");
394 goto out;
395 }
396 err = 0;
397 out:
398 cow_free(header);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700399 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400}
401
402int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize,
403 int alignment, int *bitmap_offset_out,
404 unsigned long *bitmap_len_out, int *data_offset_out)
405{
406 unsigned long long size, offset;
407 char zero = 0;
408 int err;
409
410 err = write_cow_header(cow_file, fd, backing_file, sectorsize,
411 alignment, &size);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700412 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 goto out;
414
415 *bitmap_offset_out = ROUND_UP(sizeof(struct cow_header_v3), alignment);
416 cow_sizes(COW_VERSION, size, sectorsize, alignment, *bitmap_offset_out,
417 bitmap_len_out, data_offset_out);
418
419 offset = *data_offset_out + size - sizeof(zero);
420 err = cow_seek_file(fd, offset);
Jeff Dikecb8fa612007-10-16 01:27:34 -0700421 if (err < 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422 cow_printf("cow bitmap lseek failed : err = %d\n", -err);
423 goto out;
424 }
425
Jeff Dikecb8fa612007-10-16 01:27:34 -0700426 /*
427 * does not really matter how much we write it is just to set EOF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 * this also sets the entire COW bitmap
429 * to zero without having to allocate it
430 */
431 err = cow_write_file(fd, &zero, sizeof(zero));
Jeff Dikecb8fa612007-10-16 01:27:34 -0700432 if (err != sizeof(zero)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 cow_printf("Write of bitmap to new COW file '%s' failed, "
434 "err = %d\n", cow_file, -err);
Paolo 'Blaisorblade' Giarrussofe1db502006-02-24 13:03:58 -0800435 if (err >= 0)
436 err = -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 goto out;
438 }
439
Jeff Dikecb8fa612007-10-16 01:27:34 -0700440 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 out:
Jeff Dikecb8fa612007-10-16 01:27:34 -0700442 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443}