[Cbe-oss-dev] [PATCH 1/7] libspe2: Hide internal symbols: create
Kazunori Asayama
asayama at sm.sony.co.jp
Thu Jul 19 23:21:59 EST 2007
This patch hides internal symbols in the 'create' part of libspe2.
Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
---
libspe12/dma.c | 4 ++--
libspe12/spethreads.c | 4 ++--
spebase/accessors.c | 4 ++--
spebase/create.c | 8 ++++----
spebase/create.h | 6 ++----
spebase/dma.c | 12 ++++++------
spebase/mbox.c | 34 +++++++++++++++++-----------------
7 files changed, 35 insertions(+), 37 deletions(-)
Index: b/spebase/create.c
===================================================================
--- a/spebase/create.c 2007-07-19 20:40:25.000000000 +0900
+++ b/spebase/create.c 2007-07-19 20:41:05.000000000 +0900
@@ -54,7 +54,7 @@ static const struct fd_attr spe_fd_attr[
[FD_MSS] = { .name = "mss", .mode = O_RDWR },
};
-void *mapfileat(int dir, const char *filename, int size)
+static void *mapfileat(int dir, const char *filename, int size)
{
int fd_temp;
void *ret;
@@ -71,7 +71,7 @@ void *mapfileat(int dir, const char *fil
return ret;
}
-int setsignotify(int dir, const char *filename)
+static int setsignotify(int dir, const char *filename)
{
int fd_sig, rc = 0;
char one = '1';
@@ -98,7 +98,7 @@ void _base_spe_context_unlock(spe_contex
pthread_mutex_unlock(&spe->base_private->fd_lock[fdesc]);
}
-int open_if_closed(struct spe_context *spe, enum fd_name fdesc, int locked)
+int _base_spe_open_if_closed(struct spe_context *spe, enum fd_name fdesc, int locked)
{
if (!locked)
_base_spe_context_lock(spe, fdesc);
@@ -122,7 +122,7 @@ int open_if_closed(struct spe_context *s
return spe->base_private->spe_fds_array[(int)fdesc];
}
-void close_if_open(struct spe_context *spe, enum fd_name fdesc)
+void _base_spe_close_if_open(struct spe_context *spe, enum fd_name fdesc)
{
_base_spe_context_lock(spe, fdesc);
Index: b/spebase/create.h
===================================================================
--- a/spebase/create.h 2007-07-19 20:40:25.000000000 +0900
+++ b/spebase/create.h 2007-07-19 20:41:05.000000000 +0900
@@ -22,9 +22,7 @@
#include "spebase.h"
-extern void *mapfileat( int dir, const char* filename, int size);
-extern int setsignotify(int dir, const char* filename);
-extern int open_if_closed(struct spe_context *spe, enum fd_name fdesc, int locked);
-extern void close_if_open(struct spe_context *spe, enum fd_name fdesc);
+extern int _base_spe_open_if_closed(struct spe_context *spe, enum fd_name fdesc, int locked);
+extern void _base_spe_close_if_open(struct spe_context *spe, enum fd_name fdesc);
#endif
Index: b/spebase/accessors.c
===================================================================
--- a/spebase/accessors.c 2007-07-19 20:40:25.000000000 +0900
+++ b/spebase/accessors.c 2007-07-19 20:41:05.000000000 +0900
@@ -73,12 +73,12 @@ __attribute__ ((noinline)) void __spe_c
int __base_spe_event_source_acquire(spe_context_ptr_t spe, enum fd_name fdesc)
{
- return open_if_closed(spe, fdesc, 0);
+ return _base_spe_open_if_closed(spe, fdesc, 0);
}
void __base_spe_event_source_release(struct spe_context *spe, enum fd_name fdesc)
{
- close_if_open(spe, fdesc);
+ _base_spe_close_if_open(spe, fdesc);
}
int __base_spe_spe_dir_get(spe_context_ptr_t spe)
Index: b/spebase/dma.c
===================================================================
--- a/spebase/dma.c 2007-07-19 20:40:25.000000000 +0900
+++ b/spebase/dma.c 2007-07-19 20:41:05.000000000 +0900
@@ -68,7 +68,7 @@ static int issue_mfc_command(spe_context
}
else {
int fd;
- fd = open_if_closed(spectx, FD_MFC, 0);
+ fd = _base_spe_open_if_closed(spectx, FD_MFC, 0);
if (fd != -1) {
struct mfc_command_parameter_area parm = {
.lsa = lsa,
@@ -196,7 +196,7 @@ static int spe_mfcio_tag_status_read_all
if (spectx->base_private->flags & SPE_MAP_PS) {
return spe_read_tag_status_block(spectx, mask, tag_status);
} else {
- fd = open_if_closed(spectx, FD_MFC, 0);
+ fd = _base_spe_open_if_closed(spectx, FD_MFC, 0);
if (fd == -1) {
return -1;
}
@@ -242,7 +242,7 @@ static int spe_read_tag_status_block(spe
return 0;
} else {
int fd;
- fd = open_if_closed(spectx, FD_MFC, 0);
+ fd = _base_spe_open_if_closed(spectx, FD_MFC, 0);
if (fd == -1) {
return -1;
}
@@ -272,7 +272,7 @@ static int spe_read_tag_status_noblock(s
struct pollfd poll_fd;
int fd;
- fd = open_if_closed(spectx, FD_MFC, 0);
+ fd = _base_spe_open_if_closed(spectx, FD_MFC, 0);
if (fd == -1) {
return -1;
}
@@ -334,7 +334,7 @@ int _base_spe_mssync_start(spe_context_p
mss_area->MFC_MSSync = data;
return 0;
} else {
- fd = open_if_closed(spectx, FD_MSS, 0);
+ fd = _base_spe_open_if_closed(spectx, FD_MSS, 0);
if (fd != -1) {
ret = write(fd, &data, sizeof (data));
if ((ret < 0) && (errno != EIO)) {
@@ -357,7 +357,7 @@ int _base_spe_mssync_status(spe_context_
if (spectx->base_private->flags & SPE_MAP_PS) {
return mss_area->MFC_MSSync;
} else {
- fd = open_if_closed(spectx, FD_MSS, 0);
+ fd = _base_spe_open_if_closed(spectx, FD_MSS, 0);
if (fd != -1) {
ret = read(fd, &data, sizeof (data));
if ((ret < 0) && (errno != EIO)) {
Index: b/spebase/mbox.c
===================================================================
--- a/spebase/mbox.c 2007-07-19 20:40:25.000000000 +0900
+++ b/spebase/mbox.c 2007-07-19 20:43:18.000000000 +0900
@@ -69,7 +69,7 @@ int _base_spe_out_mbox_read(spe_context_
if (spectx->base_private->flags & SPE_MAP_PS) {
rc = _base_spe_out_mbox_read_ps(spectx, mbox_data, count);
} else {
- rc = read(open_if_closed(spectx,FD_MBOX, 0), mbox_data, count*4);
+ rc = read(_base_spe_open_if_closed(spectx,FD_MBOX, 0), mbox_data, count*4);
DEBUG_PRINTF("%s read rc: %d\n", __FUNCTION__, rc);
if (rc != -1) {
rc /= 4;
@@ -132,7 +132,7 @@ int _base_spe_in_mbox_write(spe_context_
aux = mbox_data + total;
total += _base_spe_in_mbox_write_ps(spectx, aux, count - total);
if (total < count) { // we could not write everything, wait for space
- fds.fd = open_if_closed(spectx, FD_WBOX, 0);
+ fds.fd = _base_spe_open_if_closed(spectx, FD_WBOX, 0);
fds.events = POLLOUT;
rc = poll(&fds, 1, -1);
if (rc == -1 )
@@ -141,7 +141,7 @@ int _base_spe_in_mbox_write(spe_context_
} while (total < count);
} else {
while (total < 4*count) {
- rc = write(open_if_closed(spectx,FD_WBOX, 0),
+ rc = write(_base_spe_open_if_closed(spectx,FD_WBOX, 0),
(const char *)mbox_data + total, 4*count - total);
if (rc == -1) {
break;
@@ -158,7 +158,7 @@ int _base_spe_in_mbox_write(spe_context_
do {
total = _base_spe_in_mbox_write_ps(spectx, mbox_data, count);
if (total == 0) { // we could not anything, wait for space
- fds.fd = open_if_closed(spectx, FD_WBOX, 0);
+ fds.fd = _base_spe_open_if_closed(spectx, FD_WBOX, 0);
fds.events = POLLOUT;
rc = poll(&fds, 1, -1);
if (rc == -1 )
@@ -166,7 +166,7 @@ int _base_spe_in_mbox_write(spe_context_
}
} while (total == 0);
} else {
- rc = write(open_if_closed(spectx,FD_WBOX, 0), mbox_data, 4*count);
+ rc = write(_base_spe_open_if_closed(spectx,FD_WBOX, 0), mbox_data, 4*count);
total = rc/4;
}
break;
@@ -177,7 +177,7 @@ int _base_spe_in_mbox_write(spe_context_
if (spectx->base_private->flags & SPE_MAP_PS) {
total = _base_spe_in_mbox_write_ps(spectx, mbox_data, count);
} else {
- rc = write(open_if_closed(spectx,FD_WBOX_NB, 0), mbox_data, 4*count);
+ rc = write(_base_spe_open_if_closed(spectx,FD_WBOX_NB, 0), mbox_data, 4*count);
if (rc == -1 && errno == EAGAIN) {
rc = 0;
errno = 0;
@@ -208,7 +208,7 @@ int _base_spe_in_mbox_status(spe_context
if (spectx->base_private->flags & SPE_MAP_PS) {
ret = (cntl_area->SPU_Mbox_Stat >> 8) & 0xFF;
} else {
- rc = read(open_if_closed(spectx,FD_WBOX_STAT, 0), &ret, 4);
+ rc = read(_base_spe_open_if_closed(spectx,FD_WBOX_STAT, 0), &ret, 4);
if (rc != 4)
ret = -1;
}
@@ -226,7 +226,7 @@ int _base_spe_out_mbox_status(spe_contex
if (spectx->base_private->flags & SPE_MAP_PS) {
ret = cntl_area->SPU_Mbox_Stat & 0xFF;
} else {
- rc = read(open_if_closed(spectx,FD_MBOX_STAT, 0), &ret, 4);
+ rc = read(_base_spe_open_if_closed(spectx,FD_MBOX_STAT, 0), &ret, 4);
if (rc != 4)
ret = -1;
}
@@ -244,7 +244,7 @@ int _base_spe_out_intr_mbox_status(spe_c
if (spectx->base_private->flags & SPE_MAP_PS) {
ret = (cntl_area->SPU_Mbox_Stat >> 16) & 0xFF;
} else {
- rc = read(open_if_closed(spectx,FD_IBOX_STAT, 0), &ret, 4);
+ rc = read(_base_spe_open_if_closed(spectx,FD_IBOX_STAT, 0), &ret, 4);
if (rc != 4)
ret = -1;
@@ -269,8 +269,8 @@ int _base_spe_out_intr_mbox_read(spe_con
case SPE_MBOX_ALL_BLOCKING: // read all, even if blocking
total = rc = 0;
while (total < 4*count) {
- rc = read(open_if_closed(spectx,FD_IBOX, 0),
- (char *)mbox_data + total, 4*count - total);
+ rc = read(_base_spe_open_if_closed(spectx,FD_IBOX, 0),
+ (char *)mbox_data + total, 4*count - total);
if (rc == -1) {
break;
}
@@ -279,11 +279,11 @@ int _base_spe_out_intr_mbox_read(spe_con
break;
case SPE_MBOX_ANY_BLOCKING: // read at least one, even if blocking
- total = rc = read(open_if_closed(spectx,FD_IBOX, 0), mbox_data, 4*count);
+ total = rc = read(_base_spe_open_if_closed(spectx,FD_IBOX, 0), mbox_data, 4*count);
break;
case SPE_MBOX_ANY_NONBLOCKING: // only reaad, if non blocking
- rc = read(open_if_closed(spectx,FD_IBOX_NB, 0), mbox_data, 4*count);
+ rc = read(_base_spe_open_if_closed(spectx,FD_IBOX_NB, 0), mbox_data, 4*count);
if (rc == -1 && errno == EAGAIN) {
rc = 0;
errno = 0;
@@ -326,9 +326,9 @@ int _base_spe_signal_write(spe_context_p
rc = 0;
} else {
if (signal_reg == SPE_SIG_NOTIFY_REG_1)
- rc = write(open_if_closed(spectx,FD_SIG1, 0), &data, 4);
+ rc = write(_base_spe_open_if_closed(spectx,FD_SIG1, 0), &data, 4);
else if (signal_reg == SPE_SIG_NOTIFY_REG_2)
- rc = write(open_if_closed(spectx,FD_SIG2, 0), &data, 4);
+ rc = write(_base_spe_open_if_closed(spectx,FD_SIG2, 0), &data, 4);
else {
errno = EINVAL;
return -1;
@@ -338,9 +338,9 @@ int _base_spe_signal_write(spe_context_p
rc = 0;
if (signal_reg == SPE_SIG_NOTIFY_REG_1)
- close_if_open(spectx,FD_SIG1);
+ _base_spe_close_if_open(spectx,FD_SIG1);
else if (signal_reg == SPE_SIG_NOTIFY_REG_2)
- close_if_open(spectx,FD_SIG2);
+ _base_spe_close_if_open(spectx,FD_SIG2);
}
return rc;
Index: b/libspe12/dma.c
===================================================================
--- a/libspe12/dma.c 2007-07-19 20:40:25.000000000 +0900
+++ b/libspe12/dma.c 2007-07-19 20:41:05.000000000 +0900
@@ -136,7 +136,7 @@ static int read_tag_status_noblock(speid
unsigned int ret;
int mfcfd;
- mfcfd = open_if_closed(spe->spectx, FD_MFC, 0);
+ mfcfd = _base_spe_open_if_closed(spe->spectx, FD_MFC, 0);
r_read = read(mfcfd,&ret,4);
@@ -157,7 +157,7 @@ static int read_tag_status_async(speid_t
unsigned int ret;
int mfcfd;
- mfcfd = open_if_closed(spe->spectx, FD_MFC, 0);
+ mfcfd = _base_spe_open_if_closed(spe->spectx, FD_MFC, 0);
poll_fd.fd = mfcfd;
poll_fd.events = POLLIN;
Index: b/libspe12/spethreads.c
===================================================================
--- a/libspe12/spethreads.c 2007-07-19 20:40:25.000000000 +0900
+++ b/libspe12/spethreads.c 2007-07-19 20:41:05.000000000 +0900
@@ -881,7 +881,7 @@ spe_get_event(struct spe_event *pevents,
if (pevents[i].events & (SPE_EVENT_MAILBOX))
{
- SPEfds[setupSPEs].fd=open_if_closed(thread->spectx,FD_IBOX, 0);
+ SPEfds[setupSPEs].fd=_base_spe_open_if_closed(thread->spectx,FD_IBOX, 0);
SPEfds[setupSPEs].events=POLLIN;
phelper[setupSPEs].event=i;
@@ -907,7 +907,7 @@ spe_get_event(struct spe_event *pevents,
}
if (pevents[i].events & (SPE_EVENT_TAG_GROUP))
{
- SPEfds[setupSPEs].fd=open_if_closed(thread->spectx,FD_MFC, 0);
+ SPEfds[setupSPEs].fd=_base_spe_open_if_closed(thread->spectx,FD_MFC, 0);
SPEfds[setupSPEs].events=POLLIN;
phelper[setupSPEs].event=i;
More information about the cbe-oss-dev
mailing list