Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

file.h File Reference

File storage API. More...

#include <sys/types.h>
#include <time.h>
#include <libpackman/package.h>

Go to the source code of this file.

Data Structures

struct  _PmFile
 A representation of a file on the filesystem. More...


Structure (De)allocation Functions

PmFilepmNewFile (void)
 Creates a new PmFile structure.

PmFilepmDuplicateFile (PmFile *baseFile)
 Duplicates a PmFile structure.

void pmDestroyFile (PmFile *file)
 Destroys a PmFile structure.


Attribute Modification Functions

void pmSetFilePackage (PmFile *file, PmPackage *package)
 Sets the package that owns the specified file.

void pmSetFileName (PmFile *file, const char *name)
 Sets the name of the specified file.

void pmSetFileChecksum (PmFile *file, const char *checksum)
 Sets the MD5 checksum of the specified file.

void pmSetFileMode (PmFile *file, mode_t mode)
 Sets the mode of the specified file.

void pmSetFileOwner (PmFile *file, const char *owner)
 Sets the owner of the specified file.

void pmSetFileGroup (PmFile *file, const char *group)
 Sets the group of the specified file.

void pmSetFileType (PmFile *file, PmFileType type)
 Sets the file type of the specified file.

void pmSetFileMajorMinor (PmFile *file, unsigned short majorMinor)
 Sets the major/minor numbers of the specified file.

void pmSetFileSize (PmFile *file, unsigned int size)
 Sets the size of the specified file.

void pmSetFileDate (PmFile *file, time_t date)
 Sets the timestamp of the specified file.

void pmSetFileSymlink (PmFile *file, const char *symlink)
 Sets the file that this file links to.


Attribute Retrieval Functions

PmPackagepmGetFilePackage (PmFile *file)
 Returns the package that owns the specified file.

const char * pmGetFileName (PmFile *file)
 Returns the name of the specified file.

const char * pmGetFileChecksum (PmFile *file)
 Returns the MD5 checksum of the specified file.

mode_t pmGetFileMode (PmFile *file)
 Returns the mode of the specified file.

const char * pmGetFileOwner (PmFile *file)
 Returns the owner username of the specified file.

const char * pmGetFileGroup (PmFile *file)
 Returns the owner group of the specified file.

PmFileType pmGetFileType (PmFile *file)
 Returns the type of the specified file.

unsigned short pmGetFileMajorMinor (PmFile *file)
 Returns the major/minor numbers for this file.

unsigned int pmGetFileSize (PmFile *file)
 Returns the size of this file.

time_t pmGetFileDate (PmFile *file)
 Returns the date/time in seconds since the epoch.

const char * pmGetFileSymlink (PmFile *file)
 Returns the file this file is pointing to (if any).


Iteration Functions

PmFilepmFirstFile (PmPackage *pkg)
 Returns the first file in the package.

PmFilepmPreviousFile (PmFile *file)
 Returns the previous file in the list of files.

PmFilepmNextFile (PmFile *file)
 Returns the next file in the list of files.


Utility Functions

const char * pmFileTypeToName (PmFileType type)
 Converts a file type to its string equivalent.

PmFileType pmFileTypeFromName (const char *name)
 Converts the string equivalent of a file type to its PmFileType version.


Typedefs

typedef _PmFile PmFile
 PmFile.

typedef enum _PmFileType PmFileType
 A file type.


Enumerations

enum  _PmFileType {
  PM_FILETYPE_NORMAL, PM_FILETYPE_CONFIG, PM_FILETYPE_DOCUMENTATION, PM_FILETYPE_DEVICE,
  PM_FILETYPE_DIRECTORY, PM_FILETYPE_UNKNOWN
}
 A file type. More...


Detailed Description

File storage API.

Id:
file.h,v 1.13 2002/03/20 07:05:01 chipx86 Exp
Copyright:
(C) 1999-2002 The GNUpdate Project.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library 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 Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Typedef Documentation

typedef struct _PmFile PmFile
 

PmFile.

typedef enum _PmFileType PmFileType
 

A file type.

See also:
PmFile


Enumeration Type Documentation

enum _PmFileType
 

A file type.

See also:
PmFile
Enumeration values:
PM_FILETYPE_NORMAL  A normal file.
PM_FILETYPE_CONFIG  A configuration file.
PM_FILETYPE_DOCUMENTATION  A documentation file.
PM_FILETYPE_DEVICE  A device file.
PM_FILETYPE_DIRECTORY  A directory.
PM_FILETYPE_UNKNOWN  An unknown file type.


Function Documentation

void pmDestroyFile PmFile   file
 

Destroys a PmFile structure.

Parameters:
file  The PmFile to destroy.
See also:
pmNewFile() , pmDuplicateFile()

PmFile* pmDuplicateFile PmFile   baseFile
 

Duplicates a PmFile structure.

Parameters:
baseFile  The PmFile to duplicate.
Returns:
The new duplicate.
See also:
pmNewFile() , pmDestroyFile()

PmFileType pmFileTypeFromName const char *    name
 

Converts the string equivalent of a file type to its PmFileType version.

Parameters:
name  The string equivalent of the file type.
Returns:
The PmFileType version.
See also:
PmFileType, pmFileTypeToName()

const char* pmFileTypeToName PmFileType    type
 

Converts a file type to its string equivalent.

Parameters:
type  The file type to convert.
Returns:
The string equivalent of the file type.
See also:
PmFileType, pmFileTypeFromName()

PmFile* pmFirstFile PmPackage   pkg
 

Returns the first file in the package.

Parameters:
pkg  The package.
Returns:
The first file in the package.
See also:
pmPreviousFile() , pmNextFile()

const char* pmGetFileChecksum PmFile   file
 

Returns the MD5 checksum of the specified file.

Parameters:
file  The file.
Returns:
The file's MD5 checksum.
See also:
pmSetFileChecksum()

time_t pmGetFileDate PmFile   file
 

Returns the date/time in seconds since the epoch.

Parameters:
file  The file.
Returns:
The date/time in seconds since the epoch.
See also:
pmSetFileDate()

const char* pmGetFileGroup PmFile   file
 

Returns the owner group of the specified file.

Parameters:
file  The file.
Returns:
The file's owner group.
See also:
pmSetFileGroup()

unsigned short pmGetFileMajorMinor PmFile   file
 

Returns the major/minor numbers for this file.

Parameters:
file  The file.
Returns:
The file's major/minor device numbers.
See also:
pmSetFileMajorMinor()

mode_t pmGetFileMode PmFile   file
 

Returns the mode of the specified file.

Parameters:
file  The file.
Returns:
The file's mode.
See also:
pmSetFileMode()

const char* pmGetFileName PmFile   file
 

Returns the name of the specified file.

Parameters:
file  The file.
Returns:
The file's name.
See also:
pmSetFileName()

const char* pmGetFileOwner PmFile   file
 

Returns the owner username of the specified file.

Parameters:
file  The file.
Returns:
The file's owner username.
See also:
pmSetFileOwner()

PmPackage* pmGetFilePackage PmFile   file
 

Returns the package that owns the specified file.

Parameters:
file  The file.
Returns:
The package that owns this file.
See also:
pmSetFilePackage()

unsigned int pmGetFileSize PmFile   file
 

Returns the size of this file.

Parameters:
file  The file.
Returns:
The file's size.
See also:
pmSetFileSize()

const char* pmGetFileSymlink PmFile   file
 

Returns the file this file is pointing to (if any).

Parameters:
file  The file.
Returns:
A file or directory path if this is a symlink. NULL otherwise.
See also:
pmSetFileSymlink()

PmFileType pmGetFileType PmFile   file
 

Returns the type of the specified file.

Parameters:
file  The file
Returns:
The file's type.
See also:
PmFileType, pmSetFileType()

PmFile* pmNewFile void   
 

Creates a new PmFile structure.

Returns:
A new, empty PmFile structure.
See also:
pmDuplicateFile() , pmDestroyFile()

PmFile* pmNextFile PmFile   file
 

Returns the next file in the list of files.

Parameters:
file  The current file.
Returns:
The next file in the list.
See also:
pmFirstFile() , pmPreviousFile()

PmFile* pmPreviousFile PmFile   file
 

Returns the previous file in the list of files.

Parameters:
file  The current file.
Returns:
The previous file in the list.
See also:
pmFirstFile() , pmNextFile()

void pmSetFileChecksum PmFile   file,
const char *    checksum
 

Sets the MD5 checksum of the specified file.

Parameters:
file  The file.
checksum  The MD5 checksum.
See also:
pmGetFileChecksum()

void pmSetFileDate PmFile   file,
time_t    date
 

Sets the timestamp of the specified file.

Parameters:
file  The file.
date  The date/time timestamp in seconds since the epoch.
See also:
pmGetFileDate()

void pmSetFileGroup PmFile   file,
const char *    group
 

Sets the group of the specified file.

Parameters:
file  The file.
group  The owner group.
See also:
pmGetFileGroup()

void pmSetFileMajorMinor PmFile   file,
unsigned short    majorMinor
 

Sets the major/minor numbers of the specified file.

This is only used if the file is of type PM_FILETYPE_DEVICE.

Parameters:
file  The file.
majorMinor  The major/minor numbers.
See also:
pmGetFileMajorMinor()

void pmSetFileMode PmFile   file,
mode_t    mode
 

Sets the mode of the specified file.

Parameters:
file  The file.
mode  The file's mode.
See also:
pmGetFileMode()

void pmSetFileName PmFile   file,
const char *    name
 

Sets the name of the specified file.

Parameters:
file  The file.
name  The name of the file.
See also:
pmGetFileName()

void pmSetFileOwner PmFile   file,
const char *    owner
 

Sets the owner of the specified file.

Parameters:
file  The file.
owner  The owner username.
See also:
pmGetFileOwner()

void pmSetFilePackage PmFile   file,
PmPackage   package
 

Sets the package that owns the specified file.

This should only be used by libpackman.

Parameters:
file  The file.
package  The package that owns this file.
See also:
pmGetFilePackage()

void pmSetFileSize PmFile   file,
unsigned int    size
 

Sets the size of the specified file.

Parameters:
file  The file.
size  The file size.
See also:
pmGetFileSize()

void pmSetFileSymlink PmFile   file,
const char *    symlink
 

Sets the file that this file links to.

If this file is not a symlink, symlink should be NULL.

Parameters:
file  The file.
symlink  The file that this file points to.
See also:
pmGetFileSymlink()

void pmSetFileType PmFile   file,
PmFileType    type
 

Sets the file type of the specified file.

Parameters:
file  The file.
type  The file type.
See also:
PmFileType, pmGetFileType()


Generated on Tue Jul 2 03:15:24 2002 for libpackman by doxygen1.2.15-20020430