Re: Vnode API cleanup pass 2a

2014-01-04 Thread J. Hannken-Illjes
On Dec 31, 2013, at 11:34 AM, J. Hannken-Illjes hann...@eis.cs.tu-bs.de wrote:

 On Dec 30, 2013, at 10:58 PM, David Holland dholland-t...@netbsd.org wrote:
 
 On Mon, Dec 30, 2013 at 11:35:48AM +0100, J. Hannken-Illjes wrote:
 The layered file systems hashlists currently have to work on locked
 vnodes as the vnode operations returning vnodes return them locked.
 
 This leads to some very dirty hacks -- see layer_node_find() from
 sys/miscfs/genfs/layer_subr.c for example.
 
 The best solution is to change these vnode operations to return
 unlocked (and referenced) vnodes.
 
 The attached diff implements this change for operations create, mknod,
 mkdir and symlink.  It passes the atf test suite and some file system
 stress tests I use here.
 
 Comments or objections anyone?
 
 My first thought is that I really don't think it's a good idea to
 change important semantic properties (particularly locking) of calls
 from what's effectively a public API without changing the signatures
 too so old code won't compile.
 
 Ok.  Will add an API version argument to vnode_if.src so
 
   vop_mkdir {
 + VERSION 1
   IN LOCKED=YES WILLPUT struct vnode *dvp;
 
 will rename vop_mkdir_desc to vop_mkdir1_desc and then change all
 file systems to use the new desc.
 
 Also, since what you're doing is basically unlocking before return in
 every implementation, and then relocking after return at every call
 site, it's possible to do one op at a time; it seems like that would
 be a good idea in case unexpected problems crop up.
 
 This is not what I'm doing.
 
 Many file systems use one internal function to create a new inode and
 where possible I change this function to return the node unlocked.
 
 Relocking is done only for nfs server, vn_open() and temporarily for
 layered file systems.  The operations from vfs_syscalls.c all change
 vput() to vrele().
 
 Unlocking and relocking should not itself be a problem since AFAIK
 there isn't any reason for those locks to be held in the first place;
 however, I think I'd better go review all the call sites just in case.
 
 Plus I think it would be advisable to make this change first, so that
 in case we do find a site where it matters we can lock the returned
 object before anyone else can see it:
 
 #
 -#% mkdir  dvp L U U
 +#% mkdir  dvp L L L
 
 Where should it matter? VOP_MKDIR is only used from:
 
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c:zfs_replay_create()
 sys/kern/vfs_syscalls.c:do_sys_mkdirat()
 sys/nfs/nfs_serv.c:nfsrv_mkdir()
 sys/fs/union/union_vnops.c:union_mkdir()
 sys/fs/union/union_subr.c:union_mkshadow()
 sys/rump/librump/rumpvfs/rumpvnode_if.c:RUMP_VOP_MKDIR()
 
 and I don't see any problems here.

Put an updated diff to http://www.netbsd.org/~hannken/vnode-pass2a-1.diff

This diff adds API version, diffs to vnode_if.{sh,src} attached.

Further comments or objections anyone?

--
J. Hannken-Illjes - hann...@eis.cs.tu-bs.de - TU Braunschweig (Germany)



vnode-pass2a-new.diff
Description: Binary data



Mostly working uts(4) touchscreen

2014-01-04 Thread Alexander Nasonov
Touchscreen of my new notebook was reporting touchscreen has no
range report which turned out to be Z-axis related and I thought
that always passing z=0 might solve the problem.

And it indeed mostly solved the problem. I can move the mouse and
click inside the modular Xorg. The only problem is that the mouse
moves two times faster to the right and 4-5 faster to the bottom.

Basically, it works like if I had a small touchpad at the top left
corner of my screen.

If I'm in a text mode and run 'wsmoused -d /dev/wsmouse1', the
cursor doesn't move at all but it flashes (in the center of the
screen) when I touch the screen.

I wonder where should I make the last change to restore 1:1 mappings
between movements and screen pixels?

Excerpts from dmesg, xorg.conf and my patch to dev/usb/uts.c are below.

Alex

Section InputDevice
Identifier  Mouse1
Driver  mouse
Option  Protocol wsmouse
Option  Device /dev/wsmouse1
Option  ZAxisMapping X
EndSection

$ dmesg |grep uhid
uhidev0 at uhub2 port 3 configuration 1 interface 0
uhidev0: eGalax Inc. eGalaxTouch EXC7910-1031-12.00.03, rev 2.00/31.04, addr 5, 
iclass 3/1
uhidev0: 7 report ids
uhid0 at uhidev0 reportid 3: input=63, output=63, feature=0
uhid1 at uhidev0 reportid 5: input=0, output=0, feature=2
uts0 at uhidev0 reportid 6wsmouse1 at uts0 mux 0
uhid2 at uhidev0 reportid 7: input=0, output=0, feature=256
uhidev0 at uhub2 port 3 configuration 1 interface 0
uhidev0: eGalax Inc. eGalaxTouch EXC7910-1031-12.00.03, rev 2.00/31.04, addr 5, 
iclass 3/1
uhidev0: 7 report ids
uhid0 at uhidev0 reportid 3: input=63, output=63, feature=0
uhid1 at uhidev0 reportid 5: input=0, output=0, feature=2
uts0 at uhidev0 reportid 6wsmouse1 at uts0 mux 0
uhid2 at uhidev0 reportid 7: input=0, output=0, feature=256
uhidev0 at uhub2 port 3 configuration 1 interface 0
uhidev0: eGalax Inc. eGalaxTouch EXC7910-1031-12.00.03, rev 2.00/31.04, addr 4, 
iclass 3/1
uhidev0: 7 report ids
uhid0 at uhidev0 reportid 3: input=63, output=63, feature=0
uhid1 at uhidev0 reportid 5: input=0, output=0, feature=2
uts0 at uhidev0 reportid 6wsmouse1 at uts0 mux 0
uhid2 at uhidev0 reportid 7: input=0, output=0, feature=256

$ cvs diff -u sys/dev/usb/uts.c
Index: sys/dev/usb/uts.c
===
RCS file: /cvsroot/src/sys/dev/usb/uts.c,v
retrieving revision 1.3
diff -p -u -u -r1.3 uts.c
--- sys/dev/usb/uts.c   5 Jan 2013 23:34:21 -   1.3
+++ sys/dev/usb/uts.c   4 Jan 2014 23:08:03 -
@@ -75,6 +75,7 @@ struct uts_softc {
struct hid_location sc_loc_btn;

int sc_enabled;
+   int z_enabled;

int flags;  /* device configuration */
 #define UTS_ABS0x1 /* absolute position */
@@ -199,13 +200,9 @@ uts_attach(device_t parent, device_t sel
return;
}

-   /* requires HID usage Digitizer:In_Range */
-   if (!hid_locate(desc, size, HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE),
-   uha-reportid, hid_input, sc-sc_loc_z, flags)) {
-   aprint_error_dev(sc-sc_hdev.sc_dev,
-   touchscreen has no range report\n);
-   return;
-   }
+   sc-z_enabled = hid_locate(desc, size,
+   HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE),
+   uha-reportid, hid_input, sc-sc_loc_z, flags);

/* multi-touch support would need HUD_CONTACTID and HUD_CONTACTMAX */

@@ -215,8 +212,12 @@ uts_attach(device_t parent, device_t sel
sc-sc_loc_x.pos, sc-sc_loc_x.size));
DPRINTF((uts_attach: Y\t%d/%d\n,
sc-sc_loc_y.pos, sc-sc_loc_y.size));
-   DPRINTF((uts_attach: Z\t%d/%d\n,
-   sc-sc_loc_z.pos, sc-sc_loc_z.size));
+   if (sc-z_enabled) {
+   DPRINTF((uts_attach: Z\t%d/%d\n,
+   sc-sc_loc_z.pos, sc-sc_loc_z.size));
+   } else {
+   DPRINTF((uts_attach: Z disabled\n));
+   }
 #endif

a.accessops = uts_accessops;
@@ -368,7 +369,7 @@ uts_intr(struct uhidev *addr, void *ibuf
} else
dy = -hid_get_data(ibuf, sc-sc_loc_y);

-   dz = hid_get_data(ibuf, sc-sc_loc_z);
+   dz = sc-z_enabled ? hid_get_data(ibuf, sc-sc_loc_z) : 0;

if (hid_get_data(ibuf, sc-sc_loc_btn))
buttons |= 1;