Completely removed MHL stuff
[midnight-commander.git] / vfs / cpio.c
blob26f81a42d69cde07c0e28f226216639d5061a31d
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>
23 #include <errno.h>
25 #include "../src/global.h"
26 #include "../src/tty.h" /* enable/disable interrupt key */
27 #include "../src/wtools.h" /* message() */
28 #include "../src/main.h" /* print_vfs_message */
29 #include "utilvfs.h"
30 #include "vfs-impl.h"
31 #include "gc.h" /* vfs_rmstamp */
32 #include "xdirentry.h"
33 #include "../src/unixcompat.h"
35 enum {
36 STATUS_START,
37 STATUS_OK,
38 STATUS_TRAIL,
39 STATUS_FAIL,
40 STATUS_EOF
43 enum {
44 CPIO_UNKNOWN = 0, /* Not determined yet */
45 CPIO_BIN, /* Binary format */
46 CPIO_BINRE, /* Binary format, reverse endianity */
47 CPIO_OLDC, /* Old ASCII format */
48 CPIO_NEWC, /* New ASCII format */
49 CPIO_CRC /* New ASCII format + CRC */
52 static struct vfs_class vfs_cpiofs_ops;
54 struct old_cpio_header
56 unsigned short c_magic;
57 short c_dev;
58 unsigned short c_ino;
59 unsigned short c_mode;
60 unsigned short c_uid;
61 unsigned short c_gid;
62 unsigned short c_nlink;
63 short c_rdev;
64 unsigned short c_mtimes[2];
65 unsigned short c_namesize;
66 unsigned short c_filesizes[2];
69 struct new_cpio_header
71 unsigned short c_magic;
72 unsigned long c_ino;
73 unsigned long c_mode;
74 unsigned long c_uid;
75 unsigned long c_gid;
76 unsigned long c_nlink;
77 unsigned long c_mtime;
78 unsigned long c_filesize;
79 long c_dev;
80 long c_devmin;
81 long c_rdev;
82 long c_rdevmin;
83 unsigned long c_namesize;
84 unsigned long c_chksum;
87 struct defer_inode {
88 struct defer_inode *next;
89 unsigned long inumber;
90 unsigned short device;
91 struct vfs_s_inode *inode;
94 /* FIXME: should be off_t instead of int. */
95 static int cpio_position;
97 static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super);
98 static int cpio_create_entry(struct vfs_class *me, struct vfs_s_super *super, struct stat *, char *name);
99 static ssize_t cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super);
100 static ssize_t cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super);
101 static ssize_t cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super);
102 static ssize_t cpio_read(void *fh, char *buffer, int count);
104 #define CPIO_POS(super) cpio_position
105 /* If some time reentrancy should be needed change it to */
106 /* #define CPIO_POS(super) (super)->u.arch.fd */
108 #define CPIO_SEEK_SET(super, where) mc_lseek((super)->u.arch.fd, CPIO_POS(super) = (where), SEEK_SET)
109 #define CPIO_SEEK_CUR(super, where) mc_lseek((super)->u.arch.fd, CPIO_POS(super) += (where), SEEK_SET)
111 static struct defer_inode *
112 cpio_defer_find (struct defer_inode *l, struct defer_inode *i)
114 while (l && (l->inumber != i->inumber || l->device != i->device))
115 l = l->next;
116 return l;
119 static int cpio_skip_padding(struct vfs_s_super *super)
121 switch(super->u.arch.type) {
122 case CPIO_BIN:
123 case CPIO_BINRE:
124 return CPIO_SEEK_CUR(super, (2 - (CPIO_POS(super) % 2)) % 2);
125 case CPIO_NEWC:
126 case CPIO_CRC:
127 return CPIO_SEEK_CUR(super, (4 - (CPIO_POS(super) % 4)) % 4);
128 case CPIO_OLDC:
129 return CPIO_POS(super);
130 default:
131 g_assert_not_reached();
132 return 42; /* & the compiler is happy :-) */
136 static void cpio_free_archive(struct vfs_class *me, struct vfs_s_super *super)
138 struct defer_inode *l, *lnext;
140 (void) me;
142 if(super->u.arch.fd != -1)
143 mc_close(super->u.arch.fd);
144 super->u.arch.fd = -1;
145 for (l = super->u.arch.deferred; l; l = lnext) {
146 lnext = l->next;
147 g_free (l);
149 super->u.arch.deferred = NULL;
152 static int
153 cpio_open_cpio_file (struct vfs_class *me, struct vfs_s_super *super,
154 const char *name)
156 int fd, type;
157 mode_t mode;
158 struct vfs_s_inode *root;
160 if ((fd = mc_open (name, O_RDONLY)) == -1) {
161 message (D_ERROR, MSG_ERROR, _("Cannot open cpio archive\n%s"), name);
162 return -1;
165 super->name = g_strdup (name);
166 super->u.arch.fd = -1; /* for now */
167 mc_stat (name, &(super->u.arch.st));
168 super->u.arch.type = CPIO_UNKNOWN;
170 type = get_compression_type (fd);
171 if (type != COMPRESSION_NONE) {
172 char *s;
174 mc_close (fd);
175 s = g_strconcat (name, decompress_extension (type), (char *) NULL);
176 if ((fd = mc_open (s, O_RDONLY)) == -1) {
177 message (D_ERROR, MSG_ERROR, _("Cannot open cpio archive\n%s"), s);
178 g_free (s);
179 return -1;
181 g_free (s);
184 super->u.arch.fd = fd;
185 mode = super->u.arch.st.st_mode & 07777;
186 mode |= (mode & 0444) >> 2; /* set eXec where Read is */
187 mode |= S_IFDIR;
189 root = vfs_s_new_inode (me, super, &(super->u.arch.st));
190 root->st.st_mode = mode;
191 root->data_offset = -1;
192 root->st.st_nlink++;
193 root->st.st_dev = MEDATA->rdev++;
195 super->root = root;
197 CPIO_SEEK_SET (super, 0);
199 return fd;
202 static ssize_t cpio_read_head(struct vfs_class *me, struct vfs_s_super *super)
204 switch(cpio_find_head(me, super)) {
205 case CPIO_UNKNOWN:
206 return -1;
207 case CPIO_BIN:
208 case CPIO_BINRE:
209 return cpio_read_bin_head(me, super);
210 case CPIO_OLDC:
211 return cpio_read_oldc_head(me, super);
212 case CPIO_NEWC:
213 case CPIO_CRC:
214 return cpio_read_crc_head(me, super);
215 default:
216 g_assert_not_reached();
217 return 42; /* & the compiler is happy :-) */
221 #define MAGIC_LENGTH (6) /* How many bytes we have to read ahead */
222 #define SEEKBACK CPIO_SEEK_CUR(super, ptr - top)
223 #define RETURN(x) return(super->u.arch.type = (x))
224 #define TYPEIS(x) ((super->u.arch.type == CPIO_UNKNOWN) || (super->u.arch.type == (x)))
225 static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super)
227 char buf[256];
228 int ptr = 0;
229 int top;
230 int tmp;
232 top = mc_read (super->u.arch.fd, buf, 256);
233 if (top > 0)
234 CPIO_POS (super) += top;
235 for(;;) {
236 if(ptr + MAGIC_LENGTH >= top) {
237 if(top > 128) {
238 memmove(buf, buf + top - 128, 128);
239 ptr -= top - 128;
240 top = 128;
242 if((tmp = mc_read(super->u.arch.fd, buf, top)) == 0 || tmp == -1) {
243 message (D_ERROR, MSG_ERROR, _("Premature end of cpio archive\n%s"), super->name);
244 cpio_free_archive(me, super);
245 return CPIO_UNKNOWN;
247 top += tmp;
249 if(TYPEIS(CPIO_BIN) && ((*(unsigned short *)(buf + ptr)) == 070707)) {
250 SEEKBACK; RETURN(CPIO_BIN);
251 } else if(TYPEIS(CPIO_BINRE) && ((*(unsigned short *)(buf + ptr)) == GUINT16_SWAP_LE_BE_CONSTANT(070707))) {
252 SEEKBACK; RETURN(CPIO_BINRE);
253 } else if(TYPEIS(CPIO_OLDC) && (!strncmp(buf + ptr, "070707", 6))) {
254 SEEKBACK; RETURN(CPIO_OLDC);
255 } else if(TYPEIS(CPIO_NEWC) && (!strncmp(buf + ptr, "070701", 6))) {
256 SEEKBACK; RETURN(CPIO_NEWC);
257 } else if(TYPEIS(CPIO_CRC) && (!strncmp(buf + ptr, "070702", 6))) {
258 SEEKBACK; RETURN(CPIO_CRC);
260 ptr++;
263 #undef RETURN
264 #undef SEEKBACK
266 #define HEAD_LENGTH (26)
267 static ssize_t cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super)
269 union {
270 struct old_cpio_header buf;
271 short shorts[HEAD_LENGTH >> 1];
272 } u;
273 int len;
274 char *name;
275 struct stat st;
277 if((len = mc_read(super->u.arch.fd, (char *)&u.buf, HEAD_LENGTH)) < HEAD_LENGTH)
278 return STATUS_EOF;
279 CPIO_POS(super) += len;
280 if(super->u.arch.type == CPIO_BINRE) {
281 int i;
282 for(i = 0; i < (HEAD_LENGTH >> 1); i++)
283 u.shorts[i] = GUINT16_SWAP_LE_BE_CONSTANT(u.shorts[i]);
285 g_assert(u.buf.c_magic == 070707);
287 if (u.buf.c_namesize == 0 || u.buf.c_namesize > MC_MAXPATHLEN) {
288 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
289 super->name);
290 return STATUS_FAIL;
292 name = g_malloc(u.buf.c_namesize);
293 if((len = mc_read(super->u.arch.fd, name, u.buf.c_namesize)) < u.buf.c_namesize) {
294 g_free(name);
295 return STATUS_EOF;
297 name[u.buf.c_namesize - 1] = '\0';
298 CPIO_POS(super) += len;
299 cpio_skip_padding(super);
301 if(!strcmp("TRAILER!!!", name)) { /* We got to the last record */
302 g_free(name);
303 return STATUS_TRAIL;
306 st.st_dev = u.buf.c_dev;
307 st.st_ino = u.buf.c_ino;
308 st.st_mode = u.buf.c_mode;
309 st.st_nlink = u.buf.c_nlink;
310 st.st_uid = u.buf.c_uid;
311 st.st_gid = u.buf.c_gid;
312 st.st_rdev = u.buf.c_rdev;
313 st.st_size = (u.buf.c_filesizes[0] << 16) | u.buf.c_filesizes[1];
314 st.st_atime = st.st_mtime = st.st_ctime = (u.buf.c_mtimes[0] << 16) | u.buf.c_mtimes[1];
316 return cpio_create_entry(me, super, &st, name);
318 #undef HEAD_LENGTH
320 #define HEAD_LENGTH (76)
321 static ssize_t cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super)
323 struct new_cpio_header hd;
324 union {
325 struct stat st;
326 char buf[HEAD_LENGTH + 1];
327 } u;
328 int len;
329 char *name;
331 if (mc_read (super->u.arch.fd, u.buf, HEAD_LENGTH) != HEAD_LENGTH)
332 return STATUS_EOF;
333 CPIO_POS (super) += HEAD_LENGTH;
334 u.buf[HEAD_LENGTH] = 0;
336 if (sscanf (u.buf, "070707%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11lo",
337 &hd.c_dev, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
338 &hd.c_nlink, &hd.c_rdev, &hd.c_mtime,
339 &hd.c_namesize, &hd.c_filesize) < 10) {
340 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
341 super->name);
342 return STATUS_FAIL;
345 if (hd.c_namesize == 0 || hd.c_namesize > MC_MAXPATHLEN) {
346 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
347 super->name);
348 return STATUS_FAIL;
350 name = g_malloc(hd.c_namesize);
351 if((len = mc_read(super->u.arch.fd, name, hd.c_namesize)) == -1 ||
352 (unsigned long) len < hd.c_namesize) {
353 g_free (name);
354 return STATUS_EOF;
356 name[hd.c_namesize - 1] = '\0';
357 CPIO_POS(super) += len;
358 cpio_skip_padding(super);
360 if(!strcmp("TRAILER!!!", name)) { /* We got to the last record */
361 g_free(name);
362 return STATUS_TRAIL;
365 u.st.st_dev = hd.c_dev;
366 u.st.st_ino = hd.c_ino;
367 u.st.st_mode = hd.c_mode;
368 u.st.st_nlink = hd.c_nlink;
369 u.st.st_uid = hd.c_uid;
370 u.st.st_gid = hd.c_gid;
371 u.st.st_rdev = hd.c_rdev;
372 u.st.st_size = hd.c_filesize;
373 u.st.st_atime = u.st.st_mtime = u.st.st_ctime = hd.c_mtime;
375 return cpio_create_entry (me, super, &u.st, name);
377 #undef HEAD_LENGTH
379 #define HEAD_LENGTH (110)
380 static ssize_t cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super)
382 struct new_cpio_header hd;
383 union {
384 struct stat st;
385 char buf[HEAD_LENGTH + 1];
386 } u;
387 int len;
388 char *name;
390 if (mc_read (super->u.arch.fd, u.buf, HEAD_LENGTH) != HEAD_LENGTH)
391 return STATUS_EOF;
392 CPIO_POS (super) += HEAD_LENGTH;
393 u.buf[HEAD_LENGTH] = 0;
395 if (sscanf (u.buf, "%6ho%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx",
396 &hd.c_magic, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
397 &hd.c_nlink, &hd.c_mtime, &hd.c_filesize,
398 &hd.c_dev, &hd.c_devmin, &hd.c_rdev, &hd.c_rdevmin,
399 &hd.c_namesize, &hd.c_chksum) < 14) {
400 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
401 super->name);
402 return STATUS_FAIL;
405 if((super->u.arch.type == CPIO_NEWC && hd.c_magic != 070701) ||
406 (super->u.arch.type == CPIO_CRC && hd.c_magic != 070702))
407 return STATUS_FAIL;
409 if (hd.c_namesize == 0 || hd.c_namesize > MC_MAXPATHLEN) {
410 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
411 super->name);
412 return STATUS_FAIL;
415 name = g_malloc(hd.c_namesize);
416 if((len = mc_read (super->u.arch.fd, name, hd.c_namesize)) == -1 ||
417 (unsigned long) len < hd.c_namesize) {
418 g_free (name);
419 return STATUS_EOF;
421 name[hd.c_namesize - 1] = '\0';
422 CPIO_POS(super) += len;
423 cpio_skip_padding(super);
425 if(!strcmp("TRAILER!!!", name)) { /* We got to the last record */
426 g_free(name);
427 return STATUS_TRAIL;
430 u.st.st_dev = makedev (hd.c_dev, hd.c_devmin);
431 u.st.st_ino = hd.c_ino;
432 u.st.st_mode = hd.c_mode;
433 u.st.st_nlink = hd.c_nlink;
434 u.st.st_uid = hd.c_uid;
435 u.st.st_gid = hd.c_gid;
436 u.st.st_rdev = makedev (hd.c_rdev, hd.c_rdevmin);
437 u.st.st_size = hd.c_filesize;
438 u.st.st_atime = u.st.st_mtime = u.st.st_ctime = hd.c_mtime;
440 return cpio_create_entry (me, super, &u.st, name);
443 static int
444 cpio_create_entry (struct vfs_class *me, struct vfs_s_super *super,
445 struct stat *st, char *name)
447 struct vfs_s_inode *inode = NULL;
448 struct vfs_s_inode *root = super->root;
449 struct vfs_s_entry *entry = NULL;
450 char *tn;
452 switch (st->st_mode & S_IFMT) { /* For case of HP/UX archives */
453 case S_IFCHR:
454 case S_IFBLK:
455 #ifdef S_IFSOCK
456 case S_IFSOCK:
457 #endif
458 #ifdef S_IFIFO
459 case S_IFIFO:
460 #endif
461 #ifdef S_IFNAM
462 case S_IFNAM:
463 #endif
464 if ((st->st_size != 0) && (st->st_rdev == 0x0001)) {
465 /* FIXME: representation of major/minor differs between */
466 /* different operating systems. */
467 st->st_rdev = (unsigned) st->st_size;
468 st->st_size = 0;
470 break;
471 default:
472 break;
475 if ((st->st_nlink > 1) && (super->u.arch.type == CPIO_NEWC || super->u.arch.type == CPIO_CRC)) { /* For case of hardlinked files */
476 struct defer_inode i, *l;
477 i.inumber = st->st_ino;
478 i.device = st->st_dev;
479 i.inode = NULL;
480 if ((l = cpio_defer_find (super->u.arch.deferred, &i)) != NULL) {
481 inode = l->inode;
482 if (inode->st.st_size && st->st_size
483 && (inode->st.st_size != st->st_size)) {
484 message (D_ERROR, MSG_ERROR,
486 ("Inconsistent hardlinks of\n%s\nin cpio archive\n%s"),
487 name, super->name);
488 inode = NULL;
489 } else if (!inode->st.st_size)
490 inode->st.st_size = st->st_size;
494 for (tn = name + strlen (name) - 1; tn >= name && *tn == PATH_SEP; tn--)
495 *tn = 0;
496 if ((tn = strrchr (name, PATH_SEP))) {
497 *tn = 0;
498 root = vfs_s_find_inode (me, super, name, LINK_FOLLOW, FL_MKDIR);
499 *tn = PATH_SEP;
500 tn++;
501 } else
502 tn = name;
504 entry = MEDATA->find_entry (me, root, tn, LINK_FOLLOW, FL_NONE); /* In case entry is already there */
506 if (entry) { /* This shouldn't happen! (well, it can happen if there is a record for a
507 file and than a record for a directory it is in; cpio would die with
508 'No such file or directory' is such case) */
510 if (!S_ISDIR (entry->ino->st.st_mode)) { /* This can be considered archive inconsistency */
511 message (D_ERROR, MSG_ERROR,
512 _("%s contains duplicate entries! Skipping!"),
513 super->name);
514 } else {
515 entry->ino->st.st_mode = st->st_mode;
516 entry->ino->st.st_uid = st->st_uid;
517 entry->ino->st.st_gid = st->st_gid;
518 entry->ino->st.st_atime = st->st_atime;
519 entry->ino->st.st_mtime = st->st_mtime;
520 entry->ino->st.st_ctime = st->st_ctime;
523 } else { /* !entry */
525 if (!inode) {
526 inode = vfs_s_new_inode (me, super, st);
527 if ((st->st_nlink > 0) && (super->u.arch.type == CPIO_NEWC || super->u.arch.type == CPIO_CRC)) { /* For case of hardlinked files */
528 struct defer_inode *i;
529 i = g_new (struct defer_inode, 1);
530 i->inumber = st->st_ino;
531 i->device = st->st_dev;
532 i->inode = inode;
533 i->next = super->u.arch.deferred;
534 super->u.arch.deferred = i;
538 if (st->st_size)
539 inode->data_offset = CPIO_POS (super);
541 entry = vfs_s_new_entry (me, tn, inode);
542 vfs_s_insert_entry (me, root, entry);
544 if (S_ISLNK (st->st_mode)) {
545 inode->linkname = g_malloc (st->st_size + 1);
546 if (mc_read (super->u.arch.fd, inode->linkname, st->st_size)
547 < st->st_size) {
548 inode->linkname[0] = 0;
549 g_free (name);
550 return STATUS_EOF;
552 inode->linkname[st->st_size] = 0; /* Linkname stored without terminating \0 !!! */
553 CPIO_POS (super) += st->st_size;
554 cpio_skip_padding (super);
555 } else {
556 CPIO_SEEK_CUR (super, st->st_size);
559 } /* !entry */
561 g_free (name);
562 return STATUS_OK;
565 /* Need to CPIO_SEEK_CUR to skip the file at the end of add entry!!!! */
567 static int
568 cpio_open_archive (struct vfs_class *me, struct vfs_s_super *super,
569 const char *name, char *op)
571 int status = STATUS_START;
573 (void) op;
575 if (cpio_open_cpio_file (me, super, name) == -1)
576 return -1;
578 for (;;) {
579 status = cpio_read_head (me, super);
581 switch (status) {
582 case STATUS_EOF:
583 message (D_ERROR, MSG_ERROR, _("Unexpected end of file\n%s"), name);
584 return 0;
585 case STATUS_OK:
586 continue;
587 case STATUS_TRAIL:
588 break;
590 break;
593 return 0;
596 /* Remaining functions are exactly same as for tarfs (and were in fact just copied) */
597 static void *
598 cpio_super_check (struct vfs_class *me, const char *archive_name, char *op)
600 static struct stat sb;
602 (void) me;
603 (void) op;
605 if (mc_stat (archive_name, &sb))
606 return NULL;
607 return &sb;
610 static int
611 cpio_super_same (struct vfs_class *me, struct vfs_s_super *parc,
612 const char *archive_name, char *op, void *cookie)
614 struct stat *archive_stat = cookie; /* stat of main archive */
616 (void) me;
617 (void) op;
619 if (strcmp (parc->name, archive_name))
620 return 0;
622 /* Has the cached archive been changed on the disk? */
623 if (parc->u.arch.st.st_mtime < archive_stat->st_mtime) {
624 /* Yes, reload! */
625 (*vfs_cpiofs_ops.free) ((vfsid) parc);
626 vfs_rmstamp (&vfs_cpiofs_ops, (vfsid) parc);
627 return 2;
629 /* Hasn't been modified, give it a new timeout */
630 vfs_stamp (&vfs_cpiofs_ops, (vfsid) parc);
631 return 1;
634 static ssize_t cpio_read(void *fh, char *buffer, int count)
636 off_t begin = FH->ino->data_offset;
637 int fd = FH_SUPER->u.arch.fd;
638 struct vfs_class *me = FH_SUPER->me;
640 if (mc_lseek (fd, begin + FH->pos, SEEK_SET) !=
641 begin + FH->pos) ERRNOR (EIO, -1);
643 count = MIN(count, FH->ino->st.st_size - FH->pos);
645 if ((count = mc_read (fd, buffer, count)) == -1) ERRNOR (errno, -1);
647 FH->pos += count;
648 return count;
651 static int cpio_fh_open(struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode)
653 (void) fh;
654 (void) mode;
656 if ((flags & O_ACCMODE) != O_RDONLY) ERRNOR (EROFS, -1);
657 return 0;
660 void
661 init_cpiofs (void)
663 static struct vfs_s_subclass cpio_subclass;
665 cpio_subclass.flags = VFS_S_READONLY;
666 cpio_subclass.archive_check = cpio_super_check;
667 cpio_subclass.archive_same = cpio_super_same;
668 cpio_subclass.open_archive = cpio_open_archive;
669 cpio_subclass.free_archive = cpio_free_archive;
670 cpio_subclass.fh_open = cpio_fh_open;
672 vfs_s_init_class (&vfs_cpiofs_ops, &cpio_subclass);
673 vfs_cpiofs_ops.name = "cpiofs";
674 vfs_cpiofs_ops.prefix = "ucpio";
675 vfs_cpiofs_ops.read = cpio_read;
676 vfs_cpiofs_ops.setctl = NULL;
677 vfs_register_class (&vfs_cpiofs_ops);