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

[bluetooth-dev] destroyed proc filesystem



Hi,

After loading the bt.o lkm I wondered about my /proc directory. All
entries that should come from the OpenBT stack are unreadable. Here is
how it nearly looks like:
...
snip
...
-r--------    1 0        0        16781312 kcore
-rw-r--r--    1 0        0               0 ppc_htab
-r--r--r--    1 0        0               0 misc
-r--r--r--    1 0        0               0 

-r--r--r--    1 0        0               0 ribe_bt_buf: Only %d
available (non - fragmented)

-r--r--r--    1 0        0               0 ilable (non - fragmented)

-rw-rw-rw-    1 0        0               0 sdp_srv


I seems to be a problem with the way the proc files are setup in openbt.
I took a look in one of my own drivers that uses the proc filesystem.
Where I used a much simpler way to generate proc entries. I made some
changes to sdp.c to see if it makes any differences ... and it does. The
above screenshot is made AFTER I changed sdp.c to use a different way to
register the sdp_srv proc entry. The others are still untouched. SO
that's why you see an uncorrupted sdp_srv entry and all other entries
are unusable. I am not sure what happened to the /proc directory. When I
unload bt.o, everything looks fine again !

My target is (still) a PowerPC 405 (IBM) with Linux kernel 2.4.2. I get
the same result when I use 2.4.10 on the same target. Did anybody else
get these phenomenon ? Is theresomething wrong with proc implementation
in openbt ? It was working fine on my board for a long time but now this
happens :-(

I attached a diff between the original sdp.c and my version that creates
an usable /proc/sdp_srv entry.
The code is not clean ... it's my (dirty) working version. Perhaps
anybody know what is wrong.

Matthias
150d149
< #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) //MF
153,158d151
< #else
< int sdp_database_read(char *page, char **start, off_t off, int count, 
< 			     int *eof, void *data);
< #endif
< 
< #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
160,165c153
< 			   size_t count, loff_t *offset);
< #else
< int sdp_database_write(struct file *f, const char *buf, 
< 			      unsigned long count, void *data);
< #endif
< 
---
> 				  size_t count, loff_t *offset);
277d264
< #if 0 //MF
287,289d273
< #else
< static struct proc_dir_entry *sdp_proc_entry = NULL; //MF
< #endif //MF
437,453d420
< #if 1 //MF 
<   DSYS("XXX: creating procfile 2.4.x kernel like\n");
<   sdp_proc_entry = create_proc_entry("sdp_srv", S_IFREG | S_IRUGO | S_IWUSR | S_IWUGO, 0);
<   if (sdp_proc_entry)
<     {
<       DSYS("XXX: fine\n");
<       sdp_proc_entry->owner = THIS_MODULE;
<       sdp_proc_entry->read_proc = sdp_database_read;
<       sdp_proc_entry->write_proc = sdp_database_write;
<       procfs_status = 0;
<     }
<   else
<     {
<       DSYS("XXX: failed\n");
<     }
< 
< #else //MF original
456c423
< 	        struct proc_dir_entry *entry;
---
> 		struct proc_dir_entry *entry;
475d441
< #endif //MF
489,490c455
<   //MF	remove_proc_entry(sdp_proc_entry.name, &proc_root);
< 	remove_proc_entry("sdp_srv", &proc_root);
---
> 	remove_proc_entry(sdp_proc_entry.name, &proc_root);
917,918d881
< 
< #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) //MF
928d890
< #endif 
931,932c893,894
< #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) //MF
< static ssize_t sdp_database_read(struct file *f, char *buf, size_t count, loff_t *offset)
---
> ssize_t sdp_database_read(struct file *f, char *buf, 
> 			  size_t count, loff_t *offset)
934,937c896,897
< static int sdp_database_read(char *page, char **start, off_t off, int count, int *eof, void *data)   
< #endif
< #else
< static s32 sdp_database_read(struct inode *inode, struct file * file, char * buf, s32 count)
---
> s32 sdp_database_read(struct inode *inode, struct file * file,
> 		      char * buf, s32 count)
940,944d899
< #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) //MF
< #else
<   char *buf = page;
< #endif
< 
958d912
< # if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) //MF
960,964d913
< #else
< 	memcpy(buf, database_query.query, len);
< #endif /*(LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))*/
< 
< 
974,977d922
< #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) //MF
< #else
<   *start = page;
< #endif
982,983c927
< #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
< static ssize_t sdp_database_write(struct file *f, const char *buf, 
---
> ssize_t sdp_database_write(struct file *f, const char *buf, 
986,990c930
< static int sdp_database_write(struct file *f, const char *buf, 
< 			       unsigned long count, void *data)
< #endif
< #else
< static s32 sdp_database_write(struct inode *inode, struct file * file,
---
> s32 sdp_database_write(struct inode *inode, struct file * file,