How can I use my kernel on DP2?

2002-12-04 Thread kai ouyang
Hi, everybody,
 I found a very strange thing about kernel on DP2.
 I do not know why I compiled my kernel, but I can not boot with it?
Current# uname -a
FreeBSD Current.wtwh.com.cn 5.0-DP2 FreeBSD 5.0-DP2 #1: Sat Nov 16 13:38:33 
GMT 2002 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC  i386
When The box reboot, I explicitly do as follow:
?unload
?load /boot/kernel/kernel
?boot
But the result is the same!!!
Why?

Best Regards
 Ouyang Kai




_
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: setfacl requirements?

2002-12-04 Thread kai ouyang
Hi, everybody,

From Robert N M Watson
(1) UFS_ACL isn't enabled

Yes, I am sure that in my kernel config:
options UFS_ACL
options UFS_EXTATTR
options UFS_EXTATTR_AUTOSTART

(2) Extended attributes aren't available on the file system (shouldn't
   happen for UFS2, but might happen for UFS1 if you don't have
   UFS_EXTATTR and appropriate configuration of EAs) 
I do as the README.alcs
mkdir -p /usr/.attribute/system
cd /.attribute/system
extattrctl initattr -p /usr/ 388 posix1e.acl_access
extattrctl initattr -p /usr/ 388 posix1e.acl_default

(3) The file system isn't mounted with the ACL option: either -o acls (or
   acls in the fstab file), or more reliably, setting the tunefs -a
   enable flag in the file system configuration.
For better or for worse, POSIX.1e defines that getfacl() will print the
current file permissions as an ACL if ACLs aren't available on the file
system.  As such, you're probably just seeing the results of stat()
printed in an ACL form.

I use UFS1. In DP1, the ACL works nice. But in DP2, I have never succeeded.
in DP1, there is no need to add the 'acls' to 'fstab'. Anyway, I also add 
the 'acls' flag to 'fstab', but it fails, too.
The system always say:
Current#cd /usr/
Current#setfacl -m u:oyk:r src
setfacl: acl_get_file() failed: Operation not supported

Best Regards
 Ouyang Kai




_
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Another ACL problem in DP2

2002-12-03 Thread kai ouyang
Hi, everybody,
 I have some problem when I using 'ACL'.
My operations as follow:
my kernel config file include:
options UFS_ACL 
options UFS_EXTATTR
options UFS_EXTATTR_AUTOSTART

I want to do the ACL in the /usr filesystem.
#mkdir -p /usr/.attribute/system
#cd /usr/.attribute/system
#extattrctl initattr -p /usr/ 388 posix1e.acl_access
#extattrctl initattr -p /usr/ 388 posix1e.acl_default 
Then, I reboot my box.
I want to restrict 'Jack' not to access '/usr/games'.
So:
#cd /usr
#setfacl -m u:Jack: games
But the system print:
setfacl: acl_get_file() failed: Operation not supported

Why? Later, I use getfacl to check, the info as follow:
#getfacl games
#file:games
#owner:0
#group:0
user::rwx
group::r-x
other::r-x

When I use the 'ACL' on DP1's root filesystem, it works nice. Now I am 
using DP2.
Thank you!
Best Regards
 Ouyang Kai




_
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger: http://messenger.msn.com/cn 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


How can I test RAIDFrame based on DEVFS GEOM?

2002-12-02 Thread kai ouyang
Hi, everybody,
 I could not create the device name based on DEVFS.
 I use devfs rule apply path raidctl unhide command, but in /dev/, 
there is nothing about 'raidctl'. So I could not RAIDFrame.
 Another, I can use the 'disklabel -e da2s2' command, but I could not 
modify it.
 I need your help.

 Thank you!

Best Regards
 Ouyang Kai




_
Ãâ·ÑÏÂÔØ MSN Explorer:  http://explorer.msn.com/lccn/ 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


ksetest program cause the system crash!

2002-11-30 Thread kai ouyang
Hi, everybody,
  Have somebody use the /usr/src/tools/KSE/ksetest/ksetest? I want to 
test about KSE. I cvsuped my box a few days ago. my kern_thread.c 
version is 1.66.
When I use the ksetest, the box is crashed.
the information as follow:
Current# ./ksetest 
main() : 0x804c000
eip - 0x280ae973
uts() at : 0x8048e40
uts stack at : 0x814d000 - 0x8155000
main() : 0x804c400
eip - 0x280ae973
uts() at : 0x8048e40
uts stack at : 0x8255000 - 0x825d000
thread_start() : 0x804c800 804c800
thread_start() : 0x826d000 826d000
kse_create() - 0
kse_create() - 0
main() : 0x826d800
eip - 0x280ae973
uts() at : 0x8048e40
uts stack at : 0x837e000 - 0x8386000
main() : 0x826dc00
eip - 0x280ae973
uts() at : 0x8048e40
uts stack at : 0x8486000 - 0x848e000
thread_start() : 0x848e000 848e000
thread_start() : 0x848e800 848e800
thread_start() : 0x84af000 84af000
kse_create() - 0
A
panic: deallocate_dependencies: Un

Where can I search the example programs or documents about KSE?  

Thank everybody!

Best Regards
 Ouyang Kai




_
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


about GEOM 'geoms' chain question

2002-11-24 Thread kai ouyang
Hi, Poul-Henning
 This is my DP2 box's info about 'GEOM' when power on with 'boot -v'. 
GEOM: new disk da0
GEOM: new disk da1
GEOM: new disk da2
MBR Slice 1 on da0:
   80 01 01 00 a5 fe ff 7b 3f 00 00 00 3d a8 da 00  |...{?...=...|
[0] f:80 typ:165 s(CHS):0/1/1 e(CHS):123/254/255 s:63 l:14329917
GEOM: Add da0s1, start 32256 length 7336917504 end 7336949759
GEOM: Configure da0c, start 0 length 36701167104 end 36701167103
GEOM: Configure da0e, start 0 length 36701167104 end 36701167103
MBR Slice 1 on da1:
   80 01 01 00 a5 fe ff 7b 3f 00 00 00 3d a8 da 00  |...{?...=...|
[0] f:80 typ:165 s(CHS):0/1/1 e(CHS):123/254/255 s:63 l:14329917
GEOM: Add da1s1, start 32256 length 7336917504 end 7336949759
GEOM: Configure da1c, start 0 length 36701167104 end 36701167103
MBR Slice 1 on da2:
   80 01 01 00 a5 fe bf 7c 3f 00 00 00 fe 25 9c 00  |...|?%..|
[0] f:80 typ:165 s(CHS):0/1/1 e(CHS):124/254/191 s:63 l:10233342
GEOM: Add da2s1, start 32256 length 5239471104 end 5239503359
MBR Slice 2 on da2:
   80 00 81 7d a5 fe ff ff 3d 26 9c 00 3d 26 9c 00  |...}=..=..|
[1] f:80 typ:165 s(CHS):125/0/129 e(CHS):255/254/255 s:10233405 l:10233405
GEOM: Add da2s2, start 5239503360 length 5239503360 end 10479006719
GEOM: Configure da0s1a, start 0 length 134217728 end 134217727
GEOM: Configure da0s1b, start 134217728 length 244629504 end 378847231
GEOM: Configure da0s1c, start 0 length 7336917504 end 7336917503
GEOM: Configure da0s1d, start 378847232 length 268435456 end 647282687
GEOM: Configure da0s1e, start 647282688 length 268435456 end 915718143
GEOM: Configure da0s1f, start 915718144 length 6421199360 end 7336917503
GEOM: Configure da1s1a, start 0 length 134217728 end 134217727
GEOM: Configure da1s1b, start 134217728 length 244629504 end 378847231
GEOM: Configure da1s1c, start 0 length 7336917504 end 7336917503
GEOM: Configure da1s1d, start 378847232 length 268435456 end 647282687
GEOM: Configure da1s1e, start 647282688 length 268435456 end 915718143
GEOM: Configure da1s1f, start 915718144 length 6421199360 end 7336917503
GEOM: Configure da2s1c, start 0 length 5239471104 end 5239471103
GEOM: Configure da2s1e, start 0 length 5239471104 end 5239471103
GEOM: Configure da2s2c, start 0 length 5239503360 end 5239503359
GEOM: Configure da2s2e, start 0 length 524288000 end 524287999

I am studying your geom code, let me talk my understanding firstly:
'geoms' is a globe var, from the above info and code, my point is:
begin: geoms.tqh_first=NULL, geoms.tqe_prev=geoms.tqh_first;
end: geoms chain is 
-   -   -   ------  -
geoms  da0  da1  da2  Mda0  Sda0  Mda1  Sda1  Mda2  Sda2_1  Sda2_2-
 ^| -   -   -   ------  -   |
   -  -   -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 

I am not sure whether this chain is right?
If we add a partition 'da0s1h' to the box, when we excute the g_attach() 
function,
it will call redo_rank(). My viewpoint is that the 'DEV'(da0s1h) should 
been added between 'Sda0' and 'Mda1'. Based my understanding on 
'redo_rank', this function will change all the 'rank' of the elements on 
the chain, right?
'ad1', 'ad2' and their branches is irrelevant to 'ad0', why their rank must 
change?

Thank your help so much!

Best Regards
 Ouyang Kai


_
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


About gbde questions

2002-11-21 Thread kai ouyang
Hi,everybody,
 I have some puzzles on the 'gbde' function.
 I saw the gbde(4), I do not understand the 'cold' true meaning. My point 
is that if the disk were stealed by somebody, he could not see anything in 
the disk unless he knows the pass-phrase. right?
 In the first barrier, the manual said that metadata is necessary to 
locate the lock-sector, I want to know how we get metadata.
 I added the option GEOM_BDE into my kernel conf file. I am trying
I do as following gbde(8):
Current# gbde init /dev/da1s1f -l /etc/da1s1f.lock
gbde: illegal option -- l
Usage error: Invalid option
Usage:
   gbde attach dest -l filename
   gbde detach dest
   gbde init dest [-i] [-f filename] -l filename
   gbde setkey dest [-n key] -l filename
   gbde destroy dest [-n key] -l filename
Current# touch /etc/da1s1f.lock
Current# gbde init /dev/da1s1f -f /etc/da1s1f.lock
gbde: Missing number_of_keys property

The 'da1s1f' partition exists, but I do not mount it. I first try to test 
'da0s1f', but the box info:gbde: /dev/da0s1f: Device busy.

If I want to test the 'gbde' function, could somebody give me some help? 
How can I do?

Best Regards
 Ouyang Kai




_
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: About gbde questions

2002-11-21 Thread kai ouyang
Hi Everybody,

Poul-Henning Kamp write:

Right.  By cold disk we mean that the pass-phrase and key-material
is not available.  A laptop which is only suspended does _not_ meet
this criteria.

Thank you.

Yes, you want to newfs and mount /dev/da0s1f.bde
I think the -l is a mistake in the usage, it should be -L.

you mean that I must newfs /dev/da0s1f again, but it is my '/var' 
partition.
And I do not find the '/dev/da0s1f.bde' in the '/dev/'. In DEVFS model, I 
do not know how to create a new device name in '/dev/'. And what is the 
'da0s1f.bde'?
I have some puzzles about 'newfs', 'gbde' should protect the whole disk. I 
do not know the relationship of the 'gbde' and the partition.

Best Regards
 Ouyang Kai




_
Ãâ·ÑÏÂÔØ MSN Explorer:  http://explorer.msn.com/lccn/ 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Hi,a little question about DP2.

2002-11-19 Thread kai ouyang
Hi, Everybody
 In the 4.x version, I can use mknod to create a device, for example:
mknod raidctl c 201 0 root:operator.
 But in 5.0, If I use the devfs(default), I do not know how to use some 
command 
to create a device like 'mknod' doing in 4.x.
 Another question:
 In DP2: I found the disk partition 'd' will be used. I know it never be 
used in 4.x, it means the total disk size, right? But in DP2, why it could 
be used?

 Thanks!

Best Regards
 Ouyang Kai



_
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger: http://messenger.msn.com/lccn/ 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: Hi,a little question about DP2.

2002-11-19 Thread kai ouyang

Dear David,

From: David Wolfskill [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Hi,a little question about DP2.
Date: Tue, 19 Nov 2002 18:47:39 -0800 (PST)

From: kai ouyang [EMAIL PROTECTED]
Date: Wed, 20 Nov 2002 10:29:16 +0800

Hi, Everybody
  In the 4.x version, I can use mknod to create a device, for example:
mknod raidctl c 201 0 root:operator.
  But in 5.0, If I use the devfs(default), I do not know how to use some
command
to create a device like 'mknod' doing in 4.x.

My understanding is that withe DEVFS, it is the device driver's
responsibility to create the device node(s) as necessary.

Woo, I saw the 'devfs(8)', but I have no a clear idea to deal with it.
Thank you very much. Let me try:)


  Another question:
  In DP2: I found the disk partition 'd' will be used. I know it never 
be

used in 4.x, it means the total disk size, right? But in DP2, why it 
could

be used?

I think you mean partition 'c'.  And All of my systems that run -CURRENT
also run -STABLE, so I haven't tried things that I know would be
incompatible.

Ouch! This is my problem. I only think when I use FreeBSD4.x default 
partition,
it will never use 'd' partition. But I tested just now, I found the 'd' 
partition could be used.

Cheers,
david   (links to my resume at http://www.catwhisker.org/~david)
--
David H. Wolfskill[EMAIL PROTECTED]
I have no confidence in results obtained through the use of Microsoft 
products.

Best Regards
 Ouyang Kai


_
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: Hi,a little question about DP2.

2002-11-19 Thread kai ouyang
Dear smkelly,

From: Sean Kelly [EMAIL PROTECTED]
To: kai ouyang [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: Hi,a little question about DP2.
Date: Tue, 19 Nov 2002 21:07:49 -0600

On Wed, Nov 20, 2002 at 10:29:16AM +0800, kai ouyang wrote:

You can't `mknod` any device in /dev that isn't known to devfs. Devices 
are

name-based now:

edgemaster# ls -l cuaa0
crw-rw  1 uucp  dialer   28, 128 Nov 18 14:13 cuaa0
edgemaster# mknod newdevice c 28 128
mknod: newdevice: No such file or directory

`mknod` is obsoleted for /dev when using devfs, as the device entries are
created and destroyed dynamically as devices are detected and removed from
the system.

If you accidentally delete a device and aren't sure what the major/minor 
of

it was to recreate it, try something like this:

edgemaster# rm cuaa0
edgemaster# ls -l cuaa0
ls: cuaa0: No such file or directory
edgemaster# devfs rule apply path cuaa0 unhide
edgemaster# ls -l cuaa0
crw-rw  1 uucp  dialer   28, 128 Nov 18 14:13 cuaa0


Woo, thank you.
you mean that I couldn't create device manually when using DEVFS?


Actually it is the 'c' slice that is generally used to indicate the whole
disk. This is still the case in 5.0. However, I am unable to tell you what
'd' used to represent. I am also clueless on this particular detail.

Hope that helps.

I think 'c' partition represents the slice total size rather than the whole
disk size. 
The follow is my DP2 default partition info
#size   offsetfstype   [fsize bsize bps/cpg]
 a:   262144   634.2BSD 2048 16384 16392   # (Cyl.0*- 16*)
 b:   477792   262207  swap# (Cyl.   16*- 46*)
 c: 14329917   63unused0 0 # (Cyl.0*- 
891*)
 d:   524288   734.2BSD 2048 16384 32776   # (Cyl.   46*- 78*)
 e:   524288  12642874.2BSD 2048 16384 32776   # (Cyl.   78*- 
111*)
 f: 12541405  17885754.2BSD 2048 16384 28512   # (Cyl.  111*- 
891*)
cylinders/unit 0
Warning, partition c doesn't start at 0!
Warning, partition c doesn't cover the whole unit!
Warning, An incorrect partition c may cause problems for standard system 
utilities

I don't know why the 'c' partition doesn't start at 0.
It is strange.

--
Sean Kelly | PGP KeyID: 77042C7B
[EMAIL PROTECTED] | http://www.zombie.org

 Thank you!
Best Regards
 Ouyang Kai

_
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: Hi,a little question about DP2.

2002-11-19 Thread kai ouyang
Dear Wollman,

From: Garrett Wollman [EMAIL PROTECTED]
For backwards compatibility, the FreeBSD 4.x kernel would fake up the
partition tables so that they would look like old (pre-slicing)
FreeBSD partition tables; i.e., the starting offset of the slice would
be subtracted from all of the partition offsets on read and added back
in on write.  The disk partitioning subsystem in 5.x doesn't do this.
-GAWollman

Thank you!
I also want to know if I want use LVM(Logical Volume Management), I need 
create
pseudo-device in /dev. How can I do?
In 4.x, I can use  'disklabel' to change partition's size, offset and type, 
but in Current, I coudn't do that.
i.e.  
# disklabel -e /dev/da1s1
disklabel: ioctl DIOCGDINFO: Inappropriate ioctl for device
but the 'da1s1' device-name exists in '/dev'.
For my old experience in DP1, I compile kernel with option 'NO_DEVFS', so I 
can
create pseudo-device as in 4.x.
Whether I must use DP2 without DEVFS to use LVM?
Best Regards
 Ouyang Kai

_
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


a queston about ACL acl_type_t

2002-11-07 Thread kai ouyang
Hi,
 I am trying to understand the ACL implementation in FreeBSD-Current. I 
have a question about ACL.
 in acl.h, there are some acl_type_t value macro:
/*
* Possible valid values for acl_type_t arguments.
*/
#define	ACL_TYPE_ACCESS		0x
#define	ACL_TYPE_DEFAULT	 0x0001
#define	ACL_TYPE_AFS		0x0002
#define	ACL_TYPE_CODA		0x0003
#define	ACL_TYPE_NTFS		0x0004
#define	ACL_TYPE_NWFS		0x0005

But I am not sure what's means.
in the 'setfacl' source, I found the usage:
If we want to control a directory,
 acl[ACL_TYPE_DEFAULT] = acl_get_file(filename, ACL_TYPE_DEFAULT);
if we want to sontrol a file,
 acl[DEFAULT_ACL] = NULL;
Why?
What's the difference among those macros?
Why must a directory object reserve two acl_t_structs, and a file only need 
one?

Thank you!

Best Regards
 Ouyang Kai




_
Ãâ·ÑÏÂÔØ MSN Explorer:  http://explorer.msn.com/lccn/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


how to use the Giant?

2002-08-22 Thread kai ouyang

Hi everyone,
  I find many system call under the control of Giant mutex, I do not know 
when we should call mtx_lock(Giant) and mtx_unlock(Giant). I only know it 
is a global mutex.
  normally, the two functions will occure together. But, in the 
/sys/dev/aac/aac.c aac_host_command(struct aac_softc *sc), before 
kthread_exit, it only calls the mtx_lock(Giant). If I also write one 
kernel thread program, should I use the Giant?
  Thank you!

Best Regards
  Ouyang Kai



_
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger: 
http://messenger.microsoft.com/cn/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Please help: why bufwait() will cause the thread status change to SSLEEP?

2002-06-04 Thread kai ouyang
Dear John and everyone,  I do not know the thread group means what in FreeBSD5.0.Could you give me some information?Now, I mask the code about thread group operations.When I want to get the RAIDFrame information(exist in the disk block).I can call raidread_component_label(), as the following:int raidread_component_label(dev, b_vp, clabel)udev_t dev;struct vnode *b_vp;RF_ComponentLabel_t *clabel;{struct buf *bp;int error;/* XXX should probably ensure that we don't try to do this if someone has changed rf_protected_sectors. */ if (b_vp == NULL) {/* For whatever reason, this component is not valid. Don't try to read a component label from it. */return(EINVAL);} /* get a block of the appropriate size... */bp = geteblk((int)RF_COMPONENT_INFO_SIZE);bp-b_dev = udev2dev(dev, 0); /* get our ducks in a row for the read */bp-b_blkno = RF_COMPONENT_INFO_OFFSET / DEV_BSIZE;bp-b_bcount = RF_COMPONENT_INFO_SIZE;/*oyk add here to support FreeBSD5.0*/bp-b_flags |= BIO_READ;bp-b_resid = RF_COMPONENT_INFO_SIZE / DEV_BSIZE;DEV_STRATEGY(bp, 0);error = bufwait(bp); bp-b_flags |= B_INVAL | B_AGE; bp-b_ioflags = ~BIO_ERROR; if (!error) {memcpy(clabel, bp-b_data, sizeof(RF_ComponentLabel_t));  }brelse(bp); return(error);} Now, when I excute the 'error = bufwait(bp);', the system will be crash. the error informationis also thread status SSLEEP.I do know what will cause the thread status change to SSLEEP.The function in FreeBSD4.x as following:int raidread_component_label(dev, b_vp, clabel)udev_t dev;struct vnode *b_vp;RF_ComponentLabel_t *clabel;{struct buf *bp;int error;/* XXX should probably ensure that we don't try to do this if someone has changed rf_protected_sectors. */  if (b_vp == NULL) {/* For whatever reason, this component is not valid. Don't try to read a component label from it. */return(EINVAL);} /* get a block of the appropriate size... */bp = geteblk((int)RF_COMPONENT_INFO_SIZE);bp-b_dev = udev2dev(dev, 0); /* get our ducks in a row for the read */bp-b_blkno = RF_COMPONENT_INFO_OFFSET / DEV_BSIZE;bp-b_bcount = RF_COMPONENT_INFO_SIZE;bp-b_flags |= B_READ;bp-b_resid = RF_COMPONENT_INFO_SIZE / DEV_BSIZE; BUF_STRATEGY(bp, 0); error = biowait(bp);  if (!error) {memcpy(clabel, bp-b_data, sizeof(RF_ComponentLabel_t)); }brelse(bp); return(error);}I transfer it to FreeBSD5.0 according vinum example.Best RegardsOuyang Kai´ÓÍøÕ¾µÃµ½¸ü¶àÐÅÏ¢¡£MSN Explorer Ãâ·ÑÏÂÔØ£ºhttp://explorer.msn.com/lccn

I do not know the thread group means what in FreeBSD5.0.
Could you give me some information?
Now, I mask the code about thread group operations.
When I want to get the RAIDFrame information(exist in the disk block).
I can call raidread_component_label(), as the following:
int raidread_component_label(dev, b_vp, clabel)
udev_t dev;
struct vnode *b_vp;
RF_ComponentLabel_t *clabel;
{

struct buf *bp;
int error;

/* XXX should probably ensure that we don't try to do this if
   someone has changed rf_protected_sectors. */  
if (b_vp == NULL) {
/* For whatever reason, this component is not valid.
   Don't try to read a component label from it. */
return(EINVAL);
}

/* get a block of the appropriate size... */
bp = geteblk((int)RF_COMPONENT_INFO_SIZE);
bp-b_dev = udev2dev(dev, 0);

/* get our ducks in a row for the read */
bp-b_blkno = RF_COMPONENT_INFO_OFFSET / DEV_BSIZE;
bp-b_bcount = RF_COMPONENT_INFO_SIZE;
/*oyk add here to support FreeBSD5.0*/
bp-b_flags |= BIO_READ;
bp-b_resid = RF_COMPONENT_INFO_SIZE / DEV_BSIZE;
DEV_STRATEGY(bp, 0);
error = bufwait(bp);
bp-b_flags |= B_INVAL | B_AGE;
bp-b_ioflags = ~BIO_ERROR;
if (!error) {
memcpy(clabel, bp-b_data,
   sizeof(RF_ComponentLabel_t));

}
brelse(bp);  
return(error);
}

Now, when I excute the 'error = bufwait(bp);', the system will be crash. the error 
information
is also thread status SSLEEP.
I do know what will cause the thread status change to SSLEEP.
The function in FreeBSD4.x as following:
int raidread_component_label(dev, b_vp, clabel)
udev_t dev;
struct vnode *b_vp;
RF_ComponentLabel_t *clabel;
{
struct buf *bp;
int error;

/* XXX should probably ensure that we don't try to do this if
   someone has changed rf_protected_sectors. */  

if (b_vp == NULL) {
/* For whatever reason, this component is not valid.
   Don't try to read a component label from it. */
return(EINVAL);
}

/* get a block of the appropriate size... */
bp = geteblk((int)RF_COMPONENT_INFO_SIZE);
bp-b_dev = udev2dev(dev, 0);

/* get our ducks in a row for the read */
bp-b_blkno = RF_COMPONENT_INFO_OFFSET / DEV_BSIZE;

Help: from proc to thread?

2002-06-02 Thread kai ouyang
Hi, Very thank your help! Now the box can boot. I have some other problems about proc and thread.From the FreeBSD5.0 viewpoint, there are real thread in kernel, there are associated with KSE.So many functions parameters change from proc to thread.There is the function in RAIDFrame in FreeBSD4.x.  int raidlookup(path, p, vpp)char *path;struct proc *p;struct vnode **vpp;/* result */{struct nameidata nd;struct vnode *vp;struct vattr va;int error, flags; /* Sanity check the p_fd fields. This is really just a hack */if (!p-p_fd-fd_rdir || !p-p_fd-fd_cdir)printf("Warning: p_fd fields not set\n");if (!p-p_fd-fd_rdir)p-p_fd-fd_rdir = rootvnode;if (!p-p_fd-fd_cdir)p-p_fd-fd_cdir = rootvnode;NDINIT(nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, p);flags = FREAD | FWRITE;if ((error = vn_open(nd, flags, 0)) != 0) {rf_printf(2, "RAIDframe: vn_open returned %d\n", error);return (error);}vp = nd.ni_vp;if (vp-v_usecount  1) {VOP_UNLOCK(vp, 0, p);(void) vn_close(vp, FREAD | FWRITE, p-p_ucred, p);rf_printf(1, "raidlookup() vp-v_usecount  1\n");return (EBUSY);}if ((error = VOP_GETATTR(vp, va, p-p_ucred, p)) != 0) {VOP_UNLOCK(vp, 0, p);(void) vn_close(vp, FREAD | FWRITE, p-p_ucred, p);rf_printf(1, "raidlookup() VOP_GETATTR returned %d", error);return (error);}/* XXX: eventually we should handle VREG, too. */if (va.va_type != VCHR) {VOP_UNLOCK(vp, 0, p);(void) vn_close(vp, FREAD | FWRITE, p-p_ucred, p);rf_printf(1, "Returning ENOTBLK\n");return (ENOTBLK);}VOP_UNLOCK(vp, 0, p);NDFREE(nd, NDF_ONLY_PNBUF);*vpp = vp;return (0);} Based on the explain of the thread: struct proc*td_proc;/* Associated process. */ in the struct thread.and refer to the CCD code.I modify this function as following:int raidlookup(path, td, vpp)char *path;struct thread *td;struct vnode **vpp;/* result */{struct nameidata nd;struct vnode *vp;struct vattr va;struct proc *p;int error, flags; /* Sanity check the p_fd fields. This is really just a hack */p = td-td_proc;if (!p-p_fd-fd_rdir || !p-p_fd-fd_cdir)printf("Warning: p_fd fields not set\n");if (!p-p_fd-fd_rdir)p-p_fd-fd_rdir = rootvnode;if (!p-p_fd-fd_cdir)p-p_fd-fd_cdir = rootvnode;NDINIT(nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, td);flags = FREAD | FWRITE;if ((error = vn_open(nd, flags, 0)) != 0) {rf_printf(2, "RAIDframe: vn_open returned %d\n", error);return (error);}vp = nd.ni_vp;if (vp-v_usecount  1) {VOP_UNLOCK(vp, 0, td);(void) vn_close(vp, FREAD | FWRITE, td-td_ucred, td);rf_printf(1, "raidlookup() vp-v_usecount  1\n");return (EBUSY);}if ((error = VOP_GETATTR(vp, va, td-td_ucred, td)) != 0) {VOP_UNLOCK(vp, 0, td);(void) vn_close(vp, FREAD | FWRITE, td-td_ucred, td);rf_printf(1, "raidlookup() VOP_GETATTR returned %d", error);return (error);}/* XXX: eventually we should handle VREG, too. */if (va.va_type != VCHR) {VOP_UNLOCK(vp, 0, td);(void) vn_close(vp, FREAD | FWRITE,td-td_ucred, td);rf_printf(1, "Returning ENOTBLK\n");return (ENOTBLK);}VOP_UNLOCK(vp, 0, td);NDFREE(nd, NDF_ONLY_PNBUF);*vpp = vp;return (0);} Now the system will be crash , when it excutes the "p = td-td_proc".the system Information is :kernel: type 12 trap, code=0Stopped at raidlookup+0x19: movl 0(%eax),%ebx If I mask the instructions form "p = td-td_proc" to "p-p_fd-fd_cdir = rootvnode;",trace the code, I find it will be crash in vn_open.system infor:Stopped at vn_open+0x9: pushl 0x78(%eax)Why?I analyse the ccd code, it transfered the vn_open function, only change the second parameter.  Best Regards  Ouyang kai´ÓÍøÕ¾µÃµ½¸ü¶àÐÅÏ¢¡£MSN Explorer Ãâ·ÑÏÂÔØ£ºhttp://explorer.msn.com/lccn

Hi,
Very thank your help! Now the box can boot.   
I have some other problems about proc and thread.
From the FreeBSD5.0 viewpoint, there are real thread in kernel, there are associated 
with KSE.
So many functions parameters change from proc to thread.
There is the function in RAIDFrame in FreeBSD4.x.   
int raidlookup(path, p, vpp)
 char   *path;
 struct proc *p;
 struct vnode **vpp; /* result */
{
 struct nameidata nd;
 struct vnode *vp;
 struct vattr va;
 int error, flags;
 /* Sanity check the p_fd fields.  This is really just a hack */
 if (!p-p_fd-fd_rdir || !p-p_fd-fd_cdir)
  printf(Warning: p_fd fields not set\n);
   
 if (!p-p_fd-fd_rdir)
  p-p_fd-fd_rdir = rootvnode;
 if (!p-p_fd-fd_cdir)
  p-p_fd-fd_cdir = rootvnode;
 NDINIT(nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, p);
 flags = FREAD | FWRITE;
 if ((error = vn_open(nd, flags, 0)) != 0) {
  rf_printf(2, RAIDframe: vn_open returned %d\n, error);
  return (error);
 }
 vp = nd.ni_vp;
 if (vp-v_usecount  1) {
  VOP_UNLOCK(vp, 0, p);
  (void) vn_close(vp, FREAD | FWRITE, p-p_ucred, p);
  rf_printf(1, raidlookup() vp-v_usecount  1\n);
  return (EBUSY);
 }
 if ((error = VOP_GETATTR(vp, va, p-p_ucred, p)) != 0) {
  VOP_UNLOCK(vp, 0, p);
  (void) vn_close(vp, FREAD | FWRITE, p-p_ucred, p);
  rf_printf(1, raidlookup() VOP_GETATTR returned %d, error);
  return (error);
 }
 /* XXX: eventually we should handle VREG, too. */
 if (va.va_type != VCHR) {
  VOP_UNLOCK(vp, 0, p);
  (void) vn_close(vp, FREAD | 

Re:Help: from proc to thread?

2002-06-02 Thread kai ouyang
 Based on the explain of the thread: struct proc *td_proc; /* Associated process. */ in the struct thread. and refer to the CCD code. I modify this function as following: int raidlookup(path, td, vpp) char *path; struct thread *td; struct vnode **vpp; /* result */ { struct nameidata nd; struct vnode *vp; struct vattr va; struct proc *p; int error, flags; /* Sanity check the p_fd fields. This is really just a hack */ p = td-td_proc; So it dies here?  Now the system will be crash , when it excutes the "p = td-td_proc". the system Information is : kernel: type 12 trap, code=0 Stopped at raidlookup+0x19: movl 0(%eax),%ebx Hmm, can you get the 'faulting va (virtual address)' error message that itprints out? Add a line to the beginning of the function as a sanity check that does: KASSERT(td != NULL, "thread is null"); and compile your kernel with invariants and see if it panics with"thread is null". Yeah, thread is NULL.But I view all the callers, I did not find any assignment to td.I do not know the kernel how assign td to the structure.The RAIDFrame has the similar function as the vinum. I find this problem when I config a RAID level volume.Now, I check the raidctlioctl() function,because the process is here from user space to kernel space.Because the raidlookup's td is gotten from raidctlioctl() function.I add the two line to the latter function.KASSERT(td != NULL, ("raidctlioctl thread is NULL"));KASSERT(raidPtr-engine_thread != NULL, ("raidctlioctl engine thread is NULL"));It debugs in the second line. So, the raidctlioctl funcion has the td, but didn't transfer the parameter to the raidlookup().HI take place the two line by the following lines:KASSERT(td != NULL, ("raidctlioctl thread is NULL"));raidPtr-engine_thread = td;KASSERT(raidPtr-engine_thread != NULL, ("raidctlioctl engine thread is NULL"));now it pass. I want to know when the kernel assign td to raidctlioctl function? Now, the RAIDFrame will be crash here:RF_THREADGROUP_WAIT_START(raidPtr-engine_tg);panic: runq_choose: process 218(raid) in state 3Debugger("panic")Stopped at Debugger+0x40: xorl %eax,%eax raidPtr-engine_tg is the RF_ThreadGroup_s structure. struct RF_ThreadGroup_s {int created;int running;int shutdown;struct mtx mutex; int cond;};/** Wait for all threads to start running*/#define RF_THREADGROUP_WAIT_START(_g_) { \mtx_lock((_g_)-mutex); \while((_g_)-running  (_g_)-created) { \RF_LTSLEEP(((_g_)-cond), PRIBIO, "rfwcond", 0, ((_g_)-mutex)); \} \mtx_unlock((_g_)-mutex); \} RF_LTSLEEP(void *cond, int pri, const char *text, int time, struct mtx *mutex){return (msleep(cond, mutex, pri, text, time));} I man mtx_lock and find it excute after mtx_init().before the macro RF_THREADGROUP_WAIT_START, it call the rf_mtx_init();int rf_mutex_init(m)struct mtx *m;{mtx_init(m, "RAIDFrame FreeBSD5.0", MTX_DEF);return (0);}So. I am puzzled about it.´ÓÍøÕ¾µÃµ½¸ü¶àÐÅÏ¢¡£MSN Explorer Ãâ·ÑÏÂÔØ£ºhttp://explorer.msn.com/lccn

 Based on the explain of the thread: struct proc *td_proc; /* Associated process. */ 
in the struct
 thread.
 and refer to the CCD code.
 I modify this function as following:
 int raidlookup(path, td, vpp)
  char   *path;
  struct thread *td;
  struct vnode **vpp; /* result */
 {
  struct nameidata nd;
  struct vnode *vp;
  struct vattr va;
  struct proc *p;
  int error, flags;
  /* Sanity check the p_fd fields.  This is really just a hack */
  p = td-td_proc;

So it dies here?

 Now the system will be crash , when it excutes the p = td-td_proc.
 the system Information is :
 kernel: type 12 trap, code=0
 Stopped at raidlookup+0x19: movl 0(%eax),%ebx

Hmm, can you get the 'faulting va (virtual address)' error message that it
prints out?

Add a line to the beginning of the function as a sanity check that does:

KASSERT(td != NULL, thread is null);

and compile your kernel with invariants and see if it panics with
thread is null.

Yeah, thread is NULL.
But I view all the callers, I did not find any assignment to td.
I do not know the kernel how assign td to the structure.
The RAIDFrame has the similar function as the vinum. I find this problem  
when I config a RAID level volume.
Now, I check the raidctlioctl() function,because the process is here from user space 
to  
kernel space.
Because the raidlookup's td is gotten from raidctlioctl() function.
I add the two line to the latter function.
KASSERT(td != NULL, (raidctlioctl thread is NULL));
KASSERT(raidPtr-engine_thread != NULL, (raidctlioctl engine thread is NULL));
It debugs in the second line. So, the raidctlioctl funcion has the td, but didn't  
transfer the parameter to the raidlookup().
H
I take place the two line by the following lines:
KASSERT(td != NULL, (raidctlioctl thread is NULL));
raidPtr-engine_thread = td;
KASSERT(raidPtr-engine_thread != NULL, (raidctlioctl engine thread is NULL));
now it pass.

I want to know when the kernel assign td to raidctlioctl function?

Now, the RAIDFrame will be crash here:

Help!

2002-06-01 Thread kai ouyang
Hi, everybody I am working on transfer RaidFrame from FreeBSD4.x to FreeBSD5.0. Scott Long has transfered RAIDFrame from NetBSD to FreeBSD 4.x. Now, I am transfering those codes to FreeBSD5.0. This is my first strolling in FreeBSD5.0 kernel.  Firstly, I transfered some codes based on the relationship of vinum and ccd between 4.x and 5.0. It could compile successfully. Now when I boot the box, the system tell me: panic: sleeping without a mutex Debugger("panic") Stopped at Debugger+0x40: xorl %eax,%eax  I traced the source code and found some information as follow: These is a function on RAIDFrame in the FreeBSD4.x . static __inline intRF_LTSLEEP(void *cond, int pri, const char *text, int time, struct simplelock *mutex){int ret;if (mutex != NULL)simple_unlock(mutex);ret = tsleep(cond, pri, text, time);if (mutex != NULL)simple_lock(mutex);return (ret);} These is the above funtion I modifed to support FreeBSD5.0: static __inline intRF_LTSLEEP(void *cond, int pri, const char *text, int time, struct mtx *mutex){int ret;if (mutex != NULL)mtx_unlock(mutex);ret = tsleep(cond, pri, text, time);if (mutex != NULL)mtx_lock(mutex);return (ret);}  I have a clear ideal to use mtx.  I think there are maybe some problem in using the mtx. Thank you very much! Best RegardsOuyang Kai´ÓÍøÕ¾µÃµ½¸ü¶àÐÅÏ¢¡£MSN Explorer Ãâ·ÑÏÂÔØ£ºhttp://explorer.msn.com/lccn


Re:why change: from proc to thread?

2002-05-28 Thread kai ouyang
 Thank you! I know a little more. From the kthread_create() function, I find Both 4.x and 5.0 are implemented by fork1(). I am puzzled about the structure thread and the structure proc only are different terms. How or what part source code can I find the difference thread realization between 4.x and 5.0?  On Mon, 27 May 2002, kai ouyang wrote: Hi,everybody I found many v_operations, such as VOP_UNLOCK, VOP_OPEN., there all have a parameter(struct proc) in FreeBSD4.x, but, there all be changed to thread in FreeBSD5.0. why? And what relation of the proc and thread ? Thank you!FreeBSD is plannig on supporting threads at a kernel level.To do this, the basic scheduling element becomes the thread instead of theprocess. For this reason, for example, locks must be held by threadsinstead of processes, and contexts are owned by threads instead ofprocesses. This means that most functions will need a thread pointerinstead of a process pointer. The "process" becomes basically anaccounting abstraction and the holder of resources, where most of thekernel is more interested in the thread.Each process has at least one thread, possibly many. Each thread isassociated with exactly one process.julian´ÓÍøÕ¾µÃµ½¸ü¶àÐÅÏ¢¡£MSN Explorer Ãâ·ÑÏÂÔØ£ºhttp://explorer.msn.com/lccn


Re:why change: from proc to thread?

2002-05-28 Thread kai ouyang
Another problem:  There are not the structure 'bio' in FreeBSD 4.x, but exist in 5.0.  If I want to transfer some pseudo-device code from 4.x to 5.0,  what rules about old 'buf' structure to the 'bio' structure? what relation of the 'bio' and 'buf' in FreeBSD5.0? Thank you! Best Regards  Ouyang kai  On Mon, 27 May 2002, kai ouyang wrote: Hi,everybody I found many v_operations, such as VOP_UNLOCK, VOP_OPEN., there all have a parameter(struct proc) in FreeBSD4.x, but, there all be changed to thread in FreeBSD5.0. why? And what relation of the proc and thread ? Thank you!FreeBSD is plannig on supporting threads at a kernel level.To do this, the basic scheduling element becomes the thread instead of theprocess. For this reason, for example, locks must be held by threadsinstead of processes, and contexts are owned by threads instead ofprocesses. This means that most functions will need a thread pointerinstead of a process pointer. The "process" becomes basically anaccounting abstraction and the holder of resources, where most of thekernel is more interested in the thread.Each process has at least one thread, possibly many. Each thread isassociated with exactly one process.julian´ÓÍøÕ¾µÃµ½¸ü¶àÐÅÏ¢¡£MSN Explorer Ãâ·ÑÏÂÔØ£ºhttp://explorer.msn.com/lccn


why change: from proc to thread?

2002-05-27 Thread kai ouyang
Hi,everybody  I found many v_operations, such as VOP_UNLOCK, VOP_OPEN., there all have a parameter(struct proc) in FreeBSD4.x, but,  there all be changed to thread in FreeBSD5.0.why? Andwhat relation of the proc and thread ?   Thank you!Best RegardsOuyang Kai´ÓÍøÕ¾µÃµ½¸ü¶àÐÅÏ¢¡£MSN Explorer Ãâ·ÑÏÂÔØ£ºhttp://explorer.msn.com/lccn


How use UFS_ACL function?

2002-04-18 Thread kai ouyang
Hi everyone,  I has seen the manual and /sys/ufs/ufs/README.* . I add the following to the kernel conf: options UFS_EXTATTR options UFS_EXTATTR_AUTOSTART options UFS_ACL  Then, I saw extattrctl and setextattr's manual. But I do not know what's meaning. For example, I has a user name Jack, who is a wheel member.  I want to deny him to access /boot/, how can I do? Thanks! Best Regards   Ouyang kai´ÓÍøÕ¾µÃµ½¸ü¶àÐÅÏ¢¡£MSN Explorer Ãâ·ÑÏÂÔØ£ºhttp://explorer.msn.com/lccn