projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Port: handle 'size_t' / 'off_t' on Solaris
[babeltrace.git]
/
plugins
/
ctf
/
fs-src
/
file.c
diff --git
a/plugins/ctf/fs-src/file.c
b/plugins/ctf/fs-src/file.c
index 0d0ed7e0a21ddb66143260b05920c815028def25..aa5b8ff68871f58252d2c07f56239cce1ea9ad5b 100644
(file)
--- a/
plugins/ctf/fs-src/file.c
+++ b/
plugins/ctf/fs-src/file.c
@@
-25,31
+25,26
@@
#include <sys/stat.h>
#include <unistd.h>
#include <glib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <glib.h>
-
-#define PRINT_ERR_STREAM ctf_fs->error_fp
-#define PRINT_PREFIX "ctf-fs-file"
-#define PRINT_DBG_CHECK ctf_fs_debug
-#include "../print.h"
-
#include "file.h"
#include "file.h"
+#define BT_LOG_TAG "PLUGIN-CTF-FS-FILE-SRC"
+#include "logging.h"
+
BT_HIDDEN
void ctf_fs_file_destroy(struct ctf_fs_file *file)
{
BT_HIDDEN
void ctf_fs_file_destroy(struct ctf_fs_file *file)
{
- struct ctf_fs_component *ctf_fs;;
-
if (!file) {
return;
}
if (!file) {
return;
}
- ctf_fs = file->ctf_fs;
-
if (file->fp) {
if (file->fp) {
- PDBG("Closing file \"%s\" (%p)\n", file->path->str, file->fp);
+ BT_LOGD("Closing file \"%s\" (%p)",
+ file->path ? file->path->str : NULL, file->fp);
if (fclose(file->fp)) {
if (fclose(file->fp)) {
- PERR("Cannot close file \"%s\": %s\n", file->path->str,
- strerror(errno));
+ BT_LOGE("Cannot close file \"%s\": %s",
+ file->path ? file->path->str : "NULL",
+ strerror(errno));
}
}
}
}
@@
-61,7
+56,7
@@
void ctf_fs_file_destroy(struct ctf_fs_file *file)
}
BT_HIDDEN
}
BT_HIDDEN
-struct ctf_fs_file *ctf_fs_file_create(
struct ctf_fs_component *ctf_fs
)
+struct ctf_fs_file *ctf_fs_file_create(
void
)
{
struct ctf_fs_file *file = g_new0(struct ctf_fs_file, 1);
{
struct ctf_fs_file *file = g_new0(struct ctf_fs_file, 1);
@@
-69,7
+64,6
@@
struct ctf_fs_file *ctf_fs_file_create(struct ctf_fs_component *ctf_fs)
goto error;
}
goto error;
}
- file->ctf_fs = ctf_fs;
file->path = g_string_new(NULL);
if (!file->path) {
goto error;
file->path = g_string_new(NULL);
if (!file->path) {
goto error;
@@
-86,29
+80,28
@@
end:
}
BT_HIDDEN
}
BT_HIDDEN
-int ctf_fs_file_open(struct ctf_fs_component *ctf_fs, struct ctf_fs_file *file,
- const char *mode)
+int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode)
{
int ret = 0;
struct stat stat;
{
int ret = 0;
struct stat stat;
-
PDBG("Opening file \"%s\" with mode \"%s\"\n
", file->path->str, mode);
+
BT_LOGD("Opening file \"%s\" with mode \"%s\"
", file->path->str, mode);
file->fp = fopen(file->path->str, mode);
if (!file->fp) {
file->fp = fopen(file->path->str, mode);
if (!file->fp) {
-
PERR("Cannot open file \"%s\" with mode \"%s\": %s\n
",
+
BT_LOGE("Cannot open file \"%s\" with mode \"%s\": %s
",
file->path->str, mode, strerror(errno));
goto error;
}
file->path->str, mode, strerror(errno));
goto error;
}
-
PDBG("Opened file: %p\n
", file->fp);
+
BT_LOGD("Opened file: %p
", file->fp);
if (fstat(fileno(file->fp), &stat)) {
if (fstat(fileno(file->fp), &stat)) {
-
PERR("Cannot get file informations: %s\n
", strerror(errno));
+
BT_LOGE("Cannot get file informations: %s
", strerror(errno));
goto error;
}
file->size = stat.st_size;
goto error;
}
file->size = stat.st_size;
-
PDBG(" File is %zu bytes\n",
file->size);
+
BT_LOGD("File is %jd bytes", (intmax_t)
file->size);
goto end;
error:
goto end;
error:
@@
-116,7
+109,7
@@
error:
if (file->fp) {
if (fclose(file->fp)) {
if (file->fp) {
if (fclose(file->fp)) {
-
PERR("Cannot close file \"%s\": %s\n
", file->path->str,
+
BT_LOGE("Cannot close file \"%s\": %s
", file->path->str,
strerror(errno));
}
}
strerror(errno));
}
}
This page took
0.039349 seconds
and
4
git commands to generate.