fs_enet: restore promiscuous and multicast settings in restart()
[pandora-kernel.git] / drivers / scsi / scsi_devinfo.c
index e2ea739..a235802 100644 (file)
@@ -214,6 +214,7 @@ static struct {
        {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
        {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
        {"Promise", "", NULL, BLIST_SPARSELUN},
+       {"QUANTUM", "XP34301", "1071", BLIST_NOTQ},
        {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN},
        {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
        {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ},    /* Chokes on tagged INQUIRY */
@@ -275,11 +276,12 @@ static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length,
 }
 
 /**
- * scsi_dev_info_list_add: add one dev_info list entry.
+ * scsi_dev_info_list_add - add one dev_info list entry.
+ * @compatible: if true, null terminate short strings.  Otherwise space pad.
  * @vendor:    vendor string
  * @model:     model (product) string
  * @strflags:  integer string
- * @flag     if strflags NULL, use this flag value
+ * @flags:     if strflags NULL, use this flag value
  *
  * Description:
  *     Create and add one dev_info entry for @vendor, @model, @strflags or
@@ -321,8 +323,7 @@ static int scsi_dev_info_list_add(int compatible, char *vendor, char *model,
 }
 
 /**
- * scsi_dev_info_list_add_str: parse dev_list and add to the
- * scsi_dev_info_list.
+ * scsi_dev_info_list_add_str - parse dev_list and add to the scsi_dev_info_list.
  * @dev_list:  string of device flags to add
  *
  * Description:
@@ -373,15 +374,15 @@ static int scsi_dev_info_list_add_str(char *dev_list)
 }
 
 /**
- * get_device_flags - get device specific flags from the dynamic device
- * list. Called during scan time.
+ * get_device_flags - get device specific flags from the dynamic device list.
+ * @sdev:       &scsi_device to get flags for
  * @vendor:    vendor name
  * @model:     model name
  *
  * Description:
  *     Search the scsi_dev_info_list for an entry matching @vendor and
  *     @model, if found, return the matching flags value, else return
- *     the host or global default settings.
+ *     the host or global default settings.  Called during scan time.
  **/
 int scsi_get_device_flags(struct scsi_device *sdev,
                          const unsigned char *vendor,
@@ -448,53 +449,55 @@ int scsi_get_device_flags(struct scsi_device *sdev,
 }
 
 #ifdef CONFIG_SCSI_PROC_FS
-/* 
- * proc_scsi_dev_info_read: dump the scsi_dev_info_list via
- * /proc/scsi/device_info
- */
-static int proc_scsi_devinfo_read(char *buffer, char **start,
-                                 off_t offset, int length)
+static int devinfo_seq_show(struct seq_file *m, void *v)
 {
-       struct scsi_dev_info_list *devinfo;
-       int size, len = 0;
-       off_t begin = 0;
-       off_t pos = 0;
+       struct scsi_dev_info_list *devinfo =
+               list_entry(v, struct scsi_dev_info_list, dev_info_list);
 
-       list_for_each_entry(devinfo, &scsi_dev_info_list, dev_info_list) {
-               size = sprintf(buffer + len, "'%.8s' '%.16s' 0x%x\n",
+       seq_printf(m, "'%.8s' '%.16s' 0x%x\n",
                        devinfo->vendor, devinfo->model, devinfo->flags);
-               len += size;
-               pos = begin + len;
-               if (pos < offset) {
-                       len = 0;
-                       begin = pos;
-               }
-               if (pos > offset + length)
-                       goto stop_output;
-       }
+       return 0;
+}
+
+static void * devinfo_seq_start(struct seq_file *m, loff_t *pos)
+{
+       return seq_list_start(&scsi_dev_info_list, *pos);
+}
+
+static void * devinfo_seq_next(struct seq_file *m, void *v, loff_t *pos)
+{
+       return seq_list_next(v, &scsi_dev_info_list, pos);
+}
+
+static void devinfo_seq_stop(struct seq_file *m, void *v)
+{
+}
 
-stop_output:
-       *start = buffer + (offset - begin);     /* Start of wanted data */
-       len -= (offset - begin);        /* Start slop */
-       if (len > length)
-               len = length;   /* Ending slop */
-       return (len);
+static const struct seq_operations scsi_devinfo_seq_ops = {
+       .start  = devinfo_seq_start,
+       .next   = devinfo_seq_next,
+       .stop   = devinfo_seq_stop,
+       .show   = devinfo_seq_show,
+};
+
+static int proc_scsi_devinfo_open(struct inode *inode, struct file *file)
+{
+       return seq_open(file, &scsi_devinfo_seq_ops);
 }
 
 /* 
- * proc_scsi_dev_info_write: allow additions to the scsi_dev_info_list via
- * /proc.
+ * proc_scsi_dev_info_write - allow additions to scsi_dev_info_list via /proc.
  *
- * Use: echo "vendor:model:flag" > /proc/scsi/device_info
- *
- * To add a black/white list entry for vendor and model with an integer
- * value of flag to the scsi device info list.
+ * Description: Adds a black/white list entry for vendor and model with an
+ * integer value of flag to the scsi device info list.
+ * To use, echo "vendor:model:flag" > /proc/scsi/device_info
  */
-static int proc_scsi_devinfo_write(struct file *file, const char __user *buf,
-                                  unsigned long length, void *data)
+static ssize_t proc_scsi_devinfo_write(struct file *file,
+                                      const char __user *buf,
+                                      size_t length, loff_t *ppos)
 {
        char *buffer;
-       int err = length;
+       ssize_t err = length;
 
        if (!buf || length>PAGE_SIZE)
                return -EINVAL;
@@ -518,6 +521,15 @@ out:
        free_page((unsigned long)buffer);
        return err;
 }
+
+static const struct file_operations scsi_devinfo_proc_fops = {
+       .owner          = THIS_MODULE,
+       .open           = proc_scsi_devinfo_open,
+       .read           = seq_read,
+       .write          = proc_scsi_devinfo_write,
+       .llseek         = seq_lseek,
+       .release        = seq_release,
+};
 #endif /* CONFIG_SCSI_PROC_FS */
 
 module_param_string(dev_flags, scsi_dev_flags, sizeof(scsi_dev_flags), 0);
@@ -531,8 +543,7 @@ MODULE_PARM_DESC(default_dev_flags,
                 "scsi default device flag integer value");
 
 /**
- * scsi_dev_info_list_delete: called from scsi.c:exit_scsi to remove
- *     the scsi_dev_info_list.
+ * scsi_dev_info_list_delete - called from scsi.c:exit_scsi to remove the scsi_dev_info_list.
  **/
 void scsi_exit_devinfo(void)
 {
@@ -551,13 +562,12 @@ void scsi_exit_devinfo(void)
 }
 
 /**
- * scsi_dev_list_init: set up the dynamic device list.
- * @dev_list:  string of device flags to add
+ * scsi_init_devinfo - set up the dynamic device list.
  *
  * Description:
- *     Add command line @dev_list entries, then add
+ *     Add command line entries from scsi_dev_flags, then add
  *     scsi_static_device_list entries to the scsi device info list.
- **/
+ */
 int __init scsi_init_devinfo(void)
 {
 #ifdef CONFIG_SCSI_PROC_FS
@@ -580,15 +590,13 @@ int __init scsi_init_devinfo(void)
        }
 
 #ifdef CONFIG_SCSI_PROC_FS
-       p = create_proc_entry("scsi/device_info", 0, NULL);
+       p = proc_create("scsi/device_info", 0, NULL, &scsi_devinfo_proc_fops);
        if (!p) {
                error = -ENOMEM;
                goto out;
        }
 
        p->owner = THIS_MODULE;
-       p->get_info = proc_scsi_devinfo_read;
-       p->write_proc = proc_scsi_devinfo_write;
 #endif /* CONFIG_SCSI_PROC_FS */
 
  out: