/* cpio.c - cpio and tar filesystem. */ /* * GRUB -- GRand Unified Bootloader * Copyright (C) 2007,2008,2009,2013 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #define MODE_USTAR 1 /* tar support */ #define MAGIC "ustar" struct head { char name[100]; char mode[8]; char uid[8]; char gid[8]; char size[12]; char mtime[12]; char chksum[8]; char typeflag; char linkname[100]; char magic[6]; char version[2]; char uname[32]; char gname[32]; char devmajor[8]; char devminor[8]; char prefix[155]; } __attribute__ ((packed)); static inline unsigned long long read_number (const char *str, grub_size_t size) { unsigned long long ret = 0; while (size-- && *str >= '0' && *str <= '7') ret = (ret << 3) | (*str++ & 0xf); return ret; } #define FSNAME "tarfs" #include "cpio_common.c" GRUB_MOD_INIT (tar) { grub_fs_register (&grub_cpio_fs); my_mod = mod; } GRUB_MOD_FINI (tar) { grub_fs_unregister (&grub_cpio_fs); }