Ticket #314: dasd-v2.diff
File dasd-v2.diff, 5.9 KB (added by , 9 years ago) |
---|
-
src/emx/src/lib/sys/b_fsFileStatFH.c
diff --git a/src/emx/src/lib/sys/b_fsFileStatFH.c b/src/emx/src/lib/sys/b_fsFileStatFH.c index b987bde..3f7a9fb 100755
a b int __libc_Back_fsFileStatFH(int fh, struct stat *pStat) 86 86 pStat->st_nlink = 1; 87 87 pStat->st_blksize = 4096*12; /* 48KB */ 88 88 89 if ((pFH->fFlags & __LIBC_FH_TYPEMASK) == F_FILE) 89 int fDasdMode = 0; 90 ULONG fulMode; 91 92 if (!DosQueryFHState(fh, &fulMode)) 93 fDasdMode = fulMode & OPEN_FLAGS_DASD; 94 95 if ((pFH->fFlags & __LIBC_FH_TYPEMASK) == F_FILE && !fDasdMode) 90 96 { 91 97 /* 92 98 * Regular OS/2 file. -
src/emx/src/lib/sys/b_fsNativeFileStat.c
diff --git a/src/emx/src/lib/sys/b_fsNativeFileStat.c b/src/emx/src/lib/sys/b_fsNativeFileStat.c index 713bf5c..b7c17ad 100755
a b int __libc_back_fsNativeFileStat(const char *pszNativePath, struct stat *pStat) 113 113 pStat->st_birthtime = 0; 114 114 LIBCLOG_RETURN_INT(0); 115 115 } 116 117 /* 118 * If a drive in DASD mode, make a fake unix sutff 119 */ 120 if ( (pszNativePath[5] == 'd' || pszNativePath[5] =='D') 121 && (pszNativePath[6] == 'r' || pszNativePath[6] =='R') 122 && (pszNativePath[7] == 'i' || pszNativePath[7] =='I') 123 && (pszNativePath[8] == 'v' || pszNativePath[8] =='V') 124 && (pszNativePath[9] == 'e' || pszNativePath[9] =='E') 125 && ( (pszNativePath[10] >= 'A' && pszNativePath[10] <= 'Z') 126 || (pszNativePath[10] >= 'a' && pszNativePath[10] <= 'z') 127 ) 128 && pszNativePath[11] == '\0' 129 ) 130 { 131 ULONG ulDiskNum; 132 char szNativePath[3] = "x:"; 133 FSALLOCATE fsalloc; 134 FSINFO fsinfo; 135 int rc; 136 137 ulDiskNum = pszNativePath[10]; 138 ulDiskNum -= ulDiskNum >= 'a' ? 'a' : 'A'; 139 ulDiskNum++; 140 141 rc = DosQueryFSInfo(ulDiskNum, FSIL_ALLOC, &fsalloc, sizeof(fsalloc)); 142 if (rc) 143 { 144 rc = -__libc_native2errno(rc); 145 LIBCLOG_ERROR_RETURN_INT(rc); 146 } 147 148 /* fake unix stuff */ 149 /** @todo this doesn't entirely match the open and file handle stat code. 150 * Fortunately, the user will not see that unless won't have the filename... */ 151 szNativePath[0] = ulDiskNum + 'A' - 1; 152 pStat->st_dev = __libc_back_fsPathCalcInodeAndDev(szNativePath, &pStat->st_ino); 153 pStat->st_attr = FILE_NORMAL; 154 pStat->st_mode = S_IFREG | S_IRWXO | S_IRWXG | S_IRWXU; 155 pStat->st_uid = 0; 156 pStat->st_gid = 0; 157 pStat->st_rdev = 0; /* b_ioFileOpen depends on this being 0 for devices! */ 158 pStat->st_nlink = 1; 159 pStat->st_size = (off_t)fsalloc.cUnit * fsalloc.cSectorUnit * fsalloc.cbSector; 160 pStat->st_blocks = pStat->st_size / S_BLKSIZE; 161 pStat->st_blksize = 4096 * 12; /* 48kb */ 162 pStat->st_atime = 0; 163 pStat->st_mtime = 0; 164 pStat->st_ctime = 0; 165 pStat->st_birthtime = 0; 166 LIBCLOG_RETURN_INT(0); 167 } 116 168 } 117 169 118 170 /* -
src/emx/src/lib/sys/b_ioFileOpen.c
diff --git a/src/emx/src/lib/sys/b_ioFileOpen.c b/src/emx/src/lib/sys/b_ioFileOpen.c index cf2b05c..7600961 100755
a b int __libc_Back_ioFileOpen(const char *pszFile, unsigned fLibc, int fShare, off_ 153 153 if (rc) 154 154 LIBCLOG_ERROR_RETURN_INT(rc); 155 155 156 /* 157 * Check if DASD mode is requsted. 158 */ 159 if ( (szNativePath[5] == 'd' || szNativePath[5] =='D') 160 && (szNativePath[6] == 'r' || szNativePath[6] =='R') 161 && (szNativePath[7] == 'i' || szNativePath[7] =='I') 162 && (szNativePath[8] == 'v' || szNativePath[8] =='V') 163 && (szNativePath[9] == 'e' || szNativePath[9] =='E') 164 && ( (szNativePath[10] >= 'A' && szNativePath[10] <= 'Z') 165 || (szNativePath[10] >= 'a' && szNativePath[10] <= 'z') 166 ) 167 && szNativePath[11] == '\0' 168 ) 169 { 170 szNativePath[0] = szNativePath[10]; 171 if (szNativePath[0] >= 'a') 172 szNativePath[0] -= 'a' - 'A'; 173 szNativePath[1] = ':'; 174 szNativePath[2] = '\0'; 175 flOpenMode |= OPEN_FLAGS_DASD; 176 } 177 156 178 dev_t Dev = 0; 157 179 ino_t Inode = 0; 158 180 PEAOP2 pEaOp2 = NULL; -
src/emx/src/lib/sys/fs.c
diff --git a/src/emx/src/lib/sys/fs.c b/src/emx/src/lib/sys/fs.c index ad4c590..f375160 100755
a b static int fsResolveUnix(const char *pszUserPath, unsigned fFlags, char *pszNati 1105 1105 { 1106 1106 PFSQBUFFER2 pfsqb = (PFSQBUFFER2)pachBuffer; 1107 1107 ULONG cb = SIZEOF_ACHBUFFER; 1108 fDone = !DosQueryFSAttach((PCSZ)pszNativePath, 0, FSAIL_QUERYNAME, pfsqb, &cb); 1108 fDone = !DosQueryFSAttach((PCSZ)pszNativePath, 0, FSAIL_QUERYNAME, pfsqb, &cb) 1109 || ( (pszNativePath[5] == 'd' || pszNativePath[5] =='D') 1110 && (pszNativePath[6] == 'r' || pszNativePath[6] =='R') 1111 && (pszNativePath[7] == 'i' || pszNativePath[7] =='I') 1112 && (pszNativePath[8] == 'v' || pszNativePath[8] =='V') 1113 && (pszNativePath[9] == 'e' || pszNativePath[9] =='E') 1114 && ( (pszNativePath[10] >= 'A' && pszNativePath[10] <= 'Z') 1115 || (pszNativePath[10] >= 'a' && pszNativePath[10] <= 'z') 1116 ) 1117 && pszNativePath[11] == '\0' 1118 ); 1109 1119 } 1110 1120 1111 1121 /* If it was, copy path to pszNativePath and go to exit code. */