MCPcopy Create free account
hub / github.com/MariaDB/server / PlugOpenFile

Function PlugOpenFile

storage/connect/plgdbutl.cpp:811–845  ·  view source on GitHub ↗

/ Open file routine: the purpose of this routine is to make a list */ of all open file so they can be closed in SQLINIT on error jump. */ /

Source from the content-addressed store, hash-verified

809/* of all open file so they can be closed in SQLINIT on error jump. */
810/***********************************************************************/
811FILE *PlugOpenFile(PGLOBAL g, LPCSTR fname, LPCSTR ftype)
812 {
813 FILE *fop;
814 PFBLOCK fp;
815 PDBUSER dbuserp = (PDBUSER)g->Activityp->Aptr;
816
817 if (trace(1)) {
818 htrc("PlugOpenFile: fname=%s ftype=%s\n", fname, ftype);
819 htrc("dbuserp=%p\n", dbuserp);
820 } // endif trace
821
822 if ((fop= global_fopen(g, MSGID_OPEN_MODE_STRERROR, fname, ftype)) != NULL) {
823 if (trace(1))
824 htrc(" fop=%p\n", fop);
825
826 fp = (PFBLOCK)PlugSubAlloc(g, NULL, sizeof(FBLOCK));
827
828 if (trace(1))
829 htrc(" fp=%p\n", fp);
830
831 // fname may be in volatile memory such as stack
832 fp->Fname = PlugDup(g, fname);
833 fp->Count = 1;
834 fp->Type = TYPE_FB_FILE;
835 fp->File = fop;
836 fp->Mode = MODE_ANY; // ???
837 fp->Next = dbuserp->Openlist;
838 dbuserp->Openlist = fp;
839 } /* endif fop */
840
841 if (trace(1))
842 htrc(" returning fop=%p\n", fop);
843
844 return (fop);
845 } // end of PlugOpenFile
846
847/***********************************************************************/
848/* Close file routine: the purpose of this routine is to avoid */

Callers 6

OpenTableFileMethod · 0.85
OpenTempFileMethod · 0.85
OpenColumnFileMethod · 0.85
OpenTableFileMethod · 0.85
OpenTableFileMethod · 0.85
OpenTempFileMethod · 0.85

Calls 4

global_fopenFunction · 0.85
PlugSubAllocFunction · 0.85
PlugDupFunction · 0.85
htrcFunction · 0.70

Tested by

no test coverage detected