Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1
kvm
kvm-qemu-preXX-dictzip6.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kvm-qemu-preXX-dictzip6.patch of Package kvm
From c2351a5153a61e15b04ec8ac37c580cc50ef80d9 Mon Sep 17 00:00:00 2001 From: Alexander Graf <agraf@suse.de> Date: Tue, 16 Feb 2010 12:52:18 +0100 Subject: [PATCH] TAR: Implement 'L' extension type GNU Tar has several extensions. One of them is 'L', used to identify long file names. Without this extension a file name can be at most 100 bytes, including the directory name. We do hit that limit from time to time, so let's implement the extension and be able to use images with long file names. Signed-off-by: Alexander Graf <agraf@suse.de> --- block/tar.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/block/tar.c b/block/tar.c index d663c53..d7fe2b7 100644 --- a/block/tar.c +++ b/block/tar.c @@ -57,6 +57,7 @@ typedef struct BDRVTarState { SparseCache *sparse; int sparse_num; uint64_t last_end; + char longfile[2048]; } BDRVTarState; static int tar_probe(const uint8_t *buf, int buf_size, const char *filename) @@ -99,6 +100,9 @@ static int is_target_file(BlockDriverState *bs, char *filename) retval = 1; dprintf("does filename %s match? %s\n", filename, retval ? "yes" : "no"); + + /* make sure we're not using this name again */ + filename[0] = '\0'; return retval; } @@ -151,6 +155,7 @@ static int tar_open(BlockDriverState *bs, const char *filename, int flags) { BDRVTarState *s = bs->opaque; char header[SECTOR_SIZE]; + char *real_file = header; char *magic; const char *fname = filename; size_t header_offs = 0; @@ -191,7 +196,17 @@ static int tar_open(BlockDriverState *bs, const char *filename, int flags) s->file_sec = (header_offs / SECTOR_SIZE) + 1; header_offs += s->file_len + SECTOR_SIZE; - } while(!is_target_file(bs, header)); + + if (header[OFFS_TYPE] == 'L') { + bdrv_pread(s->hd, header_offs - s->file_len, s->longfile, + sizeof(s->longfile)); + s->longfile[sizeof(s->longfile)-1] = '\0'; + } else if (s->longfile[0]) { + real_file = s->longfile; + } else { + real_file = header; + } + } while(!is_target_file(bs, real_file)); /* We found an image! */ -- 1.6.0.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor