"Fossies" - the Fresh Open Source Software Archive 
Member "libisofs-1.5.4/libisofs/fsource.c" (8 Jul 2020, 2603 Bytes) of package /linux/misc/libisofs-1.5.4.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "fsource.c" see the
Fossies "Dox" file reference documentation.
1 /*
2 * Copyright (c) 2007 Vreixo Formoso
3 *
4 * This file is part of the libisofs project; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License version 2
6 * or later as published by the Free Software Foundation.
7 * See COPYING file for details.
8 */
9
10 #ifdef HAVE_CONFIG_H
11 #include "../config.h"
12 #endif
13
14 #include "fsource.h"
15 #include <stdlib.h>
16
17 /**
18 * Values belong 1000 are reserved for libisofs usage
19 */
20 unsigned int iso_fs_global_id = 1000;
21
22 void iso_file_source_ref(IsoFileSource *src)
23 {
24 ++src->refcount;
25 }
26
27 void iso_file_source_unref(IsoFileSource *src)
28 {
29 if (--src->refcount == 0) {
30 src->class->free(src);
31 free(src);
32 }
33 }
34
35 void iso_filesystem_ref(IsoFilesystem *fs)
36 {
37 ++fs->refcount;
38 }
39
40 void iso_filesystem_unref(IsoFilesystem *fs)
41 {
42 if (--fs->refcount == 0) {
43 fs->free(fs);
44 free(fs);
45 }
46 }
47
48 /*
49 * this are just helpers to invoque methods in class
50 */
51
52 inline
53 char* iso_file_source_get_path(IsoFileSource *src)
54 {
55 return src->class->get_path(src);
56 }
57
58 inline
59 char* iso_file_source_get_name(IsoFileSource *src)
60 {
61 return src->class->get_name(src);
62 }
63
64 inline
65 int iso_file_source_lstat(IsoFileSource *src, struct stat *info)
66 {
67 return src->class->lstat(src, info);
68 }
69
70 inline
71 int iso_file_source_access(IsoFileSource *src)
72 {
73 return src->class->access(src);
74 }
75
76 inline
77 int iso_file_source_stat(IsoFileSource *src, struct stat *info)
78 {
79 return src->class->stat(src, info);
80 }
81
82 inline
83 int iso_file_source_open(IsoFileSource *src)
84 {
85 return src->class->open(src);
86 }
87
88 inline
89 int iso_file_source_close(IsoFileSource *src)
90 {
91 return src->class->close(src);
92 }
93
94 inline
95 int iso_file_source_read(IsoFileSource *src, void *buf, size_t count)
96 {
97 return src->class->read(src, buf, count);
98 }
99
100 inline
101 off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag)
102 {
103 return src->class->lseek(src, offset, flag);
104 }
105
106 inline
107 int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child)
108 {
109 return src->class->readdir(src, child);
110 }
111
112 inline
113 int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
114 {
115 return src->class->readlink(src, buf, bufsiz);
116 }
117
118 inline
119 IsoFilesystem* iso_file_source_get_filesystem(IsoFileSource *src)
120 {
121 return src->class->get_filesystem(src);
122 }
123
124
125 inline
126 int iso_file_source_get_aa_string(IsoFileSource *src,
127 unsigned char **aa_string, int flag)
128 {
129 if (src->class->version < 1) {
130 *aa_string = NULL;
131 return 1;
132 }
133 return src->class->get_aa_string(src, aa_string, flag);
134 }
135