[Kos-cvs] kos/modules/fs/devfs devfs.c,1.6,1.7
thomas at kos.enix.org
thomas at kos.enix.org
Tue Dec 28 19:44:21 CET 2004
Update of /var/cvs/kos/kos/modules/fs/devfs
In directory the-doors:/tmp/cvs-serv10813/modules/fs/devfs
Modified Files:
devfs.c
Log Message:
2004-12-28 Thomas Petazzoni <thomas at crazy.kos.nx>
* modules/x86/task/task.c: Try to restrict access to exported
symbol.
* modules/x86/task/_thread_cpu_context.c: Move to the new PMM
system.
* modules/x86/task/Makefile (all): arch_task.ro instead of
arch-task.ro.
* modules/x86/mm/_team_mm_context.c: More informations.
* modules/x86/mm/_mm.h, modules/x86/mm/mm.c, modules/x86/mm/_rmap.c,
modules/x86/mm/_vmap.c: The new VMAP/RMAP system. We also make
sure access to all exported function is restricted to the VMM
module.
* modules/x86/mm/Makefile (all): arch_mm.ro instead of
arch-mm.ro.
* modules/x86/lib/Makefile (all): Rename to arch_lib.ro instead of
arch-lib.ro.
* modules/x86/internals.h: More definitions on the address space
configuration.
* modules/vmm/vmm.h (struct address_space): Add a mutex and a
spinlock to protect address space.
* modules/vmm/vmm.c: Restrict access to some exported
functions. More work has to be done in this area.
* modules/vmm/_vmm_map.c: Part of the new vmap system.
* modules/vmm/_vmm_as.c: Make the appropriate lock/unlock on the
address space mutex. It's just a first try. More reflexion has to
be made.
* modules/task/task.h: Make sure DOXYGEN doesn't try to analyze
the #if stuff, because it doesn't like it.
* modules/task/_task_utils.c (show_all_thread_info): If team is
NULL, it means that we want to display the threads of all teams.
* modules/scheduler/synchq.h: Avoid inclusion of task.h.
* modules/pmm/pmm.c: New PMM system.
* modules/pmm/_pmm_put_page.c: New PMM system.
* modules/pmm/_pmm_init.c: New PMM system.
* modules/pmm/_pmm_get_page.c: New PMM system.
* modules/pmm/_pmm_get_at_addr.c: New PMM system.
* modules/pmm/_pmm.h: struct gpfme is now private.
* modules/pmm/pmm.h: struct gpfme is now private (migrated to
_pmm.h).
* modules/pmm/Makefile (OBJS): New PMM system, with fewer
functionnalities.
* modules/kos/spinlock.h: New type spinlock_flags_t, that should
be used instead of k_ui32_t for spinlock flags.
* modules/kmem/_kvmem_utils.c: Migration to the new PMM
system and various cleanups.
* modules/kmem/_kvmem_init.c: Migration to the new PMM
system and various cleanups.
* modules/kmem/_kslab_cache_grow.c: Migration to the new PMM
system and various cleanups.
* modules/kmem/_kslab_cache_free.c: Migration to the new PMM
system, and various cleanups.
* modules/kitc/_kmutex.c: DEBUG_PRINT3 calls to show mutex
lock/unlock/trylock.
* modules/init/_init_modules.c (init_modules): A message is
displayed when initializating modules.
* modules/ide/_ide.c: Various cleanups.
* modules/fs/fat/_fat.c: Various cleanups.
* modules/fs/devfs/devfs.c: Various cleanups, including whitespace
cleanification.
* modules/debug/debug.h: Add the DEBUG_PRINT1, DEBUG_PRINT2,
DEBUG_PRINT3 macros. Maybe there's a cleaner way to do it. David ?
* modules/debug/debug.c (init_module_level0): Init the
backtracking stuff a little later so that we have debugging
messages during this initialization.
* modules/debug/bt.c (_init_backtracing_stuff): bt_next is not
anymore a valid candidate to determine if fomit-frame-pointer was
selected or not, because of gcc optimizations. We use bt_init
instead.
* modules/Makefile (doc): Add a target that generates the doxygen
documentation.
* loader/mod.h (EXPORT_FUNCTION_RESTRICTED): Change the symbol
names generated by the macros, so that they include the name of
the target module (the one allowed to import the exported
symbol). This is needed in order to export the same symbol to
multiple modules. Previously, the RESTRICTED system generated
symbols that were identical for a given symbol exported to
multiple modules.
* doc/testingfr.tex: A big update to this documentation. Not
finished. The english version should also be updated.
* TODO: Some new things to do.
* MkVars (CFLAGS): Pass the DEBUG_LEVEL Makefile variable to the C
files. In each modules/.../Makefile, we can set a
DEBUG_LEVEL=value that will set the level of verbosity of the
module. Macros named DEBUG_PRINT1, DEBUG_PRINT2, DEBUG_PRINT3 have
been added.
(MODULES): Change all '-' to '_', because of the new
EXPORT_FUNCTION_RESTRICTED system. This system creates symbol that
contains the name of a module (the one allowed to import the
exported symbol). But the '-' character is not allowed inside C
identifiers. So, we use '_' instead.
* CREDITS: Add Fabrice Bellard to the CREDITS, for his Qemu
emulator.
Index: devfs.c
===================================================================
RCS file: /var/cvs/kos/kos/modules/fs/devfs/devfs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- devfs.c 29 Dec 2003 13:42:50 -0000 1.6
+++ devfs.c 28 Dec 2004 18:44:19 -0000 1.7
@@ -31,26 +31,24 @@
char *group;
};
-/** Registers a device in the device filesystem.
- *
- * @param group The directory inside the device filesystem where the
- * device will be registered (for example : 'disk',
- * 'part', 'sound', etc..).
+/** Registers a device in the device filesystem.
*
- * @param dev_name The name of the device in the device filesystem.
+ * @param group The directory inside the device filesystem where the
+ * device will be registered (for example : 'disk',
+ * 'part', 'sound', etc..).
*
- * @param nb_views The number of interfaces supported by the device.
+ * @param dev_name The name of the device in the device filesystem.
*
- * @param view The implementation of the supported interfaces.
+ * @param kres The kernel ressources that corresponds to the device
+ * being registered.
*
- * @param device_id Where to return the ID of the device in the
- * device filesystem.
+ * @param device_id Where to return the ID of the device in the
+ * device filesystem.
*
- * @return 0 on success, an error code on failure
+ * @return ESUCCESS on success, an error code on failure
*/
-result_t devfs_register(const char *group, const char *dev_name,
- struct kres *kres,
- dev_t *device_id)
+result_t devfs_register(const char *group, const char *dev_name,
+ struct kres *kres, dev_t *device_id)
{
struct devfs_device *ndev;
@@ -69,31 +67,31 @@
ndev->group = strdup(group);
ndev->dev = strdup(dev_name);
ndev->kres = kres;
-
+
list_add_tail(devices_list, ndev);
*device_id = (dev_t) ndev;
- return 0;
+ return ESUCCESS;
}
/** Unregisters a device from the device filesystem
*
- * @param device_id The ID of the device to unregister. This ID is
- * the one that is returned (in the device_id
- * parameter) by the devfs_register() function.
+ * @param dev_id The ID of the device to unregister. This ID is
+ * the one that is returned (in the device_id
+ * parameter) by the devfs_register() function.
*
- * @return 0 on success, an error code on failure
+ * @return ESUCCESS on success, an error code on failure
*/
result_t devfs_unregister(dev_t dev_id)
{
struct devfs_device *dev;
-
+
if (dev_id == 0)
return -1;
dev = (struct devfs_device *)dev_id;
-
+
/** remove the device from the directory */
list_delete(devices_list, dev);
@@ -101,29 +99,29 @@
kfree(dev->dev);
kfree(dev);
- return 0;
+ return ESUCCESS;
}
/** The devfs is mounted. The root point and group directories must
* support the directory interface.
- *
+ *
*/
-static result_t devfs_lookup(struct ures *ures, const char *name,
+static result_t devfs_lookup(struct ures *ures, const char *name,
struct kres **kr);
-struct INTERFACE_DIR devfs_dir =
+struct INTERFACE_DIR devfs_dir =
{
devfs_lookup
};
-/** devfs must register in the fs_support
+/** devfs must register in the fs_support
*/
-static result_t devfs_attach(struct ures *block_device_sr, struct kres **kres,
+static result_t devfs_attach(struct ures *block_device_sr, struct kres **kres,
void **fs_infos, void *conf);
static result_t devfs_detach(void *fs_infos);
-struct filesystem devfs_fs =
+struct filesystem devfs_fs =
{
.attach = devfs_attach,
.detach = devfs_detach
@@ -135,7 +133,7 @@
.group = NULL
};
-struct view devfs_root_view_dir =
+struct view devfs_root_view_dir =
{ .iid = INTERFACE_DIR_ID,
.nb_ops = INTERFACE_DIR_NB_OPS,
.ops = INTERFACE_OPS(& devfs_dir),
@@ -146,17 +144,17 @@
struct kres devfs_root_kres;
-static result_t devfs_attach(struct ures *device, struct kres **kres,
+static result_t devfs_attach(struct ures *device, struct kres **kres,
void **fs_infos, void *conf)
{
UNUSED(conf);
-
+
/* In the case of devfs, there is NO underlying device, so this
pointer should be NULL */
ASSERT(device == NULL);
ASSERT(kres != NULL);
ASSERT(fs_infos != NULL);
-
+
/* Devfs is now mounted, and cannot be mounted more than once */
devfs_mounted = 1;
@@ -173,12 +171,12 @@
static result_t devfs_detach(void *fs_infos)
{
UNUSED(fs_infos);
-
+
return -ENOSYS;
}
-static result_t devfs_lookup(struct ures *ures, const char *name,
+static result_t devfs_lookup(struct ures *ures, const char *name,
struct kres **kr)
{
struct devfs_view_data *data;
@@ -191,7 +189,7 @@
ASSERT_FATAL(data != NULL);
- if(data->type == ROOT_KRES)
+ if(data->type == ROOT_KRES)
{
/* We are at the root of the filesystem, looking for the correct
group. Let's see whether such a group already exists. */
@@ -209,7 +207,7 @@
result_t result;
kres = kmalloc(sizeof(struct kres));
- if(kres == NULL)
+ if(kres == NULL)
{
return -ENOMEM;
}
@@ -251,7 +249,7 @@
}
*kr = kres;
-
+
return 0;
}
}
@@ -275,11 +273,11 @@
!strcmp(device->dev, name))
{
*kr = device->kres;
-
+
return 0;
}
}
-
+
return -ENOENT;
}
@@ -335,11 +333,11 @@
printk("FAILED : %d)\n", result);
return result;
}
- else
+ else
{
printk("Ok)\n");
}
-
+
return 0;
}
More information about the Kos-cvs
mailing list