/* Note: it is necessary to treat option as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ asmlinkage long sys32_sysfs(u32 option, u32 arg1, u32 arg2) { return sys_sysfs((int)option, arg1, arg2); }
asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2) { return sys_sysfs(option, arg1, arg2); }
int svr4_sysfs(int cmd, int arg1, int arg2) { if (cmd == GETFSIND) return sys_sysfs(cmd, arg1, arg2); if (cmd == GETNFSTYP) return sys_sysfs(cmd, arg1, arg2); if (cmd == GETFSTYP) { char *buf = (char *)arg2; int error; if (arg1 & 0x80000000) arg1 &= 0x0000ffff; if (arg1 >= 0 && arg1 < sys_sysfs(GETNFSTYP,0,0)) return sys_sysfs(cmd, arg1-1, arg2); /* * Kludge alert! Hardcoded known magic numbers! */ switch (arg1) { case 0xef53: case 0xffffef53: case 0xef51: case 0xffffef51: /* * Some SCO programs (i.e. Informix Dynamic * Server are using this to detect "real" * filesystems by checking type names :-(. * So we lie :-). */ if (is_cur_personality(PER_SCOSVR3)) error = copy_to_user(buf, "HTFS", 5); else error = copy_to_user(buf, "ext2", 5); break; case 0x137d: error = copy_to_user(buf, "ext", 4); break; case 0x9660: case 0xffff9660: error = copy_to_user(buf, "iso9660", 8); break; case 0x4d44: error = copy_to_user(buf, "msdos", 6); break; case 0x6969: error = copy_to_user(buf, "nfs", 4); break; case 0x9fa0: case 0xffff9fa0: error = copy_to_user(buf, "proc", 5); break; case 0xf995e849: case 0xe849: case 0xffffe849: error = copy_to_user(buf, "hpfs", 5); break; case 0x137f: /* original */ case 0x138f: /* original + 30 char names */ case 0x2468: /* V2 */ case 0x2478: /* V2 + 30 char names */ error = copy_to_user(buf, "minix", 6); break; case 0x564c: error = copy_to_user(buf, "ncpfs", 6); break; case 0x517b: error = copy_to_user(buf, "smbfs", 6); break; case 0x00011954: error = copy_to_user(buf, "ufs", 4); break; case 0x012fd16d: case 0xffffd16d: error = copy_to_user(buf, "xiafs", 6); break; case 0x012ff7b3+1: case 0xfffff7b3+1: error = copy_to_user(buf, "xenix", 6); break; case 0x012ff7b3+2: case 0xfffff7b3+2: case 0x012ff7b3+3: case 0xfffff7b3+3: error = copy_to_user(buf, "sysv", 5); break; case 0x012ff7b3+4: case 0xfffff7b3+4: error = copy_to_user(buf, "coherent", 9); break; default: error = copy_to_user(buf, "", 1); break; } if (error) return -EFAULT; return 0; } #if defined(CONFIG_ABI_TRACE) abi_trace(ABI_TRACE_API, "unsupported sysfs call %d\n", cmd); #endif return -EINVAL; }