Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

Block device class
[Linux 2.6 support]

Block device class. More...

Data Structures

struct  AsyncInfo
struct  mount_point_s
 Structure for holding mount point information. More...


Defines

#define MOUNT_POINT_MAX   256
#define MOUNT_POINT_STRING_SIZE   128

Functions

void block_class_visit (ClassDeviceHandler *self, const char *path, struct sysfs_class_device *class_device, dbus_bool_t is_probing)
char * strip_space (char *str)
void cdrom_check (HalDevice *d, const char *device_file)
void force_unmount (HalDevice *d)
 Force unmount of a patition.

void force_unmount_of_all_childs (HalDevice *d)
 Unmount all partitions that stems from this block device.

dbus_bool_t detect_media (HalDevice *d)
 Check for media on a block device that is not a volume.

void block_class_got_udi (ClassDeviceHandler *self, HalDevice *d, const char *udi)
dbus_bool_t detect_fs_fat (HalDevice *d)
void detect_fs (HalDevice *d)
void block_class_pre_process (ClassDeviceHandler *self, HalDevice *d, const char *sysfs_path, struct sysfs_class_device *class_device)
char * block_class_compute_udi (HalDevice *d, int append_num)
void etc_mtab_process_line (char *s)
 Process a line in /etc/mtab.

dbus_bool_t read_etc_mtab (dbus_bool_t force)
 Reads /etc/mtab and fill out mount_points and num_mount_points variables accordingly.

void sigio_handler (int sig)
 Signal handler for watching /etc.

gboolean foreach_block_device (HalDeviceStore *store, HalDevice *d, gpointer user_data)
void etc_mtab_process_all_block_devices (dbus_bool_t force)
 Load /etc/mtab and process all HAL block devices and set properties according to mount status.

void block_class_removed (ClassDeviceHandler *self, const char *sysfs_path, HalDevice *d)
gboolean foreach_detect_media (HalDeviceStore *store, HalDevice *device, gpointer user_data)
void block_class_tick (ClassDeviceHandler *self)
void block_class_detection_done (ClassDeviceHandler *self)

Variables

mount_point_s mount_points [MOUNT_POINT_MAX]
 Array holding (valid) mount points from /etc/mtab.

int num_mount_points
 Number of elements in mount_points array.

int etc_fd = -1
time_t etc_mtab_mtime = 0
 Last mtime when /etc/mtab was processed.

dbus_bool_t have_setup_watcher = FALSE
 Global to see if we have setup the watcher on /etc.

dbus_bool_t sigio_etc_changed = FALSE
 Will be set to true by the SIGIO handler.

ClassDeviceHandler block_class_handler
 Method specialisations for block device class.

ClassDeviceHandler block_class_handler
 Method specialisations for block device class.


Detailed Description

Block device class.


Function Documentation

void block_class_pre_process ClassDeviceHandler self,
HalDevice *  d,
const char *  sysfs_path,
struct sysfs_class_device *  class_device
[static]
 

Definition at line 649 of file block_class_device.c.

References class_device_get_major_minor(), detect_media(), find_and_set_physical_device(), get_last_element(), hal_device_add_capability(), parse_dec(), and read_single_line().

dbus_bool_t detect_media HalDevice *  d  )  [static]
 

Check for media on a block device that is not a volume.

Parameters:
d Device to inspect; can be any device, but it will only have effect if the device is in the GDL and is of capability block and is not a volume
TRUE iff the GDL was modified

Definition at line 372 of file block_class_device.c.

References force_unmount_of_all_childs().

Referenced by block_class_pre_process(), and foreach_detect_media().

void etc_mtab_process_all_block_devices dbus_bool_t  force  )  [static]
 

Load /etc/mtab and process all HAL block devices and set properties according to mount status.

Also, optionally, sets up a watcher to do this whenever /etc/mtab changes

Parameters:
force Force reading of mtab

Definition at line 1313 of file block_class_device.c.

References have_setup_watcher, read_etc_mtab(), and sigio_handler().

void etc_mtab_process_line char *  s  )  [static]
 

Process a line in /etc/mtab.

The given string will be modifed by this function.

Parameters:
s Line of /etc/mtab

Todo:
FIXME: Use a linked list or something that doesn't restrict us like this

Definition at line 1047 of file block_class_device.c.

References mount_point_s::major, mount_point_s::minor, mount_points, and num_mount_points.

Referenced by read_etc_mtab().

void force_unmount HalDevice *  d  )  [static]
 

Force unmount of a patition.

Must have block.volume=1 and valid block.device

Parameters:
d Device

Definition at line 231 of file block_class_device.c.

References device_property_atomic_update_begin(), device_property_atomic_update_end(), and device_send_signal_condition().

Referenced by force_unmount_of_all_childs().

void force_unmount_of_all_childs HalDevice *  d  )  [static]
 

Unmount all partitions that stems from this block device.

Must have block.is_volume==0

Parameters:
d Device

Definition at line 311 of file block_class_device.c.

References device_send_signal_condition(), and force_unmount().

Referenced by detect_media().

gboolean foreach_detect_media HalDeviceStore *  store,
HalDevice *  device,
gpointer  user_data
[static]
 

Definition at line 1369 of file block_class_device.c.

References detect_media().

dbus_bool_t read_etc_mtab dbus_bool_t  force  )  [static]
 

Reads /etc/mtab and fill out mount_points and num_mount_points variables accordingly.

This function holds the file open for further access

Parameters:
force Force reading of mtab
Returns:
FALSE if there was no changes to /etc/mtab since last invocation or an error occured

Definition at line 1135 of file block_class_device.c.

References etc_mtab_mtime, etc_mtab_process_line(), and num_mount_points.

Referenced by etc_mtab_process_all_block_devices().

void sigio_handler int  sig  )  [static]
 

Signal handler for watching /etc.

Parameters:
sig Signal number

Definition at line 1342 of file block_class_device.c.

References sigio_etc_changed.

Referenced by etc_mtab_process_all_block_devices().


Variable Documentation

ClassDeviceHandler block_class_handler
 

Initial value:

 {
    class_device_init,                  
    block_class_detection_done,         
    class_device_shutdown,              
    block_class_tick,                   
    class_device_accept,                
    block_class_visit,                  
    block_class_removed,                
    class_device_udev_event,            
    class_device_get_device_file_target,
    block_class_pre_process,            
    class_device_post_merge,            
    block_class_got_udi,                
    block_class_compute_udi,            
    "block",                            
    "block",                            
    TRUE,                               
    FALSE                               
}
Method specialisations for block device class.

Definition at line 1408 of file block_class_device.c.


Generated on Sat Apr 24 19:57:48 2004 for HAL by doxygen 1.3.6-20040222