|
From: Peter K. <pk...@us...> - 2001-03-06 11:02:37
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.139 1.140=20=20=20=20=20=20=20=20=20=20=20
sdp.c 1.65 1.66=20=20=20=20=20=20=20=20=20=20=20=20
sec_client.c 1.14 1.15=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Moved creation of the sdp_srv and the sec_srv proc-files to
sdp.c and sec_client.c. Also made sure they are always created
independent of CONFIG_BLUETOOTH_PROC.
* Initialise the wait queues for the sdp_srv and the sec_srv proc-files
before the files are created.
The diff of the modified file(s):
--- bluetooth.c 2001/03/06 10:13:49 1.139
+++ bluetooth.c 2001/03/06 11:04:15 1.140
@@ -1923,9 +1923,9 @@
=20=09
sertty =3D NULL;
=20
-#ifdef CONFIG_BLUETOOTH_PROC
DSYS("Registering BT proc files\n");
=20=20
+#ifdef CONFIG_BLUETOOTH_PROC
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
procfs_status =3D -1;
@@ -1968,64 +1968,7 @@
=20
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
{
- struct proc_dir_entry *entry;
- procfs_status =3D -1;
- if ((entry =3D create_proc_entry(sdp_proc_entry.name,
- sdp_proc_entry.mode,
- &proc_root))) {
- /*---------------------------------------------------*/
- /* If the proc entry was registered successfully, */
- /* then set all the necessary structure information. */
- /*---------------------------------------------------*/
- entry->proc_iops =3D sdp_proc_entry.proc_iops;
- entry->proc_fops =3D sdp_proc_entry.proc_fops;
- procfs_status =3D 1;
- }
- }
-#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
- procfs_status =3D proc_register(&proc_root, &sdp_proc_entry);
-#else
- procfs_status =3D proc_register_dynamic(&proc_root, &sdp_proc_entry);
-#endif /* LINUX_VERSION_CODE */
-
- if (procfs_status < 0) {
- D_ERR("Couldn't register proc file for sdp database %d\n",
- procfs_status);
- }
-
-#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
-#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
- {
- struct proc_dir_entry *entry;
procfs_status =3D -1;
- if ((entry =3D create_proc_entry(sec_man_proc_entry.name,
- sec_man_proc_entry.mode,
- &proc_root))) {
- /*---------------------------------------------------*/
- /* If the proc entry was registered successfully, */
- /* then set all the necessary structure information. */
- /*---------------------------------------------------*/
- entry->proc_iops =3D sec_man_proc_entry.proc_iops;
- entry->proc_fops =3D sec_man_proc_entry.proc_fops;
- entry->get_info =3D sec_man_proc_entry.get_info;
- procfs_status =3D 1;
- }
- }
-#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
- procfs_status =3D proc_register(&proc_root, &sec_man_proc_entry);
-#else
- procfs_status =3D proc_register_dynamic(&proc_root, &sec_man_proc_entry);
-#endif /* LINUX_VERSION_CODE */
-
- if (procfs_status < 0) {
- D_ERR("Couldn't register proc file for security manager %d\n",
- procfs_status);
- }
-#endif /* CONFIG_BLUETOOTH_USE_SECURITY_MANAGER */
-
-#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
- {
- procfs_status =3D -1;
if (create_proc_info_entry(bt_proc_doit.name,
bt_proc_doit.mode,
&proc_root,
@@ -2042,6 +1985,7 @@
D_ERR("Couldn't register proc file bt_status %d\n",=20
procfs_status);
}
+#endif /* CONFIG_BLUETOOTH_PROC */
=20
#ifdef CONFIG_BLUETOOTH_USE_TCI
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
@@ -2065,7 +2009,11 @@
}
#endif /* CONFIG_BLUETOOTH_USE_TCI */
=20=09
-#endif /* CONFIG_BLUETOOTH_PROC */
+ sdp_create_proc_file();
+
+#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
+ sec_man_create_proc_file();
+#endif
=20
DSYS("Bluetooth Driver Using ttyBT[0-%d] (data), ttyBTC (ctrl [%d])\n",
BT_NBR_DATAPORTS-1, BT_NBR_PORTS-1);
@@ -2618,26 +2566,23 @@
if (bt_stack_initiated)
bt_shutdown();
=20=09
+#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
+ sec_man_remove_proc_file();
+#endif
+ sdp_remove_proc_file();
+=09
#ifdef CONFIG_BLUETOOTH_PROC
#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
remove_proc_entry(bt_status.name, &proc_root);
remove_proc_entry(bt_internal_info.name, &proc_root);
- remove_proc_entry(sdp_proc_entry.name, &proc_root);
remove_proc_entry(bt_proc_doit.name, &proc_root);
-#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
- remove_proc_entry(sec_man_proc_entry.name, &proc_root);
-#endif /* CONFIG_BLUETOOTH_USE_SECURITY_MANAGER */
#ifdef CONFIG_BLUETOOTH_USE_TCI
remove_proc_entry(tci_proc_entry.name, &proc_root);
#endif /* CONFIG_BLUETOOTH_USE_TCI */
#else
proc_unregister(&proc_root, bt_status.low_ino);
proc_unregister(&proc_root, bt_internal_info.low_ino);
- proc_unregister(&proc_root, sdp_proc_entry.low_ino);
proc_unregister(&proc_root, bt_proc_doit.low_ino);
-#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
- proc_unregister(&proc_root, sec_man_proc_entry.low_ino);
-#endif /* CONFIG_BLUETOOTH_USE_SECURITY_MANAGER */
#ifdef CONFIG_BLUETOOTH_USE_TCI
proc_unregister(&proc_root, tci_proc_entry.low_ino);
#endif /* CONFIG_BLUETOOTH_USE_TCI */
--- sdp.c 2001/03/06 10:13:49 1.65
+++ sdp.c 2001/03/06 11:04:15 1.66
@@ -225,7 +225,7 @@
* proc directories can do almost nothing..
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-struct inode_operations sdp_proc_inode_operations =3D {
+static struct inode_operations sdp_proc_inode_operations =3D {
&sdp_procfile_operation, /* default net file-ops */
NULL, /* create */
NULL, /* lookup */
@@ -245,7 +245,7 @@
NULL /* permission */
};
#else
-struct inode_operations sdp_proc_inode_operations =3D {
+static struct inode_operations sdp_proc_inode_operations =3D {
NULL, /* create */
NULL, /* lookup */
NULL, /* link */
@@ -266,7 +266,7 @@
#endif
=20
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-struct proc_dir_entry sdp_proc_entry =3D {
+static struct proc_dir_entry sdp_proc_entry =3D {
0,
7, "sdp_srv",
S_IFREG | S_IRUGO | S_IWUSR,
@@ -276,7 +276,7 @@
sdp_proc_dir_entry_read,
};
#else
-struct proc_dir_entry sdp_proc_entry =3D {
+static struct proc_dir_entry sdp_proc_entry =3D {
0,
7, "sdp_srv",
S_IFREG | S_IRUGO | S_IWUSR,
@@ -348,7 +348,7 @@
printf("Socket connected to %s\n", server_address.sun_path);
return client_sockfd;
}
-#endif
+#endif /* !__KERNEL__ */
=20
void=20
sdp_init(s32 srv)
@@ -393,16 +393,6 @@
DSYS(__FUNCTION__ ", Init sdp as client\n");
role =3D 0;
}
-
-#ifdef __KERNEL__
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
- database_wq =3D NULL;
- sdp_disc_wq =3D NULL;
-#else
- init_waitqueue_head(&database_wq);
- init_waitqueue_head(&sdp_disc_wq);
-#endif /* LINUX_VERSION_CODE */
-#endif /* __KERNEL__ */
}
=20
void=20
@@ -417,6 +407,62 @@
}
}=20=20
}
+
+#ifdef __KERNEL__
+s32
+sdp_create_proc_file()
+{
+ s32 procfs_status =3D -ENOENT;
+
+ /* The database_wq wait queue must be initialised before anyone tries
+ to read from the /proc/sdp_srv file, so we initialise the wait
+ queues here */
+#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
+ init_waitqueue_head(&database_wq);
+ init_waitqueue_head(&sdp_disc_wq);
+#endif /* LINUX_VERSION_CODE */
+
+#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
+ {
+ struct proc_dir_entry *entry;
+
+ if ((entry =3D create_proc_entry(sdp_proc_entry.name,
+ sdp_proc_entry.mode,
+ &proc_root))) {
+ /*---------------------------------------------------*/
+ /* If the proc entry was registered successfully, */
+ /* then set all the necessary structure information. */
+ /*---------------------------------------------------*/
+ entry->proc_iops =3D sdp_proc_entry.proc_iops;
+ entry->proc_fops =3D sdp_proc_entry.proc_fops;
+ procfs_status =3D 0;
+ }
+ }
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
+ procfs_status =3D proc_register(&proc_root, &sdp_proc_entry);
+#else
+ procfs_status =3D proc_register_dynamic(&proc_root, &sdp_proc_entry);
+#endif /* LINUX_VERSION_CODE */
+
+ if (procfs_status < 0) {
+ D_ERR("Couldn't register proc file for sdp database %d\n",
+ procfs_status);
+ }
+
+ return procfs_status;
+}
+
+s32
+sdp_remove_proc_file()
+{
+#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
+ remove_proc_entry(sdp_proc_entry.name, &proc_root);
+#else
+ proc_unregister(&proc_root, sdp_proc_entry.low_ino);
+#endif
+ return 0;
+}
+#endif /* __KERNEL__ */
=20
s32=20
sdp_connect_req(u8* bd_addr, u8 line)
--- sec_client.c 2001/03/06 10:13:49 1.14
+++ sec_client.c 2001/03/06 11:04:15 1.15
@@ -167,7 +167,7 @@
*/
=20
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-struct inode_operations sec_man_proc_inode_operations =3D {
+static struct inode_operations sec_man_proc_inode_operations =3D {
&sec_man_procfile_operation, /* default net file-ops */
NULL, /* create */
NULL, /* lookup */
@@ -187,7 +187,7 @@
NULL /* permission */
};
#else
-struct inode_operations sec_man_proc_inode_operations =3D {
+static struct inode_operations sec_man_proc_inode_operations =3D {
NULL, /* create */
NULL, /* lookup */
NULL, /* link */
@@ -208,7 +208,7 @@
#endif
=20
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-struct proc_dir_entry sec_man_proc_entry =3D {
+static struct proc_dir_entry sec_man_proc_entry =3D {
0,
7, "sec_srv",
S_IFREG | S_IRUGO | S_IWUSR,
@@ -218,7 +218,7 @@
sec_man_proc_dir_entry_read,
};
#else
-struct proc_dir_entry sec_man_proc_entry =3D {
+static struct proc_dir_entry sec_man_proc_entry =3D {
0,
7, "sec_srv",
S_IFREG | S_IRUGO | S_IWUSR,
@@ -263,6 +263,62 @@
/* To indicate that nothing is ready */
security_query.originator =3D SEC_CLIENT;=20
}
+
+#ifdef __KERNEL__
+s32
+sec_man_create_proc_file()
+{
+ s32 procfs_status =3D -ENOENT;
+
+ /* The sec_man_wq wait queue must be initialised before anyone tries
+ to read from the /proc/sec_srv file, so we initialise the wait
+ queue here */
+#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
+ init_waitqueue_head(&sec_man_wq);
+#endif /* LINUX_VERSION_CODE */
+
+#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
+ {
+ struct proc_dir_entry *entry;
+ procfs_status =3D -1;
+ if ((entry =3D create_proc_entry(sec_man_proc_entry.name,
+ sec_man_proc_entry.mode,
+ &proc_root))) {
+ /*---------------------------------------------------*/
+ /* If the proc entry was registered successfully, */
+ /* then set all the necessary structure information. */
+ /*---------------------------------------------------*/
+ entry->proc_iops =3D sec_man_proc_entry.proc_iops;
+ entry->proc_fops =3D sec_man_proc_entry.proc_fops;
+ entry->get_info =3D sec_man_proc_entry.get_info;
+ procfs_status =3D 0;
+ }
+ }
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
+ procfs_status =3D proc_register(&proc_root, &sec_man_proc_entry);
+#else
+ procfs_status =3D proc_register_dynamic(&proc_root, &sec_man_proc_entry);
+#endif /* LINUX_VERSION_CODE */
+
+ if (procfs_status < 0) {
+ D_ERR("Couldn't register proc file for security manager %d\n",
+ procfs_status);
+ }
+
+ return procfs_status;
+}
+
+s32
+sec_man_remove_proc_file()
+{
+#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0)
+ remove_proc_entry(sec_man_proc_entry.name, &proc_root);
+#else
+ proc_unregister(&proc_root, sec_man_proc_entry.low_ino);
+#endif
+ return 0;
+}
+#endif /* __KERNEL__ */
=20
/* fixme -- add return value for calling functions to indicate status of=
=20
check */
|