int nnpfsdebug_cmd (int argc, char **argv) { int ret; int flags; nnpfsdebug_units[0].mult = all; nnpfsdebug_units[1].mult = all & ~almost_all_mask; if ((argc > 1 && strncmp(argv[1], "-h", 2) == 0) || argc > 2) { fprintf (stderr, "usage: nnpfsdebug [-h] ["); print_flags_table (nnpfsdebug_units, stderr); fprintf (stderr, "]\n"); return 0; } ret = nnpfs_debug (-1, &flags); if (ret) { fprintf (stderr, "nnpfs_debug: %s\n", strerror(ret)); return 0; } if (argc == 1) { char buf[1024]; unparse_flags (flags, nnpfsdebug_units, buf, sizeof(buf)); printf("nnpfsdebug is: %s\n", buf); } else if (argc == 2) { char *textflags; textflags = argv[1]; ret = parse_flags (textflags, nnpfsdebug_units, flags); if (ret < 0) { fprintf (stderr, "nnpfsdebug: unknown/bad flags `%s'\n", textflags); return 0; } flags = ret; ret = nnpfs_debug(flags, NULL); if (ret) fprintf (stderr, "nnpfs_debug: %s\n", strerror(ret)); } return 0; }
int nnpfs_pioctl_call(d_thread_t *proc, struct sys_pioctl_args *arg, register_t *return_value) { int error; struct ViceIoctl vice_ioctl; char *pathptr; struct vnode *vp = NULL; NNPFSDEB(XDEBSYS, ("nnpfs_syscall(%d, %lx, %d, %lx, %d)\n", SCARG(arg, operation), (unsigned long)SCARG(arg, a_pathP), SCARG(arg, a_opcode), (unsigned long)SCARG(arg, a_paramsP), SCARG(arg, a_followSymlinks))); /* Copy in the data structure for us */ error = copyin(SCARG(arg, a_paramsP), &vice_ioctl, sizeof(vice_ioctl)); if (error) return error; pathptr = SCARG(arg, a_pathP); if (pathptr != NULL) { error = lookup_node (pathptr, SCARG(arg, a_followSymlinks), &vp, proc); if(error) return error; } switch (SCARG(arg, a_opcode)) { case VIOC_FHGET : return fhget_call (proc, &vice_ioctl, vp); case VIOC_FHOPEN : return fhopen_call (proc, &vice_ioctl, vp, SCARG(arg, a_followSymlinks), return_value); case VIOC_NNPFSDEBUG : if (vp != NULL) vrele (vp); return nnpfs_debug (proc, &vice_ioctl); default : NNPFSDEB(XDEBSYS, ("a_opcode = %x\n", SCARG(arg, a_opcode))); return remote_pioctl (proc, arg, &vice_ioctl, vp); } }