Add patch file which is attached to the ticket #16,
[midnight-commander.git] / vfs / cpio.c
blobfb93d9a2e9706b74c205b171d469011d452a80d9
1 /* Virtual File System: GNU Tar file system.
2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007
3 Free Software Foundation, Inc.
5 Written by: 2000 Jan Hudec
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License
9 as published by the Free Software Foundation; either version 2 of
10 the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21 #include <config.h>
22 #include <errno.h>
24 #include "../src/global.h"
25 #include "../src/tty.h" /* enable/disable interrupt key */
26 #include "../src/wtools.h" /* message() */
27 #include "../src/main.h" /* print_vfs_message */
28 #include "utilvfs.h"
29 #include "vfs-impl.h"
30 #include "gc.h" /* vfs_rmstamp */
31 #include "xdirentry.h"
32 #include "../src/unixcompat.h"
34 enum {
35 STATUS_START,
36 STATUS_OK,
37 STATUS_TRAIL,
38 STATUS_FAIL,
39 STATUS_EOF
42 enum {
43 CPIO_UNKNOWN = 0, /* Not determined yet */
44 CPIO_BIN, /* Binary format */
45 CPIO_BINRE, /* Binary format, reverse endianity */
46 CPIO_OLDC, /* Old ASCII format */
47 CPIO_NEWC, /* New ASCII format */
48 CPIO_CRC /* New ASCII format + CRC */
51 static struct vfs_class vfs_cpiofs_ops;
53 struct old_cpio_header
55 unsigned short c_magic;
56 short c_dev;
57 unsigned short c_ino;
58 unsigned short c_mode;
59 unsigned short c_uid;
60 unsigned short c_gid;
61 unsigned short c_nlink;
62 short c_rdev;
63 unsigned short c_mtimes[2];
64 unsigned short c_namesize;
65 unsigned short c_filesizes[2];
68 struct new_cpio_header
70 unsigned short c_magic;
71 unsigned long c_ino;
72 unsigned long c_mode;
73 unsigned long c_uid;
74 unsigned long c_gid;
75 unsigned long c_nlink;
76 unsigned long c_mtime;
77 unsigned long c_filesize;
78 long c_dev;
79 long c_devmin;
80 long c_rdev;
81 long c_rdevmin;
82 unsigned long c_namesize;
83 unsigned long c_chksum;
86 struct defer_inode {
87 struct defer_inode *next;
88 unsigned long inumber;
89 unsigned short device;
90 struct vfs_s_inode *inode;
93 /* FIXME: should be off_t instead of int. */
94 static int cpio_position;
96 static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super);
97 static int cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super);
98 static int cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super);
99 static int cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super);
100 static int cpio_create_entry(struct vfs_class *me, struct vfs_s_super *super, struct stat *, char *name);
101 static int cpio_read(void *fh, char *buffer, int count);
103 #define CPIO_POS(super) cpio_position
104 /* If some time reentrancy should be needed change it to */
105 /* #define CPIO_POS(super) (super)->u.arch.fd */
107 #define CPIO_SEEK_SET(super, where) mc_lseek((super)->u.arch.fd, CPIO_POS(super) = (where), SEEK_SET)
108 #define CPIO_SEEK_CUR(super, where) mc_lseek((super)->u.arch.fd, CPIO_POS(super) += (where), SEEK_SET)
110 static struct defer_inode *
111 cpio_defer_find (struct defer_inode *l, struct defer_inode *i)
113 while (l && (l->inumber != i->inumber || l->device != i->device))
114 l = l->next;
115 return l;
118 static int cpio_skip_padding(struct vfs_s_super *super)
120 switch(super->u.arch.type) {
121 case CPIO_BIN:
122 case CPIO_BINRE:
123 return CPIO_SEEK_CUR(super, (2 - (CPIO_POS(super) % 2)) % 2);
124 case CPIO_NEWC:
125 case CPIO_CRC:
126 return CPIO_SEEK_CUR(super, (4 - (CPIO_POS(super) % 4)) % 4);
127 case CPIO_OLDC:
128 return CPIO_POS(super);
129 default:
130 g_assert_not_reached();
131 return 42; /* & the compiler is happy :-) */
135 static void cpio_free_archive(struct vfs_class *me, struct vfs_s_super *super)
137 struct defer_inode *l, *lnext;
139 (void) me;
141 if(super->u.arch.fd != -1)
142 mc_close(super->u.arch.fd);
143 super->u.arch.fd = -1;
144 for (l = super->u.arch.deferred; l; l = lnext) {
145 lnext = l->next;
146 g_free (l);
148 super->u.arch.deferred = NULL;
151 static int
152 cpio_open_cpio_file (struct vfs_class *me, struct vfs_s_super *super,
153 const char *name)
155 int fd, type;
156 mode_t mode;
157 struct vfs_s_inode *root;
159 if ((fd = mc_open (name, O_RDONLY)) == -1) {
160 message (1, MSG_ERROR, _("Cannot open cpio archive\n%s"), name);
161 return -1;
164 super->name = g_strdup (name);
165 super->u.arch.fd = -1; /* for now */
166 mc_stat (name, &(super->u.arch.st));
167 super->u.arch.type = CPIO_UNKNOWN;
169 type = get_compression_type (fd);
170 if (type != COMPRESSION_NONE) {
171 char *s;
173 mc_close (fd);
174 s = g_strconcat (name, decompress_extension (type), (char *) NULL);
175 if ((fd = mc_open (s, O_RDONLY)) == -1) {
176 message (1, MSG_ERROR, _("Cannot open cpio archive\n%s"), s);
177 g_free (s);
178 return -1;
180 g_free (s);
183 super->u.arch.fd = fd;
184 mode = super->u.arch.st.st_mode & 07777;
185 mode |= (mode & 0444) >> 2; /* set eXec where Read is */
186 mode |= S_IFDIR;
188 root = vfs_s_new_inode (me, super, &(super->u.arch.st));
189 root->st.st_mode = mode;
190 root->data_offset = -1;
191 root->st.st_nlink++;
192 root->st.st_dev = MEDATA->rdev++;
194 super->root = root;
196 CPIO_SEEK_SET (super, 0);
198 return fd;
201 static int cpio_read_head(struct vfs_class *me, struct vfs_s_super *super)
203 switch(cpio_find_head(me, super)) {
204 case CPIO_UNKNOWN:
205 return -1;
206 case CPIO_BIN:
207 case CPIO_BINRE:
208 return cpio_read_bin_head(me, super);
209 case CPIO_OLDC:
210 return cpio_read_oldc_head(me, super);
211 case CPIO_NEWC:
212 case CPIO_CRC:
213 return cpio_read_crc_head(me, super);
214 default:
215 g_assert_not_reached();
216 return 42; /* & the compiler is happy :-) */
220 #define MAGIC_LENGTH (6) /* How many bytes we have to read ahead */
221 #define SEEKBACK CPIO_SEEK_CUR(super, ptr - top)
222 #define RETURN(x) return(super->u.arch.type = (x))
223 #define TYPEIS(x) ((super->u.arch.type == CPIO_UNKNOWN) || (super->u.arch.type == (x)))
224 static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super)
226 char buf[256];
227 int ptr = 0;
228 int top;
229 int tmp;
231 top = mc_read (super->u.arch.fd, buf, 256);
232 if (top > 0)
233 CPIO_POS (super) += top;
234 for(;;) {
235 if(ptr + MAGIC_LENGTH >= top) {
236 if(top > 128) {
237 memmove(buf, buf + top - 128, 128);
238 ptr -= top - 128;
239 top = 128;
241 if((tmp = mc_read(super->u.arch.fd, buf, top)) == 0 || tmp == -1) {
242 message (1, MSG_ERROR, _("Premature end of cpio archive\n%s"), super->name);
243 cpio_free_archive(me, super);
244 return CPIO_UNKNOWN;
246 top += tmp;
248 if(TYPEIS(CPIO_BIN) && ((*(unsigned short *)(buf + ptr)) == 070707)) {
249 SEEKBACK; RETURN(CPIO_BIN);
250 } else if(TYPEIS(CPIO_BINRE) && ((*(unsigned short *)(buf + ptr)) == GUINT16_SWAP_LE_BE_CONSTANT(070707))) {
251 SEEKBACK; RETURN(CPIO_BINRE);
252 } else if(TYPEIS(CPIO_OLDC) && (!strncmp(buf + ptr, "070707", 6))) {
253 SEEKBACK; RETURN(CPIO_OLDC);
254 } else if(TYPEIS(CPIO_NEWC) && (!strncmp(buf + ptr, "070701", 6))) {
255 SEEKBACK; RETURN(CPIO_NEWC);
256 } else if(TYPEIS(CPIO_CRC) && (!strncmp(buf + ptr, "070702", 6))) {
257 SEEKBACK; RETURN(CPIO_CRC);
259 ptr++;
262 #undef RETURN
263 #undef SEEKBACK
265 #define HEAD_LENGTH (26)
266 static int cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super)
268 union {
269 struct old_cpio_header buf;
270 short shorts[HEAD_LENGTH >> 1];
271 } u;
272 int len;
273 char *name;
274 struct stat st;
276 if((len = mc_read(super->u.arch.fd, (char *)&u.buf, HEAD_LENGTH)) < HEAD_LENGTH)
277 return STATUS_EOF;
278 CPIO_POS(super) += len;
279 if(super->u.arch.type == CPIO_BINRE) {
280 int i;
281 for(i = 0; i < (HEAD_LENGTH >> 1); i++)
282 u.shorts[i] = GUINT16_SWAP_LE_BE_CONSTANT(u.shorts[i]);
284 g_assert(u.buf.c_magic == 070707);
286 if (u.buf.c_namesize == 0 || u.buf.c_namesize > MC_MAXPATHLEN) {
287 message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
288 super->name);
289 return STATUS_FAIL;
291 name = g_malloc(u.buf.c_namesize);
292 if((len = mc_read(super->u.arch.fd, name, u.buf.c_namesize)) < u.buf.c_namesize) {
293 g_free(name);
294 return STATUS_EOF;
296 name[u.buf.c_namesize - 1] = '\0';
297 CPIO_POS(super) += len;
298 cpio_skip_padding(super);
300 if(!strcmp("TRAILER!!!", name)) { /* We got to the last record */
301 g_free(name);
302 return STATUS_TRAIL;
305 st.st_dev = u.buf.c_dev;
306 st.st_ino = u.buf.c_ino;
307 st.st_mode = u.buf.c_mode;
308 st.st_nlink = u.buf.c_nlink;
309 st.st_uid = u.buf.c_uid;
310 st.st_gid = u.buf.c_gid;
311 st.st_rdev = u.buf.c_rdev;
312 st.st_size = (u.buf.c_filesizes[0] << 16) | u.buf.c_filesizes[1];
313 st.st_atime = st.st_mtime = st.st_ctime = (u.buf.c_mtimes[0] << 16) | u.buf.c_mtimes[1];
315 return cpio_create_entry(me, super, &st, name);
317 #undef HEAD_LENGTH
319 #define HEAD_LENGTH (76)
320 static int cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super)
322 struct new_cpio_header hd;
323 union {
324 struct stat st;
325 char buf[HEAD_LENGTH + 1];
326 } u;
327 int len;
328 char *name;
330 if (mc_read (super->u.arch.fd, u.buf, HEAD_LENGTH) != HEAD_LENGTH)
331 return STATUS_EOF;
332 CPIO_POS (super) += HEAD_LENGTH;
333 u.buf[HEAD_LENGTH] = 0;
335 if (sscanf (u.buf, "070707%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11lo",
336 &hd.c_dev, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
337 &hd.c_nlink, &hd.c_rdev, &hd.c_mtime,
338 &hd.c_namesize, &hd.c_filesize) < 10) {
339 message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
340 super->name);
341 return STATUS_FAIL;
344 if (hd.c_namesize == 0 || hd.c_namesize > MC_MAXPATHLEN) {
345 message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
346 super->name);
347 return STATUS_FAIL;
349 name = g_malloc(hd.c_namesize);
350 if((len = mc_read(super->u.arch.fd, name, hd.c_namesize)) == -1 ||
351 (unsigned long) len < hd.c_namesize) {
352 g_free (name);
353 return STATUS_EOF;
355 name[hd.c_namesize - 1] = '\0';
356 CPIO_POS(super) += len;
357 cpio_skip_padding(super);
359 if(!strcmp("TRAILER!!!", name)) { /* We got to the last record */
360 g_free(name);
361 return STATUS_TRAIL;
364 u.st.st_dev = hd.c_dev;
365 u.st.st_ino = hd.c_ino;
366 u.st.st_mode = hd.c_mode;
367 u.st.st_nlink = hd.c_nlink;
368 u.st.st_uid = hd.c_uid;
369 u.st.st_gid = hd.c_gid;
370 u.st.st_rdev = hd.c_rdev;
371 u.st.st_size = hd.c_filesize;
372 u.st.st_atime = u.st.st_mtime = u.st.st_ctime = hd.c_mtime;
374 return cpio_create_entry (me, super, &u.st, name);
376 #undef HEAD_LENGTH
378 #define HEAD_LENGTH (110)
379 static int cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super)
381 struct new_cpio_header hd;
382 union {
383 struct stat st;
384 char buf[HEAD_LENGTH + 1];
385 } u;
386 int len;
387 char *name;
389 if (mc_read (super->u.arch.fd, u.buf, HEAD_LENGTH) != HEAD_LENGTH)
390 return STATUS_EOF;
391 CPIO_POS (super) += HEAD_LENGTH;
392 u.buf[HEAD_LENGTH] = 0;
394 if (sscanf (u.buf, "%6ho%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx",
395 &hd.c_magic, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
396 &hd.c_nlink, &hd.c_mtime, &hd.c_filesize,
397 &hd.c_dev, &hd.c_devmin, &hd.c_rdev, &hd.c_rdevmin,
398 &hd.c_namesize, &hd.c_chksum) < 14) {
399 message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
400 super->name);
401 return STATUS_FAIL;
404 if((super->u.arch.type == CPIO_NEWC && hd.c_magic != 070701) ||
405 (super->u.arch.type == CPIO_CRC && hd.c_magic != 070702))
406 return STATUS_FAIL;
408 if (hd.c_namesize == 0 || hd.c_namesize > MC_MAXPATHLEN) {
409 message (1, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
410 super->name);
411 return STATUS_FAIL;
414 name = g_malloc(hd.c_namesize);
415 if((len = mc_read (super->u.arch.fd, name, hd.c_namesize)) == -1 ||
416 (unsigned long) len < hd.c_namesize) {
417 g_free (name);
418 return STATUS_EOF;
420 name[hd.c_namesize - 1] = '\0';
421 CPIO_POS(super) += len;
422 cpio_skip_padding(super);
424 if(!strcmp("TRAILER!!!", name)) { /* We got to the last record */
425 g_free(name);
426 return STATUS_TRAIL;
429 u.st.st_dev = makedev (hd.c_dev, hd.c_devmin);
430 u.st.st_ino = hd.c_ino;
431 u.st.st_mode = hd.c_mode;
432 u.st.st_nlink = hd.c_nlink;
433 u.st.st_uid = hd.c_uid;
434 u.st.st_gid = hd.c_gid;
435 u.st.st_rdev = makedev (hd.c_rdev, hd.c_rdevmin);
436 u.st.st_size = hd.c_filesize;
437 u.st.st_atime = u.st.st_mtime = u.st.st_ctime = hd.c_mtime;
439 return cpio_create_entry (me, super, &u.st, name);
442 static int
443 cpio_create_entry (struct vfs_class *me, struct vfs_s_super *super,
444 struct stat *st, char *name)
446 struct vfs_s_inode *inode = NULL;
447 struct vfs_s_inode *root = super->root;
448 struct vfs_s_entry *entry = NULL;
449 char *tn;
451 switch (st->st_mode & S_IFMT) { /* For case of HP/UX archives */
452 case S_IFCHR:
453 case S_IFBLK:
454 #ifdef S_IFSOCK
455 case S_IFSOCK:
456 #endif
457 #ifdef S_IFIFO
458 case S_IFIFO:
459 #endif
460 #ifdef S_IFNAM
461 case S_IFNAM:
462 #endif
463 if ((st->st_size != 0) && (st->st_rdev == 0x0001)) {
464 /* FIXME: representation of major/minor differs between */
465 /* different operating systems. */
466 st->st_rdev = (unsigned) st->st_size;
467 st->st_size = 0;
469 break;
470 default:
471 break;
474 if ((st->st_nlink > 1) && (super->u.arch.type == CPIO_NEWC || super->u.arch.type == CPIO_CRC)) { /* For case of hardlinked files */
475 struct defer_inode i, *l;
476 i.inumber = st->st_ino;
477 i.device = st->st_dev;
478 i.inode = NULL;
479 if ((l = cpio_defer_find (super->u.arch.deferred, &i)) != NULL) {
480 inode = l->inode;
481 if (inode->st.st_size && st->st_size
482 && (inode->st.st_size != st->st_size)) {
483 message (1, MSG_ERROR,
485 ("Inconsistent hardlinks of\n%s\nin cpio archive\n%s"),
486 name, super->name);
487 inode = NULL;
488 } else if (!inode->st.st_size)
489 inode->st.st_size = st->st_size;
493 for (tn = name + strlen (name) - 1; tn >= name && *tn == PATH_SEP; tn--)
494 *tn = 0;
495 if ((tn = strrchr (name, PATH_SEP))) {
496 *tn = 0;
497 root = vfs_s_find_inode (me, super, name, LINK_FOLLOW, FL_MKDIR);
498 *tn = PATH_SEP;
499 tn++;
500 } else
501 tn = name;
503 entry = MEDATA->find_entry (me, root, tn, LINK_FOLLOW, FL_NONE); /* In case entry is already there */
505 if (entry) { /* This shouldn't happen! (well, it can happen if there is a record for a
506 file and than a record for a directory it is in; cpio would die with
507 'No such file or directory' is such case) */
509 if (!S_ISDIR (entry->ino->st.st_mode)) { /* This can be considered archive inconsistency */
510 message (1, MSG_ERROR,
511 _("%s contains duplicate entries! Skipping!"),
512 super->name);
513 } else {
514 entry->ino->st.st_mode = st->st_mode;
515 entry->ino->st.st_uid = st->st_uid;
516 entry->ino->st.st_gid = st->st_gid;
517 entry->ino->st.st_atime = st->st_atime;
518 entry->ino->st.st_mtime = st->st_mtime;
519 entry->ino->st.st_ctime = st->st_ctime;
522 } else { /* !entry */
524 if (!inode) {
525 inode = vfs_s_new_inode (me, super, st);
526 if ((st->st_nlink > 0) && (super->u.arch.type == CPIO_NEWC || super->u.arch.type == CPIO_CRC)) { /* For case of hardlinked files */
527 struct defer_inode *i;
528 i = g_new (struct defer_inode, 1);
529 i->inumber = st->st_ino;
530 i->device = st->st_dev;
531 i->inode = inode;
532 i->next = super->u.arch.deferred;
533 super->u.arch.deferred = i;
537 if (st->st_size)
538 inode->data_offset = CPIO_POS (super);
540 entry = vfs_s_new_entry (me, tn, inode);
541 vfs_s_insert_entry (me, root, entry);
543 if (S_ISLNK (st->st_mode)) {
544 inode->linkname = g_malloc (st->st_size + 1);
545 if (mc_read (super->u.arch.fd, inode->linkname, st->st_size)
546 < st->st_size) {
547 inode->linkname[0] = 0;
548 g_free (name);
549 return STATUS_EOF;
551 inode->linkname[st->st_size] = 0; /* Linkname stored without terminating \0 !!! */
552 CPIO_POS (super) += st->st_size;
553 cpio_skip_padding (super);
554 } else {
555 CPIO_SEEK_CUR (super, st->st_size);
558 } /* !entry */
560 g_free (name);
561 return STATUS_OK;
564 /* Need to CPIO_SEEK_CUR to skip the file at the end of add entry!!!! */
566 static int
567 cpio_open_archive (struct vfs_class *me, struct vfs_s_super *super,
568 const char *name, char *op)
570 int status = STATUS_START;
572 (void) op;
574 if (cpio_open_cpio_file (me, super, name) == -1)
575 return -1;
577 for (;;) {
578 status = cpio_read_head (me, super);
580 switch (status) {
581 case STATUS_EOF:
582 message (1, MSG_ERROR, _("Unexpected end of file\n%s"), name);
583 return 0;
584 case STATUS_OK:
585 continue;
586 case STATUS_TRAIL:
587 break;
589 break;
592 return 0;
595 /* Remaining functions are exactly same as for tarfs (and were in fact just copied) */
596 static void *
597 cpio_super_check (struct vfs_class *me, const char *archive_name, char *op)
599 static struct stat sb;
601 (void) me;
602 (void) op;
604 if (mc_stat (archive_name, &sb))
605 return NULL;
606 return &sb;
609 static int
610 cpio_super_same (struct vfs_class *me, struct vfs_s_super *parc,
611 const char *archive_name, char *op, void *cookie)
613 struct stat *archive_stat = cookie; /* stat of main archive */
615 (void) me;
616 (void) op;
618 if (strcmp (parc->name, archive_name))
619 return 0;
621 /* Has the cached archive been changed on the disk? */
622 if (parc->u.arch.st.st_mtime < archive_stat->st_mtime) {
623 /* Yes, reload! */
624 (*vfs_cpiofs_ops.free) ((vfsid) parc);
625 vfs_rmstamp (&vfs_cpiofs_ops, (vfsid) parc);
626 return 2;
628 /* Hasn't been modified, give it a new timeout */
629 vfs_stamp (&vfs_cpiofs_ops, (vfsid) parc);
630 return 1;
633 static int cpio_read(void *fh, char *buffer, int count)
635 off_t begin = FH->ino->data_offset;
636 int fd = FH_SUPER->u.arch.fd;
637 struct vfs_class *me = FH_SUPER->me;
639 if (mc_lseek (fd, begin + FH->pos, SEEK_SET) !=
640 begin + FH->pos) ERRNOR (EIO, -1);
642 count = MIN(count, FH->ino->st.st_size - FH->pos);
644 if ((count = mc_read (fd, buffer, count)) == -1) ERRNOR (errno, -1);
646 FH->pos += count;
647 return count;
650 static int cpio_fh_open(struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode)
652 (void) fh;
653 (void) mode;
655 if ((flags & O_ACCMODE) != O_RDONLY) ERRNOR (EROFS, -1);
656 return 0;
659 void
660 init_cpiofs (void)
662 static struct vfs_s_subclass cpio_subclass;
664 cpio_subclass.flags = VFS_S_READONLY;
665 cpio_subclass.archive_check = cpio_super_check;
666 cpio_subclass.archive_same = cpio_super_same;
667 cpio_subclass.open_archive = cpio_open_archive;
668 cpio_subclass.free_archive = cpio_free_archive;
669 cpio_subclass.fh_open = cpio_fh_open;
671 vfs_s_init_class (&vfs_cpiofs_ops, &cpio_subclass);
672 vfs_cpiofs_ops.name = "cpiofs";
673 vfs_cpiofs_ops.prefix = "ucpio";
674 vfs_cpiofs_ops.read = cpio_read;
675 vfs_cpiofs_ops.setctl = NULL;
676 vfs_register_class (&vfs_cpiofs_ops);