示例#1
0
文件: suni.c 项目: avagin/linux
static int fetch_stats(struct atm_dev *dev,struct sonet_stats __user *arg,int zero)
{
	struct sonet_stats tmp;
	int error = 0;

	sonet_copy_stats(&PRIV(dev)->sonet_stats,&tmp);
	if (arg) error = copy_to_user(arg,&tmp,sizeof(tmp));
	if (zero && !error) sonet_subtract_stats(&PRIV(dev)->sonet_stats,&tmp);
	return error ? -EFAULT : 0;
}
示例#2
0
static int fetch_stats(struct atm_dev *dev,struct sonet_stats __user *arg,int zero)
{
    struct sonet_stats tmp;
    int error = 0;

    atomic_add(GET(HECCT),&PRIV(dev)->sonet_stats.uncorr_hcs);
    sonet_copy_stats(&PRIV(dev)->sonet_stats,&tmp);
    if (arg) error = copy_to_user(arg,&tmp,sizeof(tmp));
    if (zero && !error) {
        /* unused fields are reported as -1, but we must not "adjust"
           them */
        tmp.corr_hcs = tmp.tx_cells = tmp.rx_cells = 0;
        sonet_subtract_stats(&PRIV(dev)->sonet_stats,&tmp);
    }
    return error ? -EFAULT : 0;
}