Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

lf_advlock() API change

2 views
Skip to first unread message

Jaromír Doleček

unread,
Jul 21, 2000, 3:00:00 AM7/21/00
to
Hi,
I'd like to change kernel lk_advlock() from current

int lf_advlock __P((struct lockf **,
off_t, caddr_t, int, struct flock *, int));

to

int lf_advlock __P((struct vop_advlock_args *, struct lockf **, u_quad_t));

This matches common usage and also gives added bonus of beeing
FreeBSD-compatible.

Thoughs ? I'd like to pullup this change to 1.5 branch as well.

Jaromir
--
Jaromir Dolecek <jdol...@NetBSD.org> http://www.ics.muni.cz/~dolecek/
@@@@ Wanna a real operating system ? Go and get NetBSD, damn! @@@@

Jason R Thorpe

unread,
Jul 21, 2000, 3:00:00 AM7/21/00
to
On Fri, Jul 21, 2000 at 01:47:20PM +0200, Jaromír Doleček wrote:

> Hi,
> I'd like to change kernel lk_advlock() from current
>
> int lf_advlock __P((struct lockf **,
> off_t, caddr_t, int, struct flock *, int));
>
> to
>
> int lf_advlock __P((struct vop_advlock_args *, struct lockf **, u_quad_t));

What's the u_quad_t at the end? Is that really off_t? If so, it should say
off_t :-)

>
> This matches common usage and also gives added bonus of beeing
> FreeBSD-compatible.
>
> Thoughs ? I'd like to pullup this change to 1.5 branch as well.
>
> Jaromir
> --
> Jaromir Dolecek <jdol...@NetBSD.org> http://www.ics.muni.cz/~dolecek/
> @@@@ Wanna a real operating system ? Go and get NetBSD, damn! @@@@
>

--
-- Jason R. Thorpe <tho...@zembu.com>

Jaromír Doleček

unread,
Jul 21, 2000, 3:00:00 AM7/21/00
to
Jason R Thorpe wrote:
> > int lf_advlock __P((struct vop_advlock_args *, struct lockf **, u_quad_t));
>
> What's the u_quad_t at the end? Is that really off_t? If so, it should say
> off_t :-)

Yes, that should be off_t :)

Jaromír Doleček

unread,
Jul 21, 2000, 3:00:00 AM7/21/00
to
Hi,
here is context diff of related changes. Are there anything else to be
tweaked in lf_advlock() ? Would be good time to change it now :)

XXX
Index: miscfs/specfs/spec_vnops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/specfs/spec_vnops.c,v
retrieving revision 1.48
diff -u -r1.48 spec_vnops.c
--- spec_vnops.c 2000/03/30 12:22:14 1.48
+++ spec_vnops.c 2000/07/21 18:52:58
@@ -730,6 +730,5 @@
} */ *ap = v;
struct vnode *vp = ap->a_vp;

- return (lf_advlock(&vp->v_speclockf, (off_t)0, ap->a_id, ap->a_op,
- ap->a_fl, ap->a_flags));
+ return lf_advlock(ap, &vp->v_speclockf, (off_t)0);
}
Index: msdosfs/msdosfs_vnops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/msdosfs/msdosfs_vnops.c,v
retrieving revision 1.98
diff -u -r1.98 msdosfs_vnops.c
--- msdosfs_vnops.c 2000/06/28 02:49:15 1.98
+++ msdosfs_vnops.c 2000/07/21 18:53:02
@@ -1847,8 +1847,7 @@
} */ *ap = v;
struct denode *dep = VTODE(ap->a_vp);

- return (lf_advlock(&dep->de_lockf, dep->de_FileSize, ap->a_id, ap->a_op,
- ap->a_fl, ap->a_flags));
+ return lf_advlock(ap, &dep->de_lockf, dep->de_FileSize);
}

int
Index: nfs/nfs_vnops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/nfs/nfs_vnops.c,v
retrieving revision 1.114
diff -u -r1.114 nfs_vnops.c
--- nfs_vnops.c 2000/06/27 17:52:36 1.114
+++ nfs_vnops.c 2000/07/21 18:53:08
@@ -3049,8 +3049,7 @@
} */ *ap = v;
struct nfsnode *np = VTONFS(ap->a_vp);

- return (lf_advlock(&np->n_lockf, np->n_size, ap->a_id, ap->a_op,
- ap->a_fl, ap->a_flags));
+ return lf_advlock(ap, &np->n_lockf, np->n_size);
}

/*
Index: ufs/ufs/ufs_vnops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/ufs/ufs/ufs_vnops.c,v
retrieving revision 1.71
diff -u -r1.71 ufs_vnops.c
--- ufs_vnops.c 2000/07/05 22:25:45 1.71
+++ ufs_vnops.c 2000/07/21 18:53:12
@@ -1884,8 +1884,7 @@
} */ *ap = v;
struct inode *ip = VTOI(ap->a_vp);

- return (lf_advlock(&ip->i_lockf, ip->i_ffs_size, ap->a_id, ap->a_op,
- ap->a_fl, ap->a_flags));
+ return lf_advlock(ap, &ip->i_lockf, ip->i_ffs_size);
}

/*
Index: ufs/ext2fs/ext2fs_vnops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/ufs/ext2fs/ext2fs_vnops.c,v
retrieving revision 1.27
diff -u -r1.27 ext2fs_vnops.c
--- ext2fs_vnops.c 2000/06/28 14:16:38 1.27
+++ ext2fs_vnops.c 2000/07/21 18:53:15
@@ -1253,8 +1253,7 @@
} */ *ap = v;
struct inode *ip = VTOI(ap->a_vp);

- return (lf_advlock(&ip->i_lockf, ip->i_e2fs_size, ap->a_id, ap->a_op,
- ap->a_fl, ap->a_flags));
+ return lf_advlock(ap, &ip->i_lockf, ip->i_e2fs_size);
}

/*
Index: kern/vfs_lockf.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/vfs_lockf.c,v
retrieving revision 1.16
diff -u -r1.16 vfs_lockf.c
--- vfs_lockf.c 2000/06/12 14:33:06 1.16
+++ vfs_lockf.c 2000/07/21 18:53:16
@@ -86,14 +86,12 @@
* Do an advisory lock operation.
*/
int
-lf_advlock(head, size, id, op, fl, flags)
+lf_advlock(ap, head, size)
+ struct vop_advlock_args *ap;
struct lockf **head;
off_t size;
- caddr_t id;
- int op;
- struct flock *fl;
- int flags;
{
+ struct flock *fl = ap->a_fl;
struct lockf *lock;
off_t start, end;
int error;
@@ -125,7 +123,7 @@
* Avoid the common case of unlocking when inode has no locks.
*/
if (*head == (struct lockf *)0) {
- if (op != F_SETLK) {
+ if (ap->a_op != F_SETLK) {
fl->l_type = F_UNLCK;
return (0);
}
@@ -141,16 +139,16 @@
MALLOC(lock, struct lockf *, sizeof(*lock), M_LOCKF, M_WAITOK);
lock->lf_start = start;
lock->lf_end = end;
- lock->lf_id = id;
+ lock->lf_id = ap->a_id;
lock->lf_head = head;
lock->lf_type = fl->l_type;
lock->lf_next = (struct lockf *)0;
TAILQ_INIT(&lock->lf_blkhd);
- lock->lf_flags = flags;
+ lock->lf_flags = ap->a_flags;
/*
* Do the requested operation.
*/
- switch (op) {
+ switch (ap->a_op) {

case F_SETLK:
return (lf_setlock(lock));
Index: sys/lockf.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/lockf.h,v
retrieving revision 1.8
diff -u -r1.8 lockf.h
--- lockf.h 2000/06/12 14:33:04 1.8
+++ lockf.h 2000/07/21 18:53:16
@@ -73,8 +73,7 @@

__BEGIN_DECLS
void lf_addblock __P((struct lockf *, struct lockf *));
-int lf_advlock __P((struct lockf **,
- off_t, caddr_t, int, struct flock *, int));
+int lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));
int lf_clearlock __P((struct lockf *));
int lf_findoverlap __P((struct lockf *,
struct lockf *, int, struct lockf ***, struct lockf **));
XXX

0 new messages