96: #define isSET(flags, value) (((UW)(flags) & (UW)(value)) != 0)
97: #define isFAT_SUBDIR(typ) isSET(typ, FAT_SUBDIR)
98: #define isFAT_VOLUME(typ) isSET(typ, FAT_VOLUME)
99: #define isFAT_RDONLY(typ) isSET(typ, FAT_RDONLY)
100: #define isNOT_RDONLY(md) (((UW)(md) & O_ACCMODE) != O_RDONLY)
101: #define isDEV_RDONLY(flg) isSET(flg, DEV_FLAG_READONLY)
102:
784: {
785: return isSET(fd->fd_omode, O_SYNC) ?
786: fatDCacheSyncFS((FATFS*)fd->fd_fs, (VW)fd->fd_inode) : E_OK;
825: /* Calcurate sector / cluster offset */
826: off = offset / (isSET(map->m_flags, MAP_C) ? fs->ff_clsz : secsz);
827:
850:
851: if (isSET(map->m_flags, MAP_C)) {
852: /* Convert sector to cluster number */
984: /* Initialize cache information */
985: if (isSET(flags, MAP_C)) {
986: sec = CNtoBN(clad[0].ca_no);
1022: /* Clear Map area */
1023: if (isSET(flags, MAP_CLR)) {
1024: for (cnt = 0, i = 0; i < len; i++) {
1028: err = fatMapWriteBytes(map, 0, NULL, (D)cnt *
1029: (isSET(flags, MAP_C) ? fs->ff_clsz : secsz));
1030: err2 = fatMapEnd(map);
1032: }
1033: } else if (isSET(flags, MAP_READ)) {
1034: /* Read first cache page */
2100: }
2101: nm[i++] = isSET(smallcaps, sflg) ? AsciiToLOW(c) : c;
2102: }
2294: /* Calcurate '~' position */
2295: while (i > 0 && ! isSET(cbit, 1 << i)) i--;
2296:
2317: if (*chksum == CKSVOID) { /* 1st time, last LFN entry */
2318: if (! isSET(lde->lde_index, LFN_LAST)) goto exit0;
2319: *chksum = lde->lde_checksum;
2357: /* Check checksum */
2358: if (isSET(lde->lde_index, LFN_LAST)) {
2359: if (utf16len > (W)LFN_CHARS) goto exit0; /* Length differs */
3163: for (i = 0; i < nent; i++, nm[gnpos] += 1) {
3164: if (isSET(exist, (1 << i)) ||
3165: memcmp(dirent->de_fname, nm, BASE_EXTLEN) != 0)
3177: if (exist != existall) {
3178: for (i = 0; i < nent && isSET(exist, 1); i++, exist >>= 1);
3179: sfname[gnpos] += i; /* Set unique generation number */
4401: if (IsRootINODE(fs, inode)) {
4402: err = isSET(mode, FILMODE_WRITE) ? E_OK : EX_INVAL;
4403: } else {
4411: /* Change file mode */
4412: if (isSET(mode, FILMODE_WRITE)) {
4413: dir.di_dirent->de_ftype &= ~FAT_RDONLY;
4593: inode->fino_ftype = FAT_SUBDIR;
4594: if (! isSET(mode, FILMODE_WRITE)) {
4595: inode->fino_ftype |= FAT_RDONLY;
5009: /* File type */
5010: if (! isSET(mode, FILMODE_WRITE)) {
5011: inode->fino_ftype = FAT_RDONLY;
5027: /* If O_TRUNC, delete file data */
5028: if (isSET(oflag, O_TRUNC) &&
5029: ! isFAT_SUBDIR(inode->fino_ftype)) {
5213: /* Existent file */
5214: if (isSET(oflag, O_CREAT) && isSET(oflag, O_EXCL)) {
5215: err = EX_EXIST;
5219: err = EX_ISDIR;
5220: } else if (isSET(oflag, O_TRUNC)) {
5221: /* Directory is not truncated */
5224: } else if (lp.lp_inode->ino_type == DT_REG &&
5225: isSET(oflag, O_DIRECTORY)) {
5226: err = EX_NOTDIR;
5229: /* Nonnexisitent file */
5230: if (! isSET(oflag, O_CREAT)) {
5231: err = EX_NOENT;