Changeset 55

Show
Ignore:
Timestamp:
12/09/98 16:11:32 (10 years ago)
Author:
frodo
Message:

Module use count trick expanded to all files and directories

Also fixed a minor Makefile typo.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/TODO

    r53 r55  
    1515  places, probably (everywhere where global vars are accessed). This must be 
    1616  done for the i2c modules, too. 
    17 * Extend the mod_inc_use/mod_dec_use through the fill_inode trick, for all 
    18   new /proc files. 
    1917* Make lm78.c detect 'double hits', (same chip connected to both SMBus and 
    2018  ISA). 
  • lm-sensors/trunk/i2c/eeprom/Module.mk

    r52 r55  
    3636 
    3737clean-i2c-eeprom: 
    38         $(RM) $(I2CEEPROMSOURCES:.c=.d) $(I2CEEPROMSOURCES:.c=.o) \ 
     38        $(RM) $(I2CEEPROMSOURCES:.c=.rd) $(I2CEEPROMSOURCES:.c=.ro) \ 
    3939              $(I2CEEPROMTARGETS) 
    4040clean :: clean-i2c-eeprom 
  • lm-sensors/trunk/kernel/i2c-proc.c

    r46 r55  
    4141static void i2cproc_inc_use(struct i2c_client *client); 
    4242static void i2cproc_dec_use(struct i2c_client *client); 
     43 
     44#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     45static void monitor_bus_i2c(struct inode *inode, int fill); 
     46#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    4347 
    4448#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
     
    8185    /* ops */           NULL, 
    8286    /* get_info */      &read_bus_i2c 
     87#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     88    /* fill_inode */    &monitor_bus_i2c 
     89#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    8390  }; 
    8491 
     
    223230  return 0; 
    224231} 
     232 
     233#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     234/* Monitor access to /proc/bus/i2c*; make unloading i2c-proc.o impossible 
     235   if some process still uses it or some file in it */ 
     236void monitor_bus_i2c(struct inode *inode, int fill) 
     237{ 
     238  if (fill) 
     239    MOD_INC_USE_COUNT; 
     240  else 
     241    MOD_DEC_USE_COUNT; 
     242} 
     243#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
     244 
    225245 
    226246/* This function generates the output for /proc/bus/i2c */ 
     
    350370  } 
    351371  proc_entry->ops = &i2cproc_inode_operations; 
     372#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     373  proc_entry->fill_inode = &monitor_bus_i2c; 
     374#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    352375#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 
    353376  if (!(proc_entry = kmalloc(sizeof(struct proc_dir_entry)+strlen(name)+1, 
  • lm-sensors/trunk/kernel/sensors.c

    r51 r55  
    5757static struct i2c_client *sensors_clients[SENSORS_ENTRY_MAX]; 
    5858static unsigned short sensors_inodes[SENSORS_ENTRY_MAX]; 
    59 void sensors_fill_inode(struct inode *inode, int fill); 
     59static void sensors_fill_inode(struct inode *inode, int fill); 
     60static void sensors_dir_fill_inode(struct inode *inode, int fill); 
    6061#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    6162 
     
    181182#endif /* DEBUG */ 
    182183  sensors_inodes[id-256] = new_header->ctl_table->child->child->de->low_ino; 
    183   new_header->ctl_table->child->child->de->fill_inode = &sensors_fill_inode; 
     184  new_header->ctl_table->child->child->de->fill_inode = &sensors_dir_fill_inode; 
    184185#endif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
    185186 
     
    204205 
    205206#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     207/* Monitor access for /proc/sys/dev/sensors; make unloading sensors.o  
     208   impossible if some process still uses it or some file in it */ 
    206209void sensors_fill_inode(struct inode *inode, int fill) 
     210{ 
     211  if (fill) 
     212    MOD_INC_USE_COUNT; 
     213  else 
     214    MOD_DEC_USE_COUNT; 
     215} 
     216 
     217/* Monitor access for /proc/sys/dev/sensors/* directories; make unloading 
     218   the corresponding module impossible if some process still uses it or 
     219   some file in it */ 
     220void sensors_dir_fill_inode(struct inode *inode, int fill) 
    207221{ 
    208222  int i; 
     
    568582  if (! (sensors_proc_header = register_sysctl_table(sensors_proc,0))) 
    569583    return -ENOMEM; 
     584#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     585  sensors_proc_header->ctl_table->child->de->fill_inode = &sensors_fill_inode; 
     586#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    570587  sensors_initialized ++; 
    571588  return 0; 
  • lm-sensors/trunk/src/i2c-proc.c

    r46 r55  
    4141static void i2cproc_inc_use(struct i2c_client *client); 
    4242static void i2cproc_dec_use(struct i2c_client *client); 
     43 
     44#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     45static void monitor_bus_i2c(struct inode *inode, int fill); 
     46#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    4347 
    4448#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
     
    8185    /* ops */           NULL, 
    8286    /* get_info */      &read_bus_i2c 
     87#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     88    /* fill_inode */    &monitor_bus_i2c 
     89#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    8390  }; 
    8491 
     
    223230  return 0; 
    224231} 
     232 
     233#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     234/* Monitor access to /proc/bus/i2c*; make unloading i2c-proc.o impossible 
     235   if some process still uses it or some file in it */ 
     236void monitor_bus_i2c(struct inode *inode, int fill) 
     237{ 
     238  if (fill) 
     239    MOD_INC_USE_COUNT; 
     240  else 
     241    MOD_DEC_USE_COUNT; 
     242} 
     243#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
     244 
    225245 
    226246/* This function generates the output for /proc/bus/i2c */ 
     
    350370  } 
    351371  proc_entry->ops = &i2cproc_inode_operations; 
     372#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     373  proc_entry->fill_inode = &monitor_bus_i2c; 
     374#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    352375#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 
    353376  if (!(proc_entry = kmalloc(sizeof(struct proc_dir_entry)+strlen(name)+1, 
  • lm-sensors/trunk/src/sensors.c

    r51 r55  
    5757static struct i2c_client *sensors_clients[SENSORS_ENTRY_MAX]; 
    5858static unsigned short sensors_inodes[SENSORS_ENTRY_MAX]; 
    59 void sensors_fill_inode(struct inode *inode, int fill); 
     59static void sensors_fill_inode(struct inode *inode, int fill); 
     60static void sensors_dir_fill_inode(struct inode *inode, int fill); 
    6061#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    6162 
     
    181182#endif /* DEBUG */ 
    182183  sensors_inodes[id-256] = new_header->ctl_table->child->child->de->low_ino; 
    183   new_header->ctl_table->child->child->de->fill_inode = &sensors_fill_inode; 
     184  new_header->ctl_table->child->child->de->fill_inode = &sensors_dir_fill_inode; 
    184185#endif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
    185186 
     
    204205 
    205206#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     207/* Monitor access for /proc/sys/dev/sensors; make unloading sensors.o  
     208   impossible if some process still uses it or some file in it */ 
    206209void sensors_fill_inode(struct inode *inode, int fill) 
     210{ 
     211  if (fill) 
     212    MOD_INC_USE_COUNT; 
     213  else 
     214    MOD_DEC_USE_COUNT; 
     215} 
     216 
     217/* Monitor access for /proc/sys/dev/sensors/* directories; make unloading 
     218   the corresponding module impossible if some process still uses it or 
     219   some file in it */ 
     220void sensors_dir_fill_inode(struct inode *inode, int fill) 
    207221{ 
    208222  int i; 
     
    568582  if (! (sensors_proc_header = register_sysctl_table(sensors_proc,0))) 
    569583    return -ENOMEM; 
     584#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     585  sensors_proc_header->ctl_table->child->de->fill_inode = &sensors_fill_inode; 
     586#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    570587  sensors_initialized ++; 
    571588  return 0;