Reverted the use of bool in favour of gboolean
[midnight-commander.git] / vfs / cpio.c
blob42e8f114231cb53306dce8e3fe3399fdda598067
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 <mhl/memory.h>
26 #include <mhl/string.h>
28 #include "../src/global.h"
29 #include "../src/tty.h" /* enable/disable interrupt key */
30 #include "../src/wtools.h" /* message() */
31 #include "../src/main.h" /* print_vfs_message */
32 #include "utilvfs.h"
33 #include "vfs-impl.h"
34 #include "gc.h" /* vfs_rmstamp */
35 #include "xdirentry.h"
36 #include "../src/unixcompat.h"
38 enum {
39 STATUS_START,
40 STATUS_OK,
41 STATUS_TRAIL,
42 STATUS_FAIL,
43 STATUS_EOF
46 enum {
47 CPIO_UNKNOWN = 0, /* Not determined yet */
48 CPIO_BIN, /* Binary format */
49 CPIO_BINRE, /* Binary format, reverse endianity */
50 CPIO_OLDC, /* Old ASCII format */
51 CPIO_NEWC, /* New ASCII format */
52 CPIO_CRC /* New ASCII format + CRC */
55 static struct vfs_class vfs_cpiofs_ops;
57 struct old_cpio_header
59 unsigned short c_magic;
60 short c_dev;
61 unsigned short c_ino;
62 unsigned short c_mode;
63 unsigned short c_uid;
64 unsigned short c_gid;
65 unsigned short c_nlink;
66 short c_rdev;
67 unsigned short c_mtimes[2];
68 unsigned short c_namesize;
69 unsigned short c_filesizes[2];
72 struct new_cpio_header
74 unsigned short c_magic;
75 unsigned long c_ino;
76 unsigned long c_mode;
77 unsigned long c_uid;
78 unsigned long c_gid;
79 unsigned long c_nlink;
80 unsigned long c_mtime;
81 unsigned long c_filesize;
82 long c_dev;
83 long c_devmin;
84 long c_rdev;
85 long c_rdevmin;
86 unsigned long c_namesize;
87 unsigned long c_chksum;
90 struct defer_inode {
91 struct defer_inode *next;
92 unsigned long inumber;
93 unsigned short device;
94 struct vfs_s_inode *inode;
97 /* FIXME: should be off_t instead of int. */
98 static int cpio_position;
100 static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super);
101 static int cpio_create_entry(struct vfs_class *me, struct vfs_s_super *super, struct stat *, char *name);
102 static ssize_t cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super);
103 static ssize_t cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super);
104 static ssize_t cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super);
105 static ssize_t cpio_read(void *fh, char *buffer, int count);
107 #define CPIO_POS(super) cpio_position
108 /* If some time reentrancy should be needed change it to */
109 /* #define CPIO_POS(super) (super)->u.arch.fd */
111 #define CPIO_SEEK_SET(super, where) mc_lseek((super)->u.arch.fd, CPIO_POS(super) = (where), SEEK_SET)
112 #define CPIO_SEEK_CUR(super, where) mc_lseek((super)->u.arch.fd, CPIO_POS(super) += (where), SEEK_SET)
114 static struct defer_inode *
115 cpio_defer_find (struct defer_inode *l, struct defer_inode *i)
117 while (l && (l->inumber != i->inumber || l->device != i->device))
118 l = l->next;
119 return l;
122 static int cpio_skip_padding(struct vfs_s_super *super)
124 switch(super->u.arch.type) {
125 case CPIO_BIN:
126 case CPIO_BINRE:
127 return CPIO_SEEK_CUR(super, (2 - (CPIO_POS(super) % 2)) % 2);
128 case CPIO_NEWC:
129 case CPIO_CRC:
130 return CPIO_SEEK_CUR(super, (4 - (CPIO_POS(super) % 4)) % 4);
131 case CPIO_OLDC:
132 return CPIO_POS(super);
133 default:
134 g_assert_not_reached();
135 return 42; /* & the compiler is happy :-) */
139 static void cpio_free_archive(struct vfs_class *me, struct vfs_s_super *super)
141 struct defer_inode *l, *lnext;
143 (void) me;
145 if(super->u.arch.fd != -1)
146 mc_close(super->u.arch.fd);
147 super->u.arch.fd = -1;
148 for (l = super->u.arch.deferred; l; l = lnext) {
149 lnext = l->next;
150 g_free (l);
152 super->u.arch.deferred = NULL;
155 static int
156 cpio_open_cpio_file (struct vfs_class *me, struct vfs_s_super *super,
157 const char *name)
159 int fd, type;
160 mode_t mode;
161 struct vfs_s_inode *root;
163 if ((fd = mc_open (name, O_RDONLY)) == -1) {
164 message (D_ERROR, MSG_ERROR, _("Cannot open cpio archive\n%s"), name);
165 return -1;
168 super->name = g_strdup (name);
169 super->u.arch.fd = -1; /* for now */
170 mc_stat (name, &(super->u.arch.st));
171 super->u.arch.type = CPIO_UNKNOWN;
173 type = get_compression_type (fd);
174 if (type != COMPRESSION_NONE) {
175 char *s;
177 mc_close (fd);
178 s = g_strconcat (name, decompress_extension (type), (char *) NULL);
179 if ((fd = mc_open (s, O_RDONLY)) == -1) {
180 message (D_ERROR, MSG_ERROR, _("Cannot open cpio archive\n%s"), s);
181 g_free (s);
182 return -1;
184 g_free (s);
187 super->u.arch.fd = fd;
188 mode = super->u.arch.st.st_mode & 07777;
189 mode |= (mode & 0444) >> 2; /* set eXec where Read is */
190 mode |= S_IFDIR;
192 root = vfs_s_new_inode (me, super, &(super->u.arch.st));
193 root->st.st_mode = mode;
194 root->data_offset = -1;
195 root->st.st_nlink++;
196 root->st.st_dev = MEDATA->rdev++;
198 super->root = root;
200 CPIO_SEEK_SET (super, 0);
202 return fd;
205 static ssize_t cpio_read_head(struct vfs_class *me, struct vfs_s_super *super)
207 switch(cpio_find_head(me, super)) {
208 case CPIO_UNKNOWN:
209 return -1;
210 case CPIO_BIN:
211 case CPIO_BINRE:
212 return cpio_read_bin_head(me, super);
213 case CPIO_OLDC:
214 return cpio_read_oldc_head(me, super);
215 case CPIO_NEWC:
216 case CPIO_CRC:
217 return cpio_read_crc_head(me, super);
218 default:
219 g_assert_not_reached();
220 return 42; /* & the compiler is happy :-) */
224 #define MAGIC_LENGTH (6) /* How many bytes we have to read ahead */
225 #define SEEKBACK CPIO_SEEK_CUR(super, ptr - top)
226 #define RETURN(x) return(super->u.arch.type = (x))
227 #define TYPEIS(x) ((super->u.arch.type == CPIO_UNKNOWN) || (super->u.arch.type == (x)))
228 static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super)
230 char buf[256];
231 int ptr = 0;
232 int top;
233 int tmp;
235 top = mc_read (super->u.arch.fd, buf, 256);
236 if (top > 0)
237 CPIO_POS (super) += top;
238 for(;;) {
239 if(ptr + MAGIC_LENGTH >= top) {
240 if(top > 128) {
241 memmove(buf, buf + top - 128, 128);
242 ptr -= top - 128;
243 top = 128;
245 if((tmp = mc_read(super->u.arch.fd, buf, top)) == 0 || tmp == -1) {
246 message (D_ERROR, MSG_ERROR, _("Premature end of cpio archive\n%s"), super->name);
247 cpio_free_archive(me, super);
248 return CPIO_UNKNOWN;
250 top += tmp;
252 if(TYPEIS(CPIO_BIN) && ((*(unsigned short *)(buf + ptr)) == 070707)) {
253 SEEKBACK; RETURN(CPIO_BIN);
254 } else if(TYPEIS(CPIO_BINRE) && ((*(unsigned short *)(buf + ptr)) == GUINT16_SWAP_LE_BE_CONSTANT(070707))) {
255 SEEKBACK; RETURN(CPIO_BINRE);
256 } else if(TYPEIS(CPIO_OLDC) && (!strncmp(buf + ptr, "070707", 6))) {
257 SEEKBACK; RETURN(CPIO_OLDC);
258 } else if(TYPEIS(CPIO_NEWC) && (!strncmp(buf + ptr, "070701", 6))) {
259 SEEKBACK; RETURN(CPIO_NEWC);
260 } else if(TYPEIS(CPIO_CRC) && (!strncmp(buf + ptr, "070702", 6))) {
261 SEEKBACK; RETURN(CPIO_CRC);
263 ptr++;
266 #undef RETURN
267 #undef SEEKBACK
269 #define HEAD_LENGTH (26)
270 static ssize_t cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super)
272 union {
273 struct old_cpio_header buf;
274 short shorts[HEAD_LENGTH >> 1];
275 } u;
276 int len;
277 char *name;
278 struct stat st;
280 if((len = mc_read(super->u.arch.fd, (char *)&u.buf, HEAD_LENGTH)) < HEAD_LENGTH)
281 return STATUS_EOF;
282 CPIO_POS(super) += len;
283 if(super->u.arch.type == CPIO_BINRE) {
284 int i;
285 for(i = 0; i < (HEAD_LENGTH >> 1); i++)
286 u.shorts[i] = GUINT16_SWAP_LE_BE_CONSTANT(u.shorts[i]);
288 g_assert(u.buf.c_magic == 070707);
290 if (u.buf.c_namesize == 0 || u.buf.c_namesize > MC_MAXPATHLEN) {
291 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
292 super->name);
293 return STATUS_FAIL;
295 name = g_malloc(u.buf.c_namesize);
296 if((len = mc_read(super->u.arch.fd, name, u.buf.c_namesize)) < u.buf.c_namesize) {
297 g_free(name);
298 return STATUS_EOF;
300 name[u.buf.c_namesize - 1] = '\0';
301 CPIO_POS(super) += len;
302 cpio_skip_padding(super);
304 if(!strcmp("TRAILER!!!", name)) { /* We got to the last record */
305 g_free(name);
306 return STATUS_TRAIL;
309 st.st_dev = u.buf.c_dev;
310 st.st_ino = u.buf.c_ino;
311 st.st_mode = u.buf.c_mode;
312 st.st_nlink = u.buf.c_nlink;
313 st.st_uid = u.buf.c_uid;
314 st.st_gid = u.buf.c_gid;
315 st.st_rdev = u.buf.c_rdev;
316 st.st_size = (u.buf.c_filesizes[0] << 16) | u.buf.c_filesizes[1];
317 st.st_atime = st.st_mtime = st.st_ctime = (u.buf.c_mtimes[0] << 16) | u.buf.c_mtimes[1];
319 return cpio_create_entry(me, super, &st, name);
321 #undef HEAD_LENGTH
323 #define HEAD_LENGTH (76)
324 static ssize_t cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super)
326 struct new_cpio_header hd;
327 union {
328 struct stat st;
329 char buf[HEAD_LENGTH + 1];
330 } u;
331 int len;
332 char *name;
334 if (mc_read (super->u.arch.fd, u.buf, HEAD_LENGTH) != HEAD_LENGTH)
335 return STATUS_EOF;
336 CPIO_POS (super) += HEAD_LENGTH;
337 u.buf[HEAD_LENGTH] = 0;
339 if (sscanf (u.buf, "070707%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11lo",
340 &hd.c_dev, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
341 &hd.c_nlink, &hd.c_rdev, &hd.c_mtime,
342 &hd.c_namesize, &hd.c_filesize) < 10) {
343 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
344 super->name);
345 return STATUS_FAIL;
348 if (hd.c_namesize == 0 || hd.c_namesize > MC_MAXPATHLEN) {
349 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
350 super->name);
351 return STATUS_FAIL;
353 name = g_malloc(hd.c_namesize);
354 if((len = mc_read(super->u.arch.fd, name, hd.c_namesize)) == -1 ||
355 (unsigned long) len < hd.c_namesize) {
356 g_free (name);
357 return STATUS_EOF;
359 name[hd.c_namesize - 1] = '\0';
360 CPIO_POS(super) += len;
361 cpio_skip_padding(super);
363 if(!strcmp("TRAILER!!!", name)) { /* We got to the last record */
364 g_free(name);
365 return STATUS_TRAIL;
368 u.st.st_dev = hd.c_dev;
369 u.st.st_ino = hd.c_ino;
370 u.st.st_mode = hd.c_mode;
371 u.st.st_nlink = hd.c_nlink;
372 u.st.st_uid = hd.c_uid;
373 u.st.st_gid = hd.c_gid;
374 u.st.st_rdev = hd.c_rdev;
375 u.st.st_size = hd.c_filesize;
376 u.st.st_atime = u.st.st_mtime = u.st.st_ctime = hd.c_mtime;
378 return cpio_create_entry (me, super, &u.st, name);
380 #undef HEAD_LENGTH
382 #define HEAD_LENGTH (110)
383 static ssize_t cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super)
385 struct new_cpio_header hd;
386 union {
387 struct stat st;
388 char buf[HEAD_LENGTH + 1];
389 } u;
390 int len;
391 char *name;
393 if (mc_read (super->u.arch.fd, u.buf, HEAD_LENGTH) != HEAD_LENGTH)
394 return STATUS_EOF;
395 CPIO_POS (super) += HEAD_LENGTH;
396 u.buf[HEAD_LENGTH] = 0;
398 if (sscanf (u.buf, "%6ho%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx",
399 &hd.c_magic, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
400 &hd.c_nlink, &hd.c_mtime, &hd.c_filesize,
401 &hd.c_dev, &hd.c_devmin, &hd.c_rdev, &hd.c_rdevmin,
402 &hd.c_namesize, &hd.c_chksum) < 14) {
403 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
404 super->name);
405 return STATUS_FAIL;
408 if((super->u.arch.type == CPIO_NEWC && hd.c_magic != 070701) ||
409 (super->u.arch.type == CPIO_CRC && hd.c_magic != 070702))
410 return STATUS_FAIL;
412 if (hd.c_namesize == 0 || hd.c_namesize > MC_MAXPATHLEN) {
413 message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),
414 super->name);
415 return STATUS_FAIL;
418 name = g_malloc(hd.c_namesize);
419 if((len = mc_read (super->u.arch.fd, name, hd.c_namesize)) == -1 ||
420 (unsigned long) len < hd.c_namesize) {
421 g_free (name);
422 return STATUS_EOF;
424 name[hd.c_namesize - 1] = '\0';
425 CPIO_POS(super) += len;
426 cpio_skip_padding(super);
428 if(!strcmp("TRAILER!!!", name)) { /* We got to the last record */
429 g_free(name);
430 return STATUS_TRAIL;
433 u.st.st_dev = makedev (hd.c_dev, hd.c_devmin);
434 u.st.st_ino = hd.c_ino;
435 u.st.st_mode = hd.c_mode;
436 u.st.st_nlink = hd.c_nlink;
437 u.st.st_uid = hd.c_uid;
438 u.st.st_gid = hd.c_gid;
439 u.st.st_rdev = makedev (hd.c_rdev, hd.c_rdevmin);
440 u.st.st_size = hd.c_filesize;
441 u.st.st_atime = u.st.st_mtime = u.st.st_ctime = hd.c_mtime;
443 return cpio_create_entry (me, super, &u.st, name);
446 static int
447 cpio_create_entry (struct vfs_class *me, struct vfs_s_super *super,
448 struct stat *st, char *name)
450 struct vfs_s_inode *inode = NULL;
451 struct vfs_s_inode *root = super->root;
452 struct vfs_s_entry *entry = NULL;
453 char *tn;
455 switch (st->st_mode & S_IFMT) { /* For case of HP/UX archives */
456 case S_IFCHR:
457 case S_IFBLK:
458 #ifdef S_IFSOCK
459 case S_IFSOCK:
460 #endif
461 #ifdef S_IFIFO
462 case S_IFIFO:
463 #endif
464 #ifdef S_IFNAM
465 case S_IFNAM:
466 #endif
467 if ((st->st_size != 0) && (st->st_rdev == 0x0001)) {
468 /* FIXME: representation of major/minor differs between */
469 /* different operating systems. */
470 st->st_rdev = (unsigned) st->st_size;
471 st->st_size = 0;
473 break;
474 default:
475 break;
478 if ((st->st_nlink > 1) && (super->u.arch.type == CPIO_NEWC || super->u.arch.type == CPIO_CRC)) { /* For case of hardlinked files */
479 struct defer_inode i, *l;
480 i.inumber = st->st_ino;
481 i.device = st->st_dev;
482 i.inode = NULL;
483 if ((l = cpio_defer_find (super->u.arch.deferred, &i)) != NULL) {
484 inode = l->inode;
485 if (inode->st.st_size && st->st_size
486 && (inode->st.st_size != st->st_size)) {
487 message (D_ERROR, MSG_ERROR,
489 ("Inconsistent hardlinks of\n%s\nin cpio archive\n%s"),
490 name, super->name);
491 inode = NULL;
492 } else if (!inode->st.st_size)
493 inode->st.st_size = st->st_size;
497 for (tn = name + strlen (name) - 1; tn >= name && *tn == PATH_SEP; tn--)
498 *tn = 0;
499 if ((tn = strrchr (name, PATH_SEP))) {
500 *tn = 0;
501 root = vfs_s_find_inode (me, super, name, LINK_FOLLOW, FL_MKDIR);
502 *tn = PATH_SEP;
503 tn++;
504 } else
505 tn = name;
507 entry = MEDATA->find_entry (me, root, tn, LINK_FOLLOW, FL_NONE); /* In case entry is already there */
509 if (entry) { /* This shouldn't happen! (well, it can happen if there is a record for a
510 file and than a record for a directory it is in; cpio would die with
511 'No such file or directory' is such case) */
513 if (!S_ISDIR (entry->ino->st.st_mode)) { /* This can be considered archive inconsistency */
514 message (D_ERROR, MSG_ERROR,
515 _("%s contains duplicate entries! Skipping!"),
516 super->name);
517 } else {
518 entry->ino->st.st_mode = st->st_mode;
519 entry->ino->st.st_uid = st->st_uid;
520 entry->ino->st.st_gid = st->st_gid;
521 entry->ino->st.st_atime = st->st_atime;
522 entry->ino->st.st_mtime = st->st_mtime;
523 entry->ino->st.st_ctime = st->st_ctime;
526 } else { /* !entry */
528 if (!inode) {
529 inode = vfs_s_new_inode (me, super, st);
530 if ((st->st_nlink > 0) && (super->u.arch.type == CPIO_NEWC || super->u.arch.type == CPIO_CRC)) { /* For case of hardlinked files */
531 struct defer_inode *i;
532 i = g_new (struct defer_inode, 1);
533 i->inumber = st->st_ino;
534 i->device = st->st_dev;
535 i->inode = inode;
536 i->next = super->u.arch.deferred;
537 super->u.arch.deferred = i;
541 if (st->st_size)
542 inode->data_offset = CPIO_POS (super);
544 entry = vfs_s_new_entry (me, tn, inode);
545 vfs_s_insert_entry (me, root, entry);
547 if (S_ISLNK (st->st_mode)) {
548 inode->linkname = g_malloc (st->st_size + 1);
549 if (mc_read (super->u.arch.fd, inode->linkname, st->st_size)
550 < st->st_size) {
551 inode->linkname[0] = 0;
552 g_free (name);
553 return STATUS_EOF;
555 inode->linkname[st->st_size] = 0; /* Linkname stored without terminating \0 !!! */
556 CPIO_POS (super) += st->st_size;
557 cpio_skip_padding (super);
558 } else {
559 CPIO_SEEK_CUR (super, st->st_size);
562 } /* !entry */
564 g_free (name);
565 return STATUS_OK;
568 /* Need to CPIO_SEEK_CUR to skip the file at the end of add entry!!!! */
570 static int
571 cpio_open_archive (struct vfs_class *me, struct vfs_s_super *super,
572 const char *name, char *op)
574 int status = STATUS_START;
576 (void) op;
578 if (cpio_open_cpio_file (me, super, name) == -1)
579 return -1;
581 for (;;) {
582 status = cpio_read_head (me, super);
584 switch (status) {
585 case STATUS_EOF:
586 message (D_ERROR, MSG_ERROR, _("Unexpected end of file\n%s"), name);
587 return 0;
588 case STATUS_OK:
589 continue;
590 case STATUS_TRAIL:
591 break;
593 break;
596 return 0;
599 /* Remaining functions are exactly same as for tarfs (and were in fact just copied) */
600 static void *
601 cpio_super_check (struct vfs_class *me, const char *archive_name, char *op)
603 static struct stat sb;
605 (void) me;
606 (void) op;
608 if (mc_stat (archive_name, &sb))
609 return NULL;
610 return &sb;
613 static int
614 cpio_super_same (struct vfs_class *me, struct vfs_s_super *parc,
615 const char *archive_name, char *op, void *cookie)
617 struct stat *archive_stat = cookie; /* stat of main archive */
619 (void) me;
620 (void) op;
622 if (strcmp (parc->name, archive_name))
623 return 0;
625 /* Has the cached archive been changed on the disk? */
626 if (parc->u.arch.st.st_mtime < archive_stat->st_mtime) {
627 /* Yes, reload! */
628 (*vfs_cpiofs_ops.free) ((vfsid) parc);
629 vfs_rmstamp (&vfs_cpiofs_ops, (vfsid) parc);
630 return 2;
632 /* Hasn't been modified, give it a new timeout */
633 vfs_stamp (&vfs_cpiofs_ops, (vfsid) parc);
634 return 1;
637 static ssize_t cpio_read(void *fh, char *buffer, int count)
639 off_t begin = FH->ino->data_offset;
640 int fd = FH_SUPER->u.arch.fd;
641 struct vfs_class *me = FH_SUPER->me;
643 if (mc_lseek (fd, begin + FH->pos, SEEK_SET) !=
644 begin + FH->pos) ERRNOR (EIO, -1);
646 count = MIN(count, FH->ino->st.st_size - FH->pos);
648 if ((count = mc_read (fd, buffer, count)) == -1) ERRNOR (errno, -1);
650 FH->pos += count;
651 return count;
654 static int cpio_fh_open(struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode)
656 (void) fh;
657 (void) mode;
659 if ((flags & O_ACCMODE) != O_RDONLY) ERRNOR (EROFS, -1);
660 return 0;
663 void
664 init_cpiofs (void)
666 static struct vfs_s_subclass cpio_subclass;
668 cpio_subclass.flags = VFS_S_READONLY;
669 cpio_subclass.archive_check = cpio_super_check;
670 cpio_subclass.archive_same = cpio_super_same;
671 cpio_subclass.open_archive = cpio_open_archive;
672 cpio_subclass.free_archive = cpio_free_archive;
673 cpio_subclass.fh_open = cpio_fh_open;
675 vfs_s_init_class (&vfs_cpiofs_ops, &cpio_subclass);
676 vfs_cpiofs_ops.name = "cpiofs";
677 vfs_cpiofs_ops.prefix = "ucpio";
678 vfs_cpiofs_ops.read = cpio_read;
679 vfs_cpiofs_ops.setctl = NULL;
680 vfs_register_class (&vfs_cpiofs_ops);