00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef LC_FS_H
00015 #define LC_FS_H
00016
00017 #include <gwenhywfar/db.h>
00018 #include <gwenhywfar/misc.h>
00019 #include <gwenhywfar/types.h>
00020
00021 #include <stdio.h>
00022 #include <time.h>
00023
00024
00025 #define LC_FS_MOUNT_FLAGS_READONLY 0x00000001
00026
00027
00028 #define LC_FS_MODE_RIGHTS_OWNER_MASK 0x00000700
00029 #define LC_FS_MODE_RIGHTS_OWNER_EXEC 0x00000100
00030 #define LC_FS_MODE_RIGHTS_OWNER_WRITE 0x00000200
00031 #define LC_FS_MODE_RIGHTS_OWNER_READ 0x00000400
00032
00033 #define LC_FS_MODE_RIGHTS_GROUP_MASK 0x00000070
00034 #define LC_FS_MODE_RIGHTS_GROUP_EXEC 0x00000010
00035 #define LC_FS_MODE_RIGHTS_GROUP_WRITE 0x00000020
00036 #define LC_FS_MODE_RIGHTS_GROUP_READ 0x00000040
00037
00038 #define LC_FS_MODE_RIGHTS_OTHER_MASK 0x00000007
00039 #define LC_FS_MODE_RIGHTS_OTHER_EXEC 0x00000001
00040 #define LC_FS_MODE_RIGHTS_OTHER_WRITE 0x00000002
00041 #define LC_FS_MODE_RIGHTS_OTHER_READ 0x00000004
00042
00043 #define LC_FS_MODE_FTYPE_MASK 0x0000f000
00044 #define LC_FS_MODE_FTYPE_FILE 0x00001000
00045 #define LC_FS_MODE_FTYPE_DIR 0x00002000
00046
00047
00048
00049 typedef struct LC_FS_STAT LC_FS_STAT;
00050 typedef struct LC_FS LC_FS;
00051
00052
00053 #include <chipcard2-client/fs/fsnode.h>
00054 #include <chipcard2-client/fs/fsmodule.h>
00055
00056
00057 LC_FS *LC_FS_new();
00058 void LC_FS_free(LC_FS *fs);
00059
00060
00061 GWEN_TYPE_UINT32 LC_FS_CreateClient(LC_FS *fs);
00062 void LC_FS_DestroyClient(LC_FS *fs, GWEN_TYPE_UINT32 clid);
00063
00064
00065 int LC_FS_ChangeWorkingDir(LC_FS *fs,
00066 GWEN_TYPE_UINT32 clid,
00067 const char *path);
00068
00069 int LC_FS_OpenDir(LC_FS *fs,
00070 GWEN_TYPE_UINT32 clid,
00071 const char *path,
00072 GWEN_TYPE_UINT32 *pHid);
00073
00074 int LC_FS_MkDir(LC_FS *fs,
00075 GWEN_TYPE_UINT32 clid,
00076 const char *path,
00077 GWEN_TYPE_UINT32 mode,
00078 GWEN_TYPE_UINT32 *pHid);
00079
00080
00081 int LC_FS_ReadDir(LC_FS *fs,
00082 GWEN_TYPE_UINT32 clid,
00083 GWEN_TYPE_UINT32 hid,
00084 GWEN_STRINGLIST2 *sl);
00085
00086 int LC_FS_CloseDir(LC_FS *fs,
00087 GWEN_TYPE_UINT32 clid,
00088 GWEN_TYPE_UINT32 hid);
00089
00090 int LC_FS_OpenFile(LC_FS *fs,
00091 GWEN_TYPE_UINT32 clid,
00092 const char *path,
00093 GWEN_TYPE_UINT32 mode,
00094 GWEN_TYPE_UINT32 *pHid);
00095
00096 int LC_FS_CreateFile(LC_FS *fs,
00097 GWEN_TYPE_UINT32 clid,
00098 const char *path,
00099 GWEN_TYPE_UINT32 mode,
00100 GWEN_TYPE_UINT32 *pHid);
00101
00102 int LC_FS_CloseFile(LC_FS *fs,
00103 GWEN_TYPE_UINT32 clid,
00104 GWEN_TYPE_UINT32 hid);
00105
00106 int LC_FS_ReadFile(LC_FS *fs,
00107 GWEN_TYPE_UINT32 clid,
00108 GWEN_TYPE_UINT32 hid,
00109 GWEN_TYPE_UINT32 offset,
00110 GWEN_TYPE_UINT32 len,
00111 GWEN_BUFFER *buf);
00112
00113 int LC_FS_Unlink(LC_FS *fs,
00114 GWEN_TYPE_UINT32 clid,
00115 const char *path);
00116
00117 int LC_FS_Stat(LC_FS *fs,
00118 GWEN_TYPE_UINT32 clid,
00119 const char *path,
00120 LC_FS_STAT **pStat);
00121
00122
00123 int LC_FS_Dump(LC_FS *fs,
00124 GWEN_TYPE_UINT32 clid,
00125 const char *path,
00126 FILE *f,
00127 int indent);
00128
00129
00130 int LC_FS_Mount(LC_FS *fs,
00131 LC_FS_MODULE *fsm,
00132 const char *path);
00133
00134
00135 int LC_FS_HandleRequest(LC_FS *fs,
00136 GWEN_DB_NODE *dbRequest,
00137 GWEN_DB_NODE *dbResponse);
00138
00139
00140
00141
00142
00143 LC_FS_STAT *LC_FSStat_new();
00144 void LC_FSStat_free(LC_FS_STAT *st);
00145 LC_FS_STAT *LC_FSStat_dup(const LC_FS_STAT *ost);
00146
00147 LC_FS_STAT *LC_FSStat_fromDb(GWEN_DB_NODE *db);
00148 int LC_FSStat_toDb(const LC_FS_STAT *st, GWEN_DB_NODE *db);
00149
00150 GWEN_TYPE_UINT32 LC_FSStat_GetFileMode(const LC_FS_STAT *st);
00151 void LC_FSStat_SetFileMode(LC_FS_STAT *st, GWEN_TYPE_UINT32 m);
00152
00153 GWEN_TYPE_UINT32 LC_FSStat_GetFileSize(const LC_FS_STAT *st);
00154 void LC_FSStat_SetFileSize(LC_FS_STAT *st, GWEN_TYPE_UINT32 s);
00155
00156 time_t LC_FSStat_GetCTime(const LC_FS_STAT *st);
00157 void LC_FSStat_SetCTime(LC_FS_STAT *st, time_t ti);
00158
00159 time_t LC_FSStat_GetATime(const LC_FS_STAT *st);
00160 void LC_FSStat_SetATime(LC_FS_STAT *st, time_t ti);
00161
00162 time_t LC_FSStat_GetMTime(const LC_FS_STAT *st);
00163 void LC_FSStat_SetMTime(LC_FS_STAT *st, time_t ti);
00164
00165
00166 #endif
00167
00168
00169
00170