xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

fsource.c
Go to the documentation of this file.
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 
23 {
24  ++src->refcount;
25 }
26 
28 {
29  if (--src->refcount == 0) {
30  src->class->free(src);
31  free(src);
32  }
33 }
34 
36 {
37  ++fs->refcount;
38 }
39 
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
54 {
55  return src->class->get_path(src);
56 }
57 
58 inline
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
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
84 {
85  return src->class->open(src);
86 }
87 
88 inline
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
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
120 {
121  return src->class->get_filesystem(src);
122 }
123 
124 
125 inline
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 
off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag)
Definition: fsource.c:101
int iso_file_source_lstat(IsoFileSource *src, struct stat *info)
Definition: fsource.c:65
int iso_file_source_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
Definition: fsource.c:126
int iso_file_source_read(IsoFileSource *src, void *buf, size_t count)
Definition: fsource.c:95
int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child)
Definition: fsource.c:107
void iso_filesystem_ref(IsoFilesystem *fs)
Definition: fsource.c:35
void iso_file_source_unref(IsoFileSource *src)
Definition: fsource.c:27
unsigned int iso_fs_global_id
Definition: fsource.c:20
int iso_file_source_access(IsoFileSource *src)
Definition: fsource.c:71
char * iso_file_source_get_name(IsoFileSource *src)
Definition: fsource.c:59
void iso_filesystem_unref(IsoFilesystem *fs)
Definition: fsource.c:40
int iso_file_source_close(IsoFileSource *src)
Definition: fsource.c:89
int iso_file_source_stat(IsoFileSource *src, struct stat *info)
Definition: fsource.c:77
void iso_file_source_ref(IsoFileSource *src)
Definition: fsource.c:22
IsoFilesystem * iso_file_source_get_filesystem(IsoFileSource *src)
Definition: fsource.c:119
int iso_file_source_open(IsoFileSource *src)
Definition: fsource.c:83
int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
Definition: fsource.c:113
char * iso_file_source_get_path(IsoFileSource *src)
Definition: fsource.c:53
void(* free)(IsoFileSource *src)
Definition: libisofs.h:823
char *(* get_name)(IsoFileSource *src)
Definition: libisofs.h:661
int(* access)(IsoFileSource *src)
Definition: libisofs.h:713
IsoFilesystem *(* get_filesystem)(IsoFileSource *src)
Definition: libisofs.h:817
int(* close)(IsoFileSource *src)
Definition: libisofs.h:737
int(* stat)(IsoFileSource *src, struct stat *info)
Definition: libisofs.h:692
int(* open)(IsoFileSource *src)
Definition: libisofs.h:727
off_t(* lseek)(IsoFileSource *src, off_t offset, int flag)
Definition: libisofs.h:843
int(* get_aa_string)(IsoFileSource *src, unsigned char **aa_string, int flag)
Definition: libisofs.h:878
int(* read)(IsoFileSource *src, void *buf, size_t count)
Definition: libisofs.h:759
int(* readlink)(IsoFileSource *src, char *buf, size_t bufsiz)
Definition: libisofs.h:808
char *(* get_path)(IsoFileSource *src)
Definition: libisofs.h:653
int(* readdir)(IsoFileSource *src, IsoFileSource **child)
Definition: libisofs.h:784
int(* lstat)(IsoFileSource *src, struct stat *info)
Definition: libisofs.h:676
const IsoFileSourceIface * class
Definition: libisofs.h:915
unsigned int refcount
Definition: libisofs.h:623
void(* free)(IsoFilesystem *fs)
Definition: libisofs.h:620