2011-05-03 06:07:26 -07:00
|
|
|
/* EIO - EFL data type library
|
|
|
|
* Copyright (C) 2011 Enlightenment Developers:
|
|
|
|
* Cedric Bail <cedric.bail@free.fr>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library;
|
|
|
|
* if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "eio_private.h"
|
|
|
|
#include "Eio.h"
|
|
|
|
|
|
|
|
/*============================================================================*
|
|
|
|
* Local *
|
|
|
|
*============================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @cond LOCAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
_eio_ls_xattr_heavy(void *data, Ecore_Thread *thread)
|
|
|
|
{
|
|
|
|
Eio_File_Char_Ls *async = data;
|
2011-09-16 04:14:57 -07:00
|
|
|
Eina_Iterator *it;
|
2016-09-07 15:57:25 -07:00
|
|
|
Eina_List *pack = NULL;
|
2011-09-16 04:14:57 -07:00
|
|
|
const char *tmp;
|
2016-09-07 15:57:25 -07:00
|
|
|
double start;
|
2011-05-03 06:07:26 -07:00
|
|
|
|
2011-09-16 04:14:57 -07:00
|
|
|
it = eina_xattr_ls(async->ls.directory);
|
2013-06-20 04:28:18 -07:00
|
|
|
if (!it) return;
|
2011-05-03 06:07:26 -07:00
|
|
|
|
2016-09-07 15:57:25 -07:00
|
|
|
eio_file_container_set(&async->ls.common, eina_iterator_container_get(it));
|
|
|
|
|
|
|
|
start = ecore_time_get();
|
|
|
|
|
2011-09-16 04:14:57 -07:00
|
|
|
EINA_ITERATOR_FOREACH(it, tmp)
|
2011-05-03 06:07:26 -07:00
|
|
|
{
|
|
|
|
Eina_Bool filter = EINA_TRUE;
|
|
|
|
|
|
|
|
if (async->filter_cb)
|
|
|
|
{
|
|
|
|
filter = async->filter_cb((void*) async->ls.common.data,
|
|
|
|
&async->ls.common,
|
2011-09-16 04:14:57 -07:00
|
|
|
tmp);
|
2011-05-03 06:07:26 -07:00
|
|
|
}
|
|
|
|
|
2016-09-07 15:57:25 -07:00
|
|
|
if (filter)
|
|
|
|
{
|
|
|
|
Eio_File_Char *send_fc;
|
|
|
|
|
|
|
|
send_fc = eio_char_malloc();
|
|
|
|
if (!send_fc) goto on_error;
|
|
|
|
|
|
|
|
send_fc->filename = eina_stringshare_add(tmp);
|
|
|
|
send_fc->associated = async->ls.common.worker.associated;
|
|
|
|
async->ls.common.worker.associated = NULL;
|
|
|
|
|
|
|
|
pack = eina_list_append(pack, send_fc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
on_error:
|
|
|
|
if (async->ls.common.worker.associated)
|
|
|
|
{
|
|
|
|
eina_hash_free(async->ls.common.worker.associated);
|
|
|
|
async->ls.common.worker.associated = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pack = eio_pack_send(thread, pack, &start);
|
2011-05-03 06:07:26 -07:00
|
|
|
|
|
|
|
if (ecore_thread_check(thread))
|
|
|
|
break;
|
|
|
|
}
|
2011-09-16 04:14:57 -07:00
|
|
|
|
2016-09-07 15:57:25 -07:00
|
|
|
if (pack) ecore_thread_feedback(thread, pack);
|
2011-05-03 06:07:26 -07:00
|
|
|
|
2016-09-07 15:57:25 -07:00
|
|
|
async->ls.ls = it;
|
2011-05-03 06:07:26 -07:00
|
|
|
}
|
2011-06-29 10:28:55 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_eio_file_xattr_get(void *data, Ecore_Thread *thread)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async = data;
|
2011-09-16 07:18:08 -07:00
|
|
|
Eina_Bool failure = EINA_FALSE;
|
|
|
|
const char *file;
|
|
|
|
const char *attribute;
|
2011-06-29 10:28:55 -07:00
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
file = async->path;
|
|
|
|
attribute = async->attribute;
|
2011-06-29 10:28:55 -07:00
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
switch (async->op)
|
|
|
|
{
|
|
|
|
case EIO_XATTR_DATA:
|
|
|
|
async->todo.xdata.xattr_size = 0;
|
|
|
|
async->todo.xdata.xattr_data = NULL;
|
|
|
|
|
|
|
|
async->todo.xdata.xattr_data = eina_xattr_get(file, attribute, &async->todo.xdata.xattr_size);
|
|
|
|
if (!async->todo.xdata.xattr_data) failure = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
case EIO_XATTR_STRING:
|
|
|
|
async->todo.xstring.xattr_string = eina_xattr_string_get(file, attribute);
|
|
|
|
if (!async->todo.xstring.xattr_string) failure = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
case EIO_XATTR_DOUBLE:
|
|
|
|
failure = !eina_xattr_double_get(file, attribute, &async->todo.xdouble.xattr_double);
|
|
|
|
break;
|
|
|
|
case EIO_XATTR_INT:
|
|
|
|
failure = !eina_xattr_int_get(file, attribute, &async->todo.xint.xattr_int);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (failure)
|
2011-06-29 10:28:55 -07:00
|
|
|
ecore_thread_cancel(thread);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_eio_file_xattr_free(Eio_File_Xattr *async)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(async->path);
|
|
|
|
eina_stringshare_del(async->attribute);
|
2011-09-19 05:47:02 -07:00
|
|
|
if (!async->set)
|
|
|
|
{
|
|
|
|
if (async->op == EIO_XATTR_DATA) free(async->todo.xdata.xattr_data);
|
|
|
|
if (async->op == EIO_XATTR_STRING) free(async->todo.xstring.xattr_string);
|
|
|
|
}
|
2012-08-30 01:52:15 -07:00
|
|
|
eio_file_free(&async->common);
|
2011-06-29 10:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-12-04 09:40:58 -08:00
|
|
|
_eio_file_xattr_get_done(void *data, Ecore_Thread *thread EINA_UNUSED)
|
2011-06-29 10:28:55 -07:00
|
|
|
{
|
|
|
|
Eio_File_Xattr *async = data;
|
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
switch (async->op)
|
|
|
|
{
|
|
|
|
case EIO_XATTR_DATA:
|
|
|
|
if (async->todo.xdata.done_cb)
|
|
|
|
async->todo.xdata.done_cb((void *) async->common.data, &async->common, async->todo.xdata.xattr_data, async->todo.xdata.xattr_size);
|
|
|
|
break;
|
|
|
|
case EIO_XATTR_STRING:
|
|
|
|
if (async->todo.xstring.done_cb)
|
|
|
|
async->todo.xstring.done_cb((void *) async->common.data, &async->common, async->todo.xstring.xattr_string);
|
|
|
|
break;
|
|
|
|
case EIO_XATTR_DOUBLE:
|
|
|
|
if (async->todo.xdouble.done_cb)
|
|
|
|
async->todo.xdouble.done_cb((void *) async->common.data, &async->common, async->todo.xdouble.xattr_double);
|
|
|
|
break;
|
|
|
|
case EIO_XATTR_INT:
|
|
|
|
if (async->todo.xint.done_cb)
|
|
|
|
async->todo.xint.done_cb((void *) async->common.data, &async->common, async->todo.xint.xattr_int);
|
|
|
|
break;
|
|
|
|
}
|
2011-06-29 10:28:55 -07:00
|
|
|
|
|
|
|
_eio_file_xattr_free(async);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-12-04 09:40:58 -08:00
|
|
|
_eio_file_xattr_get_error(void *data, Ecore_Thread *thread EINA_UNUSED)
|
2011-06-29 10:28:55 -07:00
|
|
|
{
|
|
|
|
Eio_File_Xattr *async = data;
|
|
|
|
|
|
|
|
eio_file_error(&async->common);
|
|
|
|
_eio_file_xattr_free(async);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_eio_file_xattr_set(void *data, Ecore_Thread *thread)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async = data;
|
2011-09-16 07:18:08 -07:00
|
|
|
const char *file;
|
|
|
|
const char *attribute;
|
|
|
|
Eina_Xattr_Flags flags;
|
|
|
|
Eina_Bool failure = EINA_FALSE;
|
|
|
|
|
|
|
|
file = async->path;
|
|
|
|
attribute = async->attribute;
|
|
|
|
flags = async->flags;
|
2011-06-29 10:28:55 -07:00
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
switch (async->op)
|
|
|
|
{
|
|
|
|
case EIO_XATTR_DATA:
|
|
|
|
failure = !eina_xattr_set(file, attribute, async->todo.xdata.xattr_data, async->todo.xdata.xattr_size, flags);
|
2016-07-31 21:37:25 -07:00
|
|
|
async->common.length = async->todo.xdata.xattr_size;
|
2011-09-16 07:18:08 -07:00
|
|
|
break;
|
|
|
|
case EIO_XATTR_STRING:
|
|
|
|
failure = !eina_xattr_string_set(file, attribute, async->todo.xstring.xattr_string, flags);
|
2016-07-31 21:37:25 -07:00
|
|
|
async->common.length = strlen(async->todo.xstring.xattr_string) + 1;
|
2011-09-16 07:18:08 -07:00
|
|
|
break;
|
|
|
|
case EIO_XATTR_DOUBLE:
|
|
|
|
failure = !eina_xattr_double_set(file, attribute, async->todo.xdouble.xattr_double, flags);
|
2016-07-31 21:37:25 -07:00
|
|
|
async->common.length = sizeof (double);
|
2011-09-16 07:18:08 -07:00
|
|
|
break;
|
|
|
|
case EIO_XATTR_INT:
|
|
|
|
failure = !eina_xattr_int_set(file, attribute, async->todo.xint.xattr_int, flags);
|
2016-07-31 21:37:25 -07:00
|
|
|
async->common.length = sizeof (int);
|
2011-09-16 07:18:08 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (failure) eio_file_thread_error(&async->common, thread);
|
2011-06-29 10:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-03-11 00:54:59 -07:00
|
|
|
_eio_file_xattr_set_done(void *data, Ecore_Thread *thread)
|
2011-06-29 10:28:55 -07:00
|
|
|
{
|
|
|
|
Eio_File_Xattr *async = data;
|
|
|
|
|
2013-03-11 00:54:59 -07:00
|
|
|
if (!ecore_thread_check(thread))
|
|
|
|
{
|
|
|
|
if (async->common.done_cb)
|
|
|
|
async->common.done_cb((void*) async->common.data, &async->common);
|
|
|
|
}
|
2011-06-29 10:28:55 -07:00
|
|
|
|
|
|
|
_eio_file_xattr_free(async);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-12-04 09:40:58 -08:00
|
|
|
_eio_file_xattr_set_error(void *data, Ecore_Thread *thread EINA_UNUSED)
|
2011-06-29 10:28:55 -07:00
|
|
|
{
|
|
|
|
Eio_File_Xattr *async = data;
|
|
|
|
|
|
|
|
eio_file_error(&async->common);
|
|
|
|
_eio_file_xattr_free(async);
|
|
|
|
}
|
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
static Eio_File *
|
|
|
|
_eio_file_xattr_setup_get(Eio_File_Xattr *async,
|
|
|
|
const char *path,
|
|
|
|
const char *attribute,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
async->path = eina_stringshare_add(path);
|
|
|
|
async->attribute = eina_stringshare_add(attribute);
|
2011-09-19 05:47:02 -07:00
|
|
|
async->set = EINA_FALSE;
|
2011-09-16 07:18:08 -07:00
|
|
|
|
|
|
|
if (!eio_file_set(&async->common,
|
|
|
|
NULL,
|
|
|
|
error_cb,
|
|
|
|
data,
|
|
|
|
_eio_file_xattr_get,
|
|
|
|
_eio_file_xattr_get_done,
|
|
|
|
_eio_file_xattr_get_error))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return &async->common;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eio_File *
|
|
|
|
_eio_file_xattr_setup_set(Eio_File_Xattr *async,
|
|
|
|
const char *path,
|
|
|
|
const char *attribute,
|
|
|
|
Eina_Xattr_Flags flags,
|
|
|
|
Eio_Done_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
async->path = eina_stringshare_add(path);
|
|
|
|
async->attribute = eina_stringshare_add(attribute);
|
|
|
|
async->flags = flags;
|
2011-09-19 05:47:02 -07:00
|
|
|
async->set = EINA_TRUE;
|
2011-09-16 07:18:08 -07:00
|
|
|
|
|
|
|
if (!eio_file_set(&async->common,
|
|
|
|
done_cb,
|
|
|
|
error_cb,
|
|
|
|
data,
|
|
|
|
_eio_file_xattr_set,
|
|
|
|
_eio_file_xattr_set_done,
|
|
|
|
_eio_file_xattr_set_error))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return &async->common;
|
|
|
|
}
|
|
|
|
|
2011-05-03 06:07:26 -07:00
|
|
|
/**
|
|
|
|
* @endcond
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*============================================================================*
|
|
|
|
* Global *
|
|
|
|
*============================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @cond LOCAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @endcond
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*============================================================================*
|
|
|
|
* API *
|
|
|
|
*============================================================================*/
|
|
|
|
|
2016-09-07 16:20:23 -07:00
|
|
|
static Eio_File *
|
|
|
|
_eio_file_internal_xattr(const char *path,
|
|
|
|
Eio_Filter_Cb filter_cb,
|
|
|
|
Eio_Main_Cb main_cb,
|
|
|
|
Eio_Array_Cb main_internal_cb,
|
|
|
|
Eio_Done_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
2011-05-03 06:07:26 -07:00
|
|
|
{
|
|
|
|
Eio_File_Char_Ls *async;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
|
|
|
|
|
2016-09-07 16:20:23 -07:00
|
|
|
async = eio_common_alloc(sizeof (Eio_File_Char_Ls));
|
2011-05-03 06:07:26 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(async, NULL);
|
|
|
|
|
|
|
|
async->ls.directory = eina_stringshare_add(path);
|
2016-09-07 16:20:23 -07:00
|
|
|
async->filter_cb = filter_cb;
|
|
|
|
|
|
|
|
if (main_internal_cb)
|
|
|
|
{
|
|
|
|
async->main_internal_cb = main_internal_cb;
|
|
|
|
async->ls.gather = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
async->main_cb = main_cb;
|
|
|
|
}
|
2011-05-03 06:07:26 -07:00
|
|
|
|
|
|
|
if (!eio_long_file_set(&async->ls.common,
|
|
|
|
done_cb,
|
|
|
|
error_cb,
|
|
|
|
data,
|
|
|
|
_eio_ls_xattr_heavy,
|
2016-09-07 15:57:25 -07:00
|
|
|
_eio_string_notify,
|
2011-05-03 06:07:26 -07:00
|
|
|
eio_async_end,
|
|
|
|
eio_async_error))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return &async->ls.common;
|
|
|
|
}
|
|
|
|
|
eio: Rename EAPI macro to EIO_API in Eio library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: vtorri, woohyun, lucas, jptiz
Reviewed By: vtorri, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12210
2020-12-14 06:43:38 -08:00
|
|
|
EIO_API Eio_File *
|
2016-09-07 16:20:23 -07:00
|
|
|
eio_file_xattr(const char *path,
|
|
|
|
Eio_Filter_Cb filter_cb,
|
|
|
|
Eio_Main_Cb main_cb,
|
|
|
|
Eio_Done_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
|
|
|
|
|
|
|
|
return _eio_file_internal_xattr(path, filter_cb, main_cb, NULL, done_cb, error_cb, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
Eio_File *
|
|
|
|
_eio_file_xattr(const char *path,
|
|
|
|
Eio_Array_Cb main_internal_cb,
|
|
|
|
Eio_Done_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(main_internal_cb, NULL);
|
|
|
|
|
|
|
|
return _eio_file_internal_xattr(path, NULL, NULL, main_internal_cb, done_cb, error_cb, data);
|
|
|
|
}
|
|
|
|
|
eio: Rename EAPI macro to EIO_API in Eio library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: vtorri, woohyun, lucas, jptiz
Reviewed By: vtorri, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12210
2020-12-14 06:43:38 -08:00
|
|
|
EIO_API Eio_File *
|
2011-06-29 10:28:55 -07:00
|
|
|
eio_file_xattr_get(const char *path,
|
|
|
|
const char *attribute,
|
2011-09-16 07:18:08 -07:00
|
|
|
Eio_Done_Data_Cb done_cb,
|
2011-06-29 10:28:55 -07:00
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async;
|
|
|
|
|
2012-12-24 01:44:21 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
|
2011-06-29 10:28:55 -07:00
|
|
|
|
|
|
|
async = malloc(sizeof (Eio_File_Xattr));
|
|
|
|
if (!async) return NULL;
|
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
async->op = EIO_XATTR_DATA;
|
|
|
|
async->todo.xdata.done_cb = done_cb;
|
2011-06-29 10:28:55 -07:00
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
return _eio_file_xattr_setup_get(async, path, attribute, error_cb, data);
|
|
|
|
}
|
|
|
|
|
eio: Rename EAPI macro to EIO_API in Eio library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: vtorri, woohyun, lucas, jptiz
Reviewed By: vtorri, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12210
2020-12-14 06:43:38 -08:00
|
|
|
EIO_API Eio_File *
|
2011-09-16 07:18:08 -07:00
|
|
|
eio_file_xattr_string_get(const char *path,
|
|
|
|
const char *attribute,
|
|
|
|
Eio_Done_String_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async;
|
|
|
|
|
2012-12-24 01:44:21 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
|
2011-06-29 10:28:55 -07:00
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
async = malloc(sizeof (Eio_File_Xattr));
|
|
|
|
if (!async) return NULL;
|
|
|
|
|
|
|
|
async->op = EIO_XATTR_STRING;
|
|
|
|
async->todo.xstring.done_cb = done_cb;
|
|
|
|
|
|
|
|
return _eio_file_xattr_setup_get(async, path, attribute, error_cb, data);
|
2011-06-29 10:28:55 -07:00
|
|
|
}
|
|
|
|
|
eio: Rename EAPI macro to EIO_API in Eio library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: vtorri, woohyun, lucas, jptiz
Reviewed By: vtorri, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12210
2020-12-14 06:43:38 -08:00
|
|
|
EIO_API Eio_File *
|
2011-09-16 07:18:08 -07:00
|
|
|
eio_file_xattr_double_get(const char *path,
|
|
|
|
const char *attribute,
|
|
|
|
Eio_Done_Double_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async;
|
|
|
|
|
2012-12-24 01:44:21 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
|
2011-09-16 07:18:08 -07:00
|
|
|
|
|
|
|
async = malloc(sizeof (Eio_File_Xattr));
|
|
|
|
if (!async) return NULL;
|
|
|
|
|
|
|
|
async->op = EIO_XATTR_DOUBLE;
|
|
|
|
async->todo.xdouble.done_cb = done_cb;
|
|
|
|
|
|
|
|
return _eio_file_xattr_setup_get(async, path, attribute, error_cb, data);
|
|
|
|
}
|
|
|
|
|
eio: Rename EAPI macro to EIO_API in Eio library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: vtorri, woohyun, lucas, jptiz
Reviewed By: vtorri, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12210
2020-12-14 06:43:38 -08:00
|
|
|
EIO_API Eio_File *
|
2011-09-16 07:18:08 -07:00
|
|
|
eio_file_xattr_int_get(const char *path,
|
|
|
|
const char *attribute,
|
|
|
|
Eio_Done_Int_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async;
|
|
|
|
|
2012-12-24 01:44:21 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
|
2011-09-16 07:18:08 -07:00
|
|
|
|
|
|
|
async = malloc(sizeof (Eio_File_Xattr));
|
|
|
|
if (!async) return NULL;
|
|
|
|
|
|
|
|
async->op = EIO_XATTR_INT;
|
|
|
|
async->todo.xint.done_cb = done_cb;
|
|
|
|
|
|
|
|
return _eio_file_xattr_setup_get(async, path, attribute, error_cb, data);
|
|
|
|
}
|
|
|
|
|
eio: Rename EAPI macro to EIO_API in Eio library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: vtorri, woohyun, lucas, jptiz
Reviewed By: vtorri, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12210
2020-12-14 06:43:38 -08:00
|
|
|
EIO_API Eio_File *
|
2011-06-29 10:28:55 -07:00
|
|
|
eio_file_xattr_set(const char *path,
|
|
|
|
const char *attribute,
|
|
|
|
const char *xattr_data,
|
|
|
|
unsigned int xattr_size,
|
2011-09-16 04:14:57 -07:00
|
|
|
Eina_Xattr_Flags flags,
|
2011-06-29 10:28:55 -07:00
|
|
|
Eio_Done_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async;
|
|
|
|
|
2012-12-24 01:44:21 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(xattr_data, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(xattr_size, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
|
2011-06-29 10:28:55 -07:00
|
|
|
|
|
|
|
async = malloc(sizeof (Eio_File_Xattr) + xattr_size);
|
|
|
|
if (!async) return NULL;
|
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
async->op = EIO_XATTR_DATA;
|
|
|
|
async->todo.xdata.xattr_size = xattr_size;
|
|
|
|
async->todo.xdata.xattr_data = (char*) (async + 1);
|
|
|
|
memcpy(async->todo.xdata.xattr_data, xattr_data, xattr_size);
|
2011-06-29 10:28:55 -07:00
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
return _eio_file_xattr_setup_set(async, path, attribute, flags, done_cb, error_cb, data);
|
|
|
|
}
|
|
|
|
|
eio: Rename EAPI macro to EIO_API in Eio library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: vtorri, woohyun, lucas, jptiz
Reviewed By: vtorri, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12210
2020-12-14 06:43:38 -08:00
|
|
|
EIO_API Eio_File *
|
2011-09-16 07:18:08 -07:00
|
|
|
eio_file_xattr_string_set(const char *path,
|
|
|
|
const char *attribute,
|
|
|
|
const char *xattr_string,
|
|
|
|
Eina_Xattr_Flags flags,
|
|
|
|
Eio_Done_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async;
|
|
|
|
int length;
|
|
|
|
|
2012-12-24 01:44:21 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(xattr_string, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
|
2011-06-29 10:28:55 -07:00
|
|
|
|
2011-09-16 07:18:08 -07:00
|
|
|
async = malloc(sizeof (Eio_File_Xattr));
|
|
|
|
if (!async) return NULL;
|
|
|
|
|
|
|
|
length = strlen(xattr_string) + 1;
|
|
|
|
|
|
|
|
async->op = EIO_XATTR_STRING;
|
|
|
|
async->todo.xstring.xattr_string = malloc(length);
|
|
|
|
if (!async->todo.xstring.xattr_string)
|
|
|
|
{
|
|
|
|
free(async);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
memcpy(async->todo.xstring.xattr_string, xattr_string, length);
|
|
|
|
|
|
|
|
return _eio_file_xattr_setup_set(async, path, attribute, flags, done_cb, error_cb, data);
|
|
|
|
}
|
|
|
|
|
eio: Rename EAPI macro to EIO_API in Eio library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: vtorri, woohyun, lucas, jptiz
Reviewed By: vtorri, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12210
2020-12-14 06:43:38 -08:00
|
|
|
EIO_API Eio_File *
|
2011-09-16 07:18:08 -07:00
|
|
|
eio_file_xattr_double_set(const char *path,
|
|
|
|
const char *attribute,
|
|
|
|
double xattr_double,
|
|
|
|
Eina_Xattr_Flags flags,
|
|
|
|
Eio_Done_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async;
|
|
|
|
|
2012-12-24 01:44:21 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
|
2011-09-16 07:18:08 -07:00
|
|
|
|
|
|
|
async = malloc(sizeof (Eio_File_Xattr));
|
|
|
|
if (!async) return NULL;
|
|
|
|
|
|
|
|
async->op = EIO_XATTR_DOUBLE;
|
|
|
|
async->todo.xdouble.xattr_double = xattr_double;
|
|
|
|
|
|
|
|
return _eio_file_xattr_setup_set(async, path, attribute, flags, done_cb, error_cb, data);
|
|
|
|
}
|
|
|
|
|
eio: Rename EAPI macro to EIO_API in Eio library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= The Rationale =
This patch is from a series of patches to rename EAPI symbols to
specific library DSOs.
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
LIBAPI is the only solution that works for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Reviewers: vtorri, woohyun, lucas, jptiz
Reviewed By: vtorri, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12210
2020-12-14 06:43:38 -08:00
|
|
|
EIO_API Eio_File *
|
2011-09-16 07:18:08 -07:00
|
|
|
eio_file_xattr_int_set(const char *path,
|
|
|
|
const char *attribute,
|
|
|
|
int xattr_int,
|
|
|
|
Eina_Xattr_Flags flags,
|
|
|
|
Eio_Done_Cb done_cb,
|
|
|
|
Eio_Error_Cb error_cb,
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
Eio_File_Xattr *async;
|
|
|
|
|
2012-12-24 01:44:21 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
|
2011-09-16 07:18:08 -07:00
|
|
|
|
|
|
|
async = malloc(sizeof (Eio_File_Xattr));
|
|
|
|
if (!async) return NULL;
|
|
|
|
|
|
|
|
async->op = EIO_XATTR_INT;
|
|
|
|
async->todo.xint.xattr_int = xattr_int;
|
|
|
|
|
|
|
|
return _eio_file_xattr_setup_set(async, path, attribute, flags, done_cb, error_cb, data);
|
2011-06-29 10:28:55 -07:00
|
|
|
}
|