|
Line 0
Link Here
|
|
|
1 |
--- fuse_module/fuse.c.orig Fri Feb 10 17:31:53 2006 |
| 2 |
+++ fuse_module/fuse.c Sun Jul 16 14:48:43 2006 |
| 3 |
@@ -75,7 +75,7 @@ |
| 4 |
}; |
| 5 |
|
| 6 |
|
| 7 |
-#if USE_OLD_CLONEHANDLER_API |
| 8 |
+#ifdef USE_OLD_CLONEHANDLER_API |
| 9 |
static void fusedev_clone(void *arg, char *name, int namelen, struct cdev **dev); |
| 10 |
#else |
| 11 |
static void fusedev_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); |
| 12 |
@@ -120,7 +120,7 @@ |
| 13 |
__static void fuse_insert_message(struct fuse_ticket *tick); |
| 14 |
__static fuse_handler_t fuse_standard_handler; |
| 15 |
static fuse_handler_t fuse_fsync_handler; |
| 16 |
-#if FUSE_HAS_CREATE |
| 17 |
+#ifdef FUSE_HAS_CREATE |
| 18 |
static fuse_handler_t fuse_forgetful_handler; |
| 19 |
#endif |
| 20 |
|
| 21 |
@@ -852,27 +852,27 @@ |
| 22 |
case FUSE_FSYNCDIR: |
| 23 |
err = blen == 0 ? 0 : EINVAL; |
| 24 |
break; |
| 25 |
-#if FUSE_HAS_GETLK |
| 26 |
+#ifdef FUSE_HAS_GETLK |
| 27 |
case FUSE_GETLK: |
| 28 |
panic("FUSE_GETLK implementor has forgotten to define a response body format check"); |
| 29 |
break; |
| 30 |
#endif |
| 31 |
-#if FUSE_HAS_SETLK |
| 32 |
+#ifdef FUSE_HAS_SETLK |
| 33 |
case FUSE_SETLK: |
| 34 |
panic("FUSE_SETLK implementor has forgotten to define a response body format check"); |
| 35 |
break; |
| 36 |
#endif |
| 37 |
-#if FUSE_HAS_SETLKW |
| 38 |
+#ifdef FUSE_HAS_SETLKW |
| 39 |
case FUSE_SETLKW: |
| 40 |
panic("FUSE_SETLKW implementor has forgotten to define a response body format check"); |
| 41 |
break; |
| 42 |
#endif |
| 43 |
-#if FUSE_HAS_ACCESS |
| 44 |
+#ifdef FUSE_HAS_ACCESS |
| 45 |
case FUSE_ACCESS: |
| 46 |
err = blen == 0 ? 0 : EINVAL; |
| 47 |
break; |
| 48 |
#endif |
| 49 |
-#if FUSE_HAS_CREATE |
| 50 |
+#ifdef FUSE_HAS_CREATE |
| 51 |
case FUSE_CREATE: |
| 52 |
err = blen == sizeof(struct fuse_entry_out) + sizeof(struct fuse_open_out) ? 0 : EINVAL; |
| 53 |
break; |
| 54 |
@@ -881,7 +881,7 @@ |
| 55 |
panic("fuse opcodes out of sync"); |
| 56 |
} |
| 57 |
|
| 58 |
-#if _DEBUG2G |
| 59 |
+#ifdef _DEBUG2G |
| 60 |
if (err) |
| 61 |
DEBUG2G("op %s (#%d) with body size %d: invalid body size\n", |
| 62 |
(0 <= opcode && opcode <= fuse_opnames_entries) ? fuse_opnames[opcode] : "???", |
| 63 |
@@ -988,7 +988,7 @@ |
| 64 |
return (0); |
| 65 |
} |
| 66 |
|
| 67 |
-#if FUSE_HAS_CREATE |
| 68 |
+#ifdef FUSE_HAS_CREATE |
| 69 |
static int |
| 70 |
fuse_forgetful_handler(struct fuse_callback_node *caliban, struct uio *uio) |
| 71 |
{ |
| 72 |
@@ -1242,7 +1242,7 @@ |
| 73 |
static int |
| 74 |
fusedev_write(struct cdev *dev, struct uio *uio, int ioflag) |
| 75 |
{ |
| 76 |
-#if _DEBUG_MSGING |
| 77 |
+#ifdef _DEBUG_MSGING |
| 78 |
static int counter=0; |
| 79 |
#endif |
| 80 |
struct fuse_out_header *ohead; |
| 81 |
@@ -1415,7 +1415,7 @@ |
| 82 |
if ((err = fuse_callbn_wait_answer(&fdip->tick->callbn))) { |
| 83 |
/* Uh-huh, we got interrupted... */ |
| 84 |
|
| 85 |
-#if ! DONT_TRY_HARD_PREVENT_IO_IN_VAIN |
| 86 |
+#ifndef DONT_TRY_HARD_PREVENT_IO_IN_VAIN |
| 87 |
struct fuse_callback_node *fcallbn; |
| 88 |
unsigned age; |
| 89 |
#endif |
| 90 |
@@ -1438,7 +1438,7 @@ |
| 91 |
age = fdip->tick->age; |
| 92 |
fuse_callbn_set_answered(&fdip->tick->callbn); |
| 93 |
mtx_unlock(&fdip->tick->callbn.answer_mtx); |
| 94 |
-#if ! DONT_TRY_HARD_PREVENT_IO_IN_VAIN |
| 95 |
+#ifndef DONT_TRY_HARD_PREVENT_IO_IN_VAIN |
| 96 |
/* |
| 97 |
* If we are willing to pay with one more locking, we |
| 98 |
* can save on I/O by getting the device write handler |
| 99 |
@@ -1662,7 +1662,7 @@ |
| 100 |
/* static vop_pathconf_t fuse_pathconf; */ |
| 101 |
static vfs_hash_cmp_t fuse_vnode_cmp; |
| 102 |
static vfs_hash_cmp_t fuse_vnode_bgdrop_cmp; |
| 103 |
-#if FUSE_HAS_CREATE |
| 104 |
+#ifdef FUSE_HAS_CREATE |
| 105 |
static vfs_hash_cmp_t fuse_vnode_fgdrop_cmp; |
| 106 |
#endif |
| 107 |
/* static vfs_vget_t fuse_vget; */ |
| 108 |
@@ -1683,7 +1683,7 @@ |
| 109 |
static vop_lookup_t fuse_lookup; |
| 110 |
static int iterate_filehandles(struct vnode *vp, struct thread *td, struct ucred *cred, fuse_metrics_t fmetr, void *param); |
| 111 |
static fuse_metrics_t fuse_standard_metrics; |
| 112 |
-#if FUSE_HAS_CREATE |
| 113 |
+#ifdef FUSE_HAS_CREATE |
| 114 |
static __inline int create_filehandle(struct vnode *vp, struct thread *td, struct ucred *cred, int mode, struct fuse_dispatcher *fdip); |
| 115 |
#endif |
| 116 |
static struct fuse_filehandle *get_filehandle(struct vnode *vp, struct thread *td, struct ucred *cred, int mode, struct get_filehandle_param *gefhp); |
| 117 |
@@ -1729,7 +1729,7 @@ |
| 118 |
|
| 119 |
static b_strategy_t fuse_bufstrategy; |
| 120 |
|
| 121 |
-#if FUSE_HAS_CREATE |
| 122 |
+#ifdef FUSE_HAS_CREATE |
| 123 |
static vop_access_t fuse_germ_access; |
| 124 |
#endif |
| 125 |
|
| 126 |
@@ -1773,7 +1773,7 @@ |
| 127 |
.vop_unlock = fuse_unlock, |
| 128 |
}; |
| 129 |
|
| 130 |
-#if FUSE_HAS_CREATE |
| 131 |
+#ifdef FUSE_HAS_CREATE |
| 132 |
static struct vop_vector fuse_germ_vnops; |
| 133 |
#endif |
| 134 |
|
| 135 |
@@ -2092,7 +2092,7 @@ |
| 136 |
|
| 137 |
if (! (fmnt->mntopts & FUSEFS_SECONDARY)) { |
| 138 |
data->mp = mp; |
| 139 |
-#if ! REALTIME_TRACK_UNPRIVPROCDBG |
| 140 |
+#ifndef REALTIME_TRACK_UNPRIVPROCDBG |
| 141 |
fmnt->mntopts &= ~FUSEFS_UNPRIVPROCDBG; |
| 142 |
fmnt->mntopts |= get_unprivileged_proc_debug(td) ? FUSEFS_UNPRIVPROCDBG : 0; |
| 143 |
#endif |
| 144 |
@@ -2380,7 +2380,7 @@ |
| 145 |
return (0); |
| 146 |
} |
| 147 |
|
| 148 |
-#if FUSE_HAS_CREATE |
| 149 |
+#ifdef FUSE_HAS_CREATE |
| 150 |
/* |
| 151 |
* Vnode comparison function with which the given vnode always |
| 152 |
* gets inserted, but got marked invalid upon a clash. Caller |
| 153 |
@@ -2654,7 +2654,7 @@ |
| 154 |
|
| 155 |
fuse_filehandle_gc(vp, td, NULL); |
| 156 |
|
| 157 |
-#if ! DONT_STORE_FS_MAP |
| 158 |
+#ifndef DONT_STORE_FS_MAP |
| 159 |
/* |
| 160 |
* Dropping vnodes when they are not in use would mean that |
| 161 |
* the respective inode must be freed on the daemon's side |
| 162 |
@@ -2751,7 +2751,7 @@ |
| 163 |
int denied; |
| 164 |
|
| 165 |
if ((denied = cr_candebug( |
| 166 |
-#if REALTIME_TRACK_UNPRIVPROCDBG |
| 167 |
+#ifdef REALTIME_TRACK_UNPRIVPROCDBG |
| 168 |
get_unprivileged_proc_debug(td), |
| 169 |
#else |
| 170 |
fmnt->mntopts & FUSEFS_UNPRIVPROCDBG, |
| 171 |
@@ -2948,7 +2948,7 @@ |
| 172 |
|
| 173 |
} else { |
| 174 |
struct sx *devlock = fdi.slock; |
| 175 |
-#if FUSE_HAS_ACCESS |
| 176 |
+#ifdef FUSE_HAS_ACCESS |
| 177 |
struct fuse_access_in *fai; |
| 178 |
|
| 179 |
if (! (facp->facc_flags & FACCESS_DO_ACCESS)) |
| 180 |
@@ -3056,7 +3056,7 @@ |
| 181 |
|
| 182 |
bzero(&facp, sizeof(facp)); |
| 183 |
if ( |
| 184 |
-#if NO_EARLY_PERM_CHECK_HACK |
| 185 |
+#ifdef NO_EARLY_PERM_CHECK_HACK |
| 186 |
1 |
| 187 |
#else |
| 188 |
dvp->v_vflag & VV_ROOT |
| 189 |
@@ -3281,8 +3281,12 @@ |
| 190 |
DEBUG("we peacefully found that file\n"); |
| 191 |
|
| 192 |
if (flags & ISDOTDOT) { |
| 193 |
- vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td); |
| 194 |
+ VOP_UNLOCK(dvp, 0, td); |
| 195 |
+ err = vn_lock(pdp, cnp->cn_lkflags, td); |
| 196 |
VREF(pdp); |
| 197 |
+ vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); |
| 198 |
+ if (err) |
| 199 |
+ goto out; |
| 200 |
*vpp = pdp; |
| 201 |
} else if (nid == VTOI(dvp)) { |
| 202 |
VREF(dvp); /* We want ourself, ie "." */ |
| 203 |
@@ -3347,7 +3351,7 @@ |
| 204 |
if (islastcn && flags & ISOPEN) |
| 205 |
((struct fuse_vnode_data *)(*vpp)->v_data)->flags |= FVP_ACCESS_NOOP; |
| 206 |
|
| 207 |
-#if ! NO_EARLY_PERM_CHECK_HACK |
| 208 |
+#ifndef NO_EARLY_PERM_CHECK_HACK |
| 209 |
if (! islastcn) { |
| 210 |
/* We have the attributes of the next item |
| 211 |
* *now*, and it's a fact, and we do not have |
| 212 |
@@ -3486,7 +3490,7 @@ |
| 213 |
return (0); |
| 214 |
} |
| 215 |
|
| 216 |
-#if FUSE_HAS_CREATE |
| 217 |
+#ifdef FUSE_HAS_CREATE |
| 218 |
static __inline int |
| 219 |
create_filehandle(struct vnode *vp, struct thread *td, struct ucred *cred, |
| 220 |
int mode, struct fuse_dispatcher *fdip) |
| 221 |
@@ -3643,7 +3647,7 @@ |
| 222 |
* the vnode... if the vnode is a germ, it will be tried to be initialized |
| 223 |
* via a dedicated method, but from that on we go on as usual.) |
| 224 |
*/ |
| 225 |
-#if FUSE_HAS_CREATE |
| 226 |
+#ifdef FUSE_HAS_CREATE |
| 227 |
if (vp->v_op == &fuse_germ_vnops) { |
| 228 |
KASSERT(gefhp, ("create_filehandle called without get_filehandle_param")); |
| 229 |
gone_create = 1; |
| 230 |
@@ -3709,7 +3713,7 @@ |
| 231 |
if ((err = fdisp_wait_answ(&fdi))) |
| 232 |
goto out; |
| 233 |
|
| 234 |
-#if FUSE_HAS_CREATE |
| 235 |
+#ifdef FUSE_HAS_CREATE |
| 236 |
setup_filehandle: |
| 237 |
#endif |
| 238 |
foo = fdi.answ; |
| 239 |
@@ -4184,7 +4188,7 @@ |
| 240 |
#define BSD_FUSE_PAGENO_BOUND MIN(FUSE_MAX_PAGES_PER_REQ, MAXBSIZE / PAGE_SIZE) |
| 241 |
|
| 242 |
bcount = MIN(MAXBSIZE, biosize * BSD_FUSE_PAGENO_BOUND); |
| 243 |
-#if BIOREAD_CONSIDER_FILE_SIZE |
| 244 |
+#ifdef BIOREAD_CONSIDER_FILE_SIZE |
| 245 |
if (vp->v_type != VDIR) { |
| 246 |
/* |
| 247 |
* for directories we can't predict the size, in fact |
| 248 |
@@ -4493,7 +4497,7 @@ |
| 249 |
break; |
| 250 |
} |
| 251 |
|
| 252 |
-#if ZERO_PAD_INCOMPLETE_BUFS |
| 253 |
+#ifdef ZERO_PAD_INCOMPLETE_BUFS |
| 254 |
if (isbzero(buf), FUSE_NAME_OFFSET) { |
| 255 |
err = -1; |
| 256 |
break; |
| 257 |
@@ -4658,7 +4662,7 @@ |
| 258 |
struct vnode *dvp = ap->a_dvp; |
| 259 |
struct vnode **vpp = ap->a_vpp; |
| 260 |
struct vattr *vap = ap->a_vap; |
| 261 |
-#if FUSE_HAS_CREATE |
| 262 |
+#ifdef FUSE_HAS_CREATE |
| 263 |
struct fuse_dispatcher fdi; |
| 264 |
struct fuse_vnode_data *fvdat; |
| 265 |
int err; |
| 266 |
@@ -4949,7 +4953,7 @@ |
| 267 |
if (err) |
| 268 |
goto out; |
| 269 |
|
| 270 |
-#if ! DONT_DO_CHECKPATH |
| 271 |
+#ifndef DONT_DO_CHECKPATH |
| 272 |
if (doingdirectory && fdvp != tdvp) { |
| 273 |
/* |
| 274 |
* Check for pathname conflict. |
| 275 |
@@ -5741,7 +5745,7 @@ |
| 276 |
chunksize, (long long unsigned)fri->offset, respsize); |
| 277 |
|
| 278 |
if (respsize < chunksize) { |
| 279 |
-#if ZERO_PAD_INCOMPLETE_BUFS |
| 280 |
+#ifdef ZERO_PAD_INCOMPLETE_BUFS |
| 281 |
/* |
| 282 |
* "if we don't get enough data, just fill the |
| 283 |
* rest with zeros." |
| 284 |
@@ -5888,7 +5892,7 @@ |
| 285 |
"vp=%p, rc=%d", bp, vp, rc)); |
| 286 |
} |
| 287 |
|
| 288 |
-#if FUSE_HAS_CREATE |
| 289 |
+#ifdef FUSE_HAS_CREATE |
| 290 |
static int |
| 291 |
fuse_germ_access(struct vop_access_args *ap) |
| 292 |
{ |
| 293 |
@@ -5908,7 +5912,7 @@ |
| 294 |
|
| 295 |
/* Modeled after tunclone() of net/if_tun.c |
| 296 |
*/ |
| 297 |
-#if USE_OLD_CLONEHANDLER_API |
| 298 |
+#ifdef USE_OLD_CLONEHANDLER_API |
| 299 |
static void |
| 300 |
fusedev_clone(void *arg, char *name, int namelen, struct cdev **dev) |
| 301 |
#else |
| 302 |
@@ -6019,7 +6023,7 @@ |
| 303 |
fuse_fileops.fo_close = fuse_close_f; |
| 304 |
fuse_fileops.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE; |
| 305 |
|
| 306 |
-#if FUSE_HAS_CREATE |
| 307 |
+#ifdef FUSE_HAS_CREATE |
| 308 |
memcpy(&fuse_germ_vnops, &dead_vnodeops, sizeof(struct vop_vector)); |
| 309 |
fuse_germ_vnops.vop_access = fuse_germ_access; |
| 310 |
fuse_germ_vnops.vop_open = fuse_open; |