4 * Copyright (File::*c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
11 * Anastasia Lyupa <a.lyupa@samsung.com>
13 * This library is free software; you can redistribute it and/or modify it under
14 * the terms of the GNU Lesser General Public License as published by the
15 * Free Software Foundation; either version 2.1 of the License, or (at your option)
18 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
19 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
21 * License for more details.
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this library; if not, write to the Free Software Foundation, Inc., 51
25 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 * - Samsung RnD Institute Russia
34 #include <linux/limits.h>
36 #include "probeinfo.h"
38 #include "dacollection.h"
42 static enum DaOptions _sopt = OPT_FILE;
47 result File::Construct(const Tizen::Base::String& filePath,
48 const Tizen::Base::String& openMode, bool createParentDirectories) {
49 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
50 const Tizen::Base::String& openMode, bool createParentDirectories);
51 static methodType Constructp = 0;
53 probeInfo_t probeInfo;
55 bool bfiltering = true;
56 char temp_path[PATH_MAX];
57 char temp_mode[PATH_MAX];
63 void *tmpPtr = dlsym(RTLD_NEXT,
64 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_b");
66 if (tmpPtr == NULL || dlerror() != NULL) {
67 perror("dlsym failed : Tizen::Io::File::Construct");
71 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
75 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
76 setProbePoint(&probeInfo);
80 ret = (this->*Constructp)(filePath, openMode, createParentDirectories);
82 if (gProbeBlockCount == 0 && blockresult)
84 add_object_hash((void*)this, OBJECT_EXTERNAL);
87 if (postBlockBegin(blockresult)) {
88 char buffer[PATH_MAX];
90 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
91 size = attr.GetFileSize();
92 WcharToChar(temp_path,filePath.GetPointer());
93 WcharToChar(temp_mode,openMode.GetPointer());
96 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID_result_File__Construct_const_Tizen__Base__String__filePath__const_Tizen__Base__String__openMode__bool_createParentDirectories_,
97 "s4sd", absolutize_filepath(buffer,temp_path),
98 temp_mode, createParentDirectories);
99 PACK_COMMON_END('x', ret, ret, blockresult);
100 PACK_RESOURCE(0, (unsigned long)this, FD_API_OPEN, size, temp_path);
109 result File::Construct(const Tizen::Base::String& filePath,
110 const Tizen::Base::String& openMode) {
111 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
112 const Tizen::Base::String& openMode);
113 static methodType Constructp = 0;
115 probeInfo_t probeInfo;
117 bool bfiltering = true;
118 char temp_path[PATH_MAX];
119 char temp_mode[PATH_MAX];
125 void *tmpPtr = dlsym(RTLD_NEXT,
126 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_");
128 if (tmpPtr == NULL || dlerror() != NULL) {
129 perror("dlsym failed : Tizen::Io::File::Construct");
133 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
137 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
138 setProbePoint(&probeInfo);
142 ret = (this->*Constructp)(filePath, openMode);
144 if (gProbeBlockCount == 0 && blockresult)
146 add_object_hash((void*)this, OBJECT_EXTERNAL);
149 if (postBlockBegin(blockresult)) {
150 char buffer[PATH_MAX];
152 WcharToChar(temp_path,filePath.GetPointer());
153 WcharToChar(temp_mode,openMode.GetPointer());
154 // Comment this because of fault during Internet application profiling
155 // (it closes unexpectedly) but for DATizenTestApp it is ok
156 // There is the same problem at File::~File(void)
157 //if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
158 // size = attr.GetFileSize();
161 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
162 API_ID_result_File__Construct_const_Tizen__Base__String__filePath__const_Tizen__Base__String__openMode_,
163 "s4s", absolutize_filepath(buffer, temp_path),
165 PACK_COMMON_END('x', ret, ret, blockresult);
166 PACK_RESOURCE(0, (unsigned long)this, FD_API_OPEN, size, temp_path);
175 result File::Construct(const Tizen::Base::String& filePath,
176 const char *pOpenMode) {
177 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
178 const char *pOpenMode);
179 static methodType Constructp = 0;
181 probeInfo_t probeInfo;
183 bool bfiltering = true;
190 void *tmpPtr = dlsym(RTLD_NEXT,
191 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringEPKc");
193 if (tmpPtr == NULL || dlerror() != NULL) {
194 perror("dlsym failed : Tizen::Io::File::Construct");
198 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
202 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
203 setProbePoint(&probeInfo);
207 ret = (this->*Constructp)(filePath, pOpenMode);
209 if (gProbeBlockCount == 0 && blockresult)
211 add_object_hash((void*)this, OBJECT_EXTERNAL);
214 if (postBlockBegin(blockresult)) {
215 char buffer[PATH_MAX];
217 WcharToChar(temp,filePath.GetPointer());
218 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
219 size = attr.GetFileSize();
222 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
223 API_ID_result_File__Construct_const_Tizen__Base__String__filePath__const_char__pOpenMode_,
224 "s4p", absolutize_filepath(buffer, temp),
225 voidp_to_uint64(pOpenMode));
226 PACK_COMMON_END('x', ret, ret, blockresult);
227 PACK_RESOURCE(0, (unsigned long)this, FD_API_OPEN, size, temp);
236 result File::Construct(const Tizen::Base::String& filePath,
237 const char *pOpenMode,
238 const Tizen::Base::ByteBuffer& secretKey) {
239 typedef result (File::*methodType)(const Tizen::Base::String& filePath,
240 const char *pOpenMode,
241 const Tizen::Base::ByteBuffer& secretKey);
242 static methodType Constructp = 0;
244 probeInfo_t probeInfo;
246 bool bfiltering = true;
254 void *tmpPtr = dlsym(RTLD_NEXT,
255 "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringEPKcRKNS2_10ByteBufferE");
257 if (tmpPtr == NULL || dlerror() != NULL) {
258 perror("dlsym failed : Tizen::Io::File::Construct");
262 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
266 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
267 setProbePoint(&probeInfo);
271 ret = (this->*Constructp)(filePath, pOpenMode, secretKey);
273 if (gProbeBlockCount == 0 && blockresult)
275 add_object_hash((void*)this, OBJECT_EXTERNAL);
278 if (postBlockBegin(blockresult)) {
279 WcharToChar(temp,filePath.GetPointer());
280 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
281 size = attr.GetFileSize();
284 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
285 API_ID_result_File__Construct_const_Tizen__Base__String__filePath__const_char__pOpenMode__const_Tizen__Base__ByteBuffer__secretKey_,
287 voidp_to_uint64(pOpenMode));
288 PACK_COMMON_END('x', ret, ret, blockresult);
289 PACK_RESOURCE(0, (unsigned long)this, FD_API_OPEN, size, temp);
298 result File::Flush(void) {
299 typedef result (File::*methodType)(void);
300 static methodType Flushp = 0;
302 probeInfo_t probeInfo;
304 bool bfiltering = true;
312 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5FlushEv");
314 if (tmpPtr == NULL || dlerror() != NULL) {
315 perror("dlsym failed : Tizen::Io::File::Flush");
319 memcpy(&Flushp, &tmpPtr, sizeof(tmpPtr));
323 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
324 setProbePoint(&probeInfo);
328 ret = (this->*Flushp)();
330 if (postBlockBegin(blockresult)) {
331 WcharToChar(temp,this->GetName().GetPointer());
332 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
333 size = attr.GetFileSize();
336 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
337 API_ID_result_File__Flush_void_,
339 PACK_COMMON_END('x', ret, ret, blockresult);
340 PACK_RESOURCE(0, (unsigned long)this, FD_API_OTHER, size, temp);
349 Tizen::Base::String File::GetName(void) const{
350 typedef Tizen::Base::String (File::*methodType)(void) const;
351 static methodType GetNamep = 0;
352 Tizen::Base::String ret;
353 probeInfo_t probeInfo;
355 bool bfiltering = true;
363 void *tmpPtr = dlsym(RTLD_NEXT, "_ZNK5Tizen2Io4File7GetNameEv");
365 if (tmpPtr == NULL || dlerror() != NULL) {
366 perror("dlsym failed : Tizen::Io::File::GetName");
370 memcpy(&GetNamep, &tmpPtr, sizeof(tmpPtr));
374 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
375 setProbePoint(&probeInfo);
379 ret = (this->*GetNamep)();
380 result res = GetLastResult();
382 if (postBlockBegin(blockresult)) {
383 WcharToChar(temp,ret.GetPointer());
384 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
385 size = attr.GetFileSize();
388 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
389 API_ID_Tizen__Base__String_File__GetName_void__const,
391 PACK_COMMON_END('p', ret.GetPointer(), res, blockresult);
392 PACK_RESOURCE(0, (unsigned long)this, FD_API_OTHER, size, temp);
401 result File::Read(Tizen::Base::String& buffer) {
402 typedef result (File::*methodType)(Tizen::Base::String & buffer);
403 static methodType Readp = 0;
405 probeInfo_t probeInfo;
407 bool bfiltering = true;
416 void *tmpPtr = dlsym(RTLD_NEXT,
417 "_ZN5Tizen2Io4File4ReadERNS_4Base6StringE");
419 if (tmpPtr == NULL || dlerror() != NULL) {
420 perror("dlsym failed : Tizen::Io::File::Read");
424 memcpy(&Readp, &tmpPtr, sizeof(tmpPtr));
428 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
429 setProbePoint(&probeInfo);
430 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
431 size = attr.GetFileSize();
432 WcharToChar(temp, this->GetName().GetPointer());
435 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
436 API_ID_result_File__Read_Tizen__Base__String__buffer_,
437 "x", (uint64_t)(&buffer));
438 PACK_COMMON_END('x', 0, 0, blockresult);
439 PACK_RESOURCE(0, (unsigned long)this, FD_API_READ_START, size, temp);
445 ret = (this->*Readp)(buffer);
447 if (postBlockBegin(blockresult)) {
448 setProbePoint(&probeInfo);
449 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
450 size = attr.GetFileSize();
451 WcharToChar(temp, this->GetName().GetPointer());
452 nRead = buffer.GetLength();
455 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
456 API_ID_result_File__Read_Tizen__Base__String__buffer_,
457 "x", (uint64_t)(&buffer));
458 PACK_COMMON_END('x', ret, ret, blockresult);
459 PACK_RESOURCE(nRead, (unsigned long)this, FD_API_READ_END, size, temp);
468 result File::Read(Tizen::Base::ByteBuffer& buffer) {
469 typedef result (File::*methodType)(Tizen::Base::ByteBuffer & buffer);
470 static methodType Readp = 0;
472 probeInfo_t probeInfo;
474 bool bfiltering = true;
483 void *tmpPtr = dlsym(RTLD_NEXT,
484 "_ZN5Tizen2Io4File4ReadERNS_4Base10ByteBufferE");
486 if (tmpPtr == NULL || dlerror() != NULL) {
487 perror("dlsym failed : Tizen::Io::File::Read");
491 memcpy(&Readp, &tmpPtr, sizeof(tmpPtr));
495 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
496 setProbePoint(&probeInfo);
497 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
498 size = attr.GetFileSize();
499 WcharToChar(temp, this->GetName().GetPointer());
502 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
503 API_ID_result_File__Read_Tizen__Base__ByteBuffer__buffer_,
504 "x", (uint64_t)(&buffer));
505 PACK_COMMON_END('x', 0, 0, blockresult);
506 PACK_RESOURCE(0, (unsigned long)this, FD_API_READ_START, size, temp);
512 ret = (this->*Readp)(buffer);
514 if (postBlockBegin(blockresult)) {
515 setProbePoint(&probeInfo);
516 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
517 size = attr.GetFileSize();
518 WcharToChar(temp, this->GetName().GetPointer());
519 buffer.GetInt(nRead);
522 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
523 API_ID_result_File__Read_Tizen__Base__ByteBuffer__buffer_,
524 "x", (uint64_t)(&buffer));
525 PACK_COMMON_END('x', ret, ret, blockresult);
526 PACK_RESOURCE(nRead, (unsigned long)this, FD_API_READ_END, size, temp);
535 int File::Read(void *buffer, int length) {
536 typedef int (File::*methodType)(void *buffer, int length);
537 static methodType Readp = 0;
539 probeInfo_t probeInfo;
541 bool bfiltering = true;
550 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File4ReadEPvi");
552 if (tmpPtr == NULL || dlerror() != NULL) {
553 perror("dlsym failed : Tizen::Io::File::Read");
557 memcpy(&Readp, &tmpPtr, sizeof(tmpPtr));
561 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
562 setProbePoint(&probeInfo);
564 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
565 size = attr.GetFileSize();
566 WcharToChar(temp, this->GetName().GetPointer());
569 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
570 API_ID_int_File__Read_void__buffer__int_length_,
571 "xd", (uint64_t)(buffer), length);
572 PACK_COMMON_END('d', 0, 0, blockresult);
573 PACK_RESOURCE(0, (unsigned long)this, FD_API_READ_START, size, temp);
579 ret = (this->*Readp)(buffer, length);
580 result res = GetLastResult();
582 if (postBlockBegin(blockresult)) {
583 setProbePoint(&probeInfo);
584 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
585 size = attr.GetFileSize();
586 WcharToChar(temp, this->GetName().GetPointer());
587 nRead = Tell() - nRead;
590 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
591 API_ID_int_File__Read_void__buffer__int_length_,
592 "xd", (uint64_t)(buffer), length);
593 PACK_COMMON_END('d', ret, res, blockresult);
594 PACK_RESOURCE(nRead, (unsigned long)this, FD_API_READ_END, size, temp);
603 result File::Seek(FileSeekPosition position, long offset) {
604 typedef result (File::*methodType)(FileSeekPosition position, long offset);
605 static methodType Seekp = 0;
607 probeInfo_t probeInfo;
609 bool bfiltering = true;
611 char temp_pos[PATH_MAX];
618 void *tmpPtr = dlsym(RTLD_NEXT,
619 "_ZN5Tizen2Io4File4SeekENS0_16FileSeekPositionEl");
621 if (tmpPtr == NULL || dlerror() != NULL) {
622 perror("dlsym failed : Tizen::Io::File::Seek");
626 memcpy(&Seekp, &tmpPtr, sizeof(tmpPtr));
631 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
632 setProbePoint(&probeInfo);
636 ret = (this->*Seekp)(position, offset);
638 if (postBlockBegin(blockresult)) {
640 if (FILESEEKPOSITION_BEGIN == position)
641 strcpy(temp_pos, "FILESEEKPOSITION_BEGIN");
642 else if (FILESEEKPOSITION_CURRENT == position)
643 strcpy(temp_pos, "FILESEEKPOSITION_CURRENT");
644 else if (FILESEEKPOSITION_END == position)
645 strcpy(temp_pos, "FILESEEKPOSITION_END");
648 sprintf(temp_pos, "%d", position);
650 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
651 size = attr.GetFileSize();
652 WcharToChar(temp, this->GetName().GetPointer());
655 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
656 API_ID_result_File__Seek_FileSeekPosition_position__long_offset_,
657 "sx", temp_pos, (uint64_t)(offset));
658 PACK_COMMON_END('x', ret, ret, blockresult);
659 PACK_RESOURCE(0, (unsigned long)this, FD_API_OTHER, size, temp);
668 int File::Tell(void) const {
669 typedef int (File::*methodType)(void) const;
670 static methodType Tellp = 0;
672 probeInfo_t probeInfo;
674 bool bfiltering = true;
682 void *tmpPtr = dlsym(RTLD_NEXT, "_ZNK5Tizen2Io4File4TellEv");
684 if (tmpPtr == NULL || dlerror() != NULL) {
685 perror("dlsym failed : Tizen::Io::File::Tell");
689 memcpy(&Tellp, &tmpPtr, sizeof(tmpPtr));
694 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
695 setProbePoint(&probeInfo);
699 ret = (this->*Tellp)();
700 result res = GetLastResult();
702 if (postBlockBegin(blockresult)) {
703 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
704 size = attr.GetFileSize();
705 WcharToChar(temp,this->GetName().GetPointer());
708 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
709 API_ID_int_File__Tell_void__const,
711 PACK_COMMON_END('d', ret, res, blockresult);
712 PACK_RESOURCE(0, (unsigned long)this, FD_API_OTHER, size, temp);
721 result File::Truncate(int length) {
722 typedef result (File::*methodType)(int length);
723 static methodType Truncatep = 0;
725 probeInfo_t probeInfo;
727 bool bfiltering = true;
735 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File8TruncateEi");
737 if (tmpPtr == NULL || dlerror() != NULL) {
738 perror("dlsym failed : Tizen::Io::File::Truncate");
742 memcpy(&Truncatep, &tmpPtr, sizeof(tmpPtr));
746 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
747 setProbePoint(&probeInfo);
751 ret = (this->*Truncatep)(length);
753 if (postBlockBegin(blockresult)) {
754 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
755 size = attr.GetFileSize();
756 WcharToChar(temp,this->GetName().GetPointer());
759 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
760 API_ID_result_File__Truncate_int_length_,
762 PACK_COMMON_END('x', ret, ret, blockresult);
763 PACK_RESOURCE(0, (unsigned long)this, FD_API_OTHER, size, temp);
772 result File::Write(const void *buffer, int length) {
773 typedef result (File::*methodType)(const void *buffer, int length);
774 static methodType Writep = 0;
776 probeInfo_t probeInfo;
778 bool bfiltering = true;
787 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5WriteEPKvi");
789 if (tmpPtr == NULL || dlerror() != NULL) {
790 perror("dlsym failed : Tizen::Io::File::Write");
794 memcpy(&Writep, &tmpPtr, sizeof(tmpPtr));
798 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
799 setProbePoint(&probeInfo);
801 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
802 size = attr.GetFileSize();
803 WcharToChar(temp, this->GetName().GetPointer());
806 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
807 API_ID_result_File__Write_const_void__buffer__int_length_,
808 "xd", (uint64_t)(buffer), length);
809 PACK_COMMON_END('x', 0, 0, blockresult);
810 PACK_RESOURCE(0, (unsigned long)this, FD_API_WRITE_START, size, temp);
816 ret = (this->*Writep)(buffer, length);
818 if (postBlockBegin(blockresult)) {
819 setProbePoint(&probeInfo);
820 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
821 size = attr.GetFileSize();
822 WcharToChar(temp, this->GetName().GetPointer());
823 nWritten = Tell() - nWritten;
826 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
827 API_ID_result_File__Write_const_void__buffer__int_length_,
828 "xd", (uint64_t)(buffer), length);
829 PACK_COMMON_END('x', ret, ret, blockresult);
830 PACK_RESOURCE(nWritten, (unsigned long)this, FD_API_WRITE_END, size, temp);
839 result File::Write(const Tizen::Base::ByteBuffer& buffer) {
840 typedef result (File::*methodType)(const Tizen::Base::ByteBuffer& buffer);
841 static methodType Writep = 0;
843 probeInfo_t probeInfo;
845 bool bfiltering = true;
854 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5WriteERKNS_4Base10ByteBufferE");
856 if (tmpPtr == NULL || dlerror() != NULL) {
857 perror("dlsym failed : Tizen::Io::File::Write");
861 memcpy(&Writep, &tmpPtr, sizeof(tmpPtr));
865 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
866 setProbePoint(&probeInfo);
868 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
869 size = attr.GetFileSize();
870 WcharToChar(temp,this->GetName().GetPointer());
873 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
874 API_ID_result_File__Write_const_Tizen__Base__ByteBuffer__buffer_,
875 "x", (uint64_t)(&buffer));
876 PACK_COMMON_END('x', 0, 0, blockresult);
877 PACK_RESOURCE(0, (unsigned long)this, FD_API_WRITE_START, size, temp);
883 ret = (this->*Writep)(buffer);
885 if (postBlockBegin(blockresult)) {
886 setProbePoint(&probeInfo);
887 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
888 size = attr.GetFileSize();
889 WcharToChar(temp,this->GetName().GetPointer());
890 nWritten = Tell() - nWritten;
893 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
894 API_ID_result_File__Write_const_Tizen__Base__ByteBuffer__buffer_,
895 "x", (uint64_t)(&buffer));
896 PACK_COMMON_END('x', ret, ret, blockresult);
897 PACK_RESOURCE(nWritten, (unsigned long)this, FD_API_WRITE_END, size, temp);
906 result File::Write(const Tizen::Base::String& buffer) {
907 typedef result (File::*methodType)(const Tizen::Base::String& buffer);
908 static methodType Writep = 0;
910 probeInfo_t probeInfo;
912 bool bfiltering = true;
913 char temp_buf[PATH_MAX];
914 char temp_path[PATH_MAX];
922 void *tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4File5WriteERKNS_4Base6StringE");
924 if (tmpPtr == NULL || dlerror() != NULL) {
925 perror("dlsym failed : Tizen::Io::File::Write");
929 memcpy(&Writep, &tmpPtr, sizeof(tmpPtr));
933 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
934 setProbePoint(&probeInfo);
936 WcharToChar(temp_buf, buffer.GetPointer());
937 if (E_SUCCESS == File::GetAttributes(this->GetName(), attr))
938 size = attr.GetFileSize();
939 WcharToChar(temp_path, this->GetName().GetPointer());
942 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
943 API_ID_result_File__Write_const_Tizen__Base__String__buffer_,
945 PACK_COMMON_END('x', 0, 0, blockresult);
946 PACK_RESOURCE(0, (unsigned long)this, FD_API_WRITE_START, size, temp_path);
952 ret = (this->*Writep)(buffer);
954 if (postBlockBegin(blockresult)) {
955 setProbePoint(&probeInfo);
956 WcharToChar(temp_buf,buffer.GetPointer());
957 WcharToChar(temp_path,this->GetName().GetPointer());
958 nWritten = Tell() - nWritten;
959 if (E_SUCCESS == File::GetAttributes(this->GetName(),attr))
960 size = attr.GetFileSize();
961 nWritten = Tell() - nWritten;
964 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
965 API_ID_result_File__Write_const_Tizen__Base__String__buffer_,
967 PACK_COMMON_END('x', ret, ret, blockresult);
968 PACK_RESOURCE(nWritten, (unsigned long)this, FD_API_WRITE_END, size, temp_path);
977 typedef void (File::*methodType)();
978 static methodType FileDp = 0;
979 probeInfo_t probeInfo;
981 bool bfiltering = true;
983 // FileAttributes attr;
985 unsigned short caller;
991 tmpPtr = dlsym(RTLD_NEXT, "_ZN5Tizen2Io4FileD1Ev");
993 if (tmpPtr == NULL || dlerror() != NULL) {
994 perror("dlsym failed : Tizen::Io::File::~File");
998 memcpy(&FileDp, &tmpPtr, sizeof(tmpPtr));
1002 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1003 setProbePoint(&probeInfo);
1004 // error occur if File class was failed to contruct
1005 // if (ret == E_SUCCESS &&
1006 // E_SUCCESS == File::GetAttributes(this->GetName(), attr))
1007 // size = attr.GetFileSize();
1011 if (gProbeBlockCount == 0)
1014 ret = del_object_hash((void*)this, &caller);
1015 if (blockresult == 0 && ret == 0 && caller == OBJECT_EXTERNAL)
1017 setProbePoint(&probeInfo);
1026 if (postBlockBegin(blockresult)) {
1028 PREPARE_LOCAL_BUF();
1029 PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE,
1030 API_ID_File___File_void_,
1032 PACK_COMMON_END('n', 0, 0, blockresult);
1033 PACK_RESOURCE(0, (unsigned long)this, FD_API_CLOSE, size, "");
1042 //static result File::ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
1043 // const Tizen::Base::String &secureFilePath) {
1044 // typedef result (File::*methodType)(
1045 // const Tizen::Base::String &plainFilePath,
1046 // const Tizen::Base::String &secureFilePath);
1047 // static methodType ConvertToSecureFilep = 0;
1050 //static result File::ConvertToSecureFile(const Tizen::Base::String &plainFilePath,
1051 // const Tizen::Base::String &secureFilePath,
1052 // const Tizen::Base::ByteBuffer& key) {
1053 // typedef result (File::*methodType)(
1054 // const Tizen::Base::String &plainFilePath,
1055 // const Tizen::Base::String &secureFilePath,
1056 // const Tizen::Base::ByteBuffer& key);
1057 // static methodType ConvertToSecureFilep = 0;
1060 //static result File::Copy(const Tizen::Base::String& srcFilePath,
1061 // const Tizen::Base::String& destFilePath, bool failIfExist) {
1062 // typedef result (File::*methodType)(const Tizen::Base::String& srcFilePath,
1063 // const Tizen::Base::String& destFilePath, bool failIfExist);
1064 // static methodType Copyp = 0;
1067 //static result File::GetAttributes(const Tizen::Base::String& filePath,
1068 // FileAttributes& attribute) {
1069 // typedef result (File::*methodType)(const Tizen::Base::String& filePath,
1070 // FileAttributes& attribute);
1071 // static methodType GetAttributesp = 0;
1074 //static const Tizen::Base::String File::GetFileExtension(
1075 // const Tizen::Base::String& filePath) {
1076 // typedef const Tizen::Base::String (File::*methodType)(
1077 // const Tizen::Base::String& filePath);
1078 // static methodType GetFileExtensionp = 0;
1081 //const Tizen::Base::String File::GetFileName(
1082 // const Tizen::Base::String& filePath) {
1083 // typedef const Tizen::Base::String (File::*methodType)(
1084 // const Tizen::Base::String& filePath);
1085 // static methodType GetFileNamep = 0;
1086 // Tizen::Base::String ret;
1088 // if (!GetFileNamep) {
1089 // probeBlockStart();
1090 // void *tmpPtr = dlsym(RTLD_NEXT,
1091 // "_ZN5Tizen2Io4File11GetFileNameERKNS_4Base6StringE");
1093 // if (tmpPtr == NULL || dlerror() != NULL) {
1094 // perror("dlsym failed : Tizen::Io::File::GetFileName");
1098 // memcpy(&GetFileNamep, &tmpPtr, sizeof(tmpPtr));
1101 // ret = (File::(*GetFileNamep))(filePath);
1105 //static bool File::IsEncrypted(const Tizen::Base::String &filePath) {
1106 // typedef bool (File::*methodType)(const Tizen::Base::String &filePath);
1107 // static methodType IsEncryptedp = 0;
1110 //static bool File::IsFileExist(const Tizen::Base::String& filePath) {
1111 // typedef bool (File::*methodType)(const Tizen::Base::String& filePath);
1112 // static methodType IsFileExistp = 0;
1115 //static result File::Move(const Tizen::Base::String& oldFilePath,
1116 // const Tizen::Base::String& newFilePath) {
1117 // typedef result (File::*methodType)(const Tizen::Base::String& oldFilePath,
1118 // const Tizen::Base::String& newFilePath);
1119 // static methodType Movep = 0;
1122 //static result File::Remove(const Tizen::Base::String& filePath) {
1123 // typedef result (File::*methodType)(const Tizen::Base::String& filePath);
1124 // static methodType Removep = 0;