CERN org.glite.Gfal
2.0.1
|
00001 #pragma once 00002 /* 00003 * Copyright (c) Members of the EGEE Collaboration. 2004. 00004 * See http://www.eu-egee.org/partners/ for details on the copyright holders. 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 00019 00020 00029 #include <glib.h> 00030 #include <stdlib.h> 00031 #include <pthread.h> 00032 #include "gfal_prototypes.h" 00033 #include "gfal_constants.h" 00034 00035 struct _gfal_file_descriptor_container{ 00036 GHashTable* container; 00037 pthread_mutex_t m_container; 00038 }; 00039 00040 struct _gfal_file_handle_{ 00041 char module_name[GFAL_MODULE_NAME_SIZE]; // This MUST be the Name of the plugin associated with this handle ! 00042 GMutex* lock; 00043 off_t offset; 00044 gpointer ext_data; 00045 gpointer fdesc; 00046 }; 00047 00048 // low level funcs 00049 gfal_fdesc_container_handle gfal_file_descriptor_handle_create(GDestroyNotify destroyer); 00050 00051 int gfal_add_new_file_desc(gfal_fdesc_container_handle fhandle, gpointer pfile, GError** err); 00052 00053 gboolean gfal_remove_file_desc(gfal_fdesc_container_handle fhandle, int key, GError** err); 00054 00055 00056 gpointer gfal_get_file_desc(gfal_fdesc_container_handle fhandle, int key, GError** err); 00057 00058 00059 // high level funcs 00060 00061 gfal_file_handle gfal_file_handle_bind(gfal_fdesc_container_handle h, int file_desc, GError** err); 00062 00063 // convenience funcs 00064 00065 gfal_file_handle gfal_file_handle_new(const char* module_name, gpointer fdesc); 00066 00067 gfal_file_handle gfal_file_handle_ext_new(const char* module_name, gpointer fdesc, gpointer ext_data); 00068 00069 00070 void gfal_file_handle_delete(gfal_file_handle fh); 00071 00072 void gfal_file_handle_lock(gfal_file_handle fh); 00073 00074 void gfal_file_handle_unlock(gfal_file_handle fh);