Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



Best Regards
  Ouyang kai=B4=D3=CD=F8=D5=BE=B5=C3=B5=BD=B8=FC=B6=E0=D0=C5=CF=A2=A1=A3M=
SN Explorer =C3=E2=B7=D1=CF=C2=D4=D8:http://explorer.msn.com/lccn

------=_NextPart_002_0004_01C20A4F.BD05C000
Content-Type: text/html; charset="gb2312"
Content-Transfer-Encoding: quoted-printable

<HTML><BODY STYLE=3D"font:10pt verdana; border:none;"><DIV>Hi,</DIV> <DIV=
>Very thank your help! Now the box can boot. <BR>I have some other proble=
ms about proc and thread.<BR>From the FreeBSD5.0 viewpoint, there are rea=
l thread in kernel, there are associated with KSE.<BR>So many functions p=
arameters change from proc to thread.<BR>There is the function in RAIDFra=
me in FreeBSD4.x. </DIV> <DIV>int raidlookup(path, p, vpp)<BR>&nbsp;char&=
nbsp;&nbsp; *path;<BR>&nbsp;struct proc *p;<BR>&nbsp;struct vnode **vpp;&=
nbsp;/* result */<BR>{<BR>&nbsp;struct nameidata nd;<BR>&nbsp;struct vnod=
e *vp;<BR>&nbsp;struct vattr va;<BR>&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp; err=
or, flags;</DIV> <DIV>&nbsp;/* Sanity check the p_fd fields.&nbsp; This i=
s really just a hack */<BR>&nbsp;if (!p-&gt;p_fd-&gt;fd_rdir || !p-&gt;p_=
fd-&gt;fd_cdir)<BR>&nbsp;&nbsp;printf("Warning: p_fd fields not set\n");<=
BR>&nbsp;<BR>&nbsp;if (!p-&gt;p_fd-&gt;fd_rdir)<BR>&nbsp;&nbsp;p-&gt;p_fd=
-&gt;fd_rdir =3D rootvnode;<BR>&nbsp;if (!p-&gt;p_fd-&gt;fd_cdir)<BR>&nbs=
p;&nbsp;p-&gt;p_fd-&gt;fd_cdir =3D rootvnode;<BR>&nbsp;NDINIT(&amp;nd, LO=
OKUP, FOLLOW, UIO_SYSSPACE, path, p);<BR>&nbsp;flags =3D FREAD | FWRITE;<=
BR>&nbsp;if ((error =3D vn_open(&amp;nd, flags, 0)) !=3D 0) {<BR>&nbsp;&n=
bsp;rf_printf(2, "RAIDframe: vn_open returned %d\n", error);<BR>&nbsp;&nb=
sp;return (error);<BR>&nbsp;}<BR>&nbsp;vp =3D nd.ni_vp;<BR>&nbsp;if (vp-&=
gt;v_usecount &gt; 1) {<BR>&nbsp;&nbsp;VOP_UNLOCK(vp, 0, p);<BR>&nbsp;&nb=
sp;(void) vn_close(vp, FREAD | FWRITE, p-&gt;p_ucred, p);<BR>&nbsp;&nbsp;=
rf_printf(1, "raidlookup() vp-&gt;v_usecount &gt; 1\n");<BR>&nbsp;&nbsp;r=
eturn (EBUSY);<BR>&nbsp;}<BR>&nbsp;if ((error =3D VOP_GETATTR(vp, &amp;va=
, p-&gt;p_ucred, p)) !=3D 0) {<BR>&nbsp;&nbsp;VOP_UNLOCK(vp, 0, p);<BR>&n=
bsp;&nbsp;(void) vn_close(vp, FREAD | FWRITE, p-&gt;p_ucred, p);<BR>&nbsp=
;&nbsp;rf_printf(1, "raidlookup() VOP_GETATTR returned %d", error);<BR>&n=
bsp;&nbsp;return (error);<BR>&nbsp;}<BR>&nbsp;/* XXX: eventually we shoul=
d handle VREG, too. */<BR>&nbsp;if (va.va_type !=3D VCHR) {<BR>&nbsp;&nbs=
p;VOP_UNLOCK(vp, 0, p);<BR>&nbsp;&nbsp;(void) vn_close(vp, FREAD | FWRITE=
, p-&gt;p_ucred, p);<BR>&nbsp;&nbsp;rf_printf(1, "Returning ENOTBLK\n");<=
BR>&nbsp;&nbsp;return (ENOTBLK);<BR>&nbsp;}<BR>&nbsp;VOP_UNLOCK(vp, 0, p)=
;<BR>&nbsp;NDFREE(&amp;nd, NDF_ONLY_PNBUF);<BR>&nbsp;*vpp =3D vp;<BR>&nbs=
p;return (0);<BR>}</DIV> <DIV>Based on the explain of the thread: struct =
proc&nbsp;*td_proc;&nbsp;/* Associated process. */ in the struct thread.<=
BR>and refer to the CCD code.<BR>I modify this function as following:<BR>=
int raidlookup(path, td, vpp)<BR>&nbsp;char&nbsp;&nbsp; *path;<BR>&nbsp;s=
truct thread *td;<BR>&nbsp;struct vnode **vpp;&nbsp;/* result */<BR>{<BR>=
&nbsp;struct nameidata nd;<BR>&nbsp;struct vnode *vp;<BR>&nbsp;struct vat=
tr va;<BR>&nbsp;struct proc *p;<BR>&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp; erro=
r, flags;</DIV> <DIV>&nbsp;/* Sanity check the p_fd fields.&nbsp; This is=
 really just a hack */<BR>&nbsp;p =3D td-&gt;td_proc;<BR>&nbsp;if (!p-&gt=
;p_fd-&gt;fd_rdir || !p-&gt;p_fd-&gt;fd_cdir)<BR>&nbsp;&nbsp;printf("Warn=
ing: p_fd fields not set\n");<BR>&nbsp;<BR>&nbsp;if (!p-&gt;p_fd-&gt;fd_r=
dir)<BR>&nbsp;&nbsp;p-&gt;p_fd-&gt;fd_rdir =3D rootvnode;<BR>&nbsp;if (!p=
-&gt;p_fd-&gt;fd_cdir)<BR>&nbsp;&nbsp;p-&gt;p_fd-&gt;fd_cdir =3D rootvnod=
e;<BR>&nbsp;NDINIT(&amp;nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, td);<BR>&=
nbsp;flags =3D FREAD | FWRITE;<BR>&nbsp;if ((error =3D vn_open(&amp;nd, &=
amp;flags, 0)) !=3D 0) {<BR>&nbsp;&nbsp;rf_printf(2, "RAIDframe: vn_open =
returned %d\n", error);<BR>&nbsp;&nbsp;return (error);<BR>&nbsp;}<BR>&nbs=
p;vp =3D nd.ni_vp;<BR>&nbsp;if (vp-&gt;v_usecount &gt; 1) {<BR>&nbsp;&nbs=
p;VOP_UNLOCK(vp, 0, td);<BR>&nbsp;&nbsp;(void) vn_close(vp, FREAD | FWRIT=
E, td-&gt;td_ucred, td);<BR>&nbsp;&nbsp;rf_printf(1, "raidlookup() vp-&gt=
;v_usecount &gt; 1\n");<BR>&nbsp;&nbsp;return (EBUSY);<BR>&nbsp;}<BR>&nbs=
p;if ((error =3D VOP_GETATTR(vp, &amp;va, td-&gt;td_ucred, td)) !=3D 0) {=
<BR>&nbsp;&nbsp;VOP_UNLOCK(vp, 0, td);<BR>&nbsp;&nbsp;(void) vn_close(vp,=
 FREAD | FWRITE, td-&gt;td_ucred, td);<BR>&nbsp;&nbsp;rf_printf(1, "raidl=
ookup() VOP_GETATTR returned %d", error);<BR>&nbsp;&nbsp;return (error);<=
BR>&nbsp;}<BR>&nbsp;/* XXX: eventually we should handle VREG, too. */<BR>=
&nbsp;if (va.va_type !=3D VCHR) {<BR>&nbsp;&nbsp;VOP_UNLOCK(vp, 0, td);<B=
R>&nbsp;&nbsp;(void) vn_close(vp, FREAD | FWRITE,td-&gt;td_ucred, td);<BR=
>&nbsp;&nbsp;rf_printf(1, "Returning ENOTBLK\n");<BR>&nbsp;&nbsp;return (=
ENOTBLK);<BR>&nbsp;}<BR>&nbsp;VOP_UNLOCK(vp, 0, td);<BR>&nbsp;NDFREE(&amp=
;nd, NDF_ONLY_PNBUF);<BR>&nbsp;*vpp =3D vp;<BR>&nbsp;return (0);<BR>}</DI=
V> <DIV>Now the system will be crash , when it excutes the "p =3D td-&gt;=
td_proc".<BR>the system Information is :<BR>kernel: type 12 trap, code=3D=
0<BR>Stopped at raidlookup+0x19: movl 0(%eax),%ebx</DIV> <DIV>If I mask t=
he instructions form "p =3D td-&gt;td_proc" to "p-&gt;p_fd-&gt;fd_cdir =3D=
 rootvnode;",<BR>trace the code, I find it will be crash in vn_open.<BR>s=
ystem infor:<BR>Stopped at vn_open+0x9: pushl 0x78(%eax)<BR>Why?<BR>I ana=
lyse the ccd code, it transfered the vn_open function, only change the se=
cond parameter.</DIV> <DIV>&nbsp;</DIV> <DIV>Best Regards</DIV> <DIV>&nbs=
p; Ouyang kai</DIV></BODY></HTML><br clear=3Dall><hr>=B4=D3=CD=F8=D5=BE=B5=
=C3=B5=BD=B8=FC=B6=E0=D0=C5=CF=A2=A1=A3MSN Explorer =C3=E2=B7=D1=CF=C2=D4=
=D8=A3=BA<a href=3D'http://explorer.msn.com/lccn'>http://explorer.msn.com=
/lccn</a><br></p>

------=_NextPart_002_0004_01C20A4F.BD05C000--


------=_NextPart_001_0003_01C20A4F.BD05C000
Content-Type: text/plain; name="help.txt"
Content-Disposition: attachment; filename="help.txt"
Content-Transfer-Encoding: quoted-printable

Hi,
Very thank your help! Now the box can boot.  =20
I have some other problems about proc and thread.