Sponsored Content
Full Discussion: sparse files
Top Forums UNIX for Advanced & Expert Users sparse files Post 302083136 by thestevew on Friday 4th of August 2006 08:07:35 AM
Old 08-04-2006
Four unrelated questions from one user within a couple of minutes - is this homework?
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to retrieve all the linked script files/ctl files/sql files?

Hi I am going to migrate our datawarehouse system from HP Tru 64 Unix to the Red Hat Linux. Inside the box, it is running around 40 cron jobs; inside each cron job, it is calling other shell script files, and the shell script files may again call other shell script files or ctl files(for... (1 Reply)
Discussion started by: franksubramania
1 Replies

2. Programming

locate holes in a sparse file.

Lets say my program reads one block (4096 bytes) at a time from a file. It needs to report whether that block is a hole. The program currently uses read() to read 1 block into a 4KB buffer. Now I know that even if that block is a hole, it will be replaced by a sequence of NULL bytes '\0'... (15 Replies)
Discussion started by: tantric
15 Replies

3. Shell Programming and Scripting

Convert a matrix to sparse representation

Hi All, I have a matrix stored in a file matrix.mtx and looks like this: 1 0.5 0.33 0.25 0 0.33 0.25 0.2 0 0 0 0.16 0 0 0 0.14 I want to convert this matrix to its sparse representation like the one give below (sparse_matrix.mtx). This means that above matrix has been converted to its... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

4. Shell Programming and Scripting

using find but avoiding sparse files

I am no Unix administrator...I live in windows land. I wrote a script to find files of certain names and process them but was later advised to avoid checking sparse files since it would use up a lot of resources and the files I was looking for were not there. How do I avoid doing the find on... (3 Replies)
Discussion started by: shellFun
3 Replies

5. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

6. Programming

C Data Structure to represent a Sparse Array

Which data structure will be most appropriate to represent a sparse array? (1 Reply)
Discussion started by: rupeshkp728
1 Replies

7. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

8. UNIX for Beginners Questions & Answers

Automate splitting of files , scp files as each split completes and combine files on target server

i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies
ARCHIVE_ENTRY_LINKIFY(3)				   BSD Library Functions Manual 				  ARCHIVE_ENTRY_LINKIFY(3)

NAME
archive_entry_linkresolver, archive_entry_linkresolver_new, archive_entry_linkresolver_set_strategy, archive_entry_linkresolver_free, archive_entry_linkify -- hardlink resolver functions LIBRARY
Streaming Archive Library (libarchive, -larchive) SYNOPSIS
#include <archive_entry.h> struct archive_entry_linkresolver * archive_entry_linkresolver_new(void); void archive_entry_linkresolver_set_strategy(struct archive_entry_linkresolver *resolver, int format); void archive_entry_linkresolver_free(struct archive_entry_linkresolver *resolver); void archive_entry_linkify(struct archive_entry_linkresolver *resolver, struct archive_entry **entry, struct archive_entry **sparse); DESCRIPTION
Programs that want to create archives have to deal with hardlinks. Hardlinks are handled in different ways by the archive formats. The basic strategies are: 1. Ignore hardlinks and store the body for each reference (old cpio, zip). 2. Store the body the first time an inode is seen (ustar, pax). 3. Store the body the last time an inode is seen (new cpio). The archive_entry_linkresolver functions help by providing a unified interface and handling the complexity behind the scene. The archive_entry_linkresolver functions assume that archive_entry instances have valid nlinks, inode and device values. The inode and device value is used to match entries. The nlinks value is used to determined if all references have been found and if the internal refer- ences can be recycled. The archive_entry_linkresolver_new() function allocates a new link resolver. The instance can be freed using archive_entry_linkresolver_free(). All deferred entries are flushed and the internal storage is freed. The archive_entry_linkresolver_set_strategy() function selects the optimal hardlink strategy for the given format. The format code can be obtained from archive_format(3). The function can be called more than once, but it is recommended to flush all deferred entries first. The archive_entry_linkify() function is the core of archive_entry_linkresolver. The entry() argument points to the archive_entry that should be written. Depending on the strategy one of the following actions is taken: 1. For the simple archive formats *entry is left unmodified and *sparse is set to NULL. 2. For tar like archive formats, *sparse is set to NULL. If *entry is NULL, no action is taken. If the hardlink count of *entry is larger than 1 and the file type is a regular file or symbolic link, the internal list is searched for a matching inode. If such an inode is found, the link count is decremented and the file size of *entry is set to 0 to notify that no body should be written. If no such inode is found, a copy of the entry is added to the internal cache with a link count reduced by one. 3. For new cpio like archive formats a value for *entry of NULL is used to flush deferred entries. In that case *entry is set to an arbi- trary deferred entry and the entry itself is removed from the internal list. If the internal list is empty, *entry is set to NULL. In either case, *sparse is set to NULL and the function returns. If the hardlink count of *entry is one or the file type is a directory or device, *sparse is set to NULL and no further action is taken. Otherwise, the internal list is searched for a matching inode. If such an inode is not found, the entry is added to the internal list, both *entry and *sparse are set to NULL and the function returns. If such an inode is found, the link count is decremented. If it remains larger than one, the existing entry on the internal list is swapped with *entry after retaining the link count. The existing entry is returned in *entry. If the link count reached one, the new entry is also removed from the internal list and returned in *sparse. Otherwise *sparse is set to NULL. The general usage is therefore: 1. For each new archive entry, call archive_entry_linkify(). 2. Keep in mind that the entries returned may have a size of 0 now. 3. If *entry is not NULL, archive it. 4. If *sparse is not NULL, archive it. 5. After all entries have been written to disk, call archive_entry_linkify() with *entry set to NULL and archive the returned entry as long as it is not NULL. RETURN VALUES
archive_entry_linkresolver_new() returns NULL on malloc(3) failures. SEE ALSO
archive_entry(3) BSD
February 2, 2012 BSD
All times are GMT -4. The time now is 02:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy