ibmasmfs.c (0a1340c185734a57fbf4775927966ad4a1347b02) ibmasmfs.c (8e18e2941c53416aa219708e7dcad21fb4bd6794)
1/*
2 * IBM ASM Service Processor Device Driver
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 161 unchanged lines hidden (view full) ---

170
171 inode = ibmasmfs_make_inode(sb, S_IFREG | mode);
172 if (!inode) {
173 dput(dentry);
174 return NULL;
175 }
176
177 inode->i_fop = fops;
1/*
2 * IBM ASM Service Processor Device Driver
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 161 unchanged lines hidden (view full) ---

170
171 inode = ibmasmfs_make_inode(sb, S_IFREG | mode);
172 if (!inode) {
173 dput(dentry);
174 return NULL;
175 }
176
177 inode->i_fop = fops;
178 inode->u.generic_ip = data;
178 inode->i_private = data;
179
180 d_add(dentry, inode);
181 return dentry;
182}
183
184static struct dentry *ibmasmfs_create_dir (struct super_block *sb,
185 struct dentry *parent,
186 const char *name)

--- 52 unchanged lines hidden (view full) ---

239 struct reverse_heartbeat heartbeat;
240 int active;
241};
242
243static int command_file_open(struct inode *inode, struct file *file)
244{
245 struct ibmasmfs_command_data *command_data;
246
179
180 d_add(dentry, inode);
181 return dentry;
182}
183
184static struct dentry *ibmasmfs_create_dir (struct super_block *sb,
185 struct dentry *parent,
186 const char *name)

--- 52 unchanged lines hidden (view full) ---

239 struct reverse_heartbeat heartbeat;
240 int active;
241};
242
243static int command_file_open(struct inode *inode, struct file *file)
244{
245 struct ibmasmfs_command_data *command_data;
246
247 if (!inode->u.generic_ip)
247 if (!inode->i_private)
248 return -ENODEV;
249
250 command_data = kmalloc(sizeof(struct ibmasmfs_command_data), GFP_KERNEL);
251 if (!command_data)
252 return -ENOMEM;
253
254 command_data->command = NULL;
248 return -ENODEV;
249
250 command_data = kmalloc(sizeof(struct ibmasmfs_command_data), GFP_KERNEL);
251 if (!command_data)
252 return -ENOMEM;
253
254 command_data->command = NULL;
255 command_data->sp = inode->u.generic_ip;
255 command_data->sp = inode->i_private;
256 file->private_data = command_data;
257 return 0;
258}
259
260static int command_file_close(struct inode *inode, struct file *file)
261{
262 struct ibmasmfs_command_data *command_data = file->private_data;
263

--- 82 unchanged lines hidden (view full) ---

346 return count;
347}
348
349static int event_file_open(struct inode *inode, struct file *file)
350{
351 struct ibmasmfs_event_data *event_data;
352 struct service_processor *sp;
353
256 file->private_data = command_data;
257 return 0;
258}
259
260static int command_file_close(struct inode *inode, struct file *file)
261{
262 struct ibmasmfs_command_data *command_data = file->private_data;
263

--- 82 unchanged lines hidden (view full) ---

346 return count;
347}
348
349static int event_file_open(struct inode *inode, struct file *file)
350{
351 struct ibmasmfs_event_data *event_data;
352 struct service_processor *sp;
353
354 if (!inode->u.generic_ip)
354 if (!inode->i_private)
355 return -ENODEV;
356
355 return -ENODEV;
356
357 sp = inode->u.generic_ip;
357 sp = inode->i_private;
358
359 event_data = kmalloc(sizeof(struct ibmasmfs_event_data), GFP_KERNEL);
360 if (!event_data)
361 return -ENOMEM;
362
363 ibmasm_event_reader_register(sp, &event_data->reader);
364
365 event_data->sp = sp;

--- 68 unchanged lines hidden (view full) ---

434 ibmasm_cancel_next_event(&event_data->reader);
435 return 0;
436}
437
438static int r_heartbeat_file_open(struct inode *inode, struct file *file)
439{
440 struct ibmasmfs_heartbeat_data *rhbeat;
441
358
359 event_data = kmalloc(sizeof(struct ibmasmfs_event_data), GFP_KERNEL);
360 if (!event_data)
361 return -ENOMEM;
362
363 ibmasm_event_reader_register(sp, &event_data->reader);
364
365 event_data->sp = sp;

--- 68 unchanged lines hidden (view full) ---

434 ibmasm_cancel_next_event(&event_data->reader);
435 return 0;
436}
437
438static int r_heartbeat_file_open(struct inode *inode, struct file *file)
439{
440 struct ibmasmfs_heartbeat_data *rhbeat;
441
442 if (!inode->u.generic_ip)
442 if (!inode->i_private)
443 return -ENODEV;
444
445 rhbeat = kmalloc(sizeof(struct ibmasmfs_heartbeat_data), GFP_KERNEL);
446 if (!rhbeat)
447 return -ENOMEM;
448
443 return -ENODEV;
444
445 rhbeat = kmalloc(sizeof(struct ibmasmfs_heartbeat_data), GFP_KERNEL);
446 if (!rhbeat)
447 return -ENOMEM;
448
449 rhbeat->sp = (struct service_processor *)inode->u.generic_ip;
449 rhbeat->sp = inode->i_private;
450 rhbeat->active = 0;
451 ibmasm_init_reverse_heartbeat(rhbeat->sp, &rhbeat->heartbeat);
452 file->private_data = rhbeat;
453 return 0;
454}
455
456static int r_heartbeat_file_close(struct inode *inode, struct file *file)
457{

--- 45 unchanged lines hidden (view full) ---

503 if (rhbeat->active)
504 ibmasm_stop_reverse_heartbeat(&rhbeat->heartbeat);
505
506 return 1;
507}
508
509static int remote_settings_file_open(struct inode *inode, struct file *file)
510{
450 rhbeat->active = 0;
451 ibmasm_init_reverse_heartbeat(rhbeat->sp, &rhbeat->heartbeat);
452 file->private_data = rhbeat;
453 return 0;
454}
455
456static int r_heartbeat_file_close(struct inode *inode, struct file *file)
457{

--- 45 unchanged lines hidden (view full) ---

503 if (rhbeat->active)
504 ibmasm_stop_reverse_heartbeat(&rhbeat->heartbeat);
505
506 return 1;
507}
508
509static int remote_settings_file_open(struct inode *inode, struct file *file)
510{
511 file->private_data = inode->u.generic_ip;
511 file->private_data = inode->i_private;
512 return 0;
513}
514
515static int remote_settings_file_close(struct inode *inode, struct file *file)
516{
517 return 0;
518}
519

--- 120 unchanged lines hidden ---
512 return 0;
513}
514
515static int remote_settings_file_close(struct inode *inode, struct file *file)
516{
517 return 0;
518}
519

--- 120 unchanged lines hidden ---