PageRenderTime 80ms CodeModel.GetById 75ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/core/10.5/fusefs/fuse_kludges.c

http://macfuse.googlecode.com/
C | 37 lines | 27 code | 6 blank | 4 comment | 2 complexity | 65507222a5b725634c854b65e35931ab MD5 | raw file
 1/*
 2 * Copyright (C) 2006-2008 Google. All Rights Reserved.
 3 * Amit Singh <singh@>
 4 */
 5
 6#include "fuse_kludges.h"
 7#include <libkern/version.h>
 8
 9#if M_MACFUSE_ENABLE_EXCHANGE
10
11extern void
12fuse_kludge_exchange(vnode_t v1, vnode_t v2)
13{
14    if (version_major > 9) {
15        char *tmp_v_name = ((struct fuse_kludge_vnode_10 *)v1)->v_name;
16        ((struct fuse_kludge_vnode_10 *)v1)->v_name =
17            ((struct fuse_kludge_vnode_10 *)v2)->v_name;
18        ((struct fuse_kludge_vnode_10 *)v2)->v_name = tmp_v_name;
19
20        vnode_t tmp_v_parent = ((struct fuse_kludge_vnode_10 *)v1)->v_parent;
21        ((struct fuse_kludge_vnode_10 *)v1)->v_parent =
22            ((struct fuse_kludge_vnode_10 *)v2)->v_parent;
23        ((struct fuse_kludge_vnode_10 *)v2)->v_parent = tmp_v_parent;
24    } else {
25        char *tmp_v_name = ((struct fuse_kludge_vnode_9 *)v1)->v_name;
26        ((struct fuse_kludge_vnode_9 *)v1)->v_name =
27            ((struct fuse_kludge_vnode_9 *)v2)->v_name;
28        ((struct fuse_kludge_vnode_9 *)v2)->v_name = tmp_v_name;
29
30        vnode_t tmp_v_parent = ((struct fuse_kludge_vnode_9 *)v1)->v_parent;
31        ((struct fuse_kludge_vnode_9 *)v1)->v_parent =
32            ((struct fuse_kludge_vnode_9 *)v2)->v_parent;
33        ((struct fuse_kludge_vnode_9 *)v2)->v_parent = tmp_v_parent;
34    }
35}
36
37#endif /* M_MACFUSE_ENABLE_EXCHANGE */