do previous differently - pass ap->a_id down to smbfs_smb_lock()

and smbfs_smb_lockandx() as caddr_t, and mask it to 16bit value
in smbfs_smb_lockandx()
okayed by Martin
This commit is contained in:
jdolecek 2003-02-19 13:51:24 +00:00
parent 5f444770aa
commit 5c10202b37
3 changed files with 11 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_smb.c,v 1.4 2003/02/19 12:44:47 martin Exp $ */
/* $NetBSD: smbfs_smb.c,v 1.5 2003/02/19 13:51:24 jdolecek Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -90,7 +90,7 @@ smbfs_getino(struct smbnode *dnp, const char *name, int nmlen)
}
static int
smbfs_smb_lockandx(struct smbnode *np, int op, u_int32_t pid, off_t start, off_t end,
smbfs_smb_lockandx(struct smbnode *np, int op, caddr_t id, off_t start, off_t end,
struct smb_cred *scred)
{
struct smb_share *ssp = np->n_mount->sm_share;
@ -106,18 +106,18 @@ smbfs_smb_lockandx(struct smbnode *np, int op, u_int32_t pid, off_t start, off_t
return error;
smb_rq_getrequest(rqp, &mbp);
smb_rq_wstart(rqp);
mb_put_uint8(mbp, 0xff); /* secondary command */
mb_put_uint8(mbp, 0xff); /* secondary command */
mb_put_uint8(mbp, 0); /* MBZ */
mb_put_uint16le(mbp, 0);
mb_put_mem(mbp, (caddr_t)&np->n_fid, 2, MB_MSYSTEM);
mb_put_uint8(mbp, ltype); /* locktype */
mb_put_uint8(mbp, 0); /* oplocklevel - 0 seems is NO_OPLOCK */
mb_put_uint32le(mbp, 0); /* timeout - break immediately */
mb_put_uint32le(mbp, 0); /* timeout - break immediately */
mb_put_uint16le(mbp, op == SMB_LOCK_RELEASE ? 1 : 0);
mb_put_uint16le(mbp, op == SMB_LOCK_RELEASE ? 0 : 1);
smb_rq_wend(rqp);
smb_rq_bstart(rqp);
mb_put_uint16le(mbp, pid);
mb_put_uint16le(mbp, (((long) id) & 0xffff)); /* process ID */
mb_put_uint32le(mbp, start);
mb_put_uint32le(mbp, end - start);
smb_rq_bend(rqp);
@ -127,7 +127,7 @@ smbfs_smb_lockandx(struct smbnode *np, int op, u_int32_t pid, off_t start, off_t
}
int
smbfs_smb_lock(struct smbnode *np, int op, int id,
smbfs_smb_lock(struct smbnode *np, int op, caddr_t id,
off_t start, off_t end, struct smb_cred *scred)
{
struct smb_share *ssp = np->n_mount->sm_share;

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_subr.h,v 1.3 2003/02/19 12:44:47 martin Exp $ */
/* $NetBSD: smbfs_subr.h,v 1.4 2003/02/19 13:51:25 jdolecek Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -134,7 +134,7 @@ extern int smbfs_debuglevel;
/*
* smb level
*/
int smbfs_smb_lock(struct smbnode *np, int op, int id,
int smbfs_smb_lock(struct smbnode *np, int op, caddr_t id,
off_t start, off_t end, struct smb_cred *scred);
int smbfs_smb_statfs2(struct smb_share *ssp, struct statfs *sbp,
struct smb_cred *scred);

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_vnops.c,v 1.4 2003/02/19 12:44:47 martin Exp $ */
/* $NetBSD: smbfs_vnops.c,v 1.5 2003/02/19 13:51:25 jdolecek Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -1047,8 +1047,6 @@ smbfs_advlock(v)
struct vnode *vp = ap->a_vp;
struct smbnode *np = VTOSMB(vp);
struct flock *fl = ap->a_fl;
int id = 1 /* ap->a_id */;
/* int flags = ap->a_flags;*/
struct proc *p = curproc;
struct smb_cred scred;
u_quad_t size;
@ -1123,7 +1121,7 @@ smbfs_advlock(v)
error = lf_advlock(ap, &np->n_lockf, size);
if (error)
break;
error = smbfs_smb_lock(np, SMB_LOCK_EXCL, id, start, end, &scred);
error = smbfs_smb_lock(np, SMB_LOCK_EXCL, ap->a_id, start, end, &scred);
if (error) {
ap->a_op = F_UNLCK;
lf_advlock(ap, &np->n_lockf, size);
@ -1131,7 +1129,7 @@ smbfs_advlock(v)
break;
case F_UNLCK:
lf_advlock(ap, &np->n_lockf, size);
error = smbfs_smb_lock(np, SMB_LOCK_RELEASE, id, start, end, &scred);
error = smbfs_smb_lock(np, SMB_LOCK_RELEASE, ap->a_id, start, end, &scred);
break;
case F_GETLK:
error = lf_advlock(ap, &np->n_lockf, size);