fsresource.h revision bbe1b32b
1/* $XConsortium: resource.h,v 1.4 94/04/17 19:56:00 dpw Exp $ */
2/*
3Copyright (c) 1987  X Consortium
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of the X Consortium shall not be
23used in advertising or otherwise to promote the sale, use or other dealings
24in this Software without prior written authorization from the X Consortium.
25 * Copyright 1990, 1991 Network Computing Devices;
26 * Portions Copyright 1987 by Digital Equipment Corporation
27 *
28 * Permission to use, copy, modify, distribute, and sell this software and its
29 * documentation for any purpose is hereby granted without fee, provided that
30 * the above copyright notice appear in all copies and that both that
31 * copyright notice and this permission notice appear in supporting
32 * documentation, and that the names of Network Computing Devices,
33 * or Digital not be used in advertising or
34 * publicity pertaining to distribution of the software without specific,
35 * written prior permission.  Network Computing Devices, or Digital
36 * make no representations about the
37 * suitability of this software for any purpose.  It is provided "as is"
38 * without express or implied warranty.
39 *
40 * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH
41 * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
42 * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE
43 * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
44 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
45 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
46 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
47 *
48 * @(#)resource.h	4.1	91/05/02
49 *
50 */
51/* $XFree86: xc/programs/xfs/include/fsresource.h,v 1.3 1998/10/25 12:48:04 dawes Exp $ */
52
53#ifndef _RESOURCE_H_
54#define _RESOURCE_H_
55
56#include	"misc.h"
57
58typedef unsigned long RESTYPE;
59
60#define	RC_VANILLA	((RESTYPE)0)
61#define	RC_CACHED	((RESTYPE)1<<31)
62#define	RC_LASTPREDEF	RC_CACHED
63#define	RC_ANY		(~(RESTYPE)0)
64
65#define	RT_FONT		((RESTYPE)1)
66#define	RT_AUTHCONT	((RESTYPE)2)
67#define	RT_LASTPREDEF	RT_AUTHCONT
68#define	RT_NONE		((RESTYPE)0)
69
70#define	CLIENTOFFSET		22
71#define	RESOURCE_ID_MASK	0x3FFFFF
72#define	CLIENT_BITS(id)		((id) & 0x1fc00000)
73#define	CLIENT_ID(id)		((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
74#define	SERVER_BIT		0x20000000
75
76#define	INVALID			(0)
77
78#define	BAD_RESOURCE		0xe0000000
79
80#ifdef NOTYET
81extern Bool ChangeResourceValue(int cid, FSID id, RESTYPE rtype, pointer value);
82extern FSID FakeClientID(int client);
83extern RESTYPE CreateNewResourceClass(void);
84extern RESTYPE CreateNewResourceType(DeleteType deleteFunc);
85extern pointer LookupIDByClass(FSID id, RESTYPE classes);
86extern void FreeResourceByType(int cid, FSID id, RESTYPE type, Bool skipFree);
87#endif /* NOTYET */
88
89extern Bool AddResource(int cid, FSID id, RESTYPE type, pointer value);
90extern Bool InitClientResources(ClientPtr client);
91extern FSID FakeClientID(int client);
92extern pointer LookupIDByType(int cid, FSID id, RESTYPE rtype);
93extern void FreeAllResources(void);
94extern void FreeClientResources(ClientPtr client);
95extern void FreeResource(int cid, FSID id, RESTYPE skipDeleteFuncType);
96int NoneDeleteFunc (void *ptr, FSID id);
97
98#endif				/* _RESOURCE_H_ */
99