summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock/src/bdpart-register.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-02-28 17:19:49 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-03-13 12:24:18 +0100
commit796967c3df40a51a9028bc83d1a4b6dbeae07c3f (patch)
treeedd7251883f74506a69f76e6e9fbf173de195f50 /cpukit/libblock/src/bdpart-register.c
parentlibblock: Documentation (diff)
downloadrtems-796967c3df40a51a9028bc83d1a4b6dbeae07c3f.tar.bz2
libblock: Change bdbuf API
The functions o rtems_bdbuf_get(), o rtems_bdbuf_read(), o rtems_bdbuf_syncdev(), and o rtems_bdbuf_purge_dev(), use now the disk device instead of the device identifier. This makes bdbuf independent of rtems_disk_obtain() and rtems_disk_release(). It is the responsiblity of the file system to obtain the disk device. This also reduces the overhead to get a buffer. The key for the AVL tree uses now the disk device instead of the device identifier. The pointer is interpreted as an unsigned integer. This reduces the memory overhead and makes the comparison operation a bit faster. Removed function rtems_bdbuf_purge_major(). This function was too destructive and could have unpredictable side effects.
Diffstat (limited to 'cpukit/libblock/src/bdpart-register.c')
-rw-r--r--cpukit/libblock/src/bdpart-register.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/cpukit/libblock/src/bdpart-register.c b/cpukit/libblock/src/bdpart-register.c
index 172c8b4964..d937e65e6c 100644
--- a/cpukit/libblock/src/bdpart-register.c
+++ b/cpukit/libblock/src/bdpart-register.c
@@ -47,12 +47,16 @@ rtems_status_code rtems_bdpart_register(
char *logical_disk_marker = NULL;
size_t disk_name_size = strlen( disk_name);
size_t i = 0;
+ int fd = -1;
+ const rtems_disk_device *dd = NULL;
/* Get disk data */
- sc = rtems_bdpart_get_disk_data( disk_name, &disk, &disk_end);
+ sc = rtems_bdpart_get_disk_data( disk_name, &fd, &dd, &disk_end);
if (sc != RTEMS_SUCCESSFUL) {
return sc;
}
+ disk = rtems_disk_get_device_identifier( dd);
+ close( fd);
/* Get the disk device identifier */
rtems_filesystem_split_dev_t( disk, major, minor);
@@ -134,12 +138,16 @@ rtems_status_code rtems_bdpart_unregister(
dev_t disk = 0;
dev_t logical_disk = 0;
size_t i = 0;
+ int fd = -1;
+ const rtems_disk_device *dd = NULL;
/* Get disk data */
- sc = rtems_bdpart_get_disk_data( disk_name, &disk, &disk_end);
+ sc = rtems_bdpart_get_disk_data( disk_name, &fd, &dd, &disk_end);
if (sc != RTEMS_SUCCESSFUL) {
return sc;
}
+ disk = rtems_disk_get_device_identifier( dd);
+ close( fd);
/* Get the disk device identifier */
rtems_filesystem_split_dev_t( disk, major, minor);