patch-2.4.19 linux-2.4.19/drivers/ide/ide-proc.c
Next file: linux-2.4.19/drivers/ide/ide-swarm.c
Previous file: linux-2.4.19/drivers/ide/ide-probe.c
Back to the patch index
Back to the overall index
- Lines: 110
- Date:
Fri Aug 2 17:39:44 2002
- Orig file:
linux-2.4.18/drivers/ide/ide-proc.c
- Orig date:
Fri Sep 7 09:28:38 2001
diff -urN linux-2.4.18/drivers/ide/ide-proc.c linux-2.4.19/drivers/ide/ide-proc.c
@@ -65,6 +65,7 @@
#include <linux/mm.h>
#include <linux/pci.h>
#include <linux/ctype.h>
+#include <linux/hdreg.h>
#include <linux/ide.h>
#include <asm/io.h>
@@ -447,7 +448,15 @@
static int proc_ide_get_identify(ide_drive_t *drive, byte *buf)
{
- return ide_wait_cmd(drive, (drive->media == ide_disk) ? WIN_IDENTIFY : WIN_PIDENTIFY, 0, 0, 1, buf);
+ struct hd_drive_task_hdr taskfile;
+ struct hd_drive_hob_hdr hobfile;
+ memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
+ memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
+
+ taskfile.sector_count = 0x01;
+ taskfile.command = (drive->media == ide_disk) ? WIN_IDENTIFY : WIN_PIDENTIFY ;
+
+ return ide_wait_taskfile(drive, &taskfile, &hobfile, buf);
}
static int proc_ide_read_identify
@@ -457,7 +466,7 @@
int len = 0, i = 0;
if (drive && !proc_ide_get_identify(drive, page)) {
- unsigned short *val = ((unsigned short *)page) + 2;
+ unsigned short *val = (unsigned short *) page;
char *out = ((char *)val) + (SECTOR_WORDS * 4);
page = out;
do {
@@ -588,7 +597,8 @@
if (!driver)
len = sprintf(page, "(none)\n");
else
- len = sprintf(page,"%li\n", ((ide_driver_t *)drive->driver)->capacity(drive));
+ len = sprintf(page,"%llu\n",
+ (unsigned long long) ((ide_driver_t *)drive->driver)->capacity(drive));
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
}
@@ -732,16 +742,38 @@
}
}
-void destroy_proc_ide_drives(ide_hwif_t *hwif)
+void recreate_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive)
{
- int d;
+ struct proc_dir_entry *ent;
+ struct proc_dir_entry *parent = hwif->proc;
+ char name[64];
+// ide_driver_t *driver = drive->driver;
- for (d = 0; d < MAX_DRIVES; d++) {
- ide_drive_t *drive = &hwif->drives[d];
- ide_driver_t *driver = drive->driver;
+ if (drive->present && !drive->proc) {
+ drive->proc = proc_mkdir(drive->name, parent);
+ if (drive->proc)
+ ide_add_proc_entries(drive->proc, generic_drive_entries, drive);
- if (!drive->proc)
- continue;
+/*
+ * assume that we have these already, however, should test FIXME!
+ * if (driver) {
+ * ide_add_proc_entries(drive->proc, generic_subdriver_entries, drive);
+ * ide_add_proc_entries(drive->proc, driver->proc, drive);
+ * }
+ *
+ */
+ sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name);
+ ent = proc_symlink(drive->name, proc_ide_root, name);
+ if (!ent)
+ return;
+ }
+}
+
+void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive)
+{
+ ide_driver_t *driver = drive->driver;
+
+ if (drive->proc) {
if (driver)
ide_remove_proc_entries(drive->proc, driver->proc);
ide_remove_proc_entries(drive->proc, generic_drive_entries);
@@ -751,6 +783,19 @@
}
}
+void destroy_proc_ide_drives(ide_hwif_t *hwif)
+{
+ int d;
+
+ for (d = 0; d < MAX_DRIVES; d++) {
+ ide_drive_t *drive = &hwif->drives[d];
+// ide_driver_t *driver = drive->driver;
+
+ if (drive->proc)
+ destroy_proc_ide_device(hwif, drive);
+ }
+}
+
static ide_proc_entry_t hwif_entries[] = {
{ "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL },
{ "config", S_IFREG|S_IRUGO|S_IWUSR,proc_ide_read_config, proc_ide_write_config },
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)