Lines Matching refs:cp
85 * value into the vfs cp iteration, we need to pass around the int as an ptr.
128 cp_entry_init(struct cnode *cp, struct mount *mp)
135 cp->c_cpentry = NULL;
139 if (!S_ISREG(cp->c_mode) && !S_ISDIR(cp->c_mode)) {
140 cp->c_cpentry = NULL;
153 CP_ASSERT (cp->c_cpentry == NULL);
155 error = cp_getxattr(cp, hfsmp, &entry);
168 sub_error = cp_entry_create_keys (&entry, NULL, hfsmp, PROTECTION_CLASS_D, cp->c_fileid, cp->c_mode);
172 sub_error = cp_setxattr (cp, entry, hfsmp, cp->c_fileid, XATTR_CREATE);
177 if (S_ISREG(cp->c_mode)) {
187 cp->c_cpentry = entry;
190 cp_entry_destroy(&cp->c_cpentry);
402 struct cnode *cp;
416 cp = VTOC(vp);
423 hfs_lock_truncate (cp, HFS_SHARED_LOCK);
431 error = hfs_lock(cp, HFS_SHARED_LOCK);
433 hfs_unlock_truncate(cp, 0);
438 entry = cp->c_cpentry;
441 panic("Content Protection: uninitialized cnode %p", cp);
450 panic ("cp_vnode_getclass: cp %p has no keys!", cp);
458 hfs_unlock_truncate(cp, 0);
461 hfs_unlock(cp);
475 struct cnode *cp;
508 cp = VTOC(vp);
516 hfs_lock_truncate (cp, HFS_EXCLUSIVE_LOCK);
519 if (hfs_lock(cp, HFS_EXCLUSIVE_LOCK)) {
523 entry = cp->c_cpentry;
535 panic ("cp_vnode_setclass: cp %p has no keys!\n", cp);
546 error = cp_wrap(newclass, hfsmp, cp->c_fileid, &cp->c_cpentry);
554 entry = cp->c_cpentry;
561 error = cp_setxattr(cp, entry, VTOHFS(vp), 0,XATTR_REPLACE);
563 error = cp_setxattr(cp, entry, VTOHFS(vp), 0, XATTR_CREATE);
568 hfs_unlock_truncate (cp, 0);
570 hfs_unlock(cp);
577 struct cnode *cp;
593 cp = VTOC(vp);
601 hfs_lock_truncate (cp, HFS_EXCLUSIVE_LOCK);
604 if (hfs_lock(cp, HFS_EXCLUSIVE_LOCK)) {
608 entry = cp->c_cpentry;
620 panic ("cp_vnode_transcode: cp %p has no keys!", cp);
645 cp->c_fileid,
657 hfs_unlock_truncate (cp, 0);
659 hfs_unlock(cp);
686 struct cnode *cp = NULL;
712 cp = VTOC(vp);
714 if ((error = hfs_lock(cp, HFS_SHARED_LOCK))) {
718 entry = cp->c_cpentry;
730 vp = CTOV(cp, 0);
733 vp = CTOV(cp,1);
741 if ((error = cp_check_access(cp, vnop))) {
761 if (lck_rw_lock_shared_to_exclusive(&cp->c_rwlock) == FALSE) {
762 if ((error = hfs_lock(cp, HFS_EXCLUSIVE_LOCK))) {
766 cp->c_lockowner = current_thread();
776 panic ("cp_handle_vnop: cp %p has no keys!", cp);
796 error = cp_setxattr(cp, entry, VTOHFS(cp->c_vp), 0, XATTR_CREATE);
800 hfs_unlock(cp);
808 struct cnode *cp = NULL ;
823 cp = VTOC(vp);
825 if ((error = hfs_lock(cp, HFS_SHARED_LOCK))) {
829 entry = cp->c_cpentry;
833 if (!S_ISREG(cp->c_mode))
854 hfs_unlock(cp);
868 cp_handle_relocate (struct cnode *cp, struct hfsmount *hfsmp) {
872 /* cp is already locked */
873 entry = cp->c_cpentry;
881 if ((error = cp_check_access(cp, CP_READ_ACCESS | CP_WRITE_ACCESS))) {
904 /* return the cp still locked */
994 int cp_setxattr(struct cnode *cp, struct cprotect *entry, struct hfsmount *hfsmp, uint32_t fileid, int options)
1004 if (cp) {
1005 args.a_vp = cp->c_vp;
1007 arg_cp = cp;
1024 panic ("cp_setxattr: cp %p , cpentry %p still needs keys!", cp, entry);
1219 cp_getxattr(struct cnode *cp, struct hfsmount *hfsmp, struct cprotect **outentry)
1230 args.a_vp = cp->c_vp;
1250 error = hfs_getxattr_internal(cp, &args, VTOHFS(cp->c_vp), 0);
1314 error = hfs_getxattr_internal(cp, &args, VTOHFS(cp->c_vp), 0);
1403 /* create new cp data: key and class */
1497 cp_check_access(struct cnode *cp, int vnop __unused)
1505 if (!cp->c_cpentry) {
1510 if (!S_ISREG(cp->c_mode)) {
1515 switch (cp->c_cpentry->cp_pclass) {
1536 cnode_t *cp = NULL;
1548 cp = VTOC(vp);
1558 hfs_lock_truncate (cp, HFS_EXCLUSIVE_LOCK);
1561 hfs_lock(cp, HFS_FORCE_LOCK);
1563 entry = cp->c_cpentry;
1583 * to protect the cp blob across IO operations, we rely
1597 hfs_unlock (cp);
1599 hfs_lock (cp, HFS_FORCE_LOCK);
1615 hfs_unlock(cp);
1631 hfs_unlock(cp);
1635 hfs_unlock_truncate (cp, 0);