~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/scsi/scsi_proc.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
381
381
        return err;
382
382
}
383
383
 
384
 
/**
385
 
 * proc_scsi_show - show contents of /proc/scsi/scsi (attached devices)
386
 
 * @s: output goes here
387
 
 * @p: not used
388
 
 */
389
 
static int proc_scsi_show(struct seq_file *s, void *p)
390
 
{
391
 
        seq_printf(s, "Attached devices:\n");
392
 
        bus_for_each_dev(&scsi_bus_type, NULL, s, proc_print_scsidevice);
393
 
        return 0;
394
 
}
 
384
static int always_match(struct device *dev, void *data)
 
385
{
 
386
        return 1;
 
387
}
 
388
 
 
389
static inline struct device *next_scsi_device(struct device *start)
 
390
{
 
391
        struct device *next = bus_find_device(&scsi_bus_type, start, NULL,
 
392
                                              always_match);
 
393
        put_device(start);
 
394
        return next;
 
395
}
 
396
 
 
397
static void *scsi_seq_start(struct seq_file *sfile, loff_t *pos)
 
398
{
 
399
        struct device *dev = NULL;
 
400
        loff_t n = *pos;
 
401
 
 
402
        while ((dev = next_scsi_device(dev))) {
 
403
                if (!n--)
 
404
                        break;
 
405
                sfile->private++;
 
406
        }
 
407
        return dev;
 
408
}
 
409
 
 
410
static void *scsi_seq_next(struct seq_file *sfile, void *v, loff_t *pos)
 
411
{
 
412
        (*pos)++;
 
413
        sfile->private++;
 
414
        return next_scsi_device(v);
 
415
}
 
416
 
 
417
static void scsi_seq_stop(struct seq_file *sfile, void *v)
 
418
{
 
419
        put_device(v);
 
420
}
 
421
 
 
422
static int scsi_seq_show(struct seq_file *sfile, void *dev)
 
423
{
 
424
        if (!sfile->private)
 
425
                seq_puts(sfile, "Attached devices:\n");
 
426
 
 
427
        return proc_print_scsidevice(dev, sfile);
 
428
}
 
429
 
 
430
static const struct seq_operations scsi_seq_ops = {
 
431
        .start  = scsi_seq_start,
 
432
        .next   = scsi_seq_next,
 
433
        .stop   = scsi_seq_stop,
 
434
        .show   = scsi_seq_show
 
435
};
395
436
 
396
437
/**
397
438
 * proc_scsi_open - glue function
406
447
         * We don't really need this for the write case but it doesn't
407
448
         * harm either.
408
449
         */
409
 
        return single_open(file, proc_scsi_show, NULL);
 
450
        return seq_open(file, &scsi_seq_ops);
410
451
}
411
452
 
412
453
static const struct file_operations proc_scsi_operations = {
415
456
        .read           = seq_read,
416
457
        .write          = proc_scsi_write,
417
458
        .llseek         = seq_lseek,
418
 
        .release        = single_release,
 
459
        .release        = seq_release,
419
460
};
420
461
 
421
462
/**