Commit 32735425 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-input.bkbits.net/linux-input

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 26c69294 3197f480
...@@ -673,31 +673,22 @@ void blk_recount_segments(request_queue_t *q, struct bio *bio) ...@@ -673,31 +673,22 @@ void blk_recount_segments(request_queue_t *q, struct bio *bio)
seg_size = nr_phys_segs = nr_hw_segs = 0; seg_size = nr_phys_segs = nr_hw_segs = 0;
bio_for_each_segment(bv, bio, i) { bio_for_each_segment(bv, bio, i) {
if (bvprv && cluster) { if (bvprv && cluster) {
int phys, seg; if (seg_size + bv->bv_len > q->max_segment_size)
if (seg_size + bv->bv_len > q->max_segment_size) {
nr_phys_segs++;
goto new_segment; goto new_segment;
} if (!BIOVEC_PHYS_MERGEABLE(bvprv, bv))
phys = BIOVEC_PHYS_MERGEABLE(bvprv, bv);
seg = BIOVEC_SEG_BOUNDARY(q, bvprv, bv);
if (!phys || !seg)
nr_phys_segs++;
if (!seg)
goto new_segment; goto new_segment;
if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bv))
if (!BIOVEC_VIRT_MERGEABLE(bvprv, bv))
goto new_segment; goto new_segment;
seg_size += bv->bv_len; seg_size += bv->bv_len;
bvprv = bv; bvprv = bv;
continue; continue;
} else {
nr_phys_segs++;
} }
new_segment: new_segment:
if (!bvprv || !BIOVEC_VIRT_MERGEABLE(bvprv, bv))
nr_hw_segs++; nr_hw_segs++;
nr_phys_segs++;
bvprv = bv; bvprv = bv;
seg_size = bv->bv_len; seg_size = bv->bv_len;
} }
......
This diff is collapsed.
...@@ -5871,8 +5871,8 @@ int __init sbpcd_init(void) ...@@ -5871,8 +5871,8 @@ int __init sbpcd_init(void)
disk->fops = &sbpcd_bdops; disk->fops = &sbpcd_bdops;
strcpy(disk->disk_name, sbpcd_infop->name); strcpy(disk->disk_name, sbpcd_infop->name);
disk->flags = GENHD_FL_CD; disk->flags = GENHD_FL_CD;
sprintf(nbuff, "c0t%d", p->drv_id); sprintf(nbuff, "sbp/c0t%d", p->drv_id);
disk->de = devfs_mk_dir(devfs_handle, nbuff, NULL); disk->de = devfs_mk_dir(NULL, nbuff, NULL);
p->disk = disk; p->disk = disk;
if (register_cdrom(sbpcd_infop)) if (register_cdrom(sbpcd_infop))
{ {
......
...@@ -1047,7 +1047,6 @@ static int alloc_disks(ide_hwif_t *hwif) ...@@ -1047,7 +1047,6 @@ static int alloc_disks(ide_hwif_t *hwif)
static void init_gendisk (ide_hwif_t *hwif) static void init_gendisk (ide_hwif_t *hwif)
{ {
unsigned int unit; unsigned int unit;
extern devfs_handle_t ide_devfs_handle;
for (unit = 0; unit < MAX_DRIVES; ++unit) { for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t * drive = &hwif->drives[unit]; ide_drive_t * drive = &hwif->drives[unit];
...@@ -1059,13 +1058,13 @@ static void init_gendisk (ide_hwif_t *hwif) ...@@ -1059,13 +1058,13 @@ static void init_gendisk (ide_hwif_t *hwif)
"%s","IDE Drive"); "%s","IDE Drive");
drive->gendev.parent = &hwif->gendev; drive->gendev.parent = &hwif->gendev;
drive->gendev.bus = &ide_bus_type; drive->gendev.bus = &ide_bus_type;
sprintf (name, "host%d/bus%d/target%d/lun%d", sprintf (name, "ide/host%d/bus%d/target%d/lun%d",
(hwif->channel && hwif->mate) ? (hwif->channel && hwif->mate) ?
hwif->mate->index : hwif->index, hwif->mate->index : hwif->index,
hwif->channel, unit, drive->lun); hwif->channel, unit, drive->lun);
if (drive->present) { if (drive->present) {
device_register(&drive->gendev); device_register(&drive->gendev);
drive->de = devfs_mk_dir(ide_devfs_handle, name, NULL); drive->de = devfs_mk_dir(NULL, name, NULL);
} }
} }
blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS, blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
......
...@@ -6122,6 +6122,7 @@ static int idetape_cleanup (ide_drive_t *drive) ...@@ -6122,6 +6122,7 @@ static int idetape_cleanup (ide_drive_t *drive)
drive->driver_data = NULL; drive->driver_data = NULL;
devfs_unregister(tape->de_r); devfs_unregister(tape->de_r);
devfs_unregister(tape->de_n); devfs_unregister(tape->de_n);
devfs_unregister_tape(drive->disk->number);
kfree (tape); kfree (tape);
drive->disk->fops = ide_fops; drive->disk->fops = ide_fops;
return 0; return 0;
...@@ -6269,7 +6270,7 @@ static int idetape_attach (ide_drive_t *drive) ...@@ -6269,7 +6270,7 @@ static int idetape_attach (ide_drive_t *drive)
HWIF(drive)->major, minor + 128, HWIF(drive)->major, minor + 128,
S_IFCHR | S_IRUGO | S_IWUGO, S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL); &idetape_fops, NULL);
devfs_register_tape(tape->de_r); drive->disk->number = devfs_register_tape(drive->de);
drive->disk->fops = &idetape_block_ops; drive->disk->fops = &idetape_block_ops;
return 0; return 0;
failed: failed:
......
...@@ -169,15 +169,6 @@ static spinlock_t dv1394_cards_lock = SPIN_LOCK_UNLOCKED; ...@@ -169,15 +169,6 @@ static spinlock_t dv1394_cards_lock = SPIN_LOCK_UNLOCKED;
static struct hpsb_highlevel *hl_handle; /* = NULL; */ static struct hpsb_highlevel *hl_handle; /* = NULL; */
static LIST_HEAD(dv1394_devfs);
struct dv1394_devfs_entry {
struct list_head list;
devfs_handle_t devfs;
char name[32];
struct dv1394_devfs_entry *parent;
};
static spinlock_t dv1394_devfs_lock = SPIN_LOCK_UNLOCKED;
/* translate from a struct file* to the corresponding struct video_card* */ /* translate from a struct file* to the corresponding struct video_card* */
static inline struct video_card* file_to_video_card(struct file *file) static inline struct video_card* file_to_video_card(struct file *file)
...@@ -2564,135 +2555,42 @@ static struct file_operations dv1394_fops= ...@@ -2564,135 +2555,42 @@ static struct file_operations dv1394_fops=
/*** DEVFS HELPERS *********************************************************/ /*** DEVFS HELPERS *********************************************************/
struct dv1394_devfs_entry *
dv1394_devfs_find( char *name)
{
struct list_head *lh;
struct dv1394_devfs_entry *p;
spin_lock( &dv1394_devfs_lock);
if(!list_empty(&dv1394_devfs)) {
list_for_each(lh, &dv1394_devfs) {
p = list_entry(lh, struct dv1394_devfs_entry, list);
if(!strncmp(p->name, name, sizeof(p->name))) {
goto found;
}
}
}
p = NULL;
found:
spin_unlock( &dv1394_devfs_lock);
return p;
}
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
static int dv1394_devfs_add_entry(struct video_card *video) static int dv1394_devfs_add_entry(struct video_card *video)
{ {
char buf[32]; char buf[64];
struct dv1394_devfs_entry *p; snprintf(buf, sizeof(buf), "ieee1394/dv/host%d/%s/%s",
struct dv1394_devfs_entry *parent; (video->id>>2),
(video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"),
p = kmalloc(sizeof(struct dv1394_devfs_entry), GFP_KERNEL); (video->mode == MODE_RECEIVE ? "in" : "out"));
if(!p) {
printk(KERN_ERR "dv1394: cannot allocate dv1394_devfs_entry\n");
goto err;
}
memset(p, 0, sizeof(struct dv1394_devfs_entry));
snprintf(buf, sizeof(buf), "dv/host%d/%s", (video->id>>2),
(video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"));
parent = dv1394_devfs_find(buf);
if (parent == NULL) {
printk(KERN_ERR "dv1394: unable to locate parent devfs of %s\n", buf);
goto err_free;
}
video->devfs_handle = devfs_register( video->devfs_handle = devfs_register(NULL, buf, DEVFS_FL_NONE,
parent->devfs,
(video->mode == MODE_RECEIVE ? "in" : "out"),
DEVFS_FL_NONE,
IEEE1394_MAJOR, IEEE1394_MAJOR,
IEEE1394_MINOR_BLOCK_DV1394*16 + video->id, IEEE1394_MINOR_BLOCK_DV1394*16 + video->id,
S_IFCHR | S_IRUGO | S_IWUGO, S_IFCHR | S_IRUGO | S_IWUGO,
&dv1394_fops, &dv1394_fops,
(void*) video); (void*) video);
p->devfs = video->devfs_handle; if (video->devfs_handle == NULL) {
printk(KERN_ERR "dv1394: unable to create /dev/%s\n", buf);
if (p->devfs == NULL) { return -ENOMEM;
printk(KERN_ERR "dv1394: unable to create /dev/ieee1394/%s/%s\n",
parent->name,
(video->mode == MODE_RECEIVE ? "in" : "out"));
goto err_free;
} }
spin_lock( &dv1394_devfs_lock);
INIT_LIST_HEAD(&p->list);
list_add_tail(&p->list, &dv1394_devfs);
spin_unlock( &dv1394_devfs_lock);
return 0; return 0;
err_free:
kfree(p);
err:
return -ENOMEM;
} }
static int static int dv1394_devfs_add_dir(char *name)
dv1394_devfs_add_dir( char *name,
struct dv1394_devfs_entry *parent,
struct dv1394_devfs_entry **out)
{ {
struct dv1394_devfs_entry *p; if (!devfs_mk_dir(NULL, name, NULL))
printk(KERN_ERR "dv1394: unable to create /dev/%s\n", name);
p = kmalloc(sizeof(struct dv1394_devfs_entry), GFP_KERNEL); return -ENOMEM;
if(!p) {
printk(KERN_ERR "dv1394: cannot allocate dv1394_devfs_entry\n");
goto err;
}
memset(p, 0, sizeof(struct dv1394_devfs_entry));
if (parent == NULL) {
snprintf(p->name, sizeof(p->name), "%s", name);
p->devfs = devfs_mk_dir(ieee1394_devfs_handle, name, NULL);
} else {
snprintf(p->name, sizeof(p->name), "%s/%s", parent->name, name);
p->devfs = devfs_mk_dir(parent->devfs, name, NULL);
}
if (p->devfs == NULL) {
printk(KERN_ERR "dv1394: unable to create /dev/ieee1394/%s\n", p->name);
goto err_free;
} }
p->parent = parent;
if (out != NULL) *out = p;
spin_lock( &dv1394_devfs_lock);
INIT_LIST_HEAD(&p->list);
list_add_tail(&p->list, &dv1394_devfs);
spin_unlock( &dv1394_devfs_lock);
return 0; return 0;
err_free:
kfree(p);
err:
return -ENOMEM;
} }
void dv1394_devfs_del( char *name) void dv1394_devfs_del(char *name)
{ {
struct dv1394_devfs_entry *p = dv1394_devfs_find(name); char s[64];
if (p != NULL) { sprintf(s, "ieee1394/%s", name);
devfs_unregister(p->devfs); devfs_find_and_unregister(NULL, s, 0, 0, 0, 0);
spin_lock( &dv1394_devfs_lock);
list_del(&p->list);
spin_unlock( &dv1394_devfs_lock);
kfree(p);
}
} }
#endif /* CONFIG_DEVFS_FS */ #endif /* CONFIG_DEVFS_FS */
...@@ -2874,15 +2772,12 @@ static void dv1394_add_host (struct hpsb_host *host) ...@@ -2874,15 +2772,12 @@ static void dv1394_add_host (struct hpsb_host *host)
#endif #endif
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
{ snprintf(buf, sizeof(buf), "ieee1394/dv/host%d", ohci->id);
struct dv1394_devfs_entry *devfs_entry = dv1394_devfs_find("dv"); dv1394_devfs_add_dir(buf);
if (devfs_entry != NULL) { snprintf(buf, sizeof(buf), "ieee1394/dv/host%d/NTSC", ohci->id);
snprintf(buf, sizeof(buf), "host%d", ohci->id); dv1394_devfs_add_dir(buf);
dv1394_devfs_add_dir(buf, devfs_entry, &devfs_entry); snprintf(buf, sizeof(buf), "ieee1394/dv/host%d/PAL", ohci->id);
dv1394_devfs_add_dir("NTSC", devfs_entry, NULL); dv1394_devfs_add_dir(buf);
dv1394_devfs_add_dir("PAL", devfs_entry, NULL);
}
}
#endif #endif
dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE); dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE);
...@@ -3042,7 +2937,7 @@ static int __init dv1394_init_module(void) ...@@ -3042,7 +2937,7 @@ static int __init dv1394_init_module(void)
} }
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
if (dv1394_devfs_add_dir("dv", NULL, NULL) < 0) { if (dv1394_devfs_add_dir("ieee1394/dv") < 0) {
printk(KERN_ERR "dv1394: unable to create /dev/ieee1394/dv\n"); printk(KERN_ERR "dv1394: unable to create /dev/ieee1394/dv\n");
ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_DV1394); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_DV1394);
return -ENOMEM; return -ENOMEM;
......
...@@ -1078,7 +1078,6 @@ static struct miscdevice _dm_misc = { ...@@ -1078,7 +1078,6 @@ static struct miscdevice _dm_misc = {
int __init dm_interface_init(void) int __init dm_interface_init(void)
{ {
int r; int r;
char rname[64];
r = dm_hash_init(); r = dm_hash_init();
if (r) if (r)
...@@ -1091,25 +1090,12 @@ int __init dm_interface_init(void) ...@@ -1091,25 +1090,12 @@ int __init dm_interface_init(void)
return r; return r;
} }
r = devfs_generate_path(_dm_misc.devfs_handle, rname + 3, r = devfs_mk_symlink(NULL, DM_DIR "/control", DEVFS_FL_DEFAULT,
sizeof rname - 3); "../misc/" DM_NAME, &_ctl_handle, NULL);
if (r == -ENOSYS)
return 0; /* devfs not present */
if (r < 0) {
DMERR("devfs_generate_path failed for control device");
goto failed;
}
strncpy(rname + r, "../", 3);
r = devfs_mk_symlink(NULL, DM_DIR "/control",
DEVFS_FL_DEFAULT, rname + r, &_ctl_handle, NULL);
if (r) { if (r) {
DMERR("devfs_mk_symlink failed for control device"); DMERR("devfs_mk_symlink failed for control device");
goto failed; goto failed;
} }
devfs_auto_unregister(_dm_misc.devfs_handle, _ctl_handle);
DMINFO("%d.%d.%d%s initialised: %s", DM_VERSION_MAJOR, DMINFO("%d.%d.%d%s initialised: %s", DM_VERSION_MAJOR,
DM_VERSION_MINOR, DM_VERSION_PATCHLEVEL, DM_VERSION_EXTRA, DM_VERSION_MINOR, DM_VERSION_PATCHLEVEL, DM_VERSION_EXTRA,
DM_DRIVER_EMAIL); DM_DRIVER_EMAIL);
...@@ -1125,6 +1111,8 @@ void dm_interface_exit(void) ...@@ -1125,6 +1111,8 @@ void dm_interface_exit(void)
{ {
dm_hash_exit(); dm_hash_exit();
devfs_find_and_unregister(NULL, DM_DIR "/control", 0, 0, 0, 0);
if (misc_deregister(&_dm_misc) < 0) if (misc_deregister(&_dm_misc) < 0)
DMERR("misc_deregister failed for control device"); DMERR("misc_deregister failed for control device");
} }
...@@ -350,7 +350,7 @@ int dvbdev_get_free_adapter_num (void) ...@@ -350,7 +350,7 @@ int dvbdev_get_free_adapter_num (void)
int dvb_register_adapter(dvb_adapter_t **padap, char *name) int dvb_register_adapter(dvb_adapter_t **padap, char *name)
{ {
char dirname[10]; char dirname[16];
dvb_adapter_t *adap; dvb_adapter_t *adap;
int num; int num;
...@@ -374,8 +374,8 @@ int dvb_register_adapter(dvb_adapter_t **padap, char *name) ...@@ -374,8 +374,8 @@ int dvb_register_adapter(dvb_adapter_t **padap, char *name)
printk ("%s: registering new adapter (%s).\n", __FUNCTION__, name); printk ("%s: registering new adapter (%s).\n", __FUNCTION__, name);
sprintf(dirname, "adapter%d", num); sprintf(dirname, "dvb/adapter%d", num);
adap->devfs_handle = devfs_mk_dir(dvb_devfs_handle, dirname, NULL); adap->devfs_handle = devfs_mk_dir(NULL, dirname, NULL);
adap->num = num; adap->num = num;
list_add_tail (&adap->list_head, &dvb_adapter_list); list_add_tail (&adap->list_head, &dvb_adapter_list);
......
...@@ -283,7 +283,7 @@ dasd_free_device(dasd_device_t *device) ...@@ -283,7 +283,7 @@ dasd_free_device(dasd_device_t *device)
static inline int static inline int
dasd_state_new_to_known(dasd_device_t *device) dasd_state_new_to_known(dasd_device_t *device)
{ {
char buffer[5]; char buffer[10];
dasd_devmap_t *devmap; dasd_devmap_t *devmap;
umode_t devfs_perm; umode_t devfs_perm;
devfs_handle_t dir; devfs_handle_t dir;
...@@ -303,8 +303,8 @@ dasd_state_new_to_known(dasd_device_t *device) ...@@ -303,8 +303,8 @@ dasd_state_new_to_known(dasd_device_t *device)
return rc; return rc;
/* Add a proc directory and the dasd device entry to devfs. */ /* Add a proc directory and the dasd device entry to devfs. */
sprintf(buffer, "%04x", device->devinfo.devno); sprintf(buffer, "dasd/%04x", device->devinfo.devno);
dir = devfs_mk_dir(dasd_devfs_handle, buffer, device); dir = devfs_mk_dir(NULL, buffer, NULL);
device->gdp->de = dir; device->gdp->de = dir;
if (devmap->features & DASD_FEATURE_READONLY) if (devmap->features & DASD_FEATURE_READONLY)
devfs_perm = S_IFBLK | S_IRUSR; devfs_perm = S_IFBLK | S_IRUSR;
......
...@@ -5486,7 +5486,7 @@ static int osst_attach(Scsi_Device * SDp) ...@@ -5486,7 +5486,7 @@ static int osst_attach(Scsi_Device * SDp)
0, 0, &osst_fops, NULL); 0, 0, &osst_fops, NULL);
# endif # endif
} }
devfs_register_tape (tpnt->de_r[0]); disk->number = devfs_register_tape(SDp->de);
#endif #endif
tpnt->device = SDp; tpnt->device = SDp;
...@@ -5647,6 +5647,7 @@ static void osst_detach(Scsi_Device * SDp) ...@@ -5647,6 +5647,7 @@ static void osst_detach(Scsi_Device * SDp)
devfs_unregister (tpnt->de_n[mode]); devfs_unregister (tpnt->de_n[mode]);
tpnt->de_n[mode] = NULL; tpnt->de_n[mode] = NULL;
} }
devfs_unregister_tape(tpnt->disk->number);
#endif #endif
put_disk(tpnt->disk); put_disk(tpnt->disk);
kfree(tpnt); kfree(tpnt);
......
...@@ -1323,7 +1323,6 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew, ...@@ -1323,7 +1323,6 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
{ {
Scsi_Device *sdev; Scsi_Device *sdev;
char devname[64]; char devname[64];
extern devfs_handle_t scsi_devfs_handle;
sdev = scsi_alloc_sdev(sdevscan->host, sdevscan->channel, sdev = scsi_alloc_sdev(sdevscan->host, sdevscan->channel,
sdevscan->id, sdevscan->lun); sdevscan->id, sdevscan->lun);
...@@ -1445,13 +1444,13 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew, ...@@ -1445,13 +1444,13 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
*/ */
device_create_file(&sdev->sdev_driverfs_dev, &dev_attr_type); device_create_file(&sdev->sdev_driverfs_dev, &dev_attr_type);
sprintf(devname, "host%d/bus%d/target%d/lun%d", sprintf(devname, "scsi/host%d/bus%d/target%d/lun%d",
sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
if (sdev->de) if (sdev->de)
printk(KERN_WARNING "scsi devfs dir: \"%s\" already exists\n", printk(KERN_WARNING "scsi devfs dir: \"%s\" already exists\n",
devname); devname);
else else
sdev->de = devfs_mk_dir(scsi_devfs_handle, devname, NULL); sdev->de = devfs_mk_dir(NULL, devname, NULL);
/* /*
* End driverfs/devfs code. * End driverfs/devfs code.
*/ */
......
...@@ -3874,7 +3874,7 @@ static int st_attach(Scsi_Device * SDp) ...@@ -3874,7 +3874,7 @@ static int st_attach(Scsi_Device * SDp)
S_IFCHR | S_IRUGO | S_IWUGO, S_IFCHR | S_IRUGO | S_IWUGO,
&st_fops, NULL); &st_fops, NULL);
} }
devfs_register_tape (tpnt->de_r[0]); disk->number = devfs_register_tape(SDp->de);
printk(KERN_WARNING printk(KERN_WARNING
"Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n", "Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n",
...@@ -3908,6 +3908,7 @@ static void st_detach(Scsi_Device * SDp) ...@@ -3908,6 +3908,7 @@ static void st_detach(Scsi_Device * SDp)
devfs_unregister (tpnt->de_n[mode]); devfs_unregister (tpnt->de_n[mode]);
tpnt->de_n[mode] = NULL; tpnt->de_n[mode] = NULL;
} }
devfs_unregister_tape(tpnt->disk->number);
scsi_tapes[i] = 0; scsi_tapes[i] = 0;
scsi_slave_detach(SDp); scsi_slave_detach(SDp);
st_nr_dev--; st_nr_dev--;
......
...@@ -80,26 +80,33 @@ ...@@ -80,26 +80,33 @@
* @de: Any tape device entry in the device directory. * @de: Any tape device entry in the device directory.
*/ */
void devfs_register_tape (devfs_handle_t de) int devfs_register_tape (devfs_handle_t de)
{ {
int pos; int pos;
devfs_handle_t parent, slave; devfs_handle_t slave;
char name[16], dest[64]; char name[32], dest[64];
static unsigned int tape_counter; static unsigned int tape_counter;
static devfs_handle_t tape_dir; int n = tape_counter++;
if (tape_dir == NULL) tape_dir = devfs_mk_dir (NULL, "tapes", NULL); pos = devfs_generate_path (de, dest + 3, sizeof dest - 3);
parent = devfs_get_parent (de); if (pos < 0) return -1;
pos = devfs_generate_path (parent, dest + 3, sizeof dest - 3);
if (pos < 0) return;
strncpy (dest + pos, "../", 3); strncpy (dest + pos, "../", 3);
sprintf (name, "tape%u", tape_counter++); sprintf (name, "tapes/tape%u", n);
devfs_mk_symlink (tape_dir, name, DEVFS_FL_DEFAULT, dest + pos, devfs_mk_symlink (NULL, name, DEVFS_FL_DEFAULT, dest + pos, &slave, NULL);
&slave, NULL); return n;
devfs_auto_unregister (de, slave);
} /* End Function devfs_register_tape */ } /* End Function devfs_register_tape */
EXPORT_SYMBOL(devfs_register_tape); EXPORT_SYMBOL(devfs_register_tape);
void devfs_unregister_tape(int num)
{
if (num >= 0) {
char name[32];
sprintf(name, "tapes/tape%u", num);
devfs_find_and_unregister(NULL, name, 0, 0, 0, 0);
}
}
EXPORT_SYMBOL(devfs_unregister_tape);
/** /**
* devfs_register_series - Register a sequence of device entries. * devfs_register_series - Register a sequence of device entries.
......
This diff is collapsed.
...@@ -50,6 +50,7 @@ struct file * get_empty_filp(void) ...@@ -50,6 +50,7 @@ struct file * get_empty_filp(void)
file_list_unlock(); file_list_unlock();
return NULL; return NULL;
} }
ep_init_file_struct(f);
atomic_set(&f->f_count,1); atomic_set(&f->f_count,1);
f->f_version = 0; f->f_version = 0;
f->f_uid = current->fsuid; f->f_uid = current->fsuid;
...@@ -94,6 +95,7 @@ struct file * get_empty_filp(void) ...@@ -94,6 +95,7 @@ struct file * get_empty_filp(void)
int init_private_file(struct file *filp, struct dentry *dentry, int mode) int init_private_file(struct file *filp, struct dentry *dentry, int mode)
{ {
memset(filp, 0, sizeof(*filp)); memset(filp, 0, sizeof(*filp));
ep_init_file_struct(filp);
filp->f_mode = mode; filp->f_mode = mode;
atomic_set(&filp->f_count, 1); atomic_set(&filp->f_count, 1);
filp->f_dentry = dentry; filp->f_dentry = dentry;
...@@ -121,6 +123,10 @@ void __fput(struct file * file) ...@@ -121,6 +123,10 @@ void __fput(struct file * file)
struct vfsmount * mnt = file->f_vfsmnt; struct vfsmount * mnt = file->f_vfsmnt;
struct inode * inode = dentry->d_inode; struct inode * inode = dentry->d_inode;
/*
* The function ep_notify_file_close() should be the first called
* in the file cleanup chain.
*/
ep_notify_file_close(file); ep_notify_file_close(file);
locks_remove_flock(file); locks_remove_flock(file);
......
...@@ -163,7 +163,7 @@ static void devfs_register_partition(struct gendisk *dev, int part) ...@@ -163,7 +163,7 @@ static void devfs_register_partition(struct gendisk *dev, int part)
if (p[part-1].de) if (p[part-1].de)
return; return;
dir = devfs_get_parent(dev->disk_de); dir = dev->de;
if (!dir) if (!dir)
return; return;
if (dev->flags & GENHD_FL_REMOVABLE) if (dev->flags & GENHD_FL_REMOVABLE)
...@@ -178,7 +178,6 @@ static void devfs_register_partition(struct gendisk *dev, int part) ...@@ -178,7 +178,6 @@ static void devfs_register_partition(struct gendisk *dev, int part)
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
static struct unique_numspace disc_numspace = UNIQUE_NUMBERSPACE_INITIALISER; static struct unique_numspace disc_numspace = UNIQUE_NUMBERSPACE_INITIALISER;
static devfs_handle_t cdroms;
static struct unique_numspace cdrom_numspace = UNIQUE_NUMBERSPACE_INITIALISER; static struct unique_numspace cdrom_numspace = UNIQUE_NUMBERSPACE_INITIALISER;
#endif #endif
...@@ -189,7 +188,6 @@ static void devfs_create_partitions(struct gendisk *dev) ...@@ -189,7 +188,6 @@ static void devfs_create_partitions(struct gendisk *dev)
devfs_handle_t dir, slave; devfs_handle_t dir, slave;
unsigned int devfs_flags = DEVFS_FL_DEFAULT; unsigned int devfs_flags = DEVFS_FL_DEFAULT;
char dirname[64], symlink[16]; char dirname[64], symlink[16];
static devfs_handle_t devfs_handle;
if (dev->flags & GENHD_FL_REMOVABLE) if (dev->flags & GENHD_FL_REMOVABLE)
devfs_flags |= DEVFS_FL_REMOVABLE; devfs_flags |= DEVFS_FL_REMOVABLE;
...@@ -206,19 +204,15 @@ static void devfs_create_partitions(struct gendisk *dev) ...@@ -206,19 +204,15 @@ static void devfs_create_partitions(struct gendisk *dev)
sprintf(dirname, "../%s/disc%d", dev->disk_name, sprintf(dirname, "../%s/disc%d", dev->disk_name,
dev->first_minor >> dev->minor_shift); dev->first_minor >> dev->minor_shift);
dir = devfs_mk_dir(NULL, dirname + 3, NULL); dir = devfs_mk_dir(NULL, dirname + 3, NULL);
dev->de = dir;
} }
if (!devfs_handle)
devfs_handle = devfs_mk_dir(NULL, "discs", NULL);
dev->number = devfs_alloc_unique_number (&disc_numspace); dev->number = devfs_alloc_unique_number (&disc_numspace);
sprintf(symlink, "disc%d", dev->number); sprintf(symlink, "discs/disc%d", dev->number);
devfs_mk_symlink (devfs_handle, symlink, DEVFS_FL_DEFAULT, devfs_mk_symlink(NULL, symlink, DEVFS_FL_DEFAULT,
dirname + pos, &slave, NULL); dirname + pos, &slave, NULL);
dev->disk_de = devfs_register(dir, "disc", devfs_flags, dev->disk_de = devfs_register(dir, "disc", devfs_flags,
dev->major, dev->first_minor, dev->major, dev->first_minor,
S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL); S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL);
devfs_auto_unregister(dev->disk_de, slave);
if (!(dev->flags & GENHD_FL_DEVFS))
devfs_auto_unregister (slave, dir);
#endif #endif
} }
...@@ -227,11 +221,8 @@ static void devfs_create_cdrom(struct gendisk *dev) ...@@ -227,11 +221,8 @@ static void devfs_create_cdrom(struct gendisk *dev)
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
char vname[23]; char vname[23];
if (!cdroms)
cdroms = devfs_mk_dir (NULL, "cdroms", NULL);
dev->number = devfs_alloc_unique_number(&cdrom_numspace); dev->number = devfs_alloc_unique_number(&cdrom_numspace);
sprintf(vname, "cdrom%d", dev->number); sprintf(vname, "cdroms/cdrom%d", dev->number);
if (dev->de) { if (dev->de) {
int pos; int pos;
devfs_handle_t slave; devfs_handle_t slave;
...@@ -245,10 +236,8 @@ static void devfs_create_cdrom(struct gendisk *dev) ...@@ -245,10 +236,8 @@ static void devfs_create_cdrom(struct gendisk *dev)
pos = devfs_generate_path(dev->disk_de, rname+3, sizeof(rname)-3); pos = devfs_generate_path(dev->disk_de, rname+3, sizeof(rname)-3);
if (pos >= 0) { if (pos >= 0) {
strncpy(rname + pos, "../", 3); strncpy(rname + pos, "../", 3);
devfs_mk_symlink(cdroms, vname, devfs_mk_symlink(NULL, vname, DEVFS_FL_DEFAULT,
DEVFS_FL_DEFAULT,
rname + pos, &slave, NULL); rname + pos, &slave, NULL);
devfs_auto_unregister(dev->de, slave);
} }
} else { } else {
dev->disk_de = devfs_register (NULL, vname, DEVFS_FL_DEFAULT, dev->disk_de = devfs_register (NULL, vname, DEVFS_FL_DEFAULT,
...@@ -264,10 +253,22 @@ static void devfs_remove_partitions(struct gendisk *dev) ...@@ -264,10 +253,22 @@ static void devfs_remove_partitions(struct gendisk *dev)
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
devfs_unregister(dev->disk_de); devfs_unregister(dev->disk_de);
dev->disk_de = NULL; dev->disk_de = NULL;
if (dev->flags & GENHD_FL_CD) if (dev->flags & GENHD_FL_CD) {
char name[64];
sprintf(name, "cdroms/cdrom%d", dev->number);
if (dev->de)
devfs_find_and_unregister(NULL, name, 0, 0, 0, 0);
devfs_dealloc_unique_number(&cdrom_numspace, dev->number); devfs_dealloc_unique_number(&cdrom_numspace, dev->number);
else } else {
char name[64];
sprintf(name, "discs/disc%d", dev->number);
devfs_find_and_unregister(NULL, name, 0, 0, 0, 0);
if (!(dev->flags & GENHD_FL_DEVFS)) {
devfs_unregister(dev->de);
dev->de = NULL;
}
devfs_dealloc_unique_number(&disc_numspace, dev->number); devfs_dealloc_unique_number(&disc_numspace, dev->number);
}
#endif #endif
} }
......
...@@ -54,7 +54,7 @@ struct poll_table_page { ...@@ -54,7 +54,7 @@ struct poll_table_page {
* poll table. * poll table.
*/ */
void poll_freewait(poll_table* pt) void __pollfreewait(poll_table* pt)
{ {
struct poll_table_page * p = pt->table; struct poll_table_page * p = pt->table;
while (p) { while (p) {
......
...@@ -88,7 +88,8 @@ extern void devfs_auto_unregister (devfs_handle_t master,devfs_handle_t slave); ...@@ -88,7 +88,8 @@ extern void devfs_auto_unregister (devfs_handle_t master,devfs_handle_t slave);
extern devfs_handle_t devfs_get_unregister_slave (devfs_handle_t master); extern devfs_handle_t devfs_get_unregister_slave (devfs_handle_t master);
extern const char *devfs_get_name (devfs_handle_t de, unsigned int *namelen); extern const char *devfs_get_name (devfs_handle_t de, unsigned int *namelen);
extern int devfs_only (void); extern int devfs_only (void);
extern void devfs_register_tape (devfs_handle_t de); extern int devfs_register_tape (devfs_handle_t de);
extern void devfs_unregister_tape(int num);
extern void devfs_register_series (devfs_handle_t dir, const char *format, extern void devfs_register_series (devfs_handle_t dir, const char *format,
unsigned int num_entries, unsigned int num_entries,
unsigned int flags, unsigned int major, unsigned int flags, unsigned int major,
...@@ -230,11 +231,13 @@ static inline int devfs_only (void) ...@@ -230,11 +231,13 @@ static inline int devfs_only (void)
{ {
return 0; return 0;
} }
static inline void devfs_register_tape (devfs_handle_t de) static inline int devfs_register_tape (devfs_handle_t de)
{
return -1;
}
static inline void devfs_unregister_tape(int num)
{ {
return;
} }
static inline void devfs_register_series (devfs_handle_t dir, static inline void devfs_register_series (devfs_handle_t dir,
const char *format, const char *format,
unsigned int num_entries, unsigned int num_entries,
......
...@@ -34,6 +34,9 @@ asmlinkage int sys_epoll_ctl(int epfd, int op, int fd, unsigned int events); ...@@ -34,6 +34,9 @@ asmlinkage int sys_epoll_ctl(int epfd, int op, int fd, unsigned int events);
asmlinkage int sys_epoll_wait(int epfd, struct pollfd *events, int maxevents, asmlinkage int sys_epoll_wait(int epfd, struct pollfd *events, int maxevents,
int timeout); int timeout);
/* Used to initialize the epoll bits inside the "struct file" */
void ep_init_file_struct(struct file *file);
/* Used in fs/file_table.c:__fput() to unlink files from the eventpoll interface */ /* Used in fs/file_table.c:__fput() to unlink files from the eventpoll interface */
void ep_notify_file_close(struct file *file); void ep_notify_file_close(struct file *file);
......
...@@ -506,6 +506,10 @@ struct file { ...@@ -506,6 +506,10 @@ struct file {
/* needed for tty driver, and maybe others */ /* needed for tty driver, and maybe others */
void *private_data; void *private_data;
/* Used by fs/eventpoll.c to link all the hooks to this file */
struct list_head f_ep_links;
spinlock_t f_ep_lock;
}; };
extern spinlock_t files_lock; extern spinlock_t files_lock;
#define file_list_lock() spin_lock(&files_lock); #define file_list_lock() spin_lock(&files_lock);
......
...@@ -14,14 +14,17 @@ struct poll_table_page; ...@@ -14,14 +14,17 @@ struct poll_table_page;
struct poll_table_struct; struct poll_table_struct;
typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *);
typedef void (*poll_free_proc)(struct poll_table_struct *);
typedef struct poll_table_struct { typedef struct poll_table_struct {
poll_queue_proc qproc; poll_queue_proc qproc;
poll_free_proc fproc;
int error; int error;
struct poll_table_page * table; struct poll_table_page * table;
} poll_table; } poll_table;
extern void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p); extern void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p);
extern void __pollfreewait(poll_table* pt);
static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
{ {
...@@ -29,9 +32,10 @@ static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_addres ...@@ -29,9 +32,10 @@ static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_addres
p->qproc(filp, wait_address, p); p->qproc(filp, wait_address, p);
} }
static inline void poll_initwait_ex(poll_table* pt, poll_queue_proc qproc) static inline void poll_initwait_ex(poll_table* pt, poll_queue_proc qproc, poll_free_proc fproc)
{ {
pt->qproc = qproc; pt->qproc = qproc;
pt->fproc = fproc;
pt->error = 0; pt->error = 0;
pt->table = NULL; pt->table = NULL;
} }
...@@ -39,10 +43,15 @@ static inline void poll_initwait_ex(poll_table* pt, poll_queue_proc qproc) ...@@ -39,10 +43,15 @@ static inline void poll_initwait_ex(poll_table* pt, poll_queue_proc qproc)
static inline void poll_initwait(poll_table* pt) static inline void poll_initwait(poll_table* pt)
{ {
poll_initwait_ex(pt, __pollwait); poll_initwait_ex(pt, __pollwait, __pollfreewait);
} }
extern void poll_freewait(poll_table* pt); static inline void poll_freewait(poll_table* pt)
{
if (pt && pt->fproc)
pt->fproc(pt);
}
/* /*
......
...@@ -269,7 +269,7 @@ EXPORT_SYMBOL(generic_file_llseek); ...@@ -269,7 +269,7 @@ EXPORT_SYMBOL(generic_file_llseek);
EXPORT_SYMBOL(remote_llseek); EXPORT_SYMBOL(remote_llseek);
EXPORT_SYMBOL(no_llseek); EXPORT_SYMBOL(no_llseek);
EXPORT_SYMBOL(__pollwait); EXPORT_SYMBOL(__pollwait);
EXPORT_SYMBOL(poll_freewait); EXPORT_SYMBOL(__pollfreewait);
EXPORT_SYMBOL(ROOT_DEV); EXPORT_SYMBOL(ROOT_DEV);
EXPORT_SYMBOL(find_get_page); EXPORT_SYMBOL(find_get_page);
EXPORT_SYMBOL(find_lock_page); EXPORT_SYMBOL(find_lock_page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment