source: trunk/kStuff/include/k/kRdrAll.h

Last change on this file was 3571, checked in by bird, 18 years ago

Eliminated KLDRPROT.

  • Property svn:keywords set to Id
File size: 3.9 KB
RevLine 
[2826]1/* $Id: kRdrAll.h 3571 2007-08-31 02:39:26Z bird $ */
[2821]2/** @file
[3550]3 * kRdr - The File Provider, All Details and Dependencies Included.
[3542]4 */
5
6/*
7 * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net>
[2821]8 *
[3542]9 * This file is part of kStuff.
[2821]10 *
[3542]11 * kStuff is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; either version 2 of the License, or
[2821]14 * (at your option) any later version.
15 *
[3542]16 * kStuff is distributed in the hope that it will be useful,
[2821]17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[3542]19 * GNU Lesser General Public License for more details.
[2821]20 *
[3542]21 * You should have received a copy of the GNU Lesser General Public License
22 * along with kStuff; if not, write to the Free Software
[2821]23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
[3550]27#ifndef ___k_kRdrAll_h___
28#define ___k_kRdrAll_h___
[2821]29
[3542]30#include <k/kDefs.h>
[3571]31#include <k/kLdr.h>
[3543]32#include <k/kRdr.h>
[3542]33
[2821]34#ifdef __cplusplus
35extern "C" {
36#endif
37
38
[3543]39/** @defgroup grp_kRdrAll All
40 * @addtogroup grp_kRdr
41 * @{
42 */
[2821]43
44/**
[2825]45 * File provider instance operations.
46 */
[3542]47typedef struct KRDROPS
[2825]48{
49 /** The name of this file provider. */
50 const char *pszName;
51 /** Pointer to the next file provider. */
[3542]52 const struct KRDROPS *pNext;
[2825]53
54 /** Try create a new file provider instance.
55 *
56 * @returns 0 on success, OS specific error code on failure.
57 * @param ppRdr Where to store the file provider instance.
58 * @param pszFilename The filename to open.
59 */
[3542]60 int (* pfnCreate)( PPKRDR ppRdr, const char *pszFilename);
[2825]61 /** Destroy the file provider instance.
62 *
63 * @returns 0 on success, OS specific error code on failure.
64 * On failure, the file provider instance will be in an indeterminate state - don't touch it!
65 * @param pRdr The file provider instance.
66 */
[3542]67 int (* pfnDestroy)( PKRDR pRdr);
68 /** @copydoc kRdrRead */
[3546]69 int (* pfnRead)( PKRDR pRdr, void *pvBuf, KSIZE cb, KFOFF off);
[3542]70 /** @copydoc kRdrAllMap */
71 int (* pfnAllMap)( PKRDR pRdr, const void **ppvBits);
72 /** @copydoc kRdrAllUnmap */
73 int (* pfnAllUnmap)(PKRDR pRdr, const void *pvBits);
74 /** @copydoc kRdrSize */
75 KFOFF (* pfnSize)( PKRDR pRdr);
76 /** @copydoc kRdrTell */
77 KFOFF (* pfnTell)( PKRDR pRdr);
78 /** @copydoc kRdrName */
79 const char * (* pfnName)(PKRDR pRdr);
[3543]80 /** @copydoc kRdrNativeFH */
81 KIPTR (* pfnNativeFH)(PKRDR pRdr);
[3542]82 /** @copydoc kRdrPageSize */
83 KSIZE (* pfnPageSize)(PKRDR pRdr);
84 /** @copydoc kRdrMap */
[3546]85 int (* pfnMap)( PKRDR pRdr, void **ppvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed);
[3542]86 /** @copydoc kRdrRefresh */
87 int (* pfnRefresh)( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments);
88 /** @copydoc kRdrProtect */
[3546]89 int (* pfnProtect)( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect);
[3542]90 /** @copydoc kRdrUnmap */
91 int (* pfnUnmap)( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments);
92 /** @copydoc kRdrDone */
93 void (* pfnDone)( PKRDR pRdr);
[2829]94 /** The usual non-zero dummy that makes sure we've initialized all members. */
[3542]95 KU32 u32Dummy;
96} KRDROPS;
[2825]97/** Pointer to file provider operations. */
[3542]98typedef KRDROPS *PKRDROPS;
[2825]99/** Pointer to const file provider operations. */
[3542]100typedef const KRDROPS *PCKRDROPS;
[2825]101
102
103/**
104 * File provider instance core.
105 */
[3542]106typedef struct KRDR
[2825]107{
[3543]108 /** Magic number (KRDR_MAGIC). */
[3542]109 KU32 u32Magic;
[2825]110 /** Pointer to the file provider operations. */
[3542]111 PCKRDROPS pOps;
112} KRDR;
[2825]113
[3542]114void kRdrAddProvider(PKRDROPS pAdd);
[2825]115
[2948]116/** @} */
117
[2821]118#ifdef __cplusplus
119}
120#endif
121
122#endif
123
Note: See TracBrowser for help on using the repository browser.