summaryrefslogtreecommitdiff
path: root/fs/mysqlcorbafs.h
blob: 4074d0e07b4c5d9bda2d2394923f3fcde03557d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 */
#include "CorbaFS.h"

#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
#include <m_ctype.h>
#include "mysql.h"

#define QUOTE_CHAR '`'
/* Exit codes */

#define EX_USAGE 1
#define EX_MYSQLERR 2
#define EX_CONSCHECK 3
#define EX_EOM 4

#define CORBAFS_VERSION "0.01"

typedef struct
{
   POA_CorbaFS_Inode servant;
   PortableServer_POA poa;

        CORBA_char *path;
        CORBA_unsigned_long inodeNum;
#if 0
        CORBA_unsigned_short mode;
        CORBA_unsigned_long uid;
        CORBA_unsigned_long gid;
        CORBA_unsigned_long size;
        CORBA_unsigned_short numLinks;
        CORBA_long atime;
        CORBA_long mtime;
        CORBA_long ctime;
#endif
}
impl_POA_CorbaFS_Inode;

typedef struct
{
   POA_CorbaFS_FileSystem servant;
   PortableServer_POA poa;

}
impl_POA_CorbaFS_FileSystem;

/*** Implementation stub prototypes ***/
CorbaFS_FileSystem 
impl_FileSystem__create(PortableServer_POA poa, CORBA_Environment * ev);

static void 
impl_Inode__destroy(impl_POA_CorbaFS_Inode * servant,
					CORBA_Environment * ev);
static void
impl_Inode_getStatus(impl_POA_CorbaFS_Inode * servant,
   CORBA_unsigned_short * mode,
   CORBA_unsigned_long * uid,
   CORBA_unsigned_long * gid,
   CORBA_unsigned_long * size,
   CORBA_unsigned_long * inodeNum,
   CORBA_unsigned_short * numLinks,
   CORBA_long * atime,
   CORBA_long * mtime,
   CORBA_long * ctime, CORBA_Environment * ev);

static void
impl_Inode_readpage(impl_POA_CorbaFS_Inode * servant,
   CorbaFS_Buffer ** buffer,
   CORBA_long size,
   CORBA_long offset, CORBA_Environment * ev);

static void
impl_Inode_release(impl_POA_CorbaFS_Inode * servant,
   CORBA_Environment * ev);

static void impl_FileSystem__destroy(impl_POA_CorbaFS_FileSystem *
   servant, CORBA_Environment * ev);

static CorbaFS_Inode
impl_FileSystem_getInode(impl_POA_CorbaFS_FileSystem * servant,
   CORBA_char * path, CORBA_Environment * ev);

static CorbaFS_DirEntSeq *
impl_FileSystem_readdir(impl_POA_CorbaFS_FileSystem * servant,
   CORBA_char * path,
   CORBA_Environment * ev);

static CORBA_char *
impl_FileSystem_readlink(impl_POA_CorbaFS_FileSystem * servant,
   CORBA_char * filename,
   CORBA_Environment * ev);

static my_bool verbose,opt_compress;
static uint opt_mysql_port=0;
static my_string opt_mysql_unix_port=0;
static int   first_error=0;
static MYSQL connection, *sock=0;

extern uint opt_mysql_port;
extern my_string opt_mysql_unix_port,host,user,password;



static struct format {
      char *tablestart;

      char *headerrowstart;
      char *headercellstart;
      char *headercellseparator;
      char *headercellend;
      char *headerrowend;
      int  headerformat; /* 0 - simple, 1 - left padded, 2 - right padded */

      char *contentrowstart;
      char *contentcellstart;
      char *contentcellseparator;
      char *contentcellend;
      char *contentrowend;
      int  contentformat;

      char *footerrowstart;
      char *footercellstart;
      char *footercellseparator;
      char *footercellend;
      char *footerrowend;
      int  footerformat;

      char *tableend;

      char *leftuppercorner;
      char *rightuppercorner;
      char *leftdowncorner;
      char *rightdowncorner;
      char *leftcross;
      char *rightcross;
      char *topcross;
      char *middlecross;
      char *bottomcross;

      
} Human, HTML, CSF, XML;