Lines Matching refs:cp
152 hfs_is_journal_file(struct hfsmount *hfsmp, struct cnode *cp)
155 (cp->c_fileid == hfsmp->hfs_jnlinfoblkid ||
156 cp->c_fileid == hfsmp->hfs_jnlfileid)) {
216 struct cnode *cp;
228 cp = VTOC(*vpp);
229 cp->c_touch_acctime = TRUE;
230 cp->c_touch_chgtime = TRUE;
231 cp->c_touch_modtime = TRUE;
235 cp->c_rdev = vap->va_rdev;
251 hfs_ref_data_vp(struct cnode *cp, struct vnode **data_vp, int skiplock)
255 if (!data_vp || !cp) /* sanity check incoming parameters */
260 if (!skiplock) hfs_lock(cp, HFS_SHARED_LOCK);
261 struct vnode *c_vp = cp->c_vp;
266 if (!skiplock) hfs_unlock(cp);
274 if (!cp->c_rsrc_vp) {
277 if (!skiplock) hfs_unlock(cp);
281 if (0 == hfs_vget(VTOHFS(cp->c_rsrc_vp), cp->c_cnid, data_vp, 1, 0) &&
285 if (!skiplock) hfs_unlock(cp);
293 if (!skiplock) hfs_unlock(cp);
302 hfs_lazy_init_decmpfs_cnode(struct cnode *cp)
304 if (!cp->c_decmp) {
312 if (!OSCompareAndSwapPtr(NULL, dp, (void * volatile *)&cp->c_decmp)) {
319 return cp->c_decmp;
329 hfs_file_is_compressed(struct cnode *cp, int skiplock)
334 if (!(cp->c_bsdflags & UF_COMPRESSED)) {
338 decmpfs_cnode *dp = hfs_lazy_init_decmpfs_cnode(cp);
357 if (0 == hfs_ref_data_vp(cp, &data_vp, skiplock)) {
428 hfs_hides_rsrc(vfs_context_t ctx, struct cnode *cp, int skiplock)
432 if (!hfs_file_is_compressed(cp, skiplock))
434 return decmpfs_hides_rsrc(ctx, cp->c_decmp);
438 hfs_hides_xattr(vfs_context_t ctx, struct cnode *cp, const char *name, int skiplock)
442 if (!hfs_file_is_compressed(cp, skiplock))
444 return decmpfs_hides_xattr(ctx, cp->c_decmp, name);
459 struct cnode *cp = VTOC(vp);
465 if ( hfs_file_is_compressed(cp, 1) ) { /* 1 == don't take the cnode lock */
468 error = hfs_ref_data_vp(cp, &data_vp, 1); /* 1 == don't take the cnode lock */
482 if (hfs_file_is_compressed(cp, 1) ) { /* 1 == don't take the cnode lock */
498 if ((cp->c_bsdflags & APPEND) && !vnode_isdir(vp) &&
506 if (hfs_is_journal_file(hfsmp, cp))
519 if ((error = hfs_lock(cp, HFS_EXCLUSIVE_LOCK)))
525 (void)hfs_getinoquota(cp);
553 if ((now.tv_sec - cp->c_mtime) > 60) {
564 hfs_unlock(cp);
582 register struct cnode *cp;
591 cp = VTOC(vp);
602 if ((vp->v_type == VREG) && (cp->c_rsrc_vp)
603 && (vnode_isnamedstream(cp->c_rsrc_vp))) {
614 hfs_unlock(cp);
616 hfs_lock_truncate(cp, HFS_EXCLUSIVE_LOCK);
620 hfs_unlock_truncate(cp, 0);
625 if (cp->c_rsrc_vp) {
626 knownrefs = 1 + vnode_isnamedstream(cp->c_rsrc_vp);
649 hfs_touchtimes(VTOHFS(vp), cp);
652 hfs_reldirhints(cp, busy);
658 hfs_unlock_truncate(cp, 0);
660 hfs_unlock(cp);
685 struct cnode *cp;
689 cp = VTOC(vp);
700 hide_size = hfs_hides_rsrc(ap->a_context, cp, 0);
703 compressed = hfs_file_is_compressed(cp, 0);
707 if (compressed || (!VNODE_IS_RSRC(vp) && cp->c_decmp && cp->c_decmp->cmp_type >= CMP_MAX)) {
727 if (cp->c_flag & C_NOEXISTS)
730 vap->va_uid = cp->c_uid;
731 vap->va_gid = cp->c_gid;
732 vap->va_mode = cp->c_mode;
733 vap->va_flags = cp->c_bsdflags;
736 if ((cp->c_attr.ca_recflags & kHFSHasSecurityMask) == 0) {
753 (cp->c_touch_acctime || cp->c_touch_chgtime || cp->c_touch_modtime)) {
754 if ((error = hfs_lock(cp, HFS_EXCLUSIVE_LOCK)))
756 hfs_touchtimes(hfsmp, cp);
759 if ((error = hfs_lock(cp, HFS_SHARED_LOCK)))
764 data_size = (cp->c_entries + 2) * AVERAGE_HFSDIRENTRY_SIZE;
780 (cp->c_attr.ca_recflags & kHFSHasFolderCountMask))
781 nlink = cp->c_attr.ca_dircount; /* implied ".." entries */
783 nlink = cp->c_entries;
788 if (cp->c_cnid == kHFSRootFolderID) {
801 entries = cp->c_entries;
803 if (cp->c_cnid == kHFSRootFolderID) {
818 VATTR_RETURN(vap, va_dirlinkcount, (uint32_t)cp->c_linkcount);
821 data_size = VCTOF(vp, cp)->ff_size;
823 VATTR_RETURN(vap, va_nlink, (u_int64_t)cp->c_linkcount);
832 blocks = cp->c_blocks;
838 blocks = VCTOF(vp, cp)->ff_blocks;
847 VATTR_RETURN(vap, va_total_size, (cp->c_entries + 2) * AVERAGE_HFSDIRENTRY_SIZE);
869 if (cp->c_datafork) {
870 total_size = cp->c_datafork->ff_size;
873 if (cp->c_blocks - VTOF(vp)->ff_blocks) {
904 VATTR_RETURN(vap, va_total_alloc, (u_int64_t)cp->c_blocks * (u_int64_t)hfsmp->blockSize);
916 if ((cp->c_attr.ca_recflags & kHFSHasSecurityMask) == 0) {
923 if (cp->c_touch_acctime) {
929 vap->va_access_time.tv_sec = cp->c_atime;
934 vap->va_create_time.tv_sec = cp->c_itime;
936 vap->va_modify_time.tv_sec = cp->c_mtime;
938 vap->va_change_time.tv_sec = cp->c_ctime;
940 vap->va_backup_time.tv_sec = cp->c_btime;
945 u_int32_t dateadded = hfs_get_dateadded (cp);
955 vap->va_uid = cp->c_uid;
956 vap->va_gid = cp->c_gid;
957 vap->va_mode = cp->c_mode;
958 vap->va_flags = cp->c_bsdflags;
971 vap->va_fileid = (u_int64_t)cp->c_fileid;
980 if (cp->c_flag & C_HARDLINK) {
981 vap->va_linkid = (u_int64_t)hfs_currentcnid(cp);
982 vap->va_parentid = (u_int64_t)hfs_currentparent(cp);
984 vap->va_linkid = (u_int64_t)cp->c_cnid;
985 vap->va_parentid = (u_int64_t)cp->c_parentcnid;
989 vap->va_encoding = cp->c_encoding;
990 vap->va_rdev = (v_type == VBLK || v_type == VCHR) ? cp->c_rdev : 0;
1027 if (VATTR_IS_ACTIVE(vap, va_name) && (cp->c_cnid != kHFSRootFolderID)) {
1043 if ((cp->c_flag & C_HARDLINK) &&
1044 ((cp->c_desc.cd_namelen == 0) || (vap->va_linkid != cp->c_cnid))) {
1048 if ((cp->c_desc.cd_namelen == 0) && (vap->va_linkid == cp->c_fileid)) {
1086 else if (cp->c_desc.cd_namelen) {
1087 strlcpy(vap->va_name, (const char*) cp->c_desc.cd_nameptr, MAXPATHLEN);
1093 hfs_unlock(cp);
1116 struct cnode *cp = NULL;
1210 cp = VTOC(vp);
1214 hfs_unlock_truncate(cp, 0);
1221 if (cp == NULL) {
1224 cp = VTOC(vp);
1236 cp->c_touch_acctime=TRUE;
1274 if ((cp->c_bsdflags ^ vap->va_flags) & UF_COMPRESSED) {
1285 cp->c_bsdflags = vap->va_flags;
1286 cp->c_touch_chgtime = TRUE;
1295 fdFlags = (u_int16_t *) &cp->c_finderinfo[8];
1315 cp->c_itime = vap->va_create_time.tv_sec;
1317 cp->c_atime = vap->va_access_time.tv_sec;
1318 cp->c_touch_acctime = FALSE;
1321 cp->c_mtime = vap->va_modify_time.tv_sec;
1322 cp->c_touch_modtime = FALSE;
1323 cp->c_touch_chgtime = TRUE;
1332 (cp->c_cnid != kHFSRootFolderID) &&
1333 (cp->c_mtime < cp->c_itime)) {
1334 cp->c_itime = cp->c_mtime;
1338 cp->c_btime = vap->va_backup_time.tv_sec;
1339 cp->c_flag |= C_MODIFIED;
1347 cp->c_encoding = vap->va_encoding;
1348 hfs_setencodingbits(hfsmp, cp->c_encoding);
1354 if (cp) {
1358 if ((cp->c_flag & C_HARDLINK) && (vp->v_type != VDIR)){
1359 hfs_relorigin(cp, 0);
1362 hfs_unlock(cp);
1397 register struct cnode *cp = VTOC(vp);
1403 if (hfs_is_journal_file(VTOHFS(vp), cp)) {
1412 cp->c_mode &= ~ALLPERMS;
1413 cp->c_mode |= (mode & ALLPERMS);
1414 cp->c_touch_chgtime = TRUE;
1422 struct cnode *cp = VTOC(vp);
1443 if (considerFlags && (cp->c_bsdflags & IMMUTABLE))
1451 if ((retval = hfs_owner_rights(VTOHFS(vp), cp->c_uid, cred, p, false)) == 0)
1452 return ((cp->c_mode & S_IWUSR) == S_IWUSR ? 0 : EACCES);
1455 if (kauth_cred_ismember_gid(cred, cp->c_gid, &is_member) == 0 && is_member) {
1456 return ((cp->c_mode & S_IWGRP) == S_IWGRP ? 0 : EACCES);
1460 return ((cp->c_mode & S_IWOTH) == S_IWOTH ? 0 : EACCES);
1465 * Perform chown operation on cnode cp;
1477 register struct cnode *cp = VTOC(vp);
1493 uid = cp->c_uid;
1495 gid = cp->c_gid;
1503 if ((kauth_cred_getuid(cred) != cp->c_uid || uid != cp->c_uid ||
1504 (gid != cp->c_gid &&
1510 ogid = cp->c_gid;
1511 ouid = cp->c_uid;
1513 if ((error = hfs_getinoquota(cp)))
1516 dqrele(cp->c_dquot[USRQUOTA]);
1517 cp->c_dquot[USRQUOTA] = NODQUOT;
1520 dqrele(cp->c_dquot[GRPQUOTA]);
1521 cp->c_dquot[GRPQUOTA] = NODQUOT;
1531 change = (int64_t)(cp->c_blocks) * (int64_t)VTOVCB(vp)->blockSize;
1532 (void) hfs_chkdq(cp, -change, cred, CHOWN);
1533 (void) hfs_chkiq(cp, -1, cred, CHOWN);
1535 dqrele(cp->c_dquot[i]);
1536 cp->c_dquot[i] = NODQUOT;
1539 cp->c_gid = gid;
1540 cp->c_uid = uid;
1542 if ((error = hfs_getinoquota(cp)) == 0) {
1544 dqrele(cp->c_dquot[USRQUOTA]);
1545 cp->c_dquot[USRQUOTA] = NODQUOT;
1548 dqrele(cp->c_dquot[GRPQUOTA]);
1549 cp->c_dquot[GRPQUOTA] = NODQUOT;
1551 if ((error = hfs_chkdq(cp, change, cred, CHOWN)) == 0) {
1552 if ((error = hfs_chkiq(cp, 1, cred, CHOWN)) == 0)
1555 (void) hfs_chkdq(cp, -change, cred, CHOWN|FORCE);
1558 dqrele(cp->c_dquot[i]);
1559 cp->c_dquot[i] = NODQUOT;
1562 cp->c_gid = ogid;
1563 cp->c_uid = ouid;
1564 if (hfs_getinoquota(cp) == 0) {
1566 dqrele(cp->c_dquot[USRQUOTA]);
1567 cp->c_dquot[USRQUOTA] = NODQUOT;
1570 dqrele(cp->c_dquot[GRPQUOTA]);
1571 cp->c_dquot[GRPQUOTA] = NODQUOT;
1573 (void) hfs_chkdq(cp, change, cred, FORCE|CHOWN);
1574 (void) hfs_chkiq(cp, 1, cred, FORCE|CHOWN);
1575 (void) hfs_getinoquota(cp);
1579 if (hfs_getinoquota(cp))
1589 cp->c_touch_chgtime = TRUE;
2259 struct cnode *cp = VTOC(vp);
2298 hfs_unlock(cp);
2299 hfs_lock_truncate(cp, HFS_SHARED_LOCK);
2303 hfs_unlock_truncate(cp, 0);
2305 hfs_lock_truncate(cp, HFS_EXCLUSIVE_LOCK);
2310 hfs_lock(cp, HFS_FORCE_LOCK);
2319 if (fp && (((cp->c_flag & C_ALWAYS_ZEROFILL) && !TAILQ_EMPTY(&fp->ff_invalidranges)) ||
2320 ((wait || (cp->c_flag & C_ZFWANTSYNC)) &&
2321 ((cp->c_bsdflags & UF_NODUMP) == 0) &&
2323 cp->c_zftimeout != 0))) {
2326 if ((cp->c_flag & C_ALWAYS_ZEROFILL) == 0 && !fullsync && tv.tv_sec < (long)cp->c_zftimeout) {
2328 cp->c_flag |= C_ZFWANTSYNC;
2332 if (!took_trunc_lock || (cp->c_truncatelockowner == HFS_SHARED_OWNER)) {
2333 hfs_unlock(cp);
2335 hfs_unlock_truncate(cp, 0);
2337 hfs_lock_truncate(cp, HFS_EXCLUSIVE_LOCK);
2338 hfs_lock(cp, HFS_FORCE_LOCK);
2352 hfs_unlock(cp);
2356 hfs_lock(cp, HFS_FORCE_LOCK);
2357 cp->c_flag |= C_MODIFIED;
2359 hfs_unlock(cp);
2361 hfs_lock(cp, HFS_FORCE_LOCK);
2363 cp->c_flag &= ~C_ZFWANTSYNC;
2364 cp->c_zftimeout = 0;
2368 hfs_unlock_truncate(cp, 0);
2421 cp->c_touch_acctime = FALSE;
2422 cp->c_touch_chgtime = FALSE;
2423 cp->c_touch_modtime = FALSE;
2433 if ((retval == 0) && wait && !fullsync && cp->c_hint &&
2434 !ISSET(cp->c_flag, C_DELETED | C_NOEXISTS)) {
2435 hfs_metasync(VTOHFS(vp), (daddr64_t)cp->c_hint, p);
2559 struct cnode *cp = VTOC(vp);
2573 cp->c_touch_acctime = FALSE;
2574 cp->c_touch_chgtime = FALSE;
2575 cp->c_touch_modtime = FALSE;
2595 struct cnode *cp = VTOC(vp);
2601 if (!S_ISDIR(cp->c_mode)) {
2609 cp = VTOC(vp);
2611 if ((error = hfs_lockpair(dcp, cp, HFS_EXCLUSIVE_LOCK))) {
2617 hfs_unlockpair (dcp, cp);
2622 hfs_unlockpair(dcp, cp);
2636 struct cnode *cp;
2643 cp = VTOC(vp);
2647 if (dcp == cp) {
2650 if (cp->c_flag & (C_NOEXISTS | C_DELETED)) {
2653 if (cp->c_entries != 0) {
2675 if (cp->c_flag & C_HARDLINK) {
2713 ((cp->c_attr.ca_recflags & kHFSHasAttributesMask) != 0)) ||
2733 (void)hfs_getinoquota(cp);
2747 if ((dcp->c_bsdflags & APPEND) || (cp->c_bsdflags & (IMMUTABLE | APPEND))) {
2758 * the cp->c_desc which may have changed).
2763 desc.cd_cnid = cp->c_cnid;
2765 desc.cd_encoding = cp->c_encoding;
2768 if (!hfs_valid_cnode(hfsmp, dvp, cnp, cp->c_fileid, NULL, &error)) {
2786 error = cat_delete(hfsmp, &desc, &cp->c_attr);
2795 hfs_touchtimes(hfsmp, cp);
2797 cp->c_flag &= ~(C_MODIFIED | C_FORCEUPDATE);
2807 (void)hfs_chkiq(cp, -1, NOCRED, 0);
2813 cp->c_flag |= C_NOEXISTS;
2842 struct cnode *cp;
2862 cp = VTOC(vp);
2866 hfs_lock_truncate(cp, HFS_EXCLUSIVE_LOCK);
2868 if ((error = hfs_lockpair(dcp, cp, HFS_EXCLUSIVE_LOCK))) {
2869 hfs_unlock_truncate(cp, 0);
2878 * vnode attached to 'cp' if it is a regular file or symlink.
2893 if ((cp->c_rsrc_vp) && (rvp == NULL)) {
2895 rvp = cp->c_rsrc_vp;
2899 hfs_unlock_truncate (cp, 0);
2900 hfs_unlockpair (dcp, cp);
2918 * hfs_removefile already checks for a race on vp/cp
2956 hfs_unlock_truncate(cp, 0);
2957 hfs_unlockpair(dcp, cp);
3011 struct cnode *cp;
3025 cp = VTOC(vp);
3030 if (cp->c_flag & (C_NOEXISTS | C_DELETED)) {
3034 if (!hfs_valid_cnode(hfsmp, dvp, cnp, cp->c_fileid, NULL, &error)) {
3048 rsrc_vp = cp->c_rsrc_vp;
3052 if (hfs_is_journal_file(hfsmp, cp)) {
3076 if (cp->c_flag & C_HARDLINK) {
3084 if ((vnode_isdir(vp) == 1) && (cp->c_linkcount == 1) &&
3099 if ((cp->c_parentcnid != hfsmp->hfs_private_desc[FILE_HARDLINKS].cd_cnid) &&
3100 (cp->c_parentcnid != dcp->c_fileid)) {
3107 cp->c_flag |= C_DELETED;
3134 if (rsrc_vp && (cp->c_blocks - VTOF(vp)->ff_blocks)) {
3141 isbigfile = ((cp->c_datafork->ff_size >= HFS_BIGFILE_SIZE) && overflow_extents(VTOF(vp)));
3147 (cp->c_attr.ca_recflags & kHFSHasAttributesMask) != 0) {
3170 (void)hfs_getinoquota(cp);
3188 if (!dataforkbusy && cp->c_datafork->ff_blocks && !isbigfile) {
3189 cp->c_flag |= C_NEED_DATA_SETSIZE;
3192 cp->c_flag |= C_NEED_RSRC_SETSIZE;
3225 if (!dataforkbusy && !isbigfile && cp->c_datafork->ff_blocks != 0) {
3249 * the cp->c_desc which may have changed). Also, be aware that
3259 desc.cd_encoding = cp->c_desc.cd_encoding;
3263 desc.cd_hint = cp->c_desc.cd_hint;
3264 desc.cd_cnid = cp->c_cnid;
3292 MAKE_DELETED_NAME(delname, sizeof(delname), cp->c_fileid);
3303 to_desc.cd_cnid = cp->c_cnid;
3336 cp->c_flag |= C_DELETED;
3337 cp->c_ctime = tv.tv_sec;
3338 --cp->c_linkcount;
3339 (void) cat_update(hfsmp, &to_desc, &cp->c_attr, NULL, NULL);
3355 u_int32_t fileid = cp->c_fileid;
3365 if ((isdir == 0) && (cp->c_rsrcfork == NULL) &&
3366 (cp->c_blocks - VTOF(vp)->ff_blocks)) {
3373 temp_rsrc_fork->ff_cp = cp;
3400 error = cat_delete(hfsmp, &desc, &cp->c_attr);
3404 cp->c_desc.cd_nameptr, cp->c_attr.ca_fileid, error);
3431 if (cp->c_datafork->ff_blocks > 0) {
3432 savedbytes = ((off_t)cp->c_datafork->ff_blocks * (off_t)blksize);
3433 (void) hfs_chkdq(cp, (int64_t)-(savedbytes), NOCRED, 0);
3441 if (temp_rsrc_fork || cp->c_rsrcfork) {
3442 if (cp->c_rsrcfork) {
3443 if (cp->c_rsrcfork->ff_blocks > 0) {
3444 savedbytes = ((off_t)cp->c_rsrcfork->ff_blocks * (off_t)blksize);
3445 (void) hfs_chkdq(cp, (int64_t)-(savedbytes), NOCRED, 0);
3451 (void) hfs_chkdq(cp, (int64_t)-(savedbytes), NOCRED, 0);
3456 (void)hfs_chkiq(cp, -1, NOCRED, 0);
3465 error = hfs_release_storage (hfsmp, cp->c_datafork, temp_rsrc_fork, fileid);
3468 /* if cp->c_rsrcfork == NULL, hfs_release_storage will skip over it. */
3469 error = hfs_release_storage (hfsmp, cp->c_datafork, cp->c_rsrcfork, fileid);
3491 cp->c_flag |= C_NOEXISTS;
3492 cp->c_flag &= ~C_DELETED;
3494 cp->c_touch_chgtime = TRUE; /* XXX needed ? */
3495 --cp->c_linkcount;
3513 cat_releasedesc(&cp->c_desc);
3517 cp->c_flag &= ~C_DELETED;
3540 replace_desc(struct cnode *cp, struct cat_desc *cdp)
3543 if (&cp->c_desc == cdp) {
3548 if (cp->c_desc.cd_flags & CD_HASBUF && cp->c_desc.cd_nameptr != 0) {
3549 const u_int8_t *name = cp->c_desc.cd_nameptr;
3551 cp->c_desc.cd_nameptr = 0;
3552 cp->c_desc.cd_namelen = 0;
3553 cp->c_desc.cd_flags &= ~CD_HASBUF;
3556 bcopy(cdp, &cp->c_desc, sizeof(cp->c_desc));
4314 struct cnode *cp = NULL;
4348 cp = VTOC(vp);
4351 if (cp->c_flag & (C_NOEXISTS | C_DELETED)) {
4356 (void)hfs_getinoquota(cp);
4383 hfs_unlock(cp);
4384 hfs_lock_truncate(cp, HFS_EXCLUSIVE_LOCK);
4385 hfs_lock(cp, HFS_FORCE_LOCK);
4389 hfs_unlock_truncate(cp, TRUE);
4394 hfs_unlock_truncate(cp, 0);
4424 if ((cp != NULL) && (vp != NULL)) {
4425 hfs_unlock(cp);
4487 * If the directory is marked as deleted-but-in-use (cp->c_flag & C_DELETED),
4503 struct cnode *cp;
4540 cp = VTOC(vp);
4560 if (offset == 0 && !(cp->c_flag & C_DELETED)) {
4567 entry->d_fileno = cp->c_cnid;
4577 entry->d_fileno = cp->c_parentcnid;
4589 entry->d_fileno = cp->c_cnid;
4597 entry->d_fileno = cp->c_parentcnid;
4613 if (cp->c_entries == 0) {
4657 if ( localhint.dh_desc.cd_parentcnid == cp->c_fileid) {
4670 dirhint = hfs_getdirhint(cp, ((index - 1) & HFS_INDEX_MASK) | tag, 0);
4680 dirhint->dh_threadhint = cp->c_dirthreadhint;
4703 error = cat_getdirentries(hfsmp, cp->c_entries, dirhint, uio, ap->a_flags, &items, &eofflag);
4706 cp->c_dirthreadhint = dirhint->dh_threadhint;
4718 if (items >= (int)cp->c_entries) {
4724 tag = (++cp->c_dirhinttag) << HFS_INDEX_BITS;
4729 cp->c_touch_acctime = TRUE;
4745 hfs_reldirhint(cp, dirhint);
4754 hfs_unlock(cp);
4771 struct cnode *cp;
4780 cp = VTOC(vp);
4828 if (cp->c_atime < VTOHFS(vp)->hfc_timebase)
4834 // cp->c_touch_acctime = TRUE;
4838 hfs_unlock(cp);
4924 struct cnode *cp = VTOC(vp);
4937 if (((vnode_issystem(vp) && (cp->c_cnid < kHFSFirstUserCatalogNodeID))) ||
4941 if ((hfsmp->hfs_flags & HFS_READ_ONLY) || (cp->c_mode == 0)) {
4942 cp->c_flag &= ~C_MODIFIED;
4943 cp->c_touch_acctime = 0;
4944 cp->c_touch_chgtime = 0;
4945 cp->c_touch_modtime = 0;
4949 hfs_touchtimes(hfsmp, cp);
4952 if ((cp->c_flag & (C_MODIFIED | C_FORCEUPDATE)) == 0) {
4956 if (cp->c_datafork)
4957 dataforkp = &cp->c_datafork->ff_data;
4958 if (cp->c_rsrcfork)
4959 rsrcforkp = &cp->c_rsrcfork->ff_data;
4971 if (ISSET(cp->c_flag, C_FORCEUPDATE) == 0 &&
4972 (ISSET(cp->c_flag, C_DELETED) ||
4973 (dataforkp && cp->c_datafork->ff_unallocblocks) ||
4974 (rsrcforkp && cp->c_rsrcfork->ff_unallocblocks))) {
4975 // cp->c_flag &= ~(C_ACCESS | C_CHANGE | C_UPDATE);
4976 cp->c_flag |= C_MODIFIED;
5002 if (cp->c_datafork->ff_unallocblocks != 0) {
5004 if (cp->c_datafork->ff_blocks < cp->c_datafork->ff_unallocblocks) {
5006 cp->c_datafork->ff_blocks, cp->c_datafork->ff_unallocblocks);
5010 datafork.cf_blocks = (cp->c_datafork->ff_blocks - cp->c_datafork->ff_unallocblocks);
5025 if (!TAILQ_EMPTY(&cp->c_datafork->ff_invalidranges)) {
5026 numbytes = TAILQ_FIRST(&cp->c_datafork->ff_invalidranges)->rl_start;
5036 if (rsrcforkp && (cp->c_rsrcfork->ff_unallocblocks != 0)) {
5038 rsrcfork.cf_blocks = (cp->c_rsrcfork->ff_blocks - cp->c_rsrcfork->ff_unallocblocks);
5049 error = cat_update(hfsmp, &cp->c_desc, &cp->c_attr, dataforkp, rsrcforkp);
5054 cp->c_flag &= ~(C_MODIFIED | C_FORCEUPDATE);
5069 struct cnode *cp = NULL;
5382 cp = VTOC(tvp);
5393 (void) hfs_getinoquota(cp);
5421 if (error == 0 && cp != NULL) {
5422 hfs_unlock(cp);
5460 struct cnode *cp = VTOC(vp);
5473 delete_status = hfs_checkdeleted(cp);
5480 if ((rvp = cp->c_rsrc_vp)) {
5497 hfs_unlock(cp);
5502 (void) hfs_lock(cp, HFS_FORCE_LOCK);
5512 if ((delete_status = hfs_checkdeleted(cp))) {
5559 if (cp->c_lockowner != current_thread()) {
5567 if (lck_rw_lock_shared_to_exclusive(&cp->c_rwlock) == FALSE)
5568 lck_rw_lock_exclusive(&cp->c_rwlock);
5569 cp->c_lockowner = current_thread();
5583 if ((error = hfs_checkdeleted(cp))) {
5588 if ((cp->c_flag & C_DELETED ) && (cp->c_desc.cd_namelen == 0)) {
5591 MAKE_DELETED_NAME(delname, sizeof(delname), cp->c_fileid);
5596 to_desc.cd_cnid = cp->c_cnid;
5601 descptr = &cp->c_desc;
5654 error = cat_idlookup (hfsmp, cp->c_fileid, 0, 1, NULL, NULL, &rsrcfork);
5681 descptr, GNV_WANTRSRC | GNV_SKIPLOCK, &cp->c_attr,
5748 struct cnode *cp;
5752 cp = VTOC(vp);
5753 hfs_touchtimes(VTOHFS(vp), cp);
5754 hfs_unlock(cp);
5814 struct cnode *cp;
5818 cp = VTOC(vp);
5819 hfs_touchtimes(VTOHFS(vp), cp);
5820 hfs_unlock(cp);